Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file contains utf-8 chars, and the current version of blogme -- does not htmlize it correctly. -- (find-equailfile "sgml-input.el" "BOX DRAWINGS") -- (find-lua51manualw3m "#5.4.1") boxstr = [[ hh ─ HH ═ vv │ VV ║ dr ┌ hd ┬ dl ┐ Dr ╓ hD ╥ Dl ╖ vr ├ vh ┼ vl ┤ Vr ╟ Vh ╫ Vl ╢ ur └ hu ┴ ul ┘ Ur ╙ hU ╨ Ul ╜ dR ╒ Hd ╤ dL ╕ DR ╔ HD ╦ DL ╗ vR ╞ vH ╪ vL ╡ VR ╠ VH ╬ VL ╣ uR ╘ Hu ╧ uL ╛ UR ╚ HU ╩ UL ╝ ]] boxT = {} pat = "([A-Za-z])([A-Za-z]) (%S+)" for a1,a2,b in boxstr:gfind(pat) do -- PP(a1, a2, b) local sa12 = format("&%s%s;", a1, a2) local sa21 = format("&%s%s;", a2, a1) boxT[sa12] = b boxT[sa21] = b end boxify = function (str) return (str:gsub("&[A-Za-z]+;", boxT)) end pbytes = function (str) PP({str:byte(1, #str)}) end PP(boxify "foo &dr;&hd;&dh;&dl; bar") --[[ * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "boxchars.lua" PP("H", "U", "╩") pbytes "HU ╩ _" PP(boxify "foo &dr;&hd;&dh;&dl; bar") print(boxify "&VR;&HH;&HH;&UL;") -- 04 05 06 07 -- ╠══╝ ╠══╝ -- 02 03 -- ╠═════╝ -- 01 -- 8 9 10 11 12 13 14 15 -- ╠══╝ ╠══╝ ╠══╝ ╠══╝ -- 4 5 6 7 -- ╠═════╝ ╠═════╝ -- 2 3 -- ╠═══════════╝ -- 1 --]] -- Local Variables: -- coding: utf-8-unix -- End: