diff options
author | Marius <mariausol@gmail.com> | 2010-11-01 14:00:14 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-11-01 14:00:14 +0200 |
commit | e19e21294c4450e292a48ee5a3cec8a90daf91ed (patch) | |
tree | a0c53a86c5692bd2d07b9c96a51a9d8325f57c52 /tex/context/base/cldf-ver.lua | |
parent | b8fc800cde67f29f4724b642d87278f864ec2d58 (diff) | |
download | context-e19e21294c4450e292a48ee5a3cec8a90daf91ed.tar.gz |
beta 2010.11.01 12:14
Diffstat (limited to 'tex/context/base/cldf-ver.lua')
-rw-r--r-- | tex/context/base/cldf-ver.lua | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/tex/context/base/cldf-ver.lua b/tex/context/base/cldf-ver.lua index 0d7d55649..fbc7670e2 100644 --- a/tex/context/base/cldf-ver.lua +++ b/tex/context/base/cldf-ver.lua @@ -6,17 +6,47 @@ if not modules then modules = { } end modules ['cldf-ver'] = { license = "see context related readme files" } -local concat = table.concat +local concat, tohandle = table.concat, table.tohandle +local tostring, type = tostring, type local context = context -function table.tocontext(...) - local function flush(...) - context(concat{...,"\n"}) - end - context.starttyping() +local function flush(...) + context(concat{...,"\n"}) +end + +local function t_tocontext(...) + context.starttyping { "typing" } -- else [1] is intercepted context.pushcatcodes("verbatim") - table.tohandle(flush,...) + tohandle(flush,...) context.stoptyping() context.popcatcodes() end + +local function s_tocontext(...) -- we need to catch {\} + context.type() + context("{") + context.pushcatcodes("verbatim") + context(concat({...}," ")) + context.popcatcodes() + context("}") +end + +local function b_tocontext(b) + string_tocontext(tostring(b)) +end + +table .tocontext = t_tocontext +string .tocontext = s_tocontext +boolean.tocontext = b_tocontext + +function tocontext(first,...) + local t = type(first) + if t == "string" then + s_tocontext(first,...) + elseif t == "table" then + t_tocontext(first,...) + elseif t == "boolean" then + b_tocontext(first,...) + end +end |