05.11., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 1cff022a authored by eckhart's avatar eckhart

- MLW extended

parent 330a45e3
......@@ -531,6 +531,14 @@ class Node(collections.abc.Sized):
return self._tree_repr(' ', opening, closing, pretty, density=density)
@property
def xml_attr(self):
"""Returns a dictionary of XML-Attributes attached to the Node."""
if not hasattr(self, '_xml_attr'):
self._xml_attr = dict()
return self._xml_attr
def as_xml(self, src: str = None, showerrors: bool = True) -> str:
"""
Returns content as XML-tree.
......@@ -543,13 +551,16 @@ class Node(collections.abc.Sized):
def opening(node) -> str:
"""Returns the opening string for the representation of `node`."""
txt = '<' + node.tag_name
txt = ['<', node.tag_name]
# s += ' pos="%i"' % node.pos
if hasattr(self, '_xml_attr'):
txt.extend(' %s="%s"' % (k, v) for k, v in self.xml_attr.items())
if src:
txt += ' line="%i" col="%i"' % line_col(line_breaks, node.pos)
txt.append(' line="%i" col="%i"' % line_col(line_breaks, node.pos))
if showerrors and node.errors:
txt += ' err="%s"' % ''.join(str(err).replace('"', r'\"') for err in node.errors)
return txt + ">\n"
txt.append(' err="%s"' % ''.join(str(err).replace('"', r'\"')
for err in node.errors))
return "".join(txt + [">\n"])
def closing(node):
"""Returns the closing string for the representation of `node`."""
......
......@@ -10,10 +10,10 @@ GRAMMATIK
SCHREIBWEISE
script.: // gibt es hier überhaupt andere Kategorien außer "script."?
hym-: {=> imperator37m_1}
em-: Chron.: Fred.; 2,35sqq. capit.; p. 43.; 2,36 p. 60,10.
ym-: Chart.: Sangall.; A 194.
impir-: {=> impoerator38m_1}
hym-: {=> imperator37m_1}
em-: Chron.: Fred.; 2,35sqq. capit.; p. 43.; 2,36 p. 60,10.
ym-: Chart.: Sangall.; A 194.
impir-: {=> impoerator38m_1}
STRUKTUR
form. sing.:
......
......@@ -13,11 +13,11 @@
"keywords": {
"patterns": [{
"name": "keyword.secondary.mlw",
"match": "\\b(LATEINISCH|DEUTSCH|LAT|DEU|VERWECHSELBAR|BELEGE|AUTOR)\\b"
"match": "\\b(LATEINISCH|DEUTSCH|LAT|DEU)\\b"
},
{
"name": "keyword.mlw",
"match": "\\b(LEMMA|GRAMMATIK|SCHREIBWEISE|STRUKTUR|VERWECHSELBAR|BEDEUTUNG|BELEGE|AUTORIN|AUTOR)\\b"
"match": "\\b(LEMMA|GRAMMATIK|SCHREIBWEISE|STRUKTUR|VERWECHSELBAR|BEDEUTUNG|UNTER_BEDEUTUNG|UNTER_UNTER_BEDEUTUNG|UNTER_UNTER_UNTER_BEDEUTUNG|U_BEDEUTUNG|UU_BEDEUTUNG|UUU_BEDEUTUNG|UUUU_BEDEUTUNG|UUUUU_BEDEUTUNG|UUUUUU_BEDEUTUNG|UUUUUUU_BEDEUTUNG|BELEGE|AUTORIN|AUTOR|STELLENVERZEICHNIS)\\b"
}]
},
"strings": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment