Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#!/usr/bin/lua50 -e PP(arg);os.exit(0)
-- -*- coding: raw-text-unix -*-
-- #!/usr/bin/env lua50 -ePP(arg);os.exit(0)
-- This is the `blogme2-extras.lua' file of blogme2.
-- It contains experimental functions that I use at angg.twu.net.
-- Author and version: Eduardo Ochs <edrx@mat.puc-rio.br>, 2005nov09
-- License: GPL.
-- (find-blogmefile "")
-- (find-blogmefile "blogme2-outer.lua")
-- (find-blogmefile "blogme2.lua")
-- require "blogme2-extras.lua"
-- (find-blogmefile "blogme2-outer.lua" "MYL =")

(defun find-bme (commands)
  (find-sh (format "~/blogme/blogme2.lua -e 'require \"%s\"; %s'"
     "blogme2-extras.lua" commands)))

(defun find-bme0 (commands)
  (find-sh0 (format "~/blogme/blogme2.lua -e 'require \"%s\"; %s'"
     "blogme2-extras.lua" commands)))
(defun eebme (s &optional e)

"~/blogme/blogme2.lua -e 'require [[blogme2-extras.lua]]; %s'"


def [[ WARN_HTMLIZED 2 fname,glyphsfname  format([[
<table><tr><td bgcolor="#CC0000"><font color="#FFCC00" size=-1>
Warning: this is a htmlized version!
<br>The original is across <a href="%s">this link</a>;
<br>it may have some <a href="%s">strange characters</a>.
]], fname, glyphsfname)

maplines = function (f, bigstr)
    local lines = split(bigstr, "([^\n]*)\n?")
    for i=1,getn(lines) do
      lines[i] = f(lines[i]).."\n"
    return table.concat(lines)

mkdir -p /tmp/testasc/
cd       /tmp/testasc/
cp -v $ES/emacs.e .
head -n 500 < $ES/emacs.e > /tmp/testasc/emacs.e

time ~/blogme/blogme2.lua -e 'require "blogme2-extras.lua"; testasc("emacs.e")'

cat > /tmp/testasc/emacs.e <<'%%%'
«.foo»  (to "foo")
# (find-angg ".zshrc" "zcatinfo")

# time tclsh /home/edrx/TH/Generate emacs.e.old.html "a2html emacs.e"
# cd /tmp/testasc/; tkdiff emacs.e.old.html emacs.e.html

# (find-fline "/tmp/testasc/emacs.e.html")
# (find-fline "/tmp/testasc/emacs.e.html" "setq last-kbd-macro")
# (find-fline "/tmp/testasc/emacs.e.old.html")
# (find-fline "/tmp/testasc/emacs.e.old.html" "setq last-kbd-macro")


testasc = function (fname)
    bigstr = readfile(fname)
    bigstr_body = PRE(maplines(url_f, bigstr))
    bigstr_body = PRE(maplines(guill_f, bigstr))
    bigstr_body = PRE(maplines(hyper_f, bigstr))
    bigstr_warn = WARN_HTMLIZED(fname, "eev-current/glyphs.el.html")
    bigstr_all = html_all(fname.." (htmlized)\n",
    writefile(fname..".html", bigstr_all)

testasc2 = function ()
    li = [[ «.foo»  (to "foo") ]]

entities_string = [[
  Æ AElig  Á Aacute  Acirc  À Agrave Å Aring  à Atilde Ä Auml  
  Ç Ccedil É Eacute Ê Ecirc  È Egrave Ë Euml   Í Iacute Ï Iuml  
  Ó Oacute Ô Ocirc  Ò Ograve Õ Otilde Ö Ouml   Ú Uacute Û Ucirc 
  Ù Ugrave Ü Uuml   á aacute â acirc  æ aelig  à agrave å aring 
  ã atilde ä auml   ç ccedil é eacute ê ecirc  è egrave ë euml  
  í iacute î icirc  ì igrave ï iuml   ó oacute ô ocirc  ò ograve
  õ otilde ö ouml   ß szlig  ú uacute û ucirc  ù ugrave ü uuml  
  ª ordf   « laquo  ° deg    º ordm   » raquo
  & amp  > gt  < lt
  Ñ Ntilde ñ ntilde
  × times


entities["*"] = "<font color=\"red\"><strong>*</strong></font>"
entities_chars = entities_chars.."*"
entities_re = "(["..entities_chars.."])"

anchorstr = function (a) if a then return "#"..a else return "" end end

--% Htmlize text - e-scripts, programs, etc
--% Recognizes urls, guillemet anchors, and some elisp hyperlinks.
--% Experimental, incomplete, etc.
--% Usage: run hyper_f(li) on each line. Concatenate the result with "\n"s.

-- (find-es "lua5" "txt2html_in_blogme")
-- (find-angg "TH/Generate" "txt2html")
-- (find-angg "LUA/lua50init.lua" "load_rex")

if not rex then load_rex() end

--% Process urls

url_re = rex("(.*)([fh]tt?p://[-%#$&*+,./:;=?@_~0-9A-Za-z]*)(.*)")
url_f0 = function (str) return format("<a href=\"%s\">%s</a>", str, str) end
url_f  = function (str)
    local _, _, arr = url_re:match(str)
    -- if _ then return arr[1]..url_f0(arr[2])..arr[3] end
    if _ then return Q(arr[1])..url_f0(arr[2])..Q(arr[3]) end
    -- return str
    return Q(str)

--% Process guillemot anchors and urls

guill_re = "^([^«»]*)«([-+,.:_~0-9A-Za-z]+)»([^«»]*)$"
guill_f0 = function (str) return "««"..str.."»»" end
guill_f0 = function (str)
    return [[<a name="]]..str..[["><font color="green"><i>&laquo;</i>]]..
guill_f  = function (str)
    local _, _, left, anchor, right = strfind(str, guill_re)
    if _ then return url_f(left)..guill_f0(anchor)..url_f(right) end
    return url_f(str)

--% Process elisp hyperlinks, guillemot anchors, and urls

hyperstr_re0 = "[ \t]*(\"([^\"\\]|\\\\.)+\")"
hyperstr_re  = rex(hyperstr_re0)

-- Grok the string arguments of a sexp
-- (find-bme0 "PP(0, hyperstrsplit([[ \"file\" \"anchor\" \"trash\"]]))")
hyperstrsplit_re0 = format("^%s(.*)", hyperstr_re0)
hyperstrsplit_re  = rex(hyperstrsplit_re0)
hyperstr_unquote = function (qstr) return (loadstring("return "..qstr))() end
hyperstrsplit = function (str)
    local _, _, arr = hyperstrsplit_re:match(str)
    if _ then return hyperstr_unquote(arr[1]), hyperstrsplit(arr[3]) end

hypers = {}
hypers["to"] = function (fn, anchor) return anchorstr(anchor) end
hypers["find-angg"] = function (fn, fname, anchor)
    if fname then return "../"..fname..".html"..anchorstr(anchor) end

hyper_re0 = format("^(.*)\\((find-[-+A-Za-z0-9]+|%s)((%s)+)\\)([ \t]*)$",
  "to", hyperstr_re0)
hyper_re  = rex(hyper_re0)
hyper_f0 = function (funcname, rest)
    local f = hypers[funcname]
    if f then return f(funcname, hyperstrsplit(rest)) end
hyper_f1 = function (sexp, funcname, rest)
    if not sexp then sexp = "("..funcname..rest..")" end
    local target = hyper_f0(funcname, rest)
    if target then
      local _, _, left, right = strfind(sexp, "^(.*)(..)$")
      -- return format("%s<a href=\"%s\">%s</a>", left, target, right)
      return format("%s<a href=\"%s\">%s</a>", Q(left), target, right)
    -- return sexp
    return Q(sexp)
hyper_f  = function (str)
    local _, _, arr = hyper_re:match(str)
    if _ then
      local left, sexpfun, sexprest, spaces = arr[1], arr[2], arr[3], arr[7]
      return guill_f(left)..hyper_f1(nil, sexpfun, sexprest)..spaces end
    return guill_f(str)

-- (find-bme2 "hyper_test()")
hyper_test = function ()
    PP(0, hyperstrsplit([[ "file" "anchor" "trash"]]))
    PP(1, hyper_f0("to",        [[ "anchor" "trash"]]))
    PP(2, hyper_f0("find-angg", [[ "file"]]))
    PP(3, hyper_f0("find-angg", [[ "file" "anchor" "trash"]]))
    print(4, hyper_f1(nil, "find-angg", [[ "file" "anchor" "trash"]]))
    print(5, hyper_f1(nil, "find-foo",  [[ "file" "anchor" "trash"]]))
    print(6, hyper_f([[bleh (to "anchor" "trash")]]))
    print(7, hyper_f([[bleh (find-angg "file" "anchor" "trash")]]))