diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-10-13 16:22:57 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-10-13 16:22:57 +0200 |
commit | ee451a0a5c406191ec2fbc18d3f44f55bc69e706 (patch) | |
tree | 8acd5816206bb7eb26d8719b4caed33db49b2cf2 | |
parent | 0fb13b776774e39b62c61da9a0ab5ca814c5f1de (diff) | |
download | ekdosis-ee451a0a5c406191ec2fbc18d3f44f55bc69e706.tar.gz |
embedded lua file into ekdosis.dtx
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | ekdosis.dtx | 184 |
2 files changed, 99 insertions, 92 deletions
@@ -7,17 +7,18 @@ UTREE = $(shell kpsewhich --var-value TEXMFHOME) | |||
7 | all: $(NAME).pdf | 7 | all: $(NAME).pdf |
8 | test -e README.txt && mv README.txt README || exit 0 | 8 | test -e README.txt && mv README.txt README || exit 0 |
9 | $(NAME).pdf: $(NAME).dtx | 9 | $(NAME).pdf: $(NAME).dtx |
10 | lualatex -recorder -interaction=batchmode $(NAME).dtx >/dev/null | 10 | lualatex -shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null |
11 | if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi | 11 | if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi |
12 | if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi | 12 | if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi |
13 | lualatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null | 13 | lualatex -shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null |
14 | lualatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null | 14 | lualatex -shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null |
15 | clean: | 15 | clean: |
16 | rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out,toc} | 16 | rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out,toc} |
17 | rm -f *~ | 17 | rm -f *~ |
18 | rm -rf auto/ | 18 | rm -rf auto/ |
19 | # rm -f $(NAME)_*.{bib,lua} | 19 | # rm -f $(NAME)_*.{bib,lua} |
20 | distclean: clean uninst | 20 | distclean: clean uninst |
21 | rm -rf _minted-* | ||
21 | rm -f $(NAME).{pdf,sty,lua} README | 22 | rm -f $(NAME).{pdf,sty,lua} README |
22 | rm -f *.zip *.tar.gz | 23 | rm -f *.zip *.tar.gz |
23 | uninst: | 24 | uninst: |
diff --git a/ekdosis.dtx b/ekdosis.dtx index b181e53..c795721 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -41,87 +41,6 @@ along with this program. If not, see | |||
41 | <http://www.gnu.org/licenses/>. | 41 | <http://www.gnu.org/licenses/>. |
42 | --]] | 42 | --]] |
43 | 43 | ||
44 | function closestream() | ||
45 | os.remove(tex.jobname..".ekd") | ||
46 | os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") | ||
47 | return true | ||
48 | end | ||
49 | |||
50 | function remove() | ||
51 | os.remove(tex.jobname..".ekd") | ||
52 | end | ||
53 | |||
54 | function isintable(table, value) | ||
55 | for _, v in pairs(table) do | ||
56 | if v == value then return true end | ||
57 | end | ||
58 | return false | ||
59 | end | ||
60 | |||
61 | function appin(str, nl) | ||
62 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | ||
63 | if nl == "yes" then | ||
64 | f:write(str, "\n") | ||
65 | else | ||
66 | f:write(str) | ||
67 | end | ||
68 | f:close() | ||
69 | return true | ||
70 | end | ||
71 | |||
72 | function appout() | ||
73 | local file = io.open(tex.jobname..".ekd", "r") | ||
74 | if file ~= nil then io.close(file) | ||
75 | f = assert(io.open(tex.jobname..".ekd", "r")) | ||
76 | t = f:read("*a") | ||
77 | local output = {} | ||
78 | for i in string.gmatch(t, "<"..tex.count[0]..">.-</"..tex.count[0]..">") | ||
79 | do | ||
80 | table.insert(output, i) | ||
81 | end | ||
82 | f:close() | ||
83 | str = table.concat(output, "\n") | ||
84 | str = string.gsub(str, "</"..tex.count[0]..">", " ") | ||
85 | str = string.gsub(str, "<"..tex.count[0]..">", "") | ||
86 | return str | ||
87 | else end | ||
88 | end | ||
89 | |||
90 | function testapparatus() | ||
91 | local file = io.open(tex.jobname..".ekd", "r") | ||
92 | if file ~= nil then | ||
93 | local t = file:read("*a") | ||
94 | if string.find(t, "<"..tex.count[0]..">") then | ||
95 | return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end | ||
96 | else return "\\boolfalse{isapp}" end | ||
97 | file:close() | ||
98 | end | ||
99 | |||
100 | md5items = {} | ||
101 | local salt = 0 | ||
102 | |||
103 | function mdvappend(str) | ||
104 | i = md5.sumhexa(str) | ||
105 | if not isintable(md5items, i) then | ||
106 | table.insert(md5items, i) | ||
107 | else | ||
108 | i = i..salt | ||
109 | table.insert(md5items, i) | ||
110 | salt = salt + 1 | ||
111 | end | ||
112 | return "\\linelabel{"..i.."}\\append{\\textbf{\\getrefnumber{"..i.."}} "..str.."}" | ||
113 | end | ||
114 | |||
115 | --[[ -- of no use | ||
116 | function writemdv(str) | ||
117 | str = md5.sumhexa(str) | ||
118 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | ||
119 | f:write("<md5>", str, "</md5>", "\n") | ||
120 | f:close() | ||
121 | return true | ||
122 | end | ||
123 | --]] | ||
124 | |||
125 | %</lua> | 44 | %</lua> |
126 | %<*internal> | 45 | %<*internal> |
127 | \fi | 46 | \fi |
@@ -215,11 +134,15 @@ Running "make install" installs the files in the local TeX tree. | |||
215 | \usepackage{\jobname} | 134 | \usepackage{\jobname} |
216 | \usepackage{fontspec,luatextra} | 135 | \usepackage{fontspec,luatextra} |
217 | \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] | 136 | \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] |
137 | \usepackage{relsize} | ||
138 | \usepackage{minted} | ||
139 | \usepackage[contents]{colordoc} | ||
218 | \usepackage{authblk} | 140 | \usepackage{authblk} |
219 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} | 141 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} |
220 | \EnableCrossrefs | 142 | \EnableCrossrefs |
221 | \CodelineIndex | 143 | \CodelineIndex |
222 | \RecordChanges | 144 | \RecordChanges |
145 | %\OnlyDescription | ||
223 | \begin{document} | 146 | \begin{document} |
224 | \DocInput{\jobname.dtx} | 147 | \DocInput{\jobname.dtx} |
225 | \PrintChanges | 148 | \PrintChanges |
@@ -284,7 +207,6 @@ Running "make install" installs the files in the local TeX tree. | |||
284 | % describing what the environment is supposed to do, what its | 207 | % describing what the environment is supposed to do, what its |
285 | % mandatory and optional arguments are, and so forth. | 208 | % mandatory and optional arguments are, and so forth. |
286 | % | 209 | % |
287 | % \StopEventually{} | ||
288 | % | 210 | % |
289 | % \section{Implementation} | 211 | % \section{Implementation} |
290 | % | 212 | % |
@@ -364,14 +286,98 @@ Running "make install" installs the files in the local TeX tree. | |||
364 | \ifbool{ekdstarted}{}{\EkdosisStart\global\setbool{ekdstarted}{true}} | 286 | \ifbool{ekdstarted}{}{\EkdosisStart\global\setbool{ekdstarted}{true}} |
365 | \EkdosisOn}{\EkdosisOff} | 287 | \EkdosisOn}{\EkdosisOff} |
366 | % \end{macrocode} | 288 | % \end{macrocode} |
367 | % That is it. Say goodbye before leaving. | ||
368 | % \begin{macrocode} | ||
369 | \endinput | ||
370 | % \end{macrocode} | ||
371 | % | ||
372 | % \iffalse | 289 | % \iffalse |
373 | %</package> | 290 | %</package> |
374 | % \fi | 291 | % \fi |
375 | % | 292 | % \StopEventually{} |
376 | % \Finale | 293 | % \Finale |
377 | \endinput | 294 | % |
295 | % \iffalse | ||
296 | %<*lua> | ||
297 | % \fi | ||
298 | % \begin{minted}[linenos,fontsize=\relsize{-0.5}]{lua} | ||
299 | function closestream() | ||
300 | os.remove(tex.jobname..".ekd") | ||
301 | os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") | ||
302 | return true | ||
303 | end | ||
304 | |||
305 | function remove() | ||
306 | os.remove(tex.jobname..".ekd") | ||
307 | end | ||
308 | |||
309 | function isintable(table, value) | ||
310 | for _, v in pairs(table) do | ||
311 | if v == value then return true end | ||
312 | end | ||
313 | return false | ||
314 | end | ||
315 | |||
316 | function appin(str, nl) | ||
317 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | ||
318 | if nl == "yes" then | ||
319 | f:write(str, "\n") | ||
320 | else | ||
321 | f:write(str) | ||
322 | end | ||
323 | f:close() | ||
324 | return true | ||
325 | end | ||
326 | |||
327 | function appout() | ||
328 | local file = io.open(tex.jobname..".ekd", "r") | ||
329 | if file ~= nil then io.close(file) | ||
330 | f = assert(io.open(tex.jobname..".ekd", "r")) | ||
331 | t = f:read("*a") | ||
332 | local output = {} | ||
333 | for i in string.gmatch(t, "<"..tex.count[0]..">.-</"..tex.count[0]..">") | ||
334 | do | ||
335 | table.insert(output, i) | ||
336 | end | ||
337 | f:close() | ||
338 | str = table.concat(output, "\n") | ||
339 | str = string.gsub(str, "</"..tex.count[0]..">", " ") | ||
340 | str = string.gsub(str, "<"..tex.count[0]..">", "") | ||
341 | return str | ||
342 | else end | ||
343 | end | ||
344 | |||
345 | function testapparatus() | ||
346 | local file = io.open(tex.jobname..".ekd", "r") | ||
347 | if file ~= nil then | ||
348 | local t = file:read("*a") | ||
349 | if string.find(t, "<"..tex.count[0]..">") then | ||
350 | return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end | ||
351 | else return "\\boolfalse{isapp}" end | ||
352 | file:close() | ||
353 | end | ||
354 | |||
355 | md5items = {} | ||
356 | local salt = 0 | ||
357 | |||
358 | function mdvappend(str) | ||
359 | i = md5.sumhexa(str) | ||
360 | if not isintable(md5items, i) then | ||
361 | table.insert(md5items, i) | ||
362 | else | ||
363 | i = i..salt | ||
364 | table.insert(md5items, i) | ||
365 | salt = salt + 1 | ||
366 | end | ||
367 | return "\\linelabel{"..i.."}\\append{\\textbf{\\getrefnumber{"..i.."}} "..str.."}" | ||
368 | end | ||
369 | |||
370 | --[[ -- of no use | ||
371 | function writemdv(str) | ||
372 | str = md5.sumhexa(str) | ||
373 | local f = io.open(tex.jobname.."_tmp.ekd", "a+") | ||
374 | f:write("<md5>", str, "</md5>", "\n") | ||
375 | f:close() | ||
376 | return true | ||
377 | end | ||
378 | --]] | ||
379 | % \end{minted} | ||
380 | % \iffalse | ||
381 | %</lua> | ||
382 | % \fi | ||
383 | \endinput \ No newline at end of file | ||