From ee451a0a5c406191ec2fbc18d3f44f55bc69e706 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sat, 13 Oct 2018 16:22:57 +0200
Subject: embedded lua file into ekdosis.dtx

---
 ekdosis.dtx | 184 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 95 insertions(+), 89 deletions(-)

(limited to 'ekdosis.dtx')

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
 <http://www.gnu.org/licenses/>.
 --]]
 
-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]..">.-</"..tex.count[0]..">")
-      do
-	 table.insert(output, i)
-      end
-      f:close()
-      str = table.concat(output, "\n")
-      str = string.gsub(str, "</"..tex.count[0]..">", " ")
-      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("<md5>", str, "</md5>", "\n")
-   f:close()
-   return true
-end
---]]
-
 %</lua>
 %<*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
 %</package>
 % \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]..">.-</"..tex.count[0]..">")
+      do
+	 table.insert(output, i)
+      end
+      f:close()
+      str = table.concat(output, "\n")
+      str = string.gsub(str, "</"..tex.count[0]..">", " ")
+      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("<md5>", str, "</md5>", "\n")
+   f:close()
+   return true
+end
+--]]
+% \end{minted}
+% \iffalse
+%</lua>
+% \fi
+\endinput
\ No newline at end of file
-- 
cgit v1.2.3

