From 466a234415c020e09c82f4c904170ed837e1bfbb Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 14 Sep 2019 17:57:45 +0200 Subject: improved ekdosis.appin(). added recursion to lem_rdg_totei(). a bit of tidy up --- ekdosis.dtx | 68 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 941ceed..6b9b15f 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -136,6 +136,9 @@ Running "make install" installs the files in the local TeX tree. %<*driver> \documentclass{ltxdoc} \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} +\usepackage{fontspec} +\usepackage[english]{babel} +\babelfont{rm}{Old Standard} \usepackage{metalogox} \usepackage{hologo} \usepackage{hyperxmp} @@ -156,11 +159,6 @@ Running "make install" installs the files in the local TeX tree. arabtex, luatex}} \usepackage[lot]{multitoc} \usepackage{ekdosis} -\usepackage{fontspec} -\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] -\usepackage{newunicodechar} -\newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ -\newunicodechar{Ǧ}{Ǧ} % \usepackage{arabluatex} \usepackage{relsize} \usepackage{units} @@ -326,12 +324,6 @@ Running "make install" installs the files in the local TeX tree. \fi\fi\fi }{\PackageWarning{ekdosis}{parnotes: erroneous input (ignored)}} \newif\iftei@export -% \define@boolkey{ekdosis.sty}[@pkg@]{teiexport}[true]{% -% \if@pkg@teiexport -% \tei@exporttrue -% \AtBeginDocument{\luadirect{ekdosis.openteistream()}}% -% \AtEndDocument{\luadirect{ekdosis.closeteistream()}} -% \else\fi} \define@choicekey{ekdosis.sty}{teiexport}{true, false, tidy}[true]{% \edef\@exptrue{true}\edef\@expfalse{false}\edef\@exptidy{tidy} \edef\@tempa{#1} @@ -459,13 +451,7 @@ idno={}, msName={}, origDate={}][3]{% } \newcounter{ekd@lab} \def\unconditional@appin#1{% - \luadirect{ekdosis.appin( - \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, - "no")}% - \luadirect{ekdosis.appin(\luastringN{#1}, "no")}% - \luadirect{ekdosis.appin( - \luastring{}, - "yes")}% + \luadirect{ekdosis.appin(\luastringN{#1})}% } \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} \newif\ifrtl@app @@ -499,17 +485,11 @@ idno={}, msName={}, origDate={}][3]{% \NewDocumentCommand{\append@app}{+m}{% \ifekd@isinapp% \ifbool{ekd@state}{% - \luadirect{ekdosis.appin( - \luastring{<\zref@extract{ekd:\theekd@lab}{abspage}>}, - "no")}% - \luadirect{ekdosis.appin(\luastringO{#1}, "no")}% - \luadirect{ekdosis.appin( - \luastring{}, - "yes")}% + \luadirect{ekdosis.appin(\luastringO{#1})}% }{}\else\fi} \NewDocumentCommand{\append@ln@app}{+m}% {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#1}))}} -\NewDocumentCommand{\app}{+m}{% +\NewDocumentCommand{\app}{ > { \TrimSpaces } +m}{% \ekd@isinapptrue% \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% @@ -614,7 +594,8 @@ idno={}, msName={}, origDate={}][3]{% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{#2}% + {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + \unexpanded{#2}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -672,7 +653,8 @@ idno={}, msName={}, origDate={}][3]{% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{#2}% + {{\noexpand\selectlanguage{\languagename}\unexpanded{#2}}}{% + \unexpanded{#2}}% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi \fi @@ -1049,8 +1031,8 @@ local function lem_rdg_totei(str) bbraces = ekdosis.getsiglum(bbraces, "tei") return string.format("%s", bbraces) end) - return string.format("<%s wit=\"%s\">%s", - cmd, opt, arg, cmd) + return lem_rdg_totei(string.format("<%s wit=\"%s\">%s", + cmd, opt, arg, cmd)) end) return str end @@ -1386,7 +1368,16 @@ local function mdvisintable(table, value) return false end -function ekdosis.appin(str, nl) + +function ekdosis.appin(str) + local f = io.open(tex.jobname.."_tmp.ekd", "a+") + f:write("<", cur_abs_pg, ">", str, "\n") + f:close() + return true +end + +--[[ +function ekdosis.appin_out(str, nl) local f = io.open(tex.jobname.."_tmp.ekd", "a+") if nl == "yes" then f:write(str, "\n") @@ -1396,6 +1387,7 @@ function ekdosis.appin(str, nl) f:close() return true end +--]] function ekdosis.appout() local file = io.open(tex.jobname..".ekd", "r") @@ -1403,6 +1395,16 @@ function ekdosis.appout() f = assert(io.open(tex.jobname..".ekd", "r")) t = f:read("*a") local output = {} + for i in string.gmatch(t, + ".-") + do + table.insert(output, i) + end + if string.find(t, "") + then + table.insert(output, "\\par") + else + end for i in string.gmatch(t, "<"..cur_abs_pg..">.-") do @@ -1410,8 +1412,8 @@ function ekdosis.appout() end f:close() str = table.concat(output) - str = string.gsub(str, "", "") - str = string.gsub(str, "<"..cur_abs_pg..">", " ") + str = string.gsub(str, "", "") + str = string.gsub(str, "<[A-Z0-9]?"..cur_abs_pg..">", " ") return str else end end -- cgit v1.2.3