Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on blogme - my HTML generator.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/blogme.e>
#           or at <http://angg.twu.net/e/blogme.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######







# «.square-brackets»		(to "square-brackets")
# «.other-glyphs»		(to "other-glyphs")
# «.withindex»			(to "withindex")
# «._»				(to "_")
# «._TARGETS»			(to "_TARGETS")
# «.parselspaces»		(to "parselspaces")
# «.patched-listings»		(to "patched-listings")
# «.invoking-blogme»		(to "invoking-blogme")
# «.MDEF»			(to "MDEF")
# «.lua2html»			(to "lua2html")
# «.org2html»			(to "org2html")
# «.diagrams-with-words»	(to "diagrams-with-words")
# «.traffic-lights»		(to "traffic-lights")
# «.traffic-lights-glyphs»	(to "traffic-lights-glyphs")
# «.blogme3.tgz»		(to "blogme3.tgz")
# «.blogme3-at-caramelo»	(to "blogme3-at-caramelo")
# «.blogme3-at-zumbi»		(to "blogme3-at-zumbi")
# «.makefile-a2html»		(to "makefile-a2html")
# «.a2html-at-zumbi»		(to "a2html-at-zumbi")
# «.parsechangelog-tests»	(to "parsechangelog-tests")
# «.cgis»			(to "cgis")
# «.cgis-at-zumbi»		(to "cgis-at-zumbi")
# «.wikirefs»			(to "wikirefs")
# «.blogme3-in-macosx»		(to "blogme3-in-macosx")
# «.angg-audios»		(to "angg-audios")
# «.audio-sexps»		(to "audio-sexps")
# «.local-videos»		(to "local-videos")
# «.local-videos-pen-drive»	(to "local-videos-pen-drive")
# «.local-videos-debug»		(to "local-videos-debug")
# «.linkdasruas»		(to "linkdasruas")
# «.albums»			(to "albums")
# «.gsub-build»			(to "gsub-build")
# «.interactive»		(to "interactive")
# «.withindex2»			(to "withindex2")
# «.all-code-c-d-s»		(to "all-code-c-d-s")
# «.parse-makefile.auto»	(to "parse-makefile.auto")
# «.measure_utf8_ness»		(to "measure_utf8_ness")
# «.find_node»			(to "find_node")
# «._EHF»			(to "_EHF")
# «.eevintros.lua»		(to "eevintros.lua")
# «.hacking-code_c_d_angg»	(to "hacking-code_c_d_angg")
# «._E_intro»			(to "_E_intro")
# «.code_c_m_b»			(to "code_c_m_b")
# «._E_eevintro»		(to "_E_eevintro")
# «.git-manpages»		(to "git-manpages")
# «.links-to-manpages»		(to "links-to-manpages")
# «.links-to-pages-of-pdfs»	(to "links-to-pages-of-pdfs")
# «.echo-tgzfiles»		(to "echo-tgzfiles")
# «.timestamps»			(to "timestamps")
# «.code-video»			(to "code-video")
# «.U8»				(to "U8")
# «.code_eevshortvideo»		(to "code_eevshortvideo")
# «.debug-a2html»		(to "debug-a2html")
# «.create-from-repl»		(to "create-from-repl")






#####
#
# square brackets
# 2007aug29
#
#####

# «square-brackets»  (to ".square-brackets")
# (find-angg ".emacs" "square-brackets")
&#10214;&#10215;

# (find-eoutput '(insert 300006 300007))
# (find-eoutput '(insert 300006 300007) "" '(switch-to-buffer (htmlize-buffer)))
# (find-einsert '(10214 10215))

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
sgmlify_table["\17"] = "&#10214;"
sgmlify_table["\16"] = "&#10215;"
sgmlify_re = "([\15\16\17\161-\254])"
]

[PRE ['
Foo!
abefghijklmn
abcdefghijklmn
O
]]
#*




#####
#
# other glyphs
# 2007sep15
#
#####

# «other-glyphs»  (to ".other-glyphs")
# (find-angg ".emacs" "square-brackets")
# (find-eoutput '(insert 300006 300007))
# (find-eoutput '(insert 300006 300007) "" '(switch-to-buffer (htmlize-buffer)))
# (find-eoutput '(insert 332731 332736))
# (find-eoutput '(insert 332731 332736) "" '(switch-to-buffer (htmlize-buffer)))
# (find-eleimfile "quail/sgml-input.el")
# (find-eleimfile "quail/latin-ltx.el")
#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
sgmlify_table["\17"]  = "&#10214;"
sgmlify_table["\16"]  = "&#10215;"
sgmlify_table["\21"]  = "&pi;"
sgmlify_table["\221"] = "&isin;"
sgmlify_table["\240"] = "&lambda;"
sgmlify_table["\206"] = "&exist;"
sgmlify_table["\253"] = "&forall;"
sgmlify_re = "([\15-\31\161-\254])"
]

[PRE ['
abcdefghijklmn
ab&#955;&#960;efghijklmn
ab&lambda;&pi;&isin;fghi&exist;&forall;lmn

abcdefghijklmn
abðÝfghiÎýlmn
]]
#*

# (find-eoutput '(insert 21 221 240 206 253))





#####
#
# WITHINDEX
# 2007aug29
#
#####

# «withindex»  (to ".withindex")
# (find-blogme3 "anggdefs.lua" "WITHINDEX")
# (find-blogme3 "anggdefs.lua" "WITHINDEX" " Sec ")
# (find-blogme3 "anggdefs.lua" "readqline")
# (find-angg "TH/davinci.blogme" "withindex")
# (find-THgrep "grep --color -nH -e WITHINDEX *.blogme")
#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

[lua:
  -- (find-blogme3file "definers.lua" "5 readvvvvvrest")
  -- (find-blogme3file "brackets.lua" "readvvvvvrest =")
  readvvvvvvrest = function () return readvword(), readvvvvvrest() end
  _AA["6"] = readvvvvvvrest
  secindex = {}
  unanchor = function (str) return string.sub(str, 2, -2) end
  pushindex = function (indexentry, body)
      table.insert(secindex, indexentry)
      return body
    end
  def [[ ANCHOR 3 anchor,target,body NAME(anchor, HREF("#"..target, body)) ]]
  def [[ Sec    6 n,anchor,to,totarget,f,title
         pushindex(
           ANCHOR("."..unanchor(anchor), unanchor(anchor), n.." "..title),
           ANCHOR(unanchor(anchor), "."..unanchor(anchor), _G[f](n.." "..title))
         )
      ]]
  def [[ INDEX 1 _ HLIST2(BF("Quick index:"), secindex) ]]
  def [[ WITHINDEX 1 body INDEX()..body ]]
]

[#
  «.foo»	(to "foo")
  «.bar»	(to "bar")
#]

[WITHINDEX

[Sec 1 «foo»  (to ".foo")
  H2 Section foo]

[Sec 2 «bar»  (to ".bar")
  H3 Section bar]

[# INDEX]
[# lua: PP(secindex) ]

]

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[#
  «.plic»	(to "plic")
  «.bletch»	(to "bletch")
#]
[WITHINDEX
[Sec 1 «plic»  (to ".plic")
  H2 Section plic]
[Sec 2 «bletch»  (to ".bletch")
  H3 Section bletch]
]
#*




#####
#
# _
# 2007sep12
#
#####

# «_»  (to "._")
# (find-angg "TH/davinci.blogme")
#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

[lua:
  _target = {}
  _target.IUP     = "http://www.tecgraf.puc-rio.br/iup/"
  _target.CD      = "http://www.tecgraf.puc-rio.br/cd/"
  _target.IM      = "http://www.tecgraf.puc-rio.br/im/"
  _target.LuaCmd  = "http://www.tecgraf.puc-rio.br/luacmd/"
  _target.Emacs   = "emacs.html"
  _target.Lua     = "luaforth.html"
  _target.CNPq    = "http://www.cnpq.br/"
  _target.TecGraf = "http://www.tecgraf.puc-rio.br/im/"
  _target["Tcl/Tk"] = "tcltk.html"
  def [[ _  2 str,text _target[str] and HREF(_target[str], nilify(text) or str)
                                     or BF("{"..str.."}") ]]
]

[P Foo! [_ IUP] [_ IUP blah blah]]

#*




#####
#
# _TARGETS
# 2007sep29
#
#####

# «_TARGETS»  (to "._TARGETS")
# (find-blogme3 "anggdefs.lua" "_TARGETS")
# (find-lua51manual "#5.4.1" "%s: represents all space characters")
# (find-blogme3file "blogme3.lua")
# (find-blogme3file "escripts.lua")
# (find-blogme3file "elisp.lua" "TGT 1 sexp")
# (find-blogme3file "elisp.lua" "full TGT")
# (find-blogme3file "anggdefs.lua" "two_d_trim =")
# (find-blogme3grep "grep -niH -e tgt *")
# (find-blogme3grep "grep -niH -e '\"_\"' *")
# (find-anggfile "TH/emacs.blogme" " _ 1 body ")
# (find-anggfile "TH/davinci.blogme" " _  2 str,text ")

* (eepitch-lua51)
process_pointer_line = function (str)
    -- str = gsub(str, "[ \t]+$", "")
    local word, sexp = string.match(str, "^%s*(%S+)%s+%->%s+(%(.*%))%s*$")
    if word then
      -- _target[word] = TGT(sexp)
      print("<<"..word..">> :: "..sexp.." ::")
    end
  end
ppl = process_pointer_line
ppl [=[ foo -> (bar plic) ]=]
ppl [=[ foo -> (bar plic)]=]


#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
  -- (find-es "blogme" "_")
  _target = {}
  _target.IUP     = "http://www.tecgraf.puc-rio.br/iup/"
  _target["Tcl/Tk"] = "tcltk.html"
  def [[ _  2 str,text _target[str] and HREF(_target[str], nilify(text) or str)
                                     or BF("{"..str.."}") ]]
]
[lua:
  -- (find-blogme3file "elisp.lua" "full TGT")
  require "escripts"
  def [[ TGT 1 sexp Tgt(SexpLink:match(sexp)) ]]
  process_TARGET_line = function (linestr)
      local word, sexp = string.match(linestr, "^%s*(%S+)%s+%->%s+(%(.*%))%s*$")
      if word then _target[word] = TGT(sexp) end
    end
  process_TARGET_lines = function (bigstr)
      string.gsub(bigstr, "([^\n]+)", process_TARGET_line)
    end
  def [[ _TARGETS 1 lines   process_TARGET_lines(lines) ]]
]
[_TARGETS
    ttt  -> (find-es "blogme" "_TARGETS")
    ttto -> (find-es "blogme")
]
[P Foo: [_ IUP], [_ ttt].]


#*


process_TARGET = function (str)
    local word, sexp = string.match(str, "^%s*(%S+)%s+%->%s+(%(.*%))%s*$")
    if word then print("<<"..word..">> :: "..sexp.." ::") end
  end




#####
#
# sec
# 2007oct08
#
#####

-- (find-blogme3file "anggdefs.lua" "Sec, INDEX, WITHINDEX")
-- (find-blogme3file "brackets.lua" "parsewchars =")
-- (find-blogme3file "anggdefs.lua" "unanchor =")

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
-- For simplicity, the "rest of line" in readqline cannot include []s.
-- Note that the newline is optional; "readqline" never fails.
readqline = function () return parsebypattern("^[ \t]*([^\n%[%]]*)\n?()") end
readlvvrest = function () return readqline(), readvword(), readvrest() end
_AA["lvv"] = readlvvrest

unanchor = function (str) return string.match(str, "\171([!-~]+)\187") or "" end
def [[ sec   lvv  line,f,title
       pushindex(
         ANCHOR("."..unanchor(line), unanchor(line), title),
         ANCHOR(unanchor(line), "."..unanchor(line), _G[f](title))
       )
    ]]
def [[ Sec   lvv  line,f,title  sec(line, f, title) ]]
]

[#
  «.foo»	(to "foo")
  «.bar»	(to "bar")
#]

[WITHINDEX

[Sec «foo»  (to ".foo")
  H2 1. Section foo]
[Sec «bar»  (to ".bar")
  H3 2. Section bar]

[# INDEX]
[# lua: PP(secindex) ]

]

#*





#####
#
# patched listings (notes to cannibalize and discard)
# 2007oct23
#
#####

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

<table border="0" cellpadding=0 cellspacing=0><tr><td>
<pre style="background: #c4daf9; padding: 4px; margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: #aac4da; padding: 4px; margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: yellow;  padding: 0;   margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: orange;  padding: 0;   margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: yellow; 	       margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: orange; 	       margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: yellow;  padding: 0; 	        ">1 2 + . ." Bad: too much" 4 5 * .</pre>
<pre style="background: orange;  padding: 0; 	        ">1 2 + . ." vertical space" 4 5 * .</pre>
</td></tr></table>

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

<table border=0 cellpadding=0 cellspacing=0><tr><td>
<pre style="background: red;    padding: 4px; margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: yellow; padding: 0px; margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: blue;                 margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: green;                margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
</td></tr></table>

<p>&nbsp;</p>

<pre style="background: yellow; padding: 0px; margin: 0">
Foo bar
   ." Hello" 4 5 * .

 ooo
      plic plic pluic plic
</pre>


<p>&nbsp;</p>

<table border="0" cellpadding=0 cellspacing=0 style="background: yellow; margin: 0"><tr><td>
<pre>
Foo bar
  plic ploc
    tick tock
</pre>
</td></tr></table>

<table border="0" cellpadding=0 cellspacing=0><tr><td>
</td></tr></table>

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

[lua:
  def [[ T0BG 2 bg,body
    '<table border=0 cellpadding=0 cellspacing=0 style="background: '..bg..';">' .. body .. '<tr><td>'
  ]]

]

<table border=0 cellpadding=0 cellspacing=0 style="background: yellow;"><tr><td>
<pre style="margin: 0">
Foo
  bar
    plic
</pre>
<pre style="background: red;    margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="background: orange; margin: 0">1 2 + . ." Hello" 4 5 * .</pre>
<pre style="margin: 0">
Foo
<table border=0 cellpadding=0 cellspacing=0 style="background: blue;"><tr><td>
  bar
</td></tr></table>
    plic
</pre>
</td></tr></table>

<p>&nbsp;</p>

<pre style="background: yellow; padding: 0px; margin: 0">
In a "pre" block that is
 not inside a "table"
  the background spills out
   to the right side.

 Blank lines
are always respected (in "pre"s)
</pre>

<p>&nbsp;</p>

<table border="0" cellpadding=0 cellspacing=0 style="background: yellow; margin: 0"><tr><td>
<pre style="margin: 0">
Original
  code
    here

<table border=0 cellpadding=0 cellspacing=0 style="background: orange;"><tr><td># patch starts here
</td></tr></table># orig code
# commented out
<table border=0 cellpadding=0 cellspacing=0 style="background: red;"><tr><td>  my new
  version
</td></tr></table># patch ends here

Rest of the
 original
  code
</pre>
</td></tr></table>

<p>&nbsp</p>

<pre style="margin: 0">
Original
  code
    here

<table border=0 cellpadding=0 cellspacing=0 style="background: orange;"><tr><td># patch starts here
</td></tr></table># orig code
# commented out
<table border=0 cellpadding=0 cellspacing=0 style="background: red;"><tr><td>  my new
  version
</td></tr></table># patch ends here

Rest of the
 original
  code
</pre>

#*





#####
#
# patched listings
# 2007oct23
#
#####

# «parselspaces»  (to ".parselspaces")
# «patched-listings»  (to ".patched-listings")
#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]

[lua:
-- (find-blogme3file "definers.lua" "_AA[short] = _G[long]")
-- (find-blogme3file "brackets.lua" "readqrest_  =")
-- (find-blogme3file "brackets.lua" "parsespaces =")

parselspaces = function () return parsebypattern("^([ \t]*\n?)()") end
_AA["_1Q"] = function () parselspaces(); return readqrest__() or "" end

def [[ L'  _1Q body     body ]]
def [[ PRERECTBG 2 bg,body
  "<table border=0 cellpadding=0 cellspacing=0 style=\"margin: 0; background: $bg\"><tr><td>" ..
  "$body</tr></td></table>" ]]

_listing_parts = {}
_listing_add = function (text)
    tinsert(_listing_parts, text)
    return text
  end

def [[ PATCH' _1Q body  PRERECTBG("orange", _listing_add(body)) ]]
def [[ OUT'   _1Q body  PRERECTBG("red",    _listing_add(body)) ]]
def [[ ORIG'  _1Q body  _listing_add(body) ]]
def [[ PLISTING 1 body  "<pre style=\"margin: 0\">$body</pre>" ]]
def [[ PLISTING 1 body  PRE(body) ]]
]

[PLISTING [set _listing_body
[ORIG'
Original
  code
    here

][PATCH'
# patch starts here
][OUT'
# orig code
# commented out
][PATCH'
my new version
# patch ends here
][ORIG'

Rest of the
 original
  code
]]]

[PREBOXBLOGME [$ _listing_body]]

[P [set foo Foo foo foo]
[BR] [$ foo] [$ foo]]

[PREBOXBLOGME [expr: table.concat(_listing_parts)]]


#*





#####
#
# invoking blogme
# 2007oct25
#
#####

# «invoking-blogme»  (to ".invoking-blogme")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
echo $PS1
export PS1='%d# '
cd /tmp/
cat > foo.blogme <<'%%%'
[lua: print("Hello!")
      PP(arg)
]
[htmlize [J Foo Bar]
   [P A paragraph]
]
Blah
%%%
lua51 ~/blogme3/blogme3.lua -o foo.html -i foo.blogme
cat foo.html






#####
#
# MDEF
# 2007oct27
#
#####

# «MDEF»  (to ".MDEF")
# (find-blogme3 "")
# (find-blogme3file "brackets.lua")
# (find-blogme3file "definers.lua")
# (find-blogme3file "definers.lua" "runwithvars =")
# (find-blogme3file "options.lua")
# (find-a2ps "~/blogme3/definers.lua")
# (find-a2ps "~/blogme3/options.lua")

# (find-blogme3file "brackets.lua" "withsubj =")

# (find-THgrep "grep -nwH -e 'set' *.blogme")
# (find-THgrep "grep -nwH -e 'DEF' *.blogme")
# (find-THgrep "grep -nH  -e 'DEF' *.blogme")
# (find-blogme3grep "grep -nwH -e set *.lua")
# (find-blogme3grep "grep -nwH -e DEF *.lua")
# (find-blogme3grep "grep -nH  -e DEF *.lua")

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:

_V = _V or {}
def_ [[ set 2 varname,text _G[varname] = text; return text ]]
def  [[ $   1 varname      _V[varname] or _G[varname]      ]]

printlayers = function (T) for depth,tbl in layers(T) do PP(depth, tbl) end end
printlayers_V = function () for depth,tbl in layers(_V) do PP(depth, tbl) end end

runwithlocalvars = function (varnames, values, f, ...)
    _V = over(_V, {})                -- create a new frame for local vars
    for i,varname in ipairs(split("a,b", "([^,]+)")) do -- for each varname
      _V[varname] = values[i]        -- set its value in the new frame
    end
    local results = pack(f(...))     -- run f (with the new local vars)
    _V = under(_V)                   -- drop the new frame
    return unpack(results)
  end

PP(over, under)
-- PP(runwithlocalvars, "a,b", {44, 55}, printlayers_V)
-- PP(runwithlocalvars("a,b", {44, 55}, printlayers_V))
PP(runwithlocalvars("a,b", {44, 55}, doblogme, "(a: [$ a], b: [$ b])"))

-- (find-blogme3file "definers.lua" "def_set_B =")
-- (find-blogme3file "definers.lua" "def_set_G =")
-- (find-blogme3file "definers.lua" "def_as_lua =")

def_set_A("AB", "2")
def_set_G("AB", [=[function (a,b)
    return runwithlocalvars("a,b", {a,b}, doblogme, "(a: [$ a], b: [$ b])")
  end]=])
print(AB(66, 77))

def_set_AG("AB", "2", [=[function (a,b)
    return runwithlocalvars("a,b", {a,b}, doblogme, "(a: [$ a], b: [$ b])")
  end]=])

def [=[ MDEF 4Q name,apspec,arglist,body
    def_set_AG(name, apspec,
        format([==[function (%s)
            return runwithlocalvars(%q, {%s}, doblogme, %q)
          end]==], arglist, arglist, arglist, body))
    ]=]

MDEF("AC", "2", "a,c", "(a: [$ a], c: [$ c])")

print(defs_as_lua())

]

#*


  


#####
#
# lua2html and org2html
# 2007nov11
#
#####

# «lua2html»  (to ".lua2html")
# «org2html»  (to ".org2html")
# I haven't used these options in a while...
# Tests:

* (eepitch-shell)
cd /tmp/
cp -v ~/blogme3/blogme3.lua .
lua51 ~/blogme3/blogme3.lua -o blogme3.lua.html -lua2html blogme3.lua
cp -v ~/ORG/index.org .
lua51 ~/blogme3/blogme3.lua -o index.org.html   -org2html index.org

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
blogmedir = ee_expand("~/blogme3/")
dofile(ee_expand("~/blogme3/blogme3.lua"))
loada2html()
= ("foo = function"):match"^([A-Za-z0-9_.]+)([ \t]+=.*)$"
= htmlizeline_lua("foo = function")




#####
#
# diagrams with (hyperlinked) words
# 2007nov27
#
#####

# «diagrams-with-words»  (to ".diagrams-with-words")
# (find-blogme3 "anggdefs.lua" "_TARGETS")
# (find-TH "emacs" "call-diagrams")
# (find-TH "plurall")
#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
  lpeg.togsub = lpeg_togsub
  lpeg.gsub_  = lpeg_gsub_
  lpeg.gsub   = lpeg_gsub
  f     = function (s) return BG("blue", Q(s)) end
  f     = function (s) return _target[s] and BG("blue", Q(s)) or Q(s) end
  f     = function (s) return _target[s] and __(s, Q(s)) or Q(s) end
  Word  = lpeg.R("az")^1
  Dash  = lpeg.P("-")
  Words = (Word * (Dash * Word)^0) / f
  WordsGsubt = Words:togsub():Ct()
  def [[ TRANSWORDS 1q body WordsGsubt:gsub_(body, Q) ]]
  def [[ TRANSWORDS 1q body Words:gsub(body, Q) ]]
]
[_TARGETS
  code-c-d -> (find-eev "eev.el" "code-c-d")
]

[PREBOXBLOGME [TRANSWORDS
.                                code-c-d   find-code-c-d
                                    |     /       |
                                    v    v        v
            find-fline <----- ee-code-c-d   find-estring-elisp
          /  |              /                     |
         v   |             v                      v
ee-expand    |    find-node                 find-eoutput-rerun
             |        |
             v        v
            ee-goto-position
                  |
                  v
            ee-goto-rest

Top-level words:
  find-fline    - hyperlink to a file
  find-node     - hyperlink to an info node
  code-c-d      - to define `find-xxxfile' and `find-xxxnode' words
  find-code-c-d - inspect the code that `code-c-d' would run
]]

#*



#####
#
# logs with traffic-light chars (^A-^E)
# 2007dec05
#
#####

# «traffic-lights»  (to ".traffic-lights")
# (find-angg ".emacs" "find-epalette")
# (find-epalette my-palette)
# (find-ecolors)

(insert
 (propertize "a" 'face '(:foreground "firebrick1" :background "firebrick"))
 (propertize "b" 'face '(:foreground "purple1" :background "purple4"))
 (propertize "b" 'face '(:foreground "orange1" :background "orange4"))
 (propertize "c" 'face '(:foreground "darkolivegreen1" :background "darkolivegreen4"))
)

(insert
 (propertize "a" 'face '(:foreground "firebrick1" :background "firebrick"))
 "(gdb)"
 (propertize "b" 'face '(:foreground "orange1" :background "orange4"))
 " command"
 (propertize "c" 'face '(:foreground "darkolivegreen1" :background "darkolivegreen4"))
 "\noutput output\noutput"
)
  
;; «traffic-lights-glyphs»  (to ".traffic-lights-glyphs")
;; (find-angg ".emacs" "eev-traffic-light-glyphs")
;; (find-blogme3 "anggdefs.lua" "TRAFFIC")
;; (eev-traffic-light-glyphs)

;; (find-eevfile "eev-math-glyphs.el" "eev-glyphs-set-face 'eev-glyph-face-Greek")
;; (find-eevfile "eev-math-glyphs.el" "defvar eev-math-glyphs-name-to-char")
;; (eev-math-glyphs-edrx)
;;
(add-to-alist 'eev-math-glyphs-name-to-char '("^a" . ?a))
(add-to-alist 'eev-math-glyphs-name-to-char '("^b" . ?b))
(add-to-alist 'eev-math-glyphs-name-to-char '("^c" . ?c))
(eev-glyphs-set-face 'eev-glyph-face-cfont-a "firebrick1"      "firebrick")
(eev-glyphs-set-face 'eev-glyph-face-cfont-b "orange1"         "orange4")
(eev-glyphs-set-face 'eev-glyph-face-cfont-c "darkolivegreen1" "darkolivegreen4")
(eev-math-glyphs-set 'eev-glyph-face-cfont-a "^a" "^a" "")
(eev-math-glyphs-set 'eev-glyph-face-cfont-b "^b" "^b" "")
(eev-math-glyphs-set 'eev-glyph-face-cfont-c "^c" "^c" "")


#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
  traffic = function (char, str)
      if char == "\01" then return COLOR("red",   Q(str)) end
      if char == "\02" then return COLOR("green", Q(str)) end
      return Q(str)
    end
  def [[ TRAFFIC 1 body
         ("\03"..body):gsub("([\01-\03])([^\01-\03]*)", traffic) ]]
]

[PRE [TRAFFIC ['
Current directory is /home/edrx/usrc/lua-5.1.2/src/
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) set args /tmp/foo.lua
(gdb) br math_sin
Breakpoint 1 at 0x80673ef: file lmathlib.c, line 32.
(gdb) run
Starting program: /home/edrx/usrc/lua-5.1.2/src/lua_O0 /tmp/foo.lua

Breakpoint 1, math_sin (L=0x8071008) at lmathlib.c:32
(gdb) call lua_pushstring(L, "print")
(gdb) call lua_gettable(L, -10002)
(gdb) call lua_pushstring(L, "Foo!")
(gdb) call lua_pushstring(L, "Bar!")
(gdb) p lua_gettop(L)
$1 = 4
(gdb) call lua_call(L, 2, 0)
Foo!    Bar!
(gdb) p lua_gettop(L)
$2 = 1
(gdb)
]]]

#*






#####
#
# dump_E4s
# 2007dec11
#
#####

# (find-blogme3 "elisp.lua" "_E4s_as_lua")




#####
#
# build a blogme.tgz, test on a NetBSD box
# 2007dec27
#
#####

# «blogme3.tgz»  (to ".blogme3.tgz")

# (find-angg ".emacs" "caramelo")
# (find-blogme3 "Makefile")
# (find-blogme3file "")
# (find-blogme3file "anggmake.lua" " blogme3/")
# (find-THfile "")
# (find-blogme3file "Makefile")
# (find-es "lua5")
# (find-node "(make)Automatic Variables")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)

rm -Rv /tmp/blogmetest/
mkdir  /tmp/blogmetest/
mkdir  /tmp/blogmetest/TH/
cd     /tmp/blogmetest/
cp -v ~/blogme3/*.lua          /tmp/blogmetest/
cp -v ~/blogme3/Makefile       /tmp/blogmetest/
cp -v ~/LUA/lua50init.lua      /tmp/blogmetest/
cp -v ~/TH/speedbar.blogme     /tmp/blogmetest/TH/
cp -v ~/TH/blogme3.blogme      /tmp/blogmetest/TH/
# cp -v ~/blogme3/testcgi.blogme /tmp/blogmetest/TH/

cd     /tmp/blogmetest/
{TZ=GMT date; date;} > VERSION
tar -cvzf ~/blogme3/blogme3.tgz *

# Note that we build a tgz in ~/blogme3/blogme3.tgz, but then we
# upload it to http://angg.twu.net/blogme3.tgz - no "/blogme3/".

# (find-twusfile "" "blogme3")
# (ee-cp "~/blogme3/blogme3.tgz" (ee-twupfile "blogme3.tgz") 'over)
# (ee-cp "~/blogme3/blogme3.tgz" (ee-twusfile "blogme3.tgz") 'over)
# (eev "Scp ~/blogme3/blogme3.tgz edrx@angg.twu.net:slow_html/")
# (eev "Scp ~/blogme3/blogme3.tgz edrx@angg.twu.net:public_html/")

# (find-blogme3 "Makefile")
rm -Rv /tmp/blogmetest/usrc/
make S=$S testb

# Older tests:
make S=$S |& tee om
make S=$S luatest
make S=$S lpegtest
make S=$S test

# (find-blogme3file "Makefile")




#####
#
# testing blogme3 at caramelo
# 2007dec28
#
#####

# «blogme3-at-caramelo»  (to ".blogme3-at-caramelo")

* (eepitch-caramelo)
* (eepitch-kill)
* (eepitch-caramelo)
* (ee-cp "~/blogme3/blogme3.tgz" (ee-caramelofile "tmp/blogme3.tgz") 'over)

rm -Rv /tmp/blogmetest/
mkdir  /tmp/blogmetest/
cd     /tmp/blogmetest/
tar -xvzf ~edrx/tmp/blogme3.tgz

make LUAOS=bsd luatest
make LUAOS=bsd lpegtest
make LUAOS=bsd test
make LUAOS=bsd testb

# (find-blogme3 "Makefile")
# (find-es "lua5" "install-5.1.2")
# (find-es "make" "environment")
# (find-node "(make)Instead of Execution" "`-n'")
# (find-node "(make)Setting" "FOO ?= bar")




#####
#
# blogme3 at zumbi
# 2007dec28
#
#####

# «blogme3-at-zumbi»  (to ".blogme3-at-zumbi")
# http://zumbi/~edrx/tmp/
# http://zumbi/~edrx/tmp/foo
# http://zumbi/~edrx/tmp/foo.html
# (find-zumbipagefile "tmp/foo")
# (find-zumbifile "")

# (find-fline "~/blogme3/blogme3.tgz")
# (find-caramelofile "")
# (find-zumbifile    "")
# (find-caramelofile "blogme3/")
# (find-zumbifile    "blogme3/")
# (find-caramelofile "blogme3/blogme3.tgz")
# (find-zumbifile    "blogme3/blogme3.tgz")

* (ee-cp "~/blogme3/blogme3.tgz" (ee-caramelofile "blogme3/blogme3.tgz") 'over)
* (ee-cp "~/blogme3/blogme3.tgz" (ee-zumbifile    "blogme3/blogme3.tgz") 'over)

* (eepitch-caramelo)
* (eepitch-kill)
* (eepitch-caramelo)
cd ~/blogme3/
tar -xvzf blogme3.tgz
cat VERSION
make clean
make LUAOS=bsd ANGGBASE=http://10.1.0.101/TH/R/

* (eepitch-zumbi)
* (eepitch-kill)
* (eepitch-zumbi)
cd ~/blogme3/
tar -xvzf blogme3.tgz
cat VERSION
make clean
make LUAOS=bsd ANGGBASE=http://10.1.0.101/TH/R/


* (eepitch-zumbi)
* (eepitch-kill)
* (eepitch-zumbi)
cd ~/public_html/
rm -Rv www/wiki/
rm -Rv www/
export 'CVSROOT=:ext:edrx@_zumbi:/omnisys/cvsroot'
export 'CVSROOT=/omnisys/cvsroot'
cvs checkout www/wiki
cd ~/public_html/www/wiki/
cvs --help
cvs --help-commands
for i in note* project*; do
  ~edrx/blogme3/w2html $i
done

* (ee-cp "~/e/netbsd.e" (ee-zumbipagefile "www/wiki/") 'over)
~edrx/blogme3/t2html netbsd.e
# ^ Too slow!!!
# (find-blogme3 "anggdefs.lua" "wikirefs")
# (find-zumbipagefile "www/wiki/")
# http://zumbi/~edrx/www/wiki/project.cla-tlm.GuiIoMessages.html
# http://zumbi/~edrx/www/wiki/netbsd.e.html

# file:///home/edrx/TH/L/e/netbsd.e.html
# (find-zumbifile "")
# (find-zumbipagefile "www/wiki/")
# (find-es "netbsd")






# old stuff:

# (find-es "ssh" "sshaskpass")
# (find-es "blogme" "blogme3.tgz")

* (eepitch-zumbi)
* (eepitch-kill)
* (eepitch-zumbi)
* (ee-cp "~/blogme3/blogme3.tgz" (ee-zumbifile "tmp/blogme3.tgz") 'over)
# (find-es "blogme" "blogme3.tgz")
cd ~/public_html/tmp/
~edrx/blogme3/blogme3 -anggat -o http://10.1.0.101/TH/R/ foo.html -a2html foo




#####
#
# the ".a2html" target in makefiles
# 2007dec28
#
#####

# «makefile-a2html»  (to ".makefile-a2html")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/fooo
mkdir  /tmp/fooo
cd     /tmp/fooo
cat > Makefile <<'%%%'
BLOGME3 = ~edrx/blogme3/blogme3
BLOGME3A2HTML = $(BLOGME3) -anggat http://10.1.0.101/TH/R/
%.a2html:
	$(BLOGME3A2HTML) -o $*.html -a2html $*
%%%
echo "http://angg.twu.net/" > foo
make foo.a2html

# file:///tmp/fooo/foo.html



#####
#
# running a2html at zumbi
# 2007dec28
#
#####

# «a2html-at-zumbi»  (to ".a2html-at-zumbi")
# (find-zumbifile "")
# (find-zumbifile "bin/a2html")
# (find-zumbipagefile "tmp/")

* (eepitch-zumbi)
* (eepitch-kill)
* (eepitch-zumbi)
cd ~/public_html/tmp/
ls
ls | grep -v '\.html$' | grep -v '~$'
for i in $(ls | grep -v '\.html$' | grep -v '~$'); do echo $i; done
for i in $(ls | grep -v '\.html$' | grep -v '~$'); do ~/bin/a2html $i; done

# http:///zumbi/~edrx/tmp/
# http:///zumbi/~edrx/tmp/TODO.html





#####
#
# tests for the parsechangelog module
# 2007dec27
#
#####

# «parsechangelog-tests»  (to ".parsechangelog-tests")

# (find-blogme3 "")
# (find-blogme3 "escripts.lua")
# (find-es "lua5" "lpeg-quickref")
# (find-es "blogme")
# (find-angg "LUA/parsechangelog.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
-- (find-angg "LUA/parsechangelog.lua")
-- (find-es "lua5" "lpeg-quickref")
-- HOME = os.getenv "HOME"

dofile(ee_expand "~/LUA/parsechangelog.lua")

changelog    = readfile(ee_expand "~/tmp/Changelog")
c = ((SeparatorT * FieldsT)^0):Ct():match(changelog)
= #c
PP(c[1])
PP(c[2])

for fieldname, body in prfields(fields) do
  PP(fieldname, body)
end

PP(c[2])
for fieldname, body in changelogfields(c[2]) do
  PP(fieldname, body)
end

PP(fieldsandvalues(fields, changelogfields))
PP(changelogfieldsandvalues(fields))
PP(prfieldsandvalues(fields))
PP(changelogfieldsandvalues(c[2]))

print(sqlizefields("tbl1", changelogfieldsandvalues(c[2])))

-- (find-angg "LUA/parsechangelog.lua")
-- (find-es "sqlite" "pr.sqlitedb")
-- (find-es "lua5")




#####
#
# CGIs in blogme3
# 2008jan02
#
#####

# «cgis»  (to ".cgis")
# (find-blogme3 "blogme3")
# (find-blogme3file "Makefile")
# (find-blogme3file "Makefile" "blogme3:")

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[PRE [Q
[expr: getoutput("set")]
]]

#*




#####
#
# CGIs in blogme, at zumbi
# 2008jan03
#
#####

# «cgis-at-zumbi»  (to ".cgis-at-zumbi")
# (find-zumbipagefile "tmp/set.cgi")




#####
#
# wikirefs
# 2008jan03
#
#####

# «wikirefs»  (to ".wikirefs")
# (find-blogme3 "anggdefs.lua" "wikirefs")
# (find-blogme3 "anggdefs.lua" "wikirefs" "replacewikirefs =")

#*
[# (eeblogme-now-bounded)
 # file:///tmp/ee.html
 #]
[lua:
  def [[ WIKIREFS 1 bigstr replacewikirefs(bigstr) ]]
]

[PRE [WIKIREFS ['
# $Id: project.cla-tlm.GuiIoMessages,v 1.2 2008/01/02 22:30:55 silas Exp $

This is the document that describes the algorithms responsible for transfering
messages from IO to Gui and vice-versa. This process is similar to the
communication between IO and Recorder.

In main() an object of TlmGuiMain is created and its method init() is called.
This method creates almost all the object intances of the program, including
d_gio, which is an object of the type TlmGuiIO [_ tlmguiio]. After creating
this object, its method init(s) have to be called. "s" is an string which has
the path for the socket.

-- TODO: talk about the difference in TlmRecIO::init() and TlmGuiIO::init()

The init() method calls _init(), which is a method of the TlmUnixSock class,
implemented in [_ tlm_gui-io]. As TlmGuiIO inherites TlmUnixSock, its
protected methods and variables are also accessible.

-- TODO: tell why TlmRecIO::init() don't call _init(). tell that it receives
-- the ready file descriptor from tlmgui, that called tlmrec.

_init(), then, creates the socket with socket() and return a valid
filedescriptor. init() resumes the process, configuring the socket and
dup()ing, so it can use it for reading and writing.

-- TODO: continue...

# refs
# tlmgui_io http://zumbi/cgi-bin/cvsweb.cgi/cla-telemedidas/ihmtelm/tlmgui_io.cpp
# tlm_gui-io http://zumbi/cgi-bin/cvsweb.cgi/cla-telemedidas/ihmtelm/tlm_gui-io.cpp
# sfer

# vim: tw=78 ts=4 et:
]]]

#*







#####
#
# blogme3 in macosx
# 2008feb17
#
#####

# «blogme3-in-macosx»  (to ".blogme3-in-macosx")
# (find-eev "find-eev-update-links")
# (find-blogme3 "Makefile")
# (find-blogme3file "Makefile" "luaunpack:")




#####
#
# The "audios/" dir at angg.twu.net
# 2013aug08
#
#####

# «angg-audios» (to ".angg-audios")
# (find-es "html" "html5-audio")
# http://angg.twu.net/audios/
#      (find-THLfile "audios/")
#       (find-THfile "audios/")
#       (find-TH     "audios/2012set20-ict")
#       (find-TH     "audios/2012nov22-ict")
#       (find-TH     "audios/2012dez13-ict")



# «audio-sexps» (to ".audio-sexps")
# (find-TH      "html5-audio")

[lua:
-- (find-blogme3 "anggdefs.lua" "Sexp")
elispSPECIAL["find-rlmb-audio"] = meta_seek
]

[PREBOXBLOGME
[SQ
(find-rlmb-audio "0:00" "comment")
(find-rlmb-audio "1:23" "comment")
]
]





#####
#
# Local videos
# 2013sep16
#
#####

# «local-videos» (to ".local-videos")
# (find-angg "LUA/youtube.lua")
# (find-blogme3  "youtube.lua")
# (find-blogme3 "anggdefs.lua" "youtube")
#
# (find-TH "videos-locais")
# (find-TH "local-videos")
# (find-TH "linkdasruas")
# (find-THfile "linkdasruas.txt")
# (find-THLfile "local-videos.html")
# (find-THLfile "videos-locais.html")
# file:///home/edrx/TH/L/videos-locais.html
# file:///home/edrx/TH/L/local-videos.html

(find-2a 
  ' (find-fline "/sda5/videos/manifs/")
  ' (find-fline "~/TH/L/manifs/")
  )

# (find-wget "http://angg.twu.net/linkdasruas.txt")
# http://angg.twu.net/linkdasruas.txt
# http://angg.twu.net/linkdasruas.html
# http://angg.twu.net/videos-locais.html
# http://angg.twu.net/local-videos.html



# «local-videos-pen-drive» (to ".local-videos-pen-drive")
# (find-pen-links)

* (eepitch-shell2)
* (eepitch-kill)
* (eepitch-shell2)

mkdir /tmp/pen/
sudo mount -o uid=$UID         /dev/sdb1 /tmp/pen/
# (find-fline "/tmp/pen/")

# cp -v ~/TH/L/videos-locais.html /tmp/pen/
# cp -v ~/TH/L/local-videos.html  /tmp/pen/
# mkdir                           /tmp/pen/manifs/
# cp -v ~/TH/L/manifs/*           /tmp/pen/manifs/

mkdir                           /tmp/pen/manifs/
cp -v ~/TH/L/videos-locais.html /tmp/pen/manifs/
cp -v ~/TH/L/local-videos.html  /tmp/pen/manifs/
cp -v ~/TH/L/local-videos.js    /tmp/pen/manifs/
#cp -v ~/TH/L/tmp.html          /tmp/pen/manifs/
cp -v ~/TH/L/linkdasruas.html   /tmp/pen/manifs/
cp -v ~/TH/L/pendrive.jpg       /tmp/pen/manifs/
mkdir                           /tmp/pen/manifs/manifs/
cp -v ~/TH/L/manifs/*           /tmp/pen/manifs/manifs/

# (find-fline      "~/audios/")
# (find-fline "~/TH/L/audios/")
mkdir                                /tmp/pen/manifs/audios/
cp -v ~/TH/L/audios/2013dec04-aduff* /tmp/pen/manifs/audios/

# file:///tmp/pen/manifs/
# file:///tmp/pen/manifs/linkdasruas.html
# file:///tmp/pen/manifs/audios/

# Or:
# (find-sh "cd ~/TH/L/manifs/ && du -ch *.mp4")
# (find-sh "cd ~/TH/L/manifs/ && du -ch [1-N]*.mp4")
# (find-sh "cd ~/TH/L/manifs/ && du -ch [O-z]*.mp4")
#
cp -v ~/TH/L/manifs/[1-N]*      /tmp/pen/manifs/manifs/
cp -v ~/TH/L/manifs/[P-z]*      /tmp/pen/manifs/manifs/

# (find-angg ".emacs" "chomsky")
# (find-fline "/sda5/torrents/Consenso_fabricado/")
cp -v /sda5/torrents/Consenso_fabricado/*.avi /tmp/pen/

# file:///tmp/pen/manifs/linkdasruas.html
#
# file:///tmp/pen/videos-locais.html
# file:///tmp/pen/local-videos.html
# file:///tmp/pen/manifs/
# file:///tmp/pen/manifs/tmp.html
# file:///home/edrx/TH/L/videos-locais.html
# file:///home/edrx/TH/L/local-videos.html

cp -v /sda5/torrents/Consenso_fabricado/*.avi /tmp/pen/


sudo umount /tmp/pen
sync


* (eepitch-shell2)
* (eepitch-kill)
* (eepitch-shell2)
mount







#####
#
# Debugging the scripts for local videos
# 2013sep18
#
#####

# «local-videos-debug» (to ".local-videos-debug")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3()
chdir "~/TH/L/"
youtube_copy_to = "/foo/"
youtube_ls "ls manifs/*"
li = "http://www.youtube.com/watch?v=nHGwYC6n4bY Gordao do Trem"
bigstr = [[
http://www.youtube.com/watch?v=nHGwYC6n4bY Gordao do Trem
http://www.youtube.com/watch?v=nhgwyc6n4by gordao do trem
http://www.youtube.com/watch?v=nhgwyc6n4by gordao do trem
]]
= Yline(li)
= Ylines(bigstr)
= Ythumbs(bigstr)
= Yline "ello"
youtube_add_urls(bigstr)
PP(youtube_database)
PP(youtube_split_url0(li))




#####
#
# linkdasruas
# 2013oct01
#
#####

# «linkdasruas» (to ".linkdasruas")
# (find-TH      "linkdasruas")
# (find-THLfile "linkdasruas.html")
# (find-angg    "linkdasruas.txt")
# (find-THLfile "local-videos.js")
# (find-blogme3 "local-videos.js")
# (find-TH      "tmp")
# (find-THLfile "tmp.html")
# file:///home/edrx/TH/L/tmp.html

# (find-TH "local-videos")
# (find-TH "videos-locais")
# (find-es "blogme" "local-videos")

# (find-wdgrefgrep "grep -nrH -e charset *")
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
# (find-blogme3file "anggdefs.lua" "metastr =")




#####
#
# albums
# 2014jan07
#
#####

# «albums» (to ".albums")
# (find-wget "http://angg.twu.net/natal-2013/index.html")

# (find-fline "~/FOTOS/natal-2013/")
# file:///home/edrx/FOTOS/natal-2013/index.html

[lua:
  def [[ PIC0 1 n "file:///home/edrx/FOTOS/natal-2013/_DSC0"..n.."_r4.jpg" ]]
  def [[ PIC0 1 n "_DSC0"..n.."_r4.jpg" ]]
  def [[ PIC  1 n SCALEDIMAGE("30%", PIC0(n)) ]]
  def [[ PICS 1L ns mapconcat(PIC, ns, "\n") ]]
]
[htmlize0 [J]

[expr: PICS(seq(325, 347))]

]



#####
#
# Building complex patterns with gsub
# 2014mar20
#
#####

# «gsub-build» (to ".gsub-build")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)

id   = "edrx"
body = "thin"

f = function (id,body)
    local a = {}
    local r = function (s) return (s:gsub("%$([a-z]+)", a)) end
    a.id      = id
    a.qbody   = body
    a.preid   = r 'pre id="$id"'
    a.preidz  = r 'pre id="$id" style="margin:0px 0px;"'
    a.preidzr = r 'pre id="$id" style="margin:0px 0px; color:red;"'
    a.qpre    = r '<$preidzr>&lt;$preid&gt;</pre>'
    a.qspre   = r '<$preidzr>&lt;/pre&gt;</pre>'
    return      r '$qpre\n<$preidz>\n$qbody</pre>\n$qspre\n'
  end

g = function (id,c,r,body)
    local a = {}
    local r = function (s) return (s:gsub("%$([a-z]+)", a)) end
    a.id      = id
    a.qbody   = body
    a.ticr    = r 'textarea id="$id" cols=$c rows=$r'
    a.preidzr = r 'pre id="$id" style="margin:0px 0px; color:red;"'
    a.qta     = r '<$preidzr>&lt;$ticr&gt;</pre>'
    a.qsta    = r '<$preidzr>&lt;/textarea&gt;</pre>'
    return      r '$qta\n<$ticr>\n$qbody</textarea>\n$qsta\n'
  end

= f("edrx", "thin")
= g("ID", 3, 4, "thin")




#####
#
# running blogme3 interactively
# 2014aug31
#
#####

# «interactive» (to ".interactive")
# (find-angg "LUA/lua50init.lua" "loadblogme3")
# (find-angg ".emacs" "blogme3")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
blogmedir = ee_expand "~/blogme3/"
dofile(blogmedir.."blogme3.lua")
b = doblogme
=b "[BF Hello]"

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
lua51 -e 'loadblogme3(true)' -i
=b "[BF Hello]"

* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
=b "[BF Hello]"






#####
#
# withindex
# 2014sep01
#
#####

# «withindex2» (to ".withindex2")

* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
-- (find-blogme3 "anggdefs.lua" "WITHINDEX" " INDEX ")
__secn = "0"; secindex = {}
def [[ WITHINDEX0 1 body LIST2(secindex)..body ]]
def [[ WITHINDEX0 1 body SMALL(table.concat(secindex, "\n")).."\n"..body ]]
=b [=[
[WITHINDEX0
[sec <rorschach> (to ".rorschach")
  H2 [++N]. O teste de Rorschach]
[sec <rorschach2> (to ".rorschach")
  H2 [++N]. O teste de Rorschach 2]
]
]=]


* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
-- (find-blogme3 "brackets.lua" "readvword")
-- (find-blogme3 "definers.lua" "_AA")
_AA["QR"] = function () return readqword(), readvrest() end
def [[ DELAY  QR a,b doblogme(a)..b ]]
__secn = "0"; secindex = {}
=b [==[
[DELAY [++N] [++N] [++N]]
]==]


readqvrest
readqvrest =

def [[ FOO 2Q a,b PP(doblogme(a),b) ]]
=b [==[
[FOO [IT foo] bar [plic]]
]==]


def [[ SWAP 2 a,b b..a ]]
=b [==[ [SWAP foo bar] ]==]

=b [==[[SWAP [J
[sec <rorschach> (to ".rorschach")
  J [++N]. O teste de Rorschach]
[sec <rorschach2> (to ".rorschach")
  J [++N]. O teste de Rorschach 2]
]
[SMALL [expr: table.concat(secindex, "\n")]]
]]==]







#####
#
# all code-c-d-s
# 2019jan08
#
#####

# «all-code-c-d-s» (to ".all-code-c-d-s")
# (find-angg "LUA/lua50init.lua" "loadblogme3")
# (find-blogme3grep "grep --color -nH -e code_c_d *.lua")
# (find-blogme3grep "grep --color -nH -e angglisp *.lua")
# (find-blogme3grep "grep --color -nH -e doblogme *.lua")
# (find-blogme3 "angglisp.lua" "code_c_d_angg")
# (find-blogme3 "elisp.lua" "code_c_d_local")
# (find-blogme3 "elisp.lua" "code_c_d_remote")
# (find-blogme3file "elisp.lua" "set_E4 =")
# (find-blogme3file "angglisp.lua" "eevintro =")
# (find-blogme3 "options.lua" "basic-options")
# (find-blogme3 "options.lua" "basic-options" "dooption_i =")
# (find-blogme3 "options.lua" "basic-options" "dooption_a2html =")
# (find-blogme3 "options.lua" "htmlizefile")
# (find-blogme3 "anggdefs.lua" "-tgt")
# (find-blogme3file "brackets.lua" "doblogme =")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
touch ~/e/non.e
touch ~/TH/coq.blogme
makeL
# lua51 blogme3/blogme3.lua -o coq.html -i TH/coq.blogme
# lua51 blogme3/blogme3.lua -o e/non.e.html -a2html e/non.e


* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
PPV(_AA)
PPV(_EHELP)
PPV(_ESUFFIX)
PPV(_E)


pathtoroot = getpathtoroot("")
eevarticle    = pathto("eev-article.html")
eepitchreadme = pathto("eev-current/eepitch.readme.html")
eepitch_el    = pathto("eev-current/eepitch.el.html")
eevintrosdir  = pathto("eev-intros/")
require "angglisp"
PPV(_EHELP)

ELinkFun = Class {
  type    = "ELinkFun",
  __index = {
  },
}




#####
#
# Parse Makefile.auto and measure utf8-ness of a2html files
# 2019feb11
#
#####

# «parse-makefile.auto» (to ".parse-makefile.auto")
# «measure_utf8_ness» (to ".measure_utf8_ness")
# (find-THLfile "TH/Makefile")
# (find-THLfile "TH/Makefile.auto")
# (find-angg "LUA/lua50init.lua" "u8c_to_l1")
# (find-angg "LUA/lua50init.lua" "u8c_to_l1" "measure_utf8_ness")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
mkfa = ee_readfile "~/TH/L/TH/Makefile.auto"
ahtmls = mkfa:match "A_HTMLS = ([ -~]*)"
ahtmls = (ahtmls.." "):gsub("%.html ", " ")
files = sorted(split(ahtmls))
-- PPV(files)

for _,fname in ipairs(files) do
  bigstr = ee_readfile("~/"..fname)
  p, o = measure_utf8_ness(bigstr)
  if p>0 and o>0 then
    print(p, o, fname)
  end
end

for _,fname in ipairs(files) do
  bigstr = ee_readfile("~/"..fname)
  p, o = measure_utf8_ness(bigstr)
  if p>0 and o==0 then
    print(p, o, fname)
  end
end



* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
-- Measure the utf8-ness of .e files:
mkfa = ee_readfile "~/TH/L/TH/Makefile.auto"
ehtmls = mkfa:match "E_HTMLS = ([ -~]*)"
ehtmls = (ehtmls.." "):gsub("%.html ", " ")
files = sorted(split(ehtmls))
PPV(files)

for _,fname in ipairs(files) do
  bigstr = ee_readfile("~/"..fname)
  p, o = measure_utf8_ness(bigstr)
  if p>0 and o>0 then
    print(p, o, fname)
  end
end

measure_utf8_ness_of_file = function (fname)
    bigstr = ee_readfile("~/"..fname)
    for i,line in ipairs(splitlines(bigstr)) do
      p, o = measure_utf8_ness(line)
      if o>0 then
        print(p, o, line)
        printf('(find-anggfile "%s" %d)\n', fname, i)
      end
    end
  end

measure_utf8_ness_of_file "e/speech.e"
measure_utf8_ness_of_file "e/types.e"





#####
#
# find_node / adjust the entries in _EHELP
# 2019feb17
#
#####

# «find_node» (to ".find_node")
# (find-blogme3 "angglisp.lua" "find_node")
# (find-blogme3file "angglisp.lua" "\n\nset_EHELP_intro")
# (find-blogme3 "angglisp.lua" "set_EHELP_intros")
# (find-angg "LUA/lua50init.lua" "EevIntro")
# (find-blogme3grep "grep --color -nH -e _EHELP.funname *.lua")
# (find-blogme3grep "grep --color -nH -e pathto *.lua")
# (find-blogme3grep "grep --color -nH -e makesexphtml *.lua")
# (find-blogme3grep "grep --color -nH -e anchors *.lua")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all()
PPV(infonodehtmlname_table)
PPV(infomanual_basedir)
PPV(_EHELP)

-- (find-node "(libc)I/O Overview")
= find_node("(libc)I/O Overview")

http://www.gnu.org/software/libc/manual/html_node/I/O-Overview.html
http://www.gnu.org/software/libc/manual/html_node/I_002fO-Overview.html




#####
#
# The ELispHF class and the table _EHF
# 2019feb28
#
#####

# «_EHF» (to "._EHF")
# (find-angg "LUA/lua50init.lua" "ELispHF")
# (find-angg "LUA/lua50init.lua" "ELispHF" "code_c_d_angg =")
# (find-es "lua5" "ELispHF-tests")

* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
for _,stem in ipairs(split [[
    anchors audiovideo bounded brxxx channels code-c-d defun eejump
    eepitch eev eev-quick eev-install emacs emacs-keys escripts eval
    links-conv links multiwindow org pdf-like prepared psne rcirc
    templates videos wrap ]]) do
  local f=format("find-%s-intro", stem)
  _EHF[f] = ELispHF.newintro(f)
end

def [[ STOH 1 line   SexpSkel.fromline(line):tosexphtml() ]]
= STOH '(find-eev-quick-intro)'
= STOH '(find-eev-quick-intro "1.2. a")'


ei = ELispHF.newintro "find-escripts-intro"
= ei
= ei()
= ei "1.2.3. a"

= EevIntro.fromheadposspec("find-escripts-intro", "1.2.3. a")
= EevIntro.fromheadposspec("find-escripts-intro", "abc")
= EevIntro.fromheadposspec("find-escripts-intro")



= _EHF


_EHF["find-escripts-intro"]  = ELispHF.newintro "find-escripts-intro"
_EHF["find-eev-quick-intro"] = ELispHF.newintro "find-eev-quick-intro"
= _EHF["find-eev-quick-intro"]
= _EHF["find-eev-quick-intro"]("1.2. foo")






#####
#
# Debugging eevintros.lua
# 2019feb28
#
#####

# «eevintros.lua» (to ".eevintros.lua")
# (find-blogme3 "eevintros.lua")
# (find-blogme3file "eevintros.lua" "htmlizeeevintro =")
# (find-blogme3 "options.lua" "basic-options")
# (find-blogme3 "options.lua" "basic-options" "dooption_ei2html =")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
touch ~/eev-intros/find-escripts-intro
touch ~/eev-intros/find-*-intro
makeL |& tee /tmp/o
# (find-fline "/tmp/o" "-ei2html")

cd ~/TH/L/
lua51 blogme3/blogme3.lua -o eev-intros/find-escripts-intro.html -ei2html eev-intros/find-escripts-intro

# file:///home/edrx/TH/L/eev-intros/find-escripts-intro.html
# (find-fline    "~/TH/L/eev-intros/find-escripts-intro.html")
# (find-fline    "~/TH/L/eev-intros/find-escripts-intro.html" "../eev-intros")

* (eepitch-blogme3)
* (eepitch-kill)
* (eepitch-blogme3)
chdir "~/TH/L/"
dooption_o       "eev-intros/find-escripts-intro.html"
dooption_ei2html "eev-intros/find-escripts-intro"
-- (find-fline "~/TH/L/eev-intros/" "find-escripts-intro.html")
-- (find-fline "~/TH/L/eev-intros/find-escripts-intro.html")
PPV(_EHELP)

-- (find-blogme3grep "grep --color -nH -e bounded *.lua")
-- (find-blogme3grep "grep --color -nH -e anchors *.lua")
-- (find-blogme3grep "grep --color -nH -e eevintro *.lua")
-- (find-blogme3file "angglisp.lua" "eevintro =")
-- (find-blogme3grep "grep --color -nH -e eevintrosdir *.lua")

= eevintro "foo"


# (find-blogme3 "angglisp.lua" "find_xxx_intros")
# (find-blogme3 "angglisp.lua" "find_xxx_intros" "set_EHELP")





#####
#
# Hacking the utility functions of code_c_d_angg
# 2019feb28
#
#####

# «hacking-code_c_d_angg» (to ".hacking-code_c_d_angg")
# (find-blogme3 "angglisp.lua"  "code_c_d_angg")
# (find-blogme3 "angglisp.lua"  "code_c_d_angg" "dn6")
# (find-blogme3 "elisp.lua"     "code_c_d_local")
# (find-blogme3file "elisp.lua" "_E_localanchor =")
# (find-blogme3 "elisp.lua"     "set_E4")
# (find-blogme3 "elisp.lua"     "makesexphtml")
# (find-blogme3 "elisp.lua"     "_E_intro")
# (find-blogme3 "angglisp.lua"  "find_xxx_intros")

# (find-blogme3grep "grep --color -nH -e set_E4 *.lua")

# `find-dn6' is defined using:
#   code_c_d_angg("dn6", "dednat6/")
#   -> code_c_d_local("dn6", "dednat6/")
#   -> set_E4("find-dn6", _E_localanchor, h, "dednat6/", ".html")
#   -> _E["find-dn6"] = _E_localanchor



# First test: change _E_localanchor and run code_c_d_angg("dn6",
# "dednat6/") again:

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all()
= _E["find-dn6"], _E_localanchor

_E_localanchor = function (all, funname, qfname, qtag)
    local fname, tag = dequote(qfname), dequote(qtag)
    PP(all, funname, qfname, qtag)
    PP(fname, tag)
    return makesexphtml(all, funname, _EHELP[funname],
        makelocaltarget(_EBASE[funname], fname, _ESUFFIX[funname], tag))
  end

code_c_d_angg("dn6",     "dednat6/")

= _E["find-dn6"], _E_localanchor_
li = '(find-dn6 "hello.lua" "atag")'
= htmlizeline(li)
li = '(find-blogme3 "hello.lua" "atag")'
= htmlizeline(li)



#####
#
# Adding a function _E_intro that supports pointing to sections
# 2019feb28
#
#####

# «_E_intro» (to "._E_intro")
# (find-blogme3 "angglisp.lua"  "code_c_d_angg")
# (find-blogme3 "angglisp.lua"  "code_c_d_angg" "dn6")
# (find-blogme3 "elisp.lua"     "code_c_d_local")
# (find-blogme3file "elisp.lua" "_E_localanchor =")
# (find-blogme3 "elisp.lua"     "set_E4")
# (find-blogme3 "elisp.lua"     "set_EHELP")
# (find-blogme3 "elisp.lua"     "makesexphtml")
# (find-blogme3 "elisp.lua"     "_E_intro")
# (find-blogme3 "angglisp.lua"  "find_xxx_intros")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all()

_E_intro = function (all, funname, qarg1, qarg2)
    local intro = "eev-intros/"..funname..".html"
    local posspec = dequote(qarg1)
    local sec = posspec and posspec:match "^(%d[%d%.]*)%. "
    local introsec = sec and intro.."#"..sec or intro
    return makesexphtml(all, funname, introsec, introsec)
  end

_E["find-eev-quick-intro"] = _E_intro

li = '# (find-eev-quick-intro "1. Installing eev")'
= htmlizeline(li)


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
touch ~/eev-intros/find-*-intro
makeL |& tee /tmp/o

# file:///home/edrx/TH/L/eev-intros/find-escripts-intro.html



#####
#
# Reimplementing code_c_m_b using ELispHF
# 2019mar01
#
#####

# «code_c_m_b» (to ".code_c_m_b")
# (find-es "lua5" "ELispInfo")
# (find-angg "LUA/lua50init.lua" "ELispHF")
# (find-angg "LUA/lua50init.lua" "ELispHF" "code_c_m_b =")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all()
require "sexp"
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/")
= _EHF

= STOH '(find-enode "Keys")'

en = ELispHF.newnode("find-enode", "e", "emacs")
= en

code_c_m_b("e", "emacs", "http://www.gnu.org/software/emacs/manual/html_node/emacs/")
= _EHF
= STOH





#####
#
# _E_eevintro
# 2019feb28
#
#####

# «_E_eevintro» (to "._E_eevintro")
# (find-blogme3 "elisp.lua" "code_c_d_local")
# (find-blogme3grep "grep --color -nH -e _E_localanchor *.lua")
# (find-angg "LUA/lua50init.lua" "loadblogme3")




#####
#
# Making links like (find-man "1 git-xxx") point to the right place
# 2019jun13
#
#####

# «git-manpages» (to ".git-manpages")
# (find-fline "~/LOGS/2019jun13.git")
# (find-man "1 git-log" "HEAD")
# -> https://git-scm.com/docs/git-log




#####
#
# links-to-manpages
# 2020mar17
#
#####

# «links-to-manpages» (to ".links-to-manpages")
# (find-es "man" "online-man-pages")




#####
#
# links-to-pages-of-pdfs
# 2020feb23
#
#####

# «links-to-pages-of-pdfs» (to ".links-to-pages-of-pdfs")
# https://sourceforge.net/p/hol/mailman/message/36654754/ ->
# http://www.owlofminerva.net/files/fom.pdf#page=10
# (find-blogme3 "sexp.lua" "code-c-d-angg")

# (find-anggfile ".emacs" "\"nyo\"")
# (code-etex "nyo" "2019notes-yoneda")
# (nyo)

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
--   file:///home/edrx/LATEX/2019notes-yoneda.pdf
-- http://angg.twu.net/LATEX/2019notes-yoneda.pdf
--   file:///home/edrx/LATEX/2019notes-yoneda.pdf#page=10
-- http://angg.twu.net/LATEX/2019notes-yoneda.pdf#page=10
code_etex_url_prefix = "http://angg.twu.net/LATEX/"
code_etex_url_prefix =   "file:///home/edrx/LATEX/"

f = function (stem, page)
    if page then
      return format("%s%s.pdf#page=%s",
        code_etex_url_prefix, stem, page)
    else
      return format("%s%s.pdf",
        code_etex_url_prefix, stem)
    end
  end

= f("2019notes-yoneda")
= f("2019notes-yoneda", 10)




#####
#
# echo-tgzfiles
# 2020mar17
#
#####

# «echo-tgzfiles» (to ".echo-tgzfiles")
# (find-TH "Makefile" "echo-tgzfiles")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
makeL
cd
make -f TH/Makefile NEEDMAKEFILEAUTO=1 echo-tgzfiles   |& tee /tmp/oetf

for i in $(cat /tmp/oetf); do
  stat --format='touch -d "%y" %-20n' $i
done \
  |& tee /tmp/otimestamps

# (find-fline "/tmp/oetf")
# (find-fline "/tmp/otimestamps")

# (find-edrx-update-links)
makeLedrxtgz
rm -Rf /tmp/THL0/
mkdir  /tmp/THL0/
tar -C /tmp/THL0/ -xvzf ~/TH/L/edrx.tgz
cd     /tmp/THL0/
cd     /tmp/THL0/ && touch $(cat /tmp/oetf)

# (find-fline "/tmp/THL0/")
# (find-angg ".zshrc" "ee")

cd     /tmp/THL0/ && set -v && . /tmp/otimestamps && set +v

# (find-fline "/tmp/THL0/")





#####
#
# timestamps (see the block above)
# 2020mar17
#
#####

# «timestamps» (to ".timestamps")

# (find-man "1 stat")
# (find-man "1 touch")
# (find-man "1 touch" "[[CC]YY]MMDDhhmm[.ss]")
# (find-es "lua5" "luaposix-git")
# (find-luaposixgrep "grep --color -nRH --null -e stat *")
# (find-luaposixgrep "grep --color -nRH --null -e utime *")
# (find-luaposixfile "ext/posix/time.c")
# (find-luaposixfile "ext/posix/sys/stat.c")
# (find-luaposixfile "ext/posix/sys/stat.c" "st_mtime")
# (find-luaposixfile "ext/posix/utime.c")
# (find-luaposixfile "lukefile" "posix.utime")
# (find-node "(coreutils)Top")
# (find-es "unix" "coreutils-src")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
stat --format='%n foo' ~/TODO 
stat --format='touch %-20n     foo' ~/TODO 
stat --format='touch -d "%y" %-20n' ~/TODO 

# (find-THfile "Makefile" "$(TGZFILES)")
# (find-fline "~/TH/L/TH/Makefile.auto")
# (find-angg ".zshrc" "makeL")

makeL
cd ~/TH/L/ && make -f TH/Makefile NEEDMAKEFILEAUTO=1 echo-tgzfiles | tr ' ' '\n' | tee /tmp/oh
cd         && make -f TH/Makefile NEEDMAKEFILEAUTO=1 echo-tgzfiles | tr ' ' '\n' | tee /tmp/ol
cd         && make -f TH/Makefile NEEDMAKEFILEAUTO=1 echo-tgzfiles

tkdiff /tmp/oh /tmp/ol




#####
#
# code-video
# 2020oct28
#
#####

# «code-video»  (to ".code-video")
# (find-THfile "index.blogme" "sexp")
# (find-angg "LUA/lua50init.lua" "loadblogme3")
# (find-blogme3 "sexp.lua")
# (find-angg "LUA/lua50init.lua" "ELispH")
# (find-angg "LUA/lua50init.lua" "ELispHF")
# (find-angg "LUA/lua50init.lua" "ELispHF" "code_c_d_angg =")
# (find-es "lua5" "ELispH")
# (find-es "lua5" "ELispHF")
# (find-es "lua5" "ELispHF-tests")
# (find-audiovideo-intro "4. Short hyperlinks to audio and video files")
# (find-audiovideo-intro "4.3. A demo")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3()

-- (find-angg "LUA/lua50init.lua" "ELispHF")
-- (find-angg "LUA/lua50init.lua" "ELispHF" "newyoutube =")
-- (find-angg "LUA/lua50init.lua" "ELispHF" " youtube =")
-- (find-angg "LUA/lua50init.lua" "ELispHF" "codevideo =")
-- (find-angg "LUA/lua50init.lua" "ELispHF" "code_video =")

= to_youtube_hash "/foo/bar-86yiRG8YJD0.mp4"
= to_youtube_hash "http://www.youtube.com/watch?v=86yiRG8YJD0"

code_video("ECvideo", "/foo/bar-86yiRG8YJD0.mp4")
= _EHF["find-ECvideo"]
= _EHF["find-ECvideo"]("1:23")

-- (find-angg "LUA/lua50init.lua" "code_video")
_EHF["code-video"] = ELispHF {f="codevideo"}

= _EHF["code-video"]("FOOvideo", "86yiRG8YJD0")
= _EHF["find-FOOvideo"]("1:23")






#####
#
# U8 and U8'
# 2020oct28
#
#####

# «U8»  (to ".U8")

-- (find-angg "LUA/lua50init.lua" "utf8tohtml")
def  [[ U8'   1 body PRE(utf8tohtml(body)) ]]





#####
#
# code_eevshortvideo
# 2021apr22
#
#####

# «code_eevshortvideo»  (to ".code_eevshortvideo")
# (find-eev2-links)
# (find-anggfile "eev-intros/README" ";; end of the progn\n")
# (find-anggfile "eev-intros/find-videos-intro")

# (find-blogme3 "options.lua" "basic-options-sandwich")
# (find-blogme3 "options.lua" "basic-options-sandwich" "dooption_ei2html =")
# (find-blogme3grep "grep --color -nH --null -e eev2019 *.lua")

# (find-videos-intro "2. Short links to eev video tutorials")
# (find-blogme3 "sandwiches-defs.lua" "code_eevshortvideo-tests")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
touch ~/blogme3/sandwiches-defs.lua
makeL
touch ~/eev-intros/find-videos-intro
makeL
# file:///home/edrx/TH/L/eev-intros/find-videos-intro.html




#####
#
# debug-a2html
# 2022may21
#
#####

# «debug-a2html»  (to ".debug-a2html")
# (find-blogme3 "options.lua" "_O")
# (find-blogme3 "options.lua" "_O" "-a2html" "-a2html")
# (find-blogme3 "options.lua" "basic-options-sep2021")
# (find-blogme3 "options.lua" "htmlizefile_utf8")
# (find-blogme3 "escripts.lua")
# (find-blogme3 "blogme3.lua" "dooptions")
# (find-angg "LUA/lua50init.lua" "loadblogme3")
# (find-blogme3 "sandwiches.lua")
# (find-blogme3 "sandwiches-defs.lua" "code_eevshortvideo-tests")
# (find-blogme3 "sandwiches-defs.lua" "use_sand_htmlizeline")
# (find-blogme3 "sandwiches-defs.lua" "code-eevvideo")
# (find-blogme3 "sandwiches.lua" "code_youtube")

# (find-blogme3grep "grep --color=auto -nH --null -e audiovideo *.lua")
# (find-blogme3grep "grep --color=auto -nH --null -e use_sand_htmlizeline *.lua")


* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all("")
fname = ".emacs.videos"

DBG = function (linen)
    local a = _SH and _SH["find-eev2020video"].help.anchor or ""
    local linestr = "line "..tostring(linen)
    print(linestr..": "..a)
    if a == "4" then dgis = DGetInfos.newv(); error() end
  end

chdir "~"
dooptions("-o", "/tmp/o.html")

fname = ".emacs.videos"
dooption_a2html_aug2021(fname)

= dgis
= dgis[6]
= dgis[6]:fline()
PPV(dgis[6])
= dgis[9]:fline()
= dgis[8]:fline()
= dgis[7]:fline()
= dgis[6]:fline()

f = function (dgi)
    local src = dgi.short_src
    local l0  = dgi.linedefined
    local l1  = dgi.currentline
    local l2  = dgi.lastlinedefined
    local g = function (line) return format("(find-fline \"%s\" %d)", src, line) end
    return g(l1)
  end

= f(dgis[6])

= _SH["find-eev2020video"]
= _SH["find-eev2020video"].help
PPP(_SH["find-eev2020video"].help.anchor)

PP(debug.getinfo(htmlizeline))


= _SH
require "sandwiches-defs"
= _SH["find-eev2020video"]
use_sand_htmlizeline(fname)
= _SH["find-eev2020video"]
require "sandwiches-defs"   -- (find-blogme3 "sandwiches-defs.lua")
require "htmlize-utf8"      -- (find-blogme3 "htmlize-utf8.lua")
= _SH["find-eev2020video"]
chdir "~"
dooptions("-o", "/tmp/o.html")
= _SH["find-eev2020video"]

use_sand_htmlizeline(fname)
= _SH["find-eev2020video"]


-- Esses dois aqui mudam o anchor 2 pra anchor 4:

fname = ".emacs.videos"
dooption_a2html_aug2021(fname)
= _SH["find-eev2020video"]
= _SH["find-eev2020video"].help
PPP(_SH["find-eev2020video"].help.anchor)

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
DBG = function () end
DBG()


fname = ".emacs.videos"
htmlizefile_utf8(fname, outputfile)
= _SH["find-eev2020video"]




#####
#
# create-from-repl
# 2023nov27
#
#####

# «create-from-repl»  (to ".create-from-repl")
# (find-efunction 'eepitch-blogme3)
# (find-angg "LUA/lua50init.lua" "loadblogme3")
# (find-blogme3 "blogme3.lua" "dooptions")
# (find-blogme3 "options.lua" "dooptions")
# (find-blogme3 "options.lua" "basic-options" "dooption_o =")
# (find-blogme3 "options.lua" "basic-options" "dooption_i =")
#  makeL --> lua51 blogme3/blogme3.lua -o tmp.html -i TH/tmp.blogme

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "/tmp/advogados/")
rm -Rv /tmp/advogados/
mkdir  /tmp/advogados/
cd     /tmp/advogados/
cp -v ~/LATEX/2022-2-C2-C3-ajuda.pdf /tmp/advogados/0.pdf
# (find-sh0 "cp -v ~/LATEX/2022-2-C2-C3-ajuda.pdf /tmp/advogados/0.pdf")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3(true)              -- (find-angg "LUA/lua50init.lua" "loadblogme3")
require "defs-2022"            -- (find-blogme3 "defs-2022.lua")
load_caepro5()                 -- (find-blogme3 "defs-2022.lua" "load_caepro5")
require "Caepro5-blogme"       -- (find-angg "LUA/Caepro5-blogme.lua")
require "Subtitles2"           -- (find-angg "LUA/Subtitles2.lua")
Subtitle.__index.url = function (st) return "#"..st.time end

htmlizesubtitles = function ()
    inputfile  =    "~/SUBTITLES/"..subtitlestem..".lua"
    outputfile = "/tmp/advogados/"..subtitlestem..".html"
    ee_dofile(inputfile)
    dooptions("-o", outputfile)
    outerblogme = [==[
      [SETHEADSTYLE [LUCIDA]]
      [htmlize8 [lua: return subtitlestem]
        [lua: sls = SubtitleLines.from(subs_bigstr)
              return sls:blogme()
        ]
      ]
     ]==]
    b(outerblogme)
    writefile(outputfile, blogme_output)
  end

stems = [[
    2022etel
    2023-caepro-VR
    2023-caepro0
    2023antonio
    2023eduardo
    2023etel
    2023mateus
    2023quinet
    2023rcnjulho
  ]]

for i,s in ipairs(split(stems)) do
  PP(s)
  subtitlestem = s
  htmlizesubtitles()
end

-- Skel: (find-sandwiches-def-links "find-SUBSfile")
-- find-SUBSfile "2022etel.lua" "14:46"

_SH["find-SUBSfile"] = SexpHead {
  head = "find-SUBSfile",
  f = function (sh, si)
      local file = si:sexp_strarg(2)
      local time = si:sexp_strarg(3)
      if file then
        file = file:gsub(".lua", "")
        local url0 = file..".html"
        si:add_filling(2, 1, "file", url0)
      end
      if file and time then
        local url1 = file..".html#"..time
        si:add_filling(3, 1, "time", url1)
      end
    end,
}

= sexp_to_target_si  [[ (find-SUBSfile "2022etel.lua" "14:46") ]]
= sexp_to_target_st  [[ (find-SUBSfile "2022etel.lua" "14:46") ]]

Local.__index.pdf1 = "0.pdf"
outputfile = "/tmp/advogados/1.html"
dooptions("-o", outputfile)
bigstr = ee_readfile "~/ORG/indice-caepro.org"
outerblogme = [==[
  [SETHEADSTYLE [LUCIDA]]
  [htmlize8 [J (...)]
    [lua: return PRE(Local.htmlizelines(bigstr))
    ]
  ]
 ]==]
b(outerblogme)
writefile(outputfile, blogme_output)


-- (find-TH "tmp")
-- file:///tmp/o.html
-- file:///tmp/advogados/
-- (find-fline "/tmp/advogados/")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
DATE=2023nov30
ZIP=/tmp/2023nov30.zip
ZIP=/tmp/2023nov30b.zip
rm -fv $ZIP
cd /tmp/advogados/
zip $ZIP *
laf $ZIP

# https://drive.google.com/drive/my-drive
# Processo_PAD:
# https://drive.google.com/drive/folders/1fiGHFw-JFe4ht6QfYGANjLrQNTJcq1Vp





prf = PrintFunction.tostring
= prf(b)








  -- (find-fline "~/ORG/indice-caepro.org")
  bigstr = ee_readfile "~/ORG/indice-caepro.org"




dooption_a2html_sep2021(".emacs.videos")
= _SH["find-eev2020video"]






dooptions("-a2html", ".emacs.videos")
= _SH["find-eev2020video"]

dooptions("-o", "/tmp/o.html", "-a2html", ".emacs.videos")








* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
touch ~/.emacs.videos
makeR
makeL            |& tee /tmp/o
# (find-fline          "/tmp/o")
# (find-fline          "/tmp/o" " -o .emacs.videos.html -a2html .emacs.videos")
# (find-sh "grep ^lua51 /tmp/o")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
loadblogme3all("")
chdir "~"
dooptions("-o", "/tmp/o.html", "-a2html", ".emacs.videos")
-- (find-fline "/tmp/o.html")
-- (find-fline "/tmp/o.html" "name=\"2022eevwconfig\"")
-- (brg "file:///tmp/o.html")
-- (brg "file:///tmp/o.html#2022eevwconfig")

linestr = [[ (find-2021workshop3video "1:23") ]]
si = SexpIntervals.from(linestr)
si:head_apply()
= si
= si:tosandwich()
PPV(sorted(keys(si)))
= si.head
= _SH[si.head]
PPP(_SH[si.head])
= _SH["find-2021workshop3video"]

ee_dofile "~/blogme3/sandwiches-defs.lua"
= _SH["find-2021workshop3video"]
use_sand_htmlizeline()
= _SH["find-2021workshop3video"]

= getoutput("pwd")


# file:///home/edrx/TH/L/.emacs.videos.html#2022eevwconfig





chdir "~"
dooptions("-o", "/tmp/o.html", "-a2html", ".emacs.videos")






# (find-blogme3 "sexp.lua" "STOH")
# (find-es "lua5" "SexpSkel-test")
# (find-es "lua5" "SexpSkel-test" "ss:tosexphtml()")






smartpathto = function (tgt)
    if tgt == nil then return end
    if tgt:match "://" then return tgt end
    if tgt:match "^#"  them return tgt end
    return pathto(tgt)
  end





#  Local Variables:
#  coding:               utf-8-unix
#  End: