summaryrefslogtreecommitdiff
path: root/mod/tex/context/third/rst/rst_context.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <gesang@stud.uni-heidelberg.de>2013-03-12 18:11:37 +0100
committerPhilipp Gesang <gesang@stud.uni-heidelberg.de>2013-03-12 18:11:37 +0100
commit942daebfbd9ce27aa5208411d58226100a1b2935 (patch)
treee6fc5900aba33189b9108c045360adf51c7f6056 /mod/tex/context/third/rst/rst_context.lua
parent4c8419ab61e06bfcc639cb731d9837d1159b5800 (diff)
downloadcontext-rst-942daebfbd9ce27aa5208411d58226100a1b2935.tar.gz
prototype for a “container” directive
Diffstat (limited to 'mod/tex/context/third/rst/rst_context.lua')
-rw-r--r--mod/tex/context/third/rst/rst_context.lua32
1 files changed, 17 insertions, 15 deletions
diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua
index b079730..a5fb603 100644
--- a/mod/tex/context/third/rst/rst_context.lua
+++ b/mod/tex/context/third/rst/rst_context.lua
@@ -18,11 +18,12 @@
local helpers = helpers or thirddata and thirddata.rst_helpers
local rst_directives = rst_directives or thirddata and thirddata.rst_directives
-local utf = unicode.utf8
-local utflen = utf.len
-local utflower = utf.lower
-local utfupper = utf.upper
-local iowrite = io.write
+local utf = unicode.utf8
+local utflen = utf.len
+local utflower = utf.lower
+local utfupper = utf.upper
+local iowrite = io.write
+local tableconcat = table.concat
local dbg_write = helpers.dbg_writef
@@ -381,7 +382,7 @@ do
end
function rst_context.joinindented (tab)
- return table.concat (tab, "")
+ return tableconcat (tab, "")
end
local corresponding = {
@@ -640,7 +641,7 @@ function rst_context.paragraph (data)
if not data then
return ""
elseif type(data) == "table" then
- str = #data > 1 and helpers.string.wrapat(inline_parser:match(table.concat(data, " ")), 65)
+ str = #data > 1 and helpers.string.wrapat(inline_parser:match(tableconcat(data, " ")), 65)
or inline_parser:match(data[1])
else
str = data
@@ -1245,7 +1246,7 @@ function rst_context.footnote (label, content)
end
function rst_context.substitution_definition (subtext, directive, data)
- data = table.concat(data, "\n")
+ data = tableconcat(data, "\n")
local rs = rst_context.substitutions
rs[subtext] = { directive = directive, data = data }
return ""
@@ -1253,12 +1254,13 @@ end
-- not to be confused with the directive definition table rst_directives
function rst_context.directive(directive, ...)
- local rd = rst_directives
- rst_context.addsetups("directive")
- local data = {...}
- local result = ""
- if rd[directive] then
- result = rd[directive](data)
+ local d = rst_directives[directive]
+ if d then
+ rst_context.addsetups("directive")
+ local data = {...}
+ local result = ""
+ result = d(data)
+ return result
end
- return result
+ return ""
end