diff options
-rw-r--r-- | ekdosis.dtx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 5ee1169..fd99891 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -1018,6 +1018,21 @@ idno={}, msName={}, origDate={}][3]{% | |||
1018 | \end{linenumbers}% | 1018 | \end{linenumbers}% |
1019 | \iftei@export\luadirect{ekdosis.exporttei(\luastringN{#1})}\else\fi} | 1019 | \iftei@export\luadirect{ekdosis.exporttei(\luastringN{#1})}\else\fi} |
1020 | % \end{macrocode} | 1020 | % \end{macrocode} |
1021 | % Very basic implementation of poetry lines:--- | ||
1022 | % \begin{macrocode} | ||
1023 | \newlength{\ekdverseindentlength} | ||
1024 | \setlength{\ekdverseindentlength}{\parindent} | ||
1025 | \newenvironment*{ekdverse}[1][\ekdverseindentlength]{ | ||
1026 | \begin{list}{}{% | ||
1027 | \setlength{\leftmargin}{#1} | ||
1028 | \setlength{\itemsep}{0pt} | ||
1029 | \setlength{\topsep}{0pt} | ||
1030 | \setlength{\partopsep}{0pt} | ||
1031 | } | ||
1032 | \item[] | ||
1033 | }{\end{list}} | ||
1034 | % \end{macrocode} | ||
1035 | % | ||
1021 | % \iffalse | 1036 | % \iffalse |
1022 | %</package> | 1037 | %</package> |
1023 | % \fi | 1038 | % \fi |
@@ -1267,6 +1282,7 @@ local cmdtotags = { | |||
1267 | } | 1282 | } |
1268 | 1283 | ||
1269 | local envtotags = { | 1284 | local envtotags = { |
1285 | {a="ekdverse", b="lg", c=""}, | ||
1270 | {a="txarabtr", b="p", c=" xml:lang=\"arb-Latn\" type=\"transliterated\""}, | 1286 | {a="txarabtr", b="p", c=" xml:lang=\"arb-Latn\" type=\"transliterated\""}, |
1271 | {a="txarab", b="p", c=" xml:lang=\"arb\""}, | 1287 | {a="txarab", b="p", c=" xml:lang=\"arb\""}, |
1272 | {a="center", b="p", c=" rend=\"centered\""}, | 1288 | {a="center", b="p", c=" rend=\"centered\""}, |
@@ -1441,14 +1457,23 @@ end | |||
1441 | 1457 | ||
1442 | local function linestotei(str) | 1458 | local function linestotei(str) |
1443 | str = "\n<l>"..str | 1459 | str = "\n<l>"..str |
1444 | str = gsub(str, endpoem, "</l>\n") | 1460 | -- str = gsub(str, endpoem, "</l>\n") |
1445 | str = gsub(str, poemline * lpeg.P(">"), "\n<lb/>") | 1461 | str = gsub(str, poemline * lpeg.P(">"), "\n<lb/>") |
1446 | str = gsub(str, poemline, "</l>\n<l>") | 1462 | str = gsub(str, poemline, "</l>\n<l>") |
1463 | str = str.."</l>\n" | ||
1447 | return str | 1464 | return str |
1448 | end | 1465 | end |
1449 | 1466 | ||
1450 | -- better use lpeg: look into this later | 1467 | -- better use lpeg: look into this later |
1451 | local function versetotei(str) | 1468 | local function versetotei(str) |
1469 | str = string.gsub(str, "(\\begin%s?%{ekdverse%})(%b[])(.-)(\\end%s?%{ekdverse%})", function(benv, opt, arg, eenv) | ||
1470 | arg = linestotei(arg) | ||
1471 | return string.format("%s%s%s%s", benv, opt, arg, eenv) | ||
1472 | end) | ||
1473 | str = string.gsub(str, "(\\begin%s?%{ekdverse%})(.-)(\\end%s?%{ekdverse%})", function(benv, arg, eenv) | ||
1474 | arg = linestotei(arg) | ||
1475 | return string.format("%s%s%s", benv, arg, eenv) | ||
1476 | end) | ||
1452 | str = string.gsub(str, "(\\begin%s?%{verse%})(%b[])(.-)(\\end%s?%{verse%})", function(benv, opt, arg, eenv) | 1477 | str = string.gsub(str, "(\\begin%s?%{verse%})(%b[])(.-)(\\end%s?%{verse%})", function(benv, opt, arg, eenv) |
1453 | arg = linestotei(arg) | 1478 | arg = linestotei(arg) |
1454 | return string.format("%s%s%s%s", benv, opt, arg, eenv) | 1479 | return string.format("%s%s%s%s", benv, opt, arg, eenv) |