From 16b22006e1c52469314047d7824e76b0b4c2e90f Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 20 Apr 2020 12:11:04 +0200 Subject: added self_close_tags() --- ekdosis.dtx | 34 ++++++++++++++++++++++++++-------- ekdosis.el | 3 +++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/ekdosis.dtx b/ekdosis.dtx index 8fd0a15..64122d3 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -948,12 +948,12 @@ Running "make install" installs the files in the local TeX tree. {\edef\note@contents{% % \hskip .75em \ifekd@mapps - \ifbool{subsq@unit@\ekdan@type}% - {\ekd@munit@delim}{}% + \ifbool{subsq@unit@\ekdan@type}% + {\ekd@munit@delim}{}% \else% - \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% + \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem% {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}% \unexpanded\expandafter{\ekdn@sep}\else\fi% @@ -961,10 +961,10 @@ Running "make install" installs the files in the local TeX tree. {\edef\note@contents{% % \hskip .75em \ifekd@mapps - \ifbool{subsq@unit@\ekdan@type}% - {\ekd@munit@delim}{}% + \ifbool{subsq@unit@\ekdan@type}% + {\ekd@munit@delim}{}% \else% - \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% + \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em \ifdefined\ekdn@lem @@ -1588,7 +1588,7 @@ local function lem_rdg_totei(str) arg = string.sub(arg, 2, -2) return lem_rdg_totei(string.format("<%s>%s", cmd, arg, cmd)) end) --- str = string.gsub(str, "(%.-)(%)(.-%<%/lem%>)", "%1%3%2") + -- str = string.gsub(str, "(%.-)(%)(.-%<%/lem%>)", "%1%3%2") return str end @@ -1764,6 +1764,23 @@ local function checkpars(str) return str end +local function self_close_tags(str) + str = gsub(str, lpeg.P("<" * -lpeg.S("/")) + * lpeg.Cs(letters^1) + * lpeg.Cs((1 - lpeg.S"<>")^0) + * lpeg.P(">") + * lpeg.P(""), function(ftag, arg, ltag) + if ftag == ltag + then + return string.format("<%s%s/>", ftag, arg) + else + end + end) + return str +end + local function textotei(str) str = xml_entities(str) str = texpatttotei(str) @@ -1774,6 +1791,7 @@ local function textotei(str) str = versetotei(str) str = envtotei(str) str = cmdtotei(str) + str = self_close_tags(str) str = partotei(str) str = checkpars(str) return str diff --git a/ekdosis.el b/ekdosis.el index bdf92a1..63e399b 100644 --- a/ekdosis.el +++ b/ekdosis.el @@ -115,6 +115,9 @@ (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) '("[n]" ("note")) t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("[l]" ("linelabel")) + t) ;; This package relies on lualatex, so check for it: (TeX-check-engine-add-engines 'luatex) (TeX-add-symbols -- cgit v1.2.3