Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Separate it from the ManuScript XML parser from the rest of the code
Browse files Browse the repository at this point in the history
It needs some love to make it work again
  • Loading branch information
th-we committed May 16, 2021
1 parent 2aa27be commit 26a2361
Showing 1 changed file with 31 additions and 46 deletions.
77 changes: 31 additions & 46 deletions tools/langs/manuscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,28 +226,6 @@
}
}
return res;
}"
getPositionInDocument "(obj) {
if (not Self.MEIFlattened) {
return false;
}
for i = 0 to Length(Self.MEIFlattened) {
if (Self.MEIFlattened[i] = obj) {
return i;
}
}
return false;
}"
lookBack "(from, name) {
if (not Self.MEIFlattened) {
return false;
}
pos = getPositionInDocument(from);
for i = pos to 0 step -1 {
if (getName(Self.MEIFlattened[i]) = name) {
return Self.MEIFlattened[i];
}
}
}"
createXmlTag "(name, id, attributesList, isTerminal) {
if (name = '<!--')
Expand Down Expand Up @@ -407,11 +385,6 @@
meiDocumentToString "(meidoc) {
return _exportMeiDocument(meidoc);
}"
documentFromFile "(filename) {
res = _xmlImport(filename);
return res;
}"
popMode "(arr) {
if (arr.Length > 0) {
return arr.Pop();
Expand Down Expand Up @@ -447,6 +420,37 @@
return string;
}"
generateRandomID "() {
//$module(ExportGenerators.mss)
id = Self._property:MEIID + 1;
Self._property:MEIID = id;
id = 'm-' & id;
return id;
}"
}
"""

AUTHORS = "Andrew Hankinson, Alastair Porter, and Others"

FILE_TEMPLATE = """
{{
{license}
{classes}
{extras}
}}
"""

# The XML parser code does not work at the moment because of how the code above
# has changed over time. It's kept anyway to facilitate future work on MEI
# import.
XMLPARSER ="""
documentFromFile "(filename) {
res = _xmlImport(filename);
return res;
}"
_xmlImport "(filename) {
/*
Based on the Quick-n-Dirty XML parser at
Expand Down Expand Up @@ -831,25 +835,6 @@
}
return meidoc;
}"
generateRandomID "() {
//$module(ExportGenerators.mss)
id = Self._property:MEIID + 1;
Self._property:MEIID = id;
id = 'm-' & id;
return id;
}"
}
"""

AUTHORS = "Andrew Hankinson, Alastair Porter, and Others"

FILE_TEMPLATE = """
{{
{license}
{classes}
{extras}
}}
"""


Expand Down

0 comments on commit 26a2361

Please sign in to comment.