From 942daebfbd9ce27aa5208411d58226100a1b2935 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 12 Mar 2013 18:11:37 +0100 Subject: =?UTF-8?q?prototype=20for=20a=20=E2=80=9Ccontainer=E2=80=9D=20dir?= =?UTF-8?q?ective?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mod/tex/context/third/rst/rst_context.lua | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'mod/tex/context/third/rst/rst_context.lua') 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 -- cgit v1.2.3