Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file: -- http://angg.twu.net/LUA/CodeEtexTla.lua.html -- http://angg.twu.net/LUA/CodeEtexTla.lua -- (find-angg "LUA/CodeEtexTla.lua") -- Author: Eduardo Ochs <eduardoochs@gmail.com> -- -- Parse blocks of `(code-etex-tla ...)'s, like these ones: -- (find-angg ".emacs" "c2-2020-1") -- (find-angg ".emacs" "c2-2020-2") -- -- Obsolete! See: -- (find-blogme3 "code-etex-tlas.lua") -- -- (defun e () (interactive) (find-angg "LUA/CodeEtexTla.lua")) -- -- «.parse-2020-1» (to "parse-2020-1") -- «.parse-2020-2» (to "parse-2020-2") -- (find-es "lpeg" "lpeg-debug-mode") Path.prependtocpath "~/usrc/lpeg-1.0.2/?.so" require "lpeg" -- (find-es "lpeg" "globals") B,C,P,R,S,V = lpeg.B,lpeg.C,lpeg.P,lpeg.R,lpeg.S,lpeg.V Cb,Cc,Cf,Cg = lpeg.Cb,lpeg.Cc,lpeg.Cf,lpeg.Cg Cp,Cs,Ct = lpeg.Cp,lpeg.Cs,lpeg.Ct Carg,Cmt = lpeg.Carg,lpeg.Cmt -- (find-es "lpeg" "lpeg-quickref") p_s = (S' \t')^1 p_word = (R("09", "AZ", "az") + S("-_"))^1 p_qword = '"' * p_word:C() * '"' p_2qwords = p_s * p_qword * p_s * p_qword p_cet = P'(' * "code-etex-tla" * p_2qwords * P')' * (P(1)^0):C() -- «parse-2020-1» (to ".parse-2020-1") --[==[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "CodeEtexTla.lua" -- Parse this format (saved in /tmp/o): -- (find-angg ".emacs" "c2-2020-1") -- (find-angg ".emacs" "c3-2020-1") bigstr = ee_readfile "/tmp/o" stuffs = SetL.new() for _,line in ipairs(splitlines(bigstr)) do local short,long,rest = p_cet:match(line) if short then if not stuffs:has(long) then stuffs:add(long, {shorts={}, comments={}}) end local comment = rest:match("^ *; (.*)$") table.insert(stuffs:get(long).shorts, short) table.insert(stuffs:get(long).comments, comment) end end = stuffs for k,v in stuffs:gen() do PP(k, v) end do print [[\def\incl#1{\includepdf[pages=1-last]{#1.pdf}}]] for k,v in stuffs:gen() do print() printf('%% (%s "title")\n', v.shorts[1]) printf('%% (%s "title")\n', v.shorts[1]) printf('\\incl{%s}\n', k) end end -- See: (c2m201tudop 1 "title") -- (c2m201tudoa "title") -- (c3m201tudop 1 "title") -- (c3m201tudoa "title") --]==] -- «parse-2020-2» (to ".parse-2020-2") --[==[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "CodeEtexTla.lua" -- Parse this format (saved in /tmp/o): -- (find-angg ".emacs" "c2-2020-2") -- (find-angg ".emacs" "c3-2020-2") -- Hack: use the block above. --]==] -- Ok: (c2m201tudop 1 "title") -- (c2m201tudoa "title") -- (c3m201tudop 1 "title") -- (c3m201tudoa "title") -- -- (c2m202tudop 1 "title") -- (c2m202tudoa "title") -- (c3m202tudop 1 "title") -- (c3m202tudoa "title") -- -- (c2m211tudop 1 "title") -- (c2m211tudoa "title") -- (c3m211tudop 1 "title") -- (c3m211tudoa "title") -- -- (c2m212tudop 1 "title") -- (c2m212tudoa "title") -- (c3m212tudop 1 "title") -- (c3m212tudoa "title") -- -- (c2m221tudop 1 "title") -- (c2m221tudoa "title") -- (c3m221tudop 1 "title") -- (c3m221tudoa "title") -- http://angg.twu.net/LATEX/2020-1-C2-tudo.pdf -- http://angg.twu.net/LATEX/2020-2-C2-tudo.pdf -- http://angg.twu.net/LATEX/2021-1-C2-tudo.pdf -- http://angg.twu.net/LATEX/2021-2-C2-tudo.pdf -- http://angg.twu.net/LATEX/2022-1-C2-tudo.pdf -- http://angg.twu.net/LATEX/2020-1-C3-tudo.pdf -- http://angg.twu.net/LATEX/2020-2-C3-tudo.pdf -- http://angg.twu.net/LATEX/2021-1-C3-tudo.pdf -- http://angg.twu.net/LATEX/2021-2-C3-tudo.pdf -- http://angg.twu.net/LATEX/2022-1-C3-tudo.pdf -- Página -- Quadros -- Pdfzão com todos os pdfzinhos -- Logs do Telegram -- Local Variables: -- coding: utf-8-unix -- End: