aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-08-17 19:10:53 +0200
committerRobert Alessi <alessi@robertalessi.net>2016-08-17 19:10:53 +0200
commit603a4562819fca15dd66831a10b1fd7344d2cd83 (patch)
tree91baa54853671fb990304edf756cf7560ae7cc72
parenta24d31f5dab8e66dcaf7b84a73658f4b88c9faf5 (diff)
downloadekdosis-603a4562819fca15dd66831a10b1fd7344d2cd83.tar.gz
compute linelabels and linerefs with md5sum
-rw-r--r--ekdosis.dtx59
1 files changed, 50 insertions, 9 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 5430f87..5248f96 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -40,7 +40,7 @@ You should have received a copy of the GNU General Public License
40along with this program. If not, see 40along with this program. If not, see
41<http://www.gnu.org/licenses/>. 41<http://www.gnu.org/licenses/>.
42--]] 42--]]
43 43
44function closestream() 44function closestream()
45 os.remove(tex.jobname..".ekd") 45 os.remove(tex.jobname..".ekd")
46 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") 46 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
@@ -90,6 +90,35 @@ function testapparatus()
90 file:close() 90 file:close()
91end 91end
92 92
93function getlab()
94 return "\\getrefnumber{ekdl:\\theedk@lab}"
95end
96
97--[[
98local linecount = 0
99
100count_lines = function(head)
101 while head do
102 if head.id == 0 then
103 linecount = linecount + 1
104 end
105 head = head.next
106 end
107 return true
108end
109
110count_lines = function(head)
111 for line in node.traverse_id(0, head) do
112 linecount = linecount + 1
113 end
114 return head
115end
116
117function getline()
118 return linecount
119end
120--]]
121
93%</lua> 122%</lua>
94%<*internal> 123%<*internal>
95\fi 124\fi
@@ -181,12 +210,15 @@ Running "make install" installs the files in the local TeX tree.
181\usepackage[numbered]{hypdoc} 210\usepackage[numbered]{hypdoc}
182\usepackage{\jobname} 211\usepackage{\jobname}
183\usepackage{fontspec,luatextra} 212\usepackage{fontspec,luatextra}
213\usepackage{authblk}
184\newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} 214\newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}}
185\EnableCrossrefs 215\EnableCrossrefs
186\CodelineIndex 216\CodelineIndex
187\RecordChanges 217\RecordChanges
188\begin{document} 218\begin{document}
189 \DocInput{\jobname.dtx} 219 \DocInput{\jobname.dtx}
220 \PrintChanges
221 \PrintIndex
190\end{document} 222\end{document}
191%</driver> 223%</driver>
192% \fi 224% \fi
@@ -212,11 +244,13 @@ Running "make install" installs the files in the local TeX tree.
212% \GetFileInfo{\jobname.dtx} 244% \GetFileInfo{\jobname.dtx}
213% \DoNotIndex{\newcommand,\newenvironment} 245% \DoNotIndex{\newcommand,\newenvironment}
214% 246%
215%\title{\textsf{ekdosis} --- Typesetting of TEI xml compliant critical editions\thanks{This file 247% \title{\textsf{ekdosis} --- Typesetting of TEI xml compliant
216% describes version \fileversion, last revised \filedate.} 248% critical editions\thanks{This file describes version \fileversion,
217%} 249% last revised \filedate.} }
218%\author{Robert Alessi} 250%
219%\date{\fileversion\ released \filedate} 251% \author{Robert Alessi}
252% \affil{CNRS UMR 8167 (Paris, France)\footnote{\url{robert.alessi@cnrs.fr}}}
253% \date{\fileversion\ released \filedate}
220% 254%
221%\maketitle 255%\maketitle
222% 256%
@@ -243,9 +277,6 @@ Running "make install" installs the files in the local TeX tree.
243% mandatory and optional arguments are, and so forth. 277% mandatory and optional arguments are, and so forth.
244% 278%
245% \StopEventually{} 279% \StopEventually{}
246% \PrintChanges
247% \PrintIndex
248%
249% 280%
250% \section{Implementation} 281% \section{Implementation}
251% 282%
@@ -275,6 +306,7 @@ Running "make install" installs the files in the local TeX tree.
275\RequirePackage{luacode} 306\RequirePackage{luacode}
276\RequirePackage{xparse} 307\RequirePackage{xparse}
277\RequirePackage{etoolbox} 308\RequirePackage{etoolbox}
309\RequirePackage[addpageno]{lineno}
278\RequirePackage{float} 310\RequirePackage{float}
279\newfloat{apparat}{b}{lap} 311\newfloat{apparat}{b}{lap}
280\RequirePackage{afterpage} 312\RequirePackage{afterpage}
@@ -297,6 +329,10 @@ Running "make install" installs the files in the local TeX tree.
297 \luadirect{appin(\luastringN{#1}, "no")}% 329 \luadirect{appin(\luastringN{#1}, "no")}%
298 \luadirect{appin(\luastring{</\getpagerefnumber{ekd:\theekd@lab}>}, "yes")}% 330 \luadirect{appin(\luastring{</\getpagerefnumber{ekd:\theekd@lab}>}, "yes")}%
299 \stepcounter{ekd@lab}}{}} 331 \stepcounter{ekd@lab}}{}}
332\NewDocumentCommand{\mdv}{m}{%
333 \luadirect{tex.sprint(md5.sumhexa(\luastringN{#1}))}}
334\NewDocumentCommand{\obappend}{+m}{%
335 \linelabel{\mdv{#1}}\append{\getrefnumber{\mdv{#1}}~#1}}
300\NewDocumentCommand{\myappend}{+m}{% 336\NewDocumentCommand{\myappend}{+m}{%
301 \ifbool{ekdstate}{% 337 \ifbool{ekdstate}{%
302 \label{\getlab}% 338 \label{\getlab}%
@@ -330,6 +366,11 @@ Running "make install" installs the files in the local TeX tree.
330\newenvironment{ekdosis}{% 366\newenvironment{ekdosis}{%
331\ifbool{ekdstarted}{}{\EkdosisStart\global\setbool{ekdstarted}{true}} 367\ifbool{ekdstarted}{}{\EkdosisStart\global\setbool{ekdstarted}{true}}
332\EkdosisOn}{\EkdosisOff} 368\EkdosisOn}{\EkdosisOff}
369\newenvironment{countlines}%
370{\directlua{luatexbase.add_to_callback("post_linebreak_filter",
371 count_lines, "count_lines")}}%
372{\par
373\directlua{luatexbase.remove_from_callback("post_linebreak_filter", "count_lines")}}
333% \end{macrocode} 374% \end{macrocode}
334% That is it. Say goodbye before leaving. 375% That is it. Say goodbye before leaving.
335% \begin{macrocode} 376% \begin{macrocode}