aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-10-16 12:28:41 +0200
committerRobert Alessi <alessi@robertalessi.net>2018-10-16 12:28:41 +0200
commit6260d5667d5e96af19fe070ae9887b459ac00577 (patch)
treece12d90314727be59c16b6fb2d3e08bc6c7facbf
parent7985191ecbb1344dfd985b2b59c8ecbc51a219cc (diff)
downloadekdosis-6260d5667d5e96af19fe070ae9887b459ac00577.tar.gz
better formatting of lua code
-rw-r--r--ekdosis.dtx39
1 files changed, 22 insertions, 17 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 91b9c4b..eaa13b2 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -139,6 +139,10 @@ Running "make install" installs the files in the local TeX tree.
139\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] 139\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}]
140\usepackage{relsize} 140\usepackage{relsize}
141\usepackage{minted} 141\usepackage{minted}
142\newminted[ekdlua]{lua}{linenos, fontsize=\relsize{-0.5},
143 xleftmargin=12pt,
144 numberblanklines=false, numbersep=3pt, firstnumber=last}
145\renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}}
142\usepackage[contents]{colordoc} 146\usepackage[contents]{colordoc}
143\usepackage{authblk} 147\usepackage{authblk}
144\newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} 148\newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}}
@@ -298,11 +302,11 @@ Running "make install" installs the files in the local TeX tree.
298% \iffalse `' 302% \iffalse `'
299%<*lua> 303%<*lua>
300% \fi 304% \fi
301% \begin{minted}[linenos,fontsize=\relsize{-0.5}]{lua} 305% \begin{ekdlua}
302function closestream() 306function closestream()
303 os.remove(tex.jobname..".ekd") 307 os.remove(tex.jobname..".ekd")
304 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") 308 os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd")
305 return true 309 return true
306end 310end
307 311
308function remove() 312function remove()
@@ -317,14 +321,14 @@ function isintable(table, value)
317end 321end
318 322
319function appin(str, nl) 323function appin(str, nl)
320 local f = io.open(tex.jobname.."_tmp.ekd", "a+") 324 local f = io.open(tex.jobname.."_tmp.ekd", "a+")
321 if nl == "yes" then 325 if nl == "yes" then
322 f:write(str, "\n") 326 f:write(str, "\n")
323 else 327 else
324 f:write(str) 328 f:write(str)
325 end 329 end
326 f:close() 330 f:close()
327 return true 331 return true
328end 332end
329 333
330function appout() 334function appout()
@@ -333,7 +337,8 @@ function appout()
333 f = assert(io.open(tex.jobname..".ekd", "r")) 337 f = assert(io.open(tex.jobname..".ekd", "r"))
334 t = f:read("*a") 338 t = f:read("*a")
335 local output = {} 339 local output = {}
336 for i in string.gmatch(t, "<"..tex.count[0]..">.-</"..tex.count[0]..">") 340 for i in string.gmatch(t,
341 "<"..tex.count[0]..">.-</"..tex.count[0]..">")
337 do 342 do
338 table.insert(output, i) 343 table.insert(output, i)
339 end 344 end
@@ -350,7 +355,7 @@ function testapparatus()
350 if file ~= nil then 355 if file ~= nil then
351 local t = file:read("*a") 356 local t = file:read("*a")
352 if string.find(t, "<"..tex.count[0]..">") then 357 if string.find(t, "<"..tex.count[0]..">") then
353 return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end 358 return "\\booltrue{isapp}" else return "\\boolfalse{isapp}" end
354 else return "\\boolfalse{isapp}" end 359 else return "\\boolfalse{isapp}" end
355 file:close() 360 file:close()
356end 361end
@@ -371,15 +376,15 @@ function mdvappend(str)
371end 376end
372 377
373--[[ -- of no use 378--[[ -- of no use
374function writemdv(str) 379 function writemdv(str)
375 str = md5.sumhexa(str) 380 str = md5.sumhexa(str)
376 local f = io.open(tex.jobname.."_tmp.ekd", "a+") 381 local f = io.open(tex.jobname.."_tmp.ekd", "a+")
377 f:write("<md5>", str, "</md5>", "\n") 382 f:write("<md5>", str, "</md5>", "\n")
378 f:close() 383 f:close()
379 return true 384 return true
380end 385 end
381--]] 386--]]
382% \end{minted} 387% \end{ekdlua}
383% \iffalse 388% \iffalse
384%</lua> 389%</lua>
385% \fi 390% \fi