Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file: -- http://anggtwu.net/LUA/Caepro5-blogme.lua.html -- http://anggtwu.net/LUA/Caepro5-blogme.lua -- (find-angg "LUA/Caepro5-blogme.lua") -- Author: Eduardo Ochs <eduardoochs@gmail.com> -- -- Used by: -- (find-TH "tmp") -- -- (defun e () (interactive) (find-angg "LUA/Caepro5-blogme.lua")) -- «.Local» (to "Local") -- «.Local-tests» (to "Local-tests") -- (find-TH "tmp") -- Path.prependtopath "~/blogme3/?.lua" -- (find-angg "LUA/Caepro5.lua" "gram" "caepropat") -- (find-blogme3 "defs-2022.lua" "load_caepro5") -- (find-blogme3 "defs-2022.lua" "load_caepro5" "caeproR") -- (find-angg "LUA/Caepro5.lua" "Enrichen") -- loadblogme3() -- require "defs-2022" -- (find-blogme3 "defs-2022.lua") -- load_caepro5() -- (find-blogme3 "defs-2022.lua" "load_caepro5") local B,C,P,R,S,V = lpeg.B,lpeg.C,lpeg.P,lpeg.R,lpeg.S,lpeg.V local Cb,Cc,Cf,Cg = lpeg.Cb,lpeg.Cc,lpeg.Cf,lpeg.Cg local Cp,Cs,Ct = lpeg.Cp,lpeg.Cs,lpeg.Ct local Carg,Cmt = lpeg.Carg,lpeg.Cmt Local_setcolor = function (color) return function (str) return COLOR(color, str) end end Local_pat = C(caepropat) Local_patR = C(caepropat) / function (a,o) return Local.fromR(a,o) end Local_other1 = R("09","AZ","az")^1 + P(1) Local_other2 = ((-caepropat) * Local_other1)^1 Local_other3 = Local_other2 / "<%0>" Local_other3 = Local_other2 / function (str) return Local.htmlizerest(str) end Local_line0 = Cs((Local_patR + Local_other3)^0) Local_line = (#P"* " * (Local_line0 / Local_setcolor("red"))) + (#P"** " * (Local_line0 / Local_setcolor("green"))) + (#P"*** " * (Local_line0 / Local_setcolor("violet"))) + Local_line0 -- _ _ -- | | ___ ___ __ _| | -- | | / _ \ / __/ _` | | -- | |__| (_) | (_| (_| | | -- |_____\___/ \___\__,_|_| -- -- «Local» (to ".Local") Local = Class { type = "Local", from = function (abbrev, o) local lo = Local {abbrev=abbrev, o=o} lo.e = Enrichen.from0(lo.o):adds0() lo.urlp = lo.e.o.urlp lo.url = lo:pdf1ize(lo.urlp) return lo end, htmlizerest = function (str) return "<"..str..">" end, htmlizerest = function (str) return htmlizeline(str) end, htmlizeline = function (str) return Local_line:match(str) end, htmlizelines = function (str) return (str:gsub("[^\n]+", Local.htmlizeline)) end, fromR = function (abbrev, o) return Local.from(abbrev, o):R() end, __index = { pdf0 = "http://anggtwu.net/LATEX/2022-2-C2-C3-ajuda.pdf", pdf0pat = "http://anggtwu.net/LATEX/2022%-2%-C2%-C3%-ajuda.pdf", pdf1 = "2023aug16.pdf", pdf1ize = function (lo, url) return (url:gsub(lo.pdf0pat, lo.pdf1)) end, R = function (lo) return HREF(lo.url, lo.abbrev) end, }, } -- «Local-tests» (to ".Local-tests") --[[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) loadblogme3() require "defs-2022" -- (find-blogme3 "defs-2022.lua") load_caepro5() -- (find-blogme3 "defs-2022.lua" "load_caepro5") dofile "Caepro5-blogme.lua" = package = keys(package.loaded) = PPV(keys(package.loaded)) -- (find-angg "LUA/Caepro5.lua" "Enrichen-tests") = Enrichen.from0(caepropat:match "2aT1"):adds0() = Enrichen.from0(caepropat:match "2aT1"):adds0().o.gsexp = Enrichen.from0(caepropat:match "2aT1"):adds0().o.urlp -- (find-fline "~/ORG/indice-caepro.org") bigstr = ee_readfile "~/ORG/indice-caepro.org" = Local.htmlizelines(bigstr) lpeg.treem = function (pat, str) return trees(pat:match(str or "")) end subj = "__2aT1__" = (C(2) * Local_pat * C(2)):treem(subj) = (C(2) * Local_patR * C(2)):treem(subj) = (C(2) * Local_patR * C(2)):match(subj) = (P(2) * Local_patR * P(2)):Cs():match(subj) = ((Local_patR + Local_other3)^1):Cs():match(subj) subj = "2aT1_2aT1" subj = "_2022-500-linhas-etel#2&" = Local_line:match(subj) = Local.htmlizeline(subj) ab = "2aT1" ab = "2022-500-linhas-etel#2" lo = Local.from(ab, caepropat:match(ab)) = lo = lo.o = lo.e = lo.urlp = lo.url = lo:R() run_repl3_now() ptb = nil = C(2) = PrintFunction.from(C) = R("foo", "bar") --]] -- def [[ R 2 url,body HREF(url, nilify(body) or url) ]] -- Local Variables: -- coding: utf-8-unix -- End: