|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- https://anggtwu.net/LUA/CodePdfFiles1.lua.html
-- https://anggtwu.net/LUA/CodePdfFiles1.lua
-- (find-angg "LUA/CodePdfFiles1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun e () (interactive) (find-angg "LUA/CodePdfFiles1.lua"))
pat_cp = '^%(code%-pdf%-page +"(.-)" +"~/books/__analysis/(.-)"%)'
pat_b = '^;; %(find%-LATEX "education.bib" "bib%-(.-)"%)'
m = function (pat) PP(li,pat); return li:match(pat) end
m = function (pat) return li:match(pat) end
mb = function () return m(pat_b) end
mcp = function () return m(pat_cp) end
getcites = function (fname)
local pat1 = "\\cite{(.-)}"
local pat2 = "\\cite%[.-%]{(.-)}"
local cites = Set.new()
for id in ee_readfile(fname):gmatch(pat1) do cites:add(id) end
for id in ee_readfile(fname):gmatch(pat2) do cites:add(id) end
return cites
end
-- (find-fline "~/LATEX/2026logica-para-pessoas.tex")
-- (find-fline "~/LATEX/2026bad-foundations.tex")
cites1 = getcites("~/LATEX/2026logica-para-pessoas.tex")
cites2 = getcites("~/LATEX/2026bad-foundations.tex")
cites = cites1 + cites2
bs = VTable
getbibpdfs = function (fname)
local L = VTable {}
local collect = function (b,p) print(b,p) end
local collect = function (b,p) table.insert(L,{b=b,p=p}) end
for _,li_ in ipairs(splitlines(ee_readfile(fname))) do
li = li_
if mb() then table.insert(bs,mb()) end
if mcp() then
lastc,lastp = mcp()
for _,b in ipairs(bs) do collect(b,lastp) end
end
if li=="" then bs = VTable {} end
-- if li=="" then
-- if lastb and lastp then collect(lastb, lastp) end
-- lastb,lastc,lastp = nil,nil,nil
-- end
end
return L
end
bibpdfs = Set.new()
for _,bp in ipairs(getbibpdfs("~/books/__analysis/__analysis.el")) do
local b,p = bp.b,bp.p
-- PP(bp)
bibpdfs:add(b,p)
end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "CodePdfFiles1.lua"
= bibpdfs
= bibpdfs:ksc(" ")
= (bibpdfs - cites):ksc(" ")
= (cites - bibpdfs):ksc(" ")
= cites1
= cites2
= cites
cites3 = bibpdfs * cites
= cites3
= cites1:ksc" "
= cites1:ksc"\n"
= cites2:ksc"\n"
= cites3:ksc"\n"
bigstr
)
for b,p in (cites * bibpdfs):gen() do print(b,p) end
for b,p in (bibpdfs * cites):gen() do print(b,p) end
= ee_readfile "~/books/__analysis/__analysis.el"
for _,li_ in ipairs(splitlines(bigstr)) do
li = li_
if mb() then lastb = mb() end
-- if mb() then print(mb()) end
if mcp() and lastb then
lastc,lastp = mcp()
end
if li=="" then
if lastb and lastp then print(lastb, lastp) end
lastb,lastc,lastp = nil,nil,nil
end
end
= pat_b
= li
= mb()
= li
= pat_b
= li:match(pat_b)
= mb()
= ("abcd"):match"bc"
= cites1
= cites2
= cites1
for _,li in ipairs(splitlines(pel.bigstr)) do
pel:setbib(li)
print(pel:getbibfname(li))
end
for a,b in pel:genbibpdfs() do print(a,b) end
for _,li in pel:genlines() do print(pel:parse_code(li)) end
for _,li in pel:genlines() do print(pel:parse_shortfname(li)) end
for _,li in pel:genlines() do print(pel:parse_bib(li)) end
for _,li in ipairs(
for _,li in ipairs(splitlines(bigstr)) do
local c,d = li:match(pat)
if c then
A1:add(c,d)
local fname0 = d:match(pat2)
if fname0 then
print(c,fname0)
A2:add(c,fname0)
end
end
end
print(c,d) end
end
--]]
-- Local Variables:
-- coding: utf-8-unix
-- End: