|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- http://angg.twu.net/LUA/elispwt.lua.html
-- http://angg.twu.net/LUA/elispwt.lua
-- (find-angg "LUA/elispwt.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- "Elisp with targets".
-- This was the first version of, and was superseded by:
-- (find-blogme3 "sandwiches.lua")
-- (find-blogme3 "sandwiches-defs.lua")
--
-- Experimental, intended to supersede this:
-- (find-angg "LUA/lua50init.lua" "ELispH")
-- (find-angg "LUA/lua50init.lua" "ELispHF")
-- (find-angg "LUA/lua50init.lua" "SexpSkel")
-- (find-blogme3 "sexp.lua")
-- «.SexpTarget» (to "SexpTarget")
-- «.SexpTarget-tests» (to "SexpTarget-tests")
-- «.SexpIntervals» (to "SexpIntervals")
-- «.SexpIntervals-tests» (to "SexpIntervals-tests")
-- «.SexpHead» (to "SexpHead")
-- «.SexpHead-tests» (to "SexpHead-tests")
--
-- «.code_c_d_angg» (to "code_c_d_angg")
-- «.code_c_d_angg-tests» (to "code_c_d_angg-tests")
-- «.code_c_m_b» (to "code_c_m_b")
-- «.code_c_m_b-tests» (to "code_c_m_b-tests")
-- «.find-node» (to "find-node")
-- «.find-node-test» (to "find-node-test")
-- «.code_intro» (to "code_intro")
-- «.code_intro-tests» (to "code_intro-tests")
-- «.code_youtube» (to "code_youtube")
-- «.code_youtube-tests» (to "code_youtube-tests")
-- «.code_helponly» (to "code_helponly")
-- «.code_helponly-tests» (to "code_helponly-tests")
--
-- «.code_c_m_bs» (to "code_c_m_bs")
-- «.code_c_d_anggs» (to "code_c_d_anggs")
-- «SexpTarget» (to ".SexpTarget")
-- Uses: (find-angg "LUA/lua50init.lua" "getsexp")
--
SexpTarget = Class {
type = "SexpTarget",
fromtext = function (text)
return SexpTarget {text=text}
end,
from = function (o)
if type(o) == "string" then return SexpTarget.fromtext(o) end
if otype(o) == "SexpTarget" then return o end
error()
end,
__tostring = mytabletostring,
__index = {
url = function (st)
if st.f then return st[st.f](st) end
return st.text
end,
--
find_angg = function (st)
local fname,anchor = st.fname, st.anchor
return "http://angg.twu.net/"..fname..".html"..
(anchor and ("#"..anchor) or "")
end,
find_intro = function (st)
local stem,anchor = st.stem, st.anchor
local anggurl = "eev-intros/find-"..stem.."-intro.html"
if anchor then anggurl = anggurl.."#"..anchor end
return "http://angg.twu.net/"..anggurl
end,
find_node = function (st)
local manual,node = st.manual, st.node
local baseurl = infomanual_basedir[manual]
local shre = "([-'/ &])"
local shtable = {["-"] = "_002d", ["'"] = "_0027", ["/"] = "_002f",
[" "] = "-", ["&"] = "-"}
local shnode = node:gsub("%s+", " "):gsub(shre, shtable)
return baseurl..shnode
end,
find_youtube = function (st)
local hash,time = st.hash, st.time
return youtube_make_url(hash, time)
end,
},
}
-- «SexpTarget-tests» (to ".SexpTarget-tests")
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
st = SexpTarget.fromtext("foo")
= st
= st:url()
SexpTarget.__index.foo = function (st) return st.f.."FOO" end
st.f = "foo"
= st:url()
code_c_m_b = function (c, manual, basedir)
infomanual_basedir[manual] = basedir
-- local find_cnode = "find-"..c.."node"
-- _EHF[find_cnode] = ELispHF.newnode(find_cnode, c, manual)
end
code_c_m_b("e", "emacs", "http://www.gnu.org/software/emacs/manual/html_node/emacs/")
code_c_m_b("el", "elisp", "http://www.gnu.org/software/emacs/manual/html_node/elisp/")
st = SexpTarget {f="find_node", manual="emacs", node="Keys", text="ek"}
= st
= st:url()
st = SexpTarget {f="find_intro", stem="eev", anchor="1"}
st = SexpTarget {f="find_intro", stem="eev"}
= st
= st:url()
st = SexpTarget {f="find_angg", fname="LATEX/2021haskell.tex", anchor="title"}
st = SexpTarget {f="find_angg", fname="LATEX/2021haskell.tex"}
= st
= st:url()
-- (find-blogme3 "sexp.lua" "find-xxxnodes")
--]]
-- «SexpIntervals» (to ".SexpIntervals")
-- Example:
-- bigstr = [[# (find-eev-intro "1. `eev-mode'")]]
-- si = SexpIntervals.fromline(bigstr)
-- si:addtint(1, nil, "head")
-- si:addtint("e", nil, "end")
-- print(si)
-- --> (find-eev-intro "1. `eev-mode'")
-- -------------- : head
-- --: end
--
-- Supersedes: (find-angg "LUA/lua50init.lua" "SexpSkel")
-- Uses: (find-angg "LUA/lua50init.lua" "getsexp")
--
SexpIntervals = Class {
type = "SexpIntervals",
fromline = function (str)
local sexp, head, skel, left = getsexp(str)
if not sexp then return end
local si = SexpIntervals {
line=str, -- Like '# (find-eev-intro "1.")'
sexp=sexp, -- like '(find-eev-intro "1.")'
head=head, -- like 'find-eev-intro'
skel=skel, -- like '(find-eev-intro "__")'
left=left -- like '# '
}
local skelbody = " "..si.skel:sub(2,-2).." "
local allintervals = {}
for b,e in skelbody:gmatch("()[^ \t]+()") do
table.insert(allintervals, {b=b, e=e})
end
si.allintervals = allintervals
si.tintervals = {} -- intervals with targets; use `b's as keys
si.tintervalnames = {} -- `b's <-> `name's; for example 2 <-> "1"
return si
end,
--
-- SexpIntervals.htmlizeline(linestr) always returns a string.
-- It is a very high-level function that uses the table _SH of
-- `SexpHead' that is defined below.
htmlizeline = function (linestr)
local si = SexpIntervals.fromline(linestr)
if si and _SH[si.head] then
si:applyhead()
return si:linehtml(), si
end
return SexpIntervals({}):hzleft(linestr)
end,
--
__tostring = function (si) return si:tostring() end,
__index = {
sexpsub = function (si, b, e)
return si.sexp:sub(b, e-1)
end,
rawarg = function (si, n)
if not si.allintervals[n] then return end
local be = si.allintervals[n]
return si.sexp:sub(be.b, be.e-1)
end,
strarg = function (si, n)
local rawarg = si:rawarg(n)
if not rawarg then return end
if not rawarg:match('^".*"$') then return end
return rawarg:sub(2, -2)
end,
narg = function (si, n)
local rawarg = si:rawarg(n)
if not rawarg then return end
if rawarg:match('^[-+]?%d+$') then return tonumber(rawarg) end
local body = rawarg:match('^%(%+ (.*)%)')
if body then
local total = 0
for _,k in ipairs(map(tonumber, split(body))) do
total = total + k
end
return total
end
end,
argbe = function (si, n, delta)
local be = si.allintervals[n]
return be.b+(delta or 0), be.e-(delta or 0)
end,
endbe = function (si)
local e = #si.sexp+1
local b = (si.sexp:sub(-2, -2) == '"') and e-2 or e-1
return b,e
end,
--
sortedtintervals = function (si)
local tints = {}
for _,b in ipairs(sorted(keys(si.tintervals))) do
table.insert(tints, si.tintervals[b])
end
return tints
end,
addtinterval = function (si, tint)
si.tintervals[tint.b] = tint
si.tintervalnames[tint.b] = tint.name
si.tintervalnames[tint.name] = tint.b
end,
addtint = function (si, n, delta, text, st)
local b,e,name,tint
if n == "e" then
name,b,e = n, si:endbe()
else
name,b,e = n..(delta==1 and "m" or ""), si:argbe(n, delta)
end
if st == nil then st = text end
if type(st) == "string" then st = SexpTarget.fromtext(st) end
tint = {b=b, e=e, name=name, text=text, st=st}
si:addtinterval(tint)
return si
end,
--
dash = function (si, b, e)
return (" "):rep(b-1) .. ("-"):rep(e-b) .. (" "):rep(#si.sexp-e+1)
end,
tostring = function (si)
local A = {si.sexp}
for i,tint in ipairs(si:sortedtintervals()) do
local b,e,text,name = tint.b, tint.e, tint.text, tint.name
table.insert(A, si:dash(b, e)..":"..name..": "..(text or ""))
end
return table.concat(A, "\n")
end,
--
hzleft = function (si, str) return str end,
hztext = function (si, str) return str end,
hzhref = function (si, str) return str end,
makehref = function (si, st, text)
return format('<a href="%s">%s</a>', st:url(), si:hzhref(text))
end,
--
linehtml = function (si) return si:hzleft(si.left) .. si:sexphtml() end,
sexphtml = function (si) return si:sexphtml0(si:splitattargets()) end,
sexphtml0 = function (si, A)
html = si:hztext(A[1].text)
for i=2,#A,2 do
html = html .. si:makehref(A[i].st, A[i].text)
.. si:hztext(A[i+1].text)
end
return html
end,
--
splitattargets = function (si)
local A,lastpos = {}, 1
local addtoA = function (b, e, st)
table.insert(A, {b=b, e=e, text=si:sexpsub(b, e), st=st})
end
for i,tint in ipairs(si:sortedtintervals()) do
addtoA(lastpos, tint.b)
addtoA(tint.b, tint.e, tint.st)
lastpos = tint.e
end
addtoA(lastpos, #si.sexp+1)
return A
end,
--
-- :applyhead() uses the table of SexpHeads defined below.
applyhead = function (si)
local sh = _SH[si.head]
sh:f(si)
return si
end,
},
}
-- «SexpIntervals-tests» (to ".SexpIntervals-tests")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-eev-intro "1. `eev-mode'")]]
= SexpIntervals.htmlizeline(bigstr)
si = SexpIntervals.fromline(bigstr)
si:addtint(1, nil, "head")
si:addtint("e", nil, "end")
= si
PPV(si)
PPV(si:splitattargets())
print(si:linehtml())
= SexpTarget.fromtext("foo")
= SexpTarget.fromtext("foo"):url()
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = '# (find-eev-intro "1." (+ -2 -3) +4 "foo" "bar")'
si = SexpIntervals.fromline(bigstr)
PPV(si)
PP(si:rawarg(1))
PP(si:strarg(1))
PP(si:strarg(2))
PP(si:strarg(4)) -- nil
PP(si:narg(3))
PP(si:narg(4))
= si
si:addtint(1, nil, "head")
si:addtint("e", nil, "end")
si:addtint(2, 1, "sec")
= si
PPV(si)
PPV(si:splitattargets())
= si
--]==]
-- «SexpHead» (to ".SexpHead")
--
SexpHead = Class {
type = "SexpHead",
__tostring = mytabletostring,
__index = {
},
}
_SH = VerticalTable {}
-- «SexpHead-tests» (to ".SexpHead-tests")
--
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
_SH["foo"] = SexpHead {
f = function (sh, si)
si:addtint(1, nil, "FOO")
end,
}
bigstr = [[(foo)]]
h, si = SexpIntervals.htmlizeline(bigstr)
= h
= si
PPV(si)
PPV(si:splitattargets())
--]==]
-- «code_c_d_angg» (to ".code_c_d_angg")
--
code_c_d_angg = function (c, d)
local find_c = "find-"..c
_SH[find_c] = SexpHead {
head = find_c,
-- (find-eev-quick-intro "9. Shorter hyperlinks")
help = SexpTarget {f="find_intro", stem="eev-quick", anchor="9"},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
local a, b = si:strarg(2), si:strarg(3)
if a then
local target = SexpTarget {f="find_angg", fname=d..a, anchor=b}
si:addtint("e", nil, "target", target)
end
end,
}
end
-- «code_c_d_angg-tests» (to ".code_c_d_angg-tests")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-LATEX "2021haskell.tex" "title")]]
= SexpIntervals.htmlizeline(bigstr)
code_c_d_angg("LATEX", "LATEX/")
= (SexpIntervals.htmlizeline(bigstr))
--]==]
-- «code_c_m_b» (to ".code_c_m_b")
--
code_c_m_b = function (c, manual, basedir)
infomanual_basedir[manual] = basedir
local find_cnode = "find-"..c.."node"
_SH[find_cnode] = SexpHead {
head = find_cnode,
-- (find-eev-quick-intro "9.2. Extra arguments to `code-c-d'")
help = SexpTarget {f="find_intro", stem="eev-quick", anchor="9.2"},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
local a = si:strarg(2)
if not a then return end
local target = SexpTarget {f="find_node", manual=manual, node=a}
si:addtint("e", nil, "target", target)
end,
}
end
code_c_m_b("e", "emacs", "http://www.gnu.org/software/emacs/manual/html_node/emacs/")
code_c_m_b("el", "elisp", "http://www.gnu.org/software/emacs/manual/html_node/elisp/")
-- «code_c_m_b-tests» (to ".code_c_m_b-tests")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-enode "Keys")]]
= (SexpIntervals.htmlizeline(bigstr))
--]==]
-- «find-node» (to ".find-node")
--
_SH["find-node"] = SexpHead {
head = "find-node",
-- (find-eev-quick-intro "3. Elisp hyperlinks")
help = SexpTarget {f="find_intro", stem="eev-quick", anchor="3"},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
local ab = si:strarg(2)
if not ab then return end
local a, b = ab:match("^%(([^()]+)%)(.*)$")
if not a then return end
local target = SexpTarget {f="find_node", manual=a, node=b}
si:addtint("e", nil, "target", target)
end,
}
-- «find-node-test» (to ".find-node-test")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-node "(emacs)Keys")]]
= (SexpIntervals.htmlizeline(bigstr))
--]==]
-- «code_intro» (to ".code_intro")
--
code_intro = function (stem)
local find_stem_intro = "find-"..stem.."-intro"
_SH[find_stem_intro] = SexpHead {
head = find_stem_intro,
help = SexpTarget {f="find_intro", stem=stem, anchor=nil},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
local a = si:strarg(2)
if not a then return end
local anchor = a:match("^%d[.%d]*%.")
if not anchor then return end
local target = SexpTarget {f="find_intro", stem=stem, anchor=anchor}
si:addtint("e", nil, "target", target)
end,
}
end
-- «code_intro-tests» (to ".code_intro-tests")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-foo-intro "12.34. bar")]]
= (SexpIntervals.htmlizeline(bigstr))
code_intro("foo")
bigstr = [[# (find-foo-intro "12.34. bar")]]
= (SexpIntervals.htmlizeline(bigstr))
--]==]
ee_intro_stems = [[
anchors audiovideo bounded brxxx channels code-c-d defun eejump
eepitch eev eev-quick eev-install elisp emacs emacs-keys escripts
eval git here-links links-conv links multiwindow org pdf-like
prepared psne rcirc refining templates three-main-keys videos
windows-beginner wrap
]]
for _,stem in ipairs(split(ee_intro_stems)) do
code_intro(stem)
end
-- «code_youtube» (to ".code_youtube")
--
code_youtube = function (c, hash)
local find_c = "find-"..c
_SH[find_c] = SexpHead {
head = find_c,
-- (find-audiovideo-intro "4. Short hyperlinks to audio and video files")
help = SexpTarget {f="find_intro", stem="audiovideo", anchor="4"},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
local time = si:strarg(2)
if time then
local target = SexpTarget {f="find_youtube", hash=hash, time=time}
si:addtint(2, 1, "target", target)
end
end,
}
end
-- «code_youtube-tests» (to ".code_youtube-tests")
--
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
code_youtube("eev2019video", "86yiRG8YJD0")
bigstr = [[# (find-eev2019video "15:56")]]
= (SexpIntervals.htmlizeline(bigstr))
--]==]
-- «code_c_m_bs» (to ".code_c_m_bs")
code_c_m_b("e", "emacs", "http://www.gnu.org/software/emacs/manual/html_node/emacs/")
code_c_m_b("el", "elisp", "http://www.gnu.org/software/emacs/manual/html_node/elisp/")
code_c_m_b("eli", "eintr", "http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/")
code_c_m_b("efaq", "efaq", "https://www.gnu.org/software/emacs/manual/html_node/efaq/")
code_c_m_b("cl", "cl", "http://www.gnu.org/software/emacs/manual/html_node/cl/")
code_c_m_b("gnus", "gnus", "http://www.gnu.org/software/emacs/manual/html_node/gnus/")
code_c_m_b("message", "message", "http://www.gnu.org/software/emacs/manual/html_node/message/")
code_c_m_b("woman", "woman", "http://www.gnu.org/software/emacs/manual/html_node/woman/")
code_c_m_b("rcirc", "rcirc", "http://www.gnu.org/software/emacs/manual/html_node/rcirc/")
code_c_m_b("org", "org", "http://www.gnu.org/software/emacs/manual/html_node/org/")
code_c_m_b("gst", "gst", "http://www.gnu.org/software/smalltalk/manual/html_node/")
code_c_m_b("gstbase", "gst-base", "http://www.gnu.org/software/smalltalk/manual-base/html_node/")
code_c_m_b("gstlibs", "gst-libs", "http://www.gnu.org/software/smalltalk/manual-libs/html_node/")
code_c_m_b("pclcvs", "pcl-cvs", "http://www.gnu.org/software/emacs/manual/html_node/pcl-cvs/")
code_c_m_b("autotype", "autotype", "http://www.gnu.org/software/emacs/manual/html_node/autotype/")
code_c_m_b("libc", "libc", "http://www.gnu.org/software/libc/manual/html_node/")
code_c_m_b("make", "make", "http://www.gnu.org/software/make/manual/html_node/")
code_c_m_b("grub", "grub", "https://www.gnu.org/software/grub/manual/grub/html_node/")
code_c_m_b("gawk", "gawk", "http://www.gnu.org/software/gawk/manual/html_node/")
code_c_m_b("texi", "texinfo", "http://www.gnu.org/software/texinfo/manual/texinfo/html_node/")
code_c_m_b("gcc", "gcc-4.1", "http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/")
code_c_m_b("coreutils", "coreutils", "http://www.gnu.org/software/coreutils/manual/html_node/")
code_c_m_b("bash", "bash", "http://www.gnu.org/software/bash/manual/html_node/")
code_c_m_b("bash", "bashref", "http://www.gnu.org/software/bash/manual/html_node/")
code_c_m_b("wget", "wget", "http://www.gnu.org/software/wget/manual/html_node/")
code_c_m_b("slime", "slime", "http://common-lisp.net/project/slime/doc/html/")
code_c_m_b("bison", "bison", "http://www.gnu.org/software/bison/manual/html_node/")
code_c_m_b("octave", "octave", "http://www.gnu.org/software/octave/doc/interpreter/")
code_c_m_b("rcirc", "rcirc", "http://www.gnu.org/software/emacs/manual/html_node/rcirc/")
code_c_m_b("binutils", "binutils", "http://sourceware.org/binutils/docs/binutils/")
code_c_m_b("gdb", "gdb", "http://sourceware.org/gdb/download/onlinedocs/gdb/")
code_c_m_b("parted", "parted", "https://www.gnu.org/software/parted/manual/html_node/")
-- «code_c_d_anggs» (to ".code_c_d_anggs")
code_c_d_angg("angg", "")
code_c_d_angg("es", "e/")
code_c_d_angg("dednat4", "dednat4/")
code_c_d_angg("dn4", "dednat4/")
code_c_d_angg("dn4ex", "dednat4/examples/")
code_c_d_angg("dn5", "dednat5/")
code_c_d_angg("dn6", "LATEX/dednat6/")
code_c_d_angg("dednat6", "dednat6/")
code_c_d_angg("blogme", "blogme/")
code_c_d_angg("blogme3", "blogme3/")
code_c_d_angg("blogme4", "blogme4/")
code_c_d_angg("eev", "eev-current/")
code_c_d_angg("flua", "flua/")
code_c_d_angg("rubyforth", "rubyforth/")
code_c_d_angg("vtutil", "vtutil/")
code_c_d_angg("vtutil4", "vtutil4/")
code_c_d_angg("RETRO", "RETRO/")
code_c_d_angg("gab", "gab/")
code_c_d_angg("eevvideos", "eev-videos/")
code_c_d_angg("quadr", "quadradinho/")
code_c_d_angg("ydb", "youtube-db/")
code_c_d_angg("fbcache", "fbcache/")
code_c_d_angg("clg", "2019-CLG/")
code_c_d_angg("books", "books/")
-- «code_helponly» (to ".code_helponly")
--
code_helponly = function (head, stem, anchor)
_SH[head] = SexpHead {
head = head,
help = SexpTarget {f="find_intro", stem=stem, anchor=anchor},
f = function (sh, si)
si:addtint(1, nil, "help", sh.help)
end,
}
end
code_helponly_line = function (linestr)
local si = SexpIntervals.fromline(linestr)
if not si then return end
local head = bitrim(si.left)
local stem = si.head:match "find%-(.*)%-intro(.*)"
local posspec = si:strarg(2)
local anchor = posspec and posspec:match "^(%d[.%d]*)%."
code_helponly(head, stem, anchor)
end
code_helponly_lines = function (bigstr)
for _,linestr in ipairs(splitlines(bigstr)) do
code_helponly_line(linestr)
end
end
code_helponly_lines [[
eelatex-bounded (find-bounded-intro)
eev-bounded (find-bounded-intro)
eek (find-eev-quick-intro "3. Elisp hyperlinks")
find-efunction (find-eev-quick-intro "3. Elisp hyperlinks")
find-efunctiondescr (find-eev-quick-intro "3. Elisp hyperlinks")
find-elongkey-links (find-eev-quick-intro "4.2. `find-ekey-links' and friends")
find-fline (find-eev-quick-intro "3. Elisp hyperlinks")
find-man (find-eev-quick-intro "3. Elisp hyperlinks")
find-node (find-eev-quick-intro "3. Elisp hyperlinks")
find-sh (find-eev-quick-intro "3. Elisp hyperlinks")
find-sh0 (find-eev-quick-intro "3. Elisp hyperlinks")
eepitch (find-eev-quick-intro "6. Controlling shell-like programs")
eepitch-kill (find-eev-quick-intro "6. Controlling shell-like programs")
eepitch-shell (find-eev-quick-intro "6. Controlling shell-like programs")
eepitch-lua51 (find-eev-quick-intro "6. Controlling shell-like programs")
eepitch (find-eepitch-intro "2.3. `eepitch'")
eepitch-kill (find-eepitch-intro "2.2. `(eepitch-kill)'")
code-c-d (find-eev-quick-intro "9. Shorter hyperlinks")
find-xpdfpage (find-eev-quick-intro "9.3. Hyperlinks to PDF files")
find-pdf-page (find-pdf-like-intro "4. Hyperlinks to pages of PDF files")
find-pdf-text (find-pdf-like-intro "4. Hyperlinks to pages of PDF files")
code-pdf-page (find-pdf-like-intro "7. Shorter hyperlinks to PDF files")
code-pdf-text (find-pdf-like-intro "7. Shorter hyperlinks to PDF files")
code-audio (find-audiovideo-intro "4. Short hyperlinks to audio and video files")
code-video (find-audiovideo-intro "4. Short hyperlinks to audio and video files")
]]
-- «code_helponly-tests» (to ".code_helponly-tests")
--
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-man)]]
= (SexpIntervals.htmlizeline(bigstr))
--]==]
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "elispwt.lua"
bigstr = [[# (find-LATEX "2021haskell.tex" "title")]]
= SexpIntervals.htmlizeline(bigstr)
code_c_d_angg("LATEX", "LATEX/")
= SexpIntervals.htmlizeline(bigstr)
si = SexpIntervals.fromline(bigstr)
= si
= si:applyhead()
= si:linehtml()
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
code_c_d_angg("LATEX", "LATEX/")
bigstr = [[# (find-LATEX "2021haskell.tex" "title")]]
= si.head
PPV(si)
sh = _SH[si.head]
= sh
= sh.head
= sh.help
= sh.help:url()
= sh:f(si)
= si
PPV(si)
PPV(si.tintervals)
= si:linehtml()
= _SH
= _SH["find-LATEX"]
PPV(_SH["find-LATEX"])
= _SH["find-LATEX"].help
= _SH["find-LATEX"].help:url()
--]==]
use_new_htmlizeline = function ()
--
-- (find-blogme3 "escripts.lua" ".htmlizelines")
-- (find-blogme3 "escripts.lua" ".htmlizeline")
--
SpecialT = UrlT + AnchorT + SexpLinkT * Eol
-- SpecialT = UrlT + AnchorT + PipeAmpT + PipeSnarfDirT + HereDocT + SexpLinkT * Eol
SpecialT = UrlT + AnchorT + PipeAmpT + PipeSnarfDirT + HereDocT
EtcChar = 1 - lpeg.S "\n"
EtcSpecial = Pos * lpeg.P {
[1] = Pos * SpecialT
+ EtcChar * lpeg.V(1)
}
EtcSpecials = EtcSpecial^0
EtcSpecialsEtc = EtcSpecials * Pos * EtcChar^0 * Pos
--
htmlizelineleft = function (str)
return lpeg.match(lpeg.Ct(EtcSpecialsEtc) / sbeconcat(str, Q), str)
end
--
SexpIntervals.__index.hzleft = function (si, str)
return htmlizelineleft(str)
end
SexpIntervals.__index.hztext = function (si, str)
return Q(str)
end
SexpIntervals.__index.hzhref = function (si, str)
return Q(str)
end
--
htmlizeline = function (str)
return SexpIntervals.htmlizeline(str)
end
--
end
-- Local Variables:
-- coding: utf-8-unix
-- End: