aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-10-13 16:22:57 +0200
committerRobert Alessi <alessi@robertalessi.net>2018-10-13 16:22:57 +0200
commitee451a0a5c406191ec2fbc18d3f44f55bc69e706 (patch)
tree8acd5816206bb7eb26d8719b4caed33db49b2cf2
parent0fb13b776774e39b62c61da9a0ab5ca814c5f1de (diff)
downloadekdosis-ee451a0a5c406191ec2fbc18d3f44f55bc69e706.tar.gz
embedded lua file into ekdosis.dtx
-rw-r--r--Makefile7
-rw-r--r--ekdosis.dtx184
2 files changed, 99 insertions, 92 deletions
diff --git a/Makefile b/Makefile
index 114be45..5ade50e 100644
--- a/Makefile
+++ b/Makefile
@@ -7,17 +7,18 @@ UTREE = $(shell kpsewhich --var-value TEXMFHOME)
7all: $(NAME).pdf 7all: $(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
15clean: 15clean:
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}
20distclean: clean uninst 20distclean: 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
23uninst: 24uninst:
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
44function closestream()
45 os.remove(tex.jobname..".ekd")
46 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
47 return true
48end
49
50function remove()
51 os.remove(tex.jobname..".ekd")
52end
53
54function isintable(table, value)
55 for _, v in pairs(table) do
56 if v == value then return true end
57 end
58 return false
59end
60
61function 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
70end
71
72function 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
88end
89
90function 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()
98end
99
100md5items = {}
101local salt = 0
102
103function 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.."}"
113end
114
115--[[ -- of no use
116function 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
122end
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}
299function closestream()
300 os.remove(tex.jobname..".ekd")
301 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
302 return true
303end
304
305function remove()
306 os.remove(tex.jobname..".ekd")
307end
308
309function isintable(table, value)
310 for _, v in pairs(table) do
311 if v == value then return true end
312 end
313 return false
314end
315
316function 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
325end
326
327function 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
343end
344
345function 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()
353end
354
355md5items = {}
356local salt = 0
357
358function 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.."}"
368end
369
370--[[ -- of no use
371function 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
377end
378--]]
379% \end{minted}
380% \iffalse
381%</lua>
382% \fi
383\endinput \ No newline at end of file