|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- http://angg.twu.net/LUA/Show1.lua.html
-- http://angg.twu.net/LUA/Show1.lua
-- (find-angg "LUA/Show1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun e () (interactive) (find-angg "LUA/Show1.lua"))
-- (find-angggrep "grep --color=auto -niH --null -e show LUA/Lazy*.lua")
--
-- (defun s () (interactive) (find-angg "LUA/Show1.lua"))
-- (defun a () (interactive) (find-angg "LUA/Pict2e1.lua"))
-- (defun b () (interactive) (find-angg "LUA/Pict2e1-1.lua"))
-- (defun ab () (interactive) (find-2b '(a) '(b)))
-- (code-etv "~/LATEX/")
-- (find-code-etv "~/LATEX/")
-- «.string.show» (to "string.show")
-- «.string.show-tests» (to "string.show-tests")
require "Pict2e1" -- (find-angg "LUA/Pict2e1.lua" "Show")
require "Verbatim1" -- (find-angg "LUA/Verbatim1.lua" "Verbatim")
-- «string.show» (to ".string.show")
-- Based on: (find-angg "LUA/Lazy5.lua" "string.show")
-- (find-angg "LUA/Pict2e1.lua" "Show")
string.show = function (str, ops)
return Show.try(str:show0(ops):tostringp())
end
string.show0 = function (str, ops)
local p = PictList { str }
local scale = function (op) return op:match("^([%d%.]+)$") end
for _,op in ipairs(split(ops)) do
if op == "d" then p = p:d()
elseif op == "dd" then p = p:dd()
elseif scale(op) then p = p:scalebox(scale(op))
else error("Unknown op")
end
end
return p
end
-- «string.show-tests» (to ".string.show-tests")
--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Show1.lua"
= ("22 \\cdot foo")
= ("22 \\cdot foo"):show(" dd")
* (etv)
= ("22 \\cdot foo"):show("4 dd")
* (etv)
= Show.log
--]==]
-- Local Variables:
-- coding: utf-8-unix
-- End: