diff options
author | Marius <mariausol@gmail.com> | 2010-11-20 00:20:11 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-11-20 00:20:11 +0200 |
commit | b4b58bbfe882406b09b2548e7aa55d238987f894 (patch) | |
tree | 346fdd16f41f0d24406a64e7167d4dade8e1b325 /tex/context/base/cldf-ver.lua | |
parent | c59707ed27b62aa6d05dccba192d134de4ec24f6 (diff) | |
download | context-b4b58bbfe882406b09b2548e7aa55d238987f894.tar.gz |
beta 2010.11.19 22:50
Diffstat (limited to 'tex/context/base/cldf-ver.lua')
-rw-r--r-- | tex/context/base/cldf-ver.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tex/context/base/cldf-ver.lua b/tex/context/base/cldf-ver.lua index 390ffa04e..12b5479b7 100644 --- a/tex/context/base/cldf-ver.lua +++ b/tex/context/base/cldf-ver.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['cldf-ver'] = { } local concat, tohandle = table.concat, table.tohandle +local splitlines = string.splitlines local tostring, type = tostring, type local context = context @@ -18,7 +19,7 @@ end local function t_tocontext(...) context.starttyping { "typing" } -- else [1] is intercepted context.pushcatcodes("verbatim") - tohandle(flush,...) + tohandle(flush,...) -- ok? context.stoptyping() context.popcatcodes() end @@ -50,3 +51,21 @@ function tocontext(first,...) b_tocontext(first,...) end end + +function context.tobuffer(name,str) + context.startbuffer { name } + context.pushcatcodes("verbatim") + local lines = type(str) == "string" and splitlines(str) or str + for i=1,#lines do + context(lines[i] .. " ") + end + context.stopbuffer() + context.popcatcodes() +end + +function context.tolines(str) + local lines = type(str) == "string" and splitlines(str) or str + for i=1,#lines do + context(lines[i] .. " ") + end +end |