From ee451a0a5c406191ec2fbc18d3f44f55bc69e706 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 13 Oct 2018 16:22:57 +0200 Subject: embedded lua file into ekdosis.dtx --- Makefile | 7 ++- ekdosis.dtx | 184 +++++++++++++++++++++++++++++++----------------------------- 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) all: $(NAME).pdf test -e README.txt && mv README.txt README || exit 0 $(NAME).pdf: $(NAME).dtx - lualatex -recorder -interaction=batchmode $(NAME).dtx >/dev/null + lualatex -shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi - lualatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - lualatex --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null + lualatex -shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null + lualatex -shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null clean: rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,ins,log,out,toc} rm -f *~ rm -rf auto/ # rm -f $(NAME)_*.{bib,lua} distclean: clean uninst + rm -rf _minted-* rm -f $(NAME).{pdf,sty,lua} README rm -f *.zip *.tar.gz 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 . --]] -function closestream() - os.remove(tex.jobname..".ekd") - os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") - return true -end - -function remove() - os.remove(tex.jobname..".ekd") -end - -function isintable(table, value) - for _, v in pairs(table) do - if v == value then return true end - end - return false -end - -function appin(str, nl) - local f = io.open(tex.jobname.."_tmp.ekd", "a+") - if nl == "yes" then - f:write(str, "\n") - else - f:write(str) - end - f:close() - return true -end - -function appout() - local file = io.open(tex.jobname..".ekd", "r") - if file ~= nil then io.close(file) - f = assert(io.open(tex.jobname..".ekd", "r")) - t = f:read("*a") - local output = {} - for i in string.gmatch(t, "<"..tex.count[0]..">.-") - do - table.insert(output, i) - end - f:close() - str = table.concat(output, "\n") - str = string.gsub(str, "", " ") - str = string.gsub(str, "<"..tex.count[0]..">", "") - return str - else end -end - -function testapparatus() - local file = io.open(tex.jobname..".ekd", "r") - if file ~= nil then - local t = file:read("*a") - if string.find(t, "<"..tex.count[0]..">") then - return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end - else return "\\boolfalse{isapp}" end - file:close() -end - -md5items = {} -local salt = 0 - -function mdvappend(str) - i = md5.sumhexa(str) - if not isintable(md5items, i) then - table.insert(md5items, i) - else - i = i..salt - table.insert(md5items, i) - salt = salt + 1 - end - return "\\linelabel{"..i.."}\\append{\\textbf{\\getrefnumber{"..i.."}} "..str.."}" -end - ---[[ -- of no use -function writemdv(str) - str = md5.sumhexa(str) - local f = io.open(tex.jobname.."_tmp.ekd", "a+") - f:write("", str, "", "\n") - f:close() - return true -end ---]] - % %<*internal> \fi @@ -215,11 +134,15 @@ Running "make install" installs the files in the local TeX tree. \usepackage{\jobname} \usepackage{fontspec,luatextra} \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] +\usepackage{relsize} +\usepackage{minted} +\usepackage[contents]{colordoc} \usepackage{authblk} \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} \EnableCrossrefs \CodelineIndex \RecordChanges +%\OnlyDescription \begin{document} \DocInput{\jobname.dtx} \PrintChanges @@ -284,7 +207,6 @@ Running "make install" installs the files in the local TeX tree. % describing what the environment is supposed to do, what its % mandatory and optional arguments are, and so forth. % -% \StopEventually{} % % \section{Implementation} % @@ -364,14 +286,98 @@ Running "make install" installs the files in the local TeX tree. \ifbool{ekdstarted}{}{\EkdosisStart\global\setbool{ekdstarted}{true}} \EkdosisOn}{\EkdosisOff} % \end{macrocode} -% That is it. Say goodbye before leaving. -% \begin{macrocode} -\endinput -% \end{macrocode} -% % \iffalse % % \fi -% +% \StopEventually{} % \Finale -\endinput +% +% \iffalse +%<*lua> +% \fi +% \begin{minted}[linenos,fontsize=\relsize{-0.5}]{lua} +function closestream() + os.remove(tex.jobname..".ekd") + os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") + return true +end + +function remove() + os.remove(tex.jobname..".ekd") +end + +function isintable(table, value) + for _, v in pairs(table) do + if v == value then return true end + end + return false +end + +function appin(str, nl) + local f = io.open(tex.jobname.."_tmp.ekd", "a+") + if nl == "yes" then + f:write(str, "\n") + else + f:write(str) + end + f:close() + return true +end + +function appout() + local file = io.open(tex.jobname..".ekd", "r") + if file ~= nil then io.close(file) + f = assert(io.open(tex.jobname..".ekd", "r")) + t = f:read("*a") + local output = {} + for i in string.gmatch(t, "<"..tex.count[0]..">.-") + do + table.insert(output, i) + end + f:close() + str = table.concat(output, "\n") + str = string.gsub(str, "", " ") + str = string.gsub(str, "<"..tex.count[0]..">", "") + return str + else end +end + +function testapparatus() + local file = io.open(tex.jobname..".ekd", "r") + if file ~= nil then + local t = file:read("*a") + if string.find(t, "<"..tex.count[0]..">") then + return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end + else return "\\boolfalse{isapp}" end + file:close() +end + +md5items = {} +local salt = 0 + +function mdvappend(str) + i = md5.sumhexa(str) + if not isintable(md5items, i) then + table.insert(md5items, i) + else + i = i..salt + table.insert(md5items, i) + salt = salt + 1 + end + return "\\linelabel{"..i.."}\\append{\\textbf{\\getrefnumber{"..i.."}} "..str.."}" +end + +--[[ -- of no use +function writemdv(str) + str = md5.sumhexa(str) + local f = io.open(tex.jobname.."_tmp.ekd", "a+") + f:write("", str, "", "\n") + f:close() + return true +end +--]] +% \end{minted} +% \iffalse +% +% \fi +\endinput \ No newline at end of file -- cgit v1.2.3