diff options
-rw-r--r-- | ekdosis.dtx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index ff9d2f9..3e2e6ed 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -9087,6 +9087,7 @@ local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) | |||
9087 | local app = lpeg.Cs("app") | 9087 | local app = lpeg.Cs("app") |
9088 | local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) | 9088 | local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) |
9089 | local note = lpeg.Cs("note") | 9089 | local note = lpeg.Cs("note") |
9090 | local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" } | ||
9090 | local lnbrk = lpeg.Cs("\\\\") | 9091 | local lnbrk = lpeg.Cs("\\\\") |
9091 | local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1) | 9092 | local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1) |
9092 | local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1 * spcenc^-1) | 9093 | local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1 * spcenc^-1) |
@@ -9683,7 +9684,16 @@ local function lem_rdg_totei(str) | |||
9683 | end | 9684 | end |
9684 | 9685 | ||
9685 | local function relocate_notes(str) | 9686 | local function relocate_notes(str) |
9686 | str = string.gsub(str, "(%<lem.-%>.-)(%<note.->.-%<%/note%>)(.-%<%/lem%>)", "%1%3%2") | 9687 | str = gsub(str, inlem, function(arg) |
9688 | local notes = {} | ||
9689 | for i in string.gmatch(arg, "%<note.->.-%<%/note%>") | ||
9690 | do | ||
9691 | table.insert(notes, i) | ||
9692 | end | ||
9693 | allnotes = table.concat(notes) | ||
9694 | arg = string.gsub(arg, "%<note.->.-%<%/note%>", "") | ||
9695 | return string.format("%s%s", arg, allnotes) | ||
9696 | end) | ||
9687 | return str | 9697 | return str |
9688 | end | 9698 | end |
9689 | 9699 | ||