From 09dd07bcc2397ff03460d5e89f8125456c29e025 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 12 Mar 2013 17:05:16 +0100 Subject: fix spurious global; workaround buffer idiosyncrasy in manual --- mod/doc/context/third/rst/documentation.rst | 4 ++-- mod/scripts/context/lua/third/rst/mtx-t-rst.lua | 2 +- mod/tex/context/third/rst/rst_context.lua | 5 +++-- mod/tex/context/third/rst/rst_helpers.lua | 6 +++--- mod/tex/context/third/rst/rst_parser.lua | 8 +++++--- mod/tex/context/third/rst/rst_setups.lua | 1 + 6 files changed, 15 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/doc/context/third/rst/documentation.rst b/mod/doc/context/third/rst/documentation.rst index 90168a3..924aa7a 100644 --- a/mod/doc/context/third/rst/documentation.rst +++ b/mod/doc/context/third/rst/documentation.rst @@ -405,8 +405,8 @@ caption text of the image. .. |TEX| ctx:: \TeX .. |PDFTEX| ctx:: \PDFTEX .. |LUATEX| ctx:: \LUATEX -.. |rstcontext| ctx:: {\em rst}\kern.5pt\CONTEXT -.. |rst| ctx:: {\rm re}{\ss Structured}{\rm Text} +.. |rstcontext| ctx:: \bgroup\em rst\egroup\kern.5pt\CONTEXT +.. |rst| ctx:: \bgroup\rm re\egroup\bgroup\ss Structured\egroup\bgroup\rm Text\egroup .. |LATEX| ctx:: \LATEX .. _outline: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html diff --git a/mod/scripts/context/lua/third/rst/mtx-t-rst.lua b/mod/scripts/context/lua/third/rst/mtx-t-rst.lua index 08782a9..fc3b8e9 100644 --- a/mod/scripts/context/lua/third/rst/mtx-t-rst.lua +++ b/mod/scripts/context/lua/third/rst/mtx-t-rst.lua @@ -14,7 +14,7 @@ scripts.rst = { } environment.loadluafile("rst_parser") -local ea = environment.argument +local ea = environment.argument local helpinfo = [[ =============================================================== diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua index e7637b3..b079730 100644 --- a/mod/tex/context/third/rst/rst_context.lua +++ b/mod/tex/context/third/rst/rst_context.lua @@ -72,12 +72,13 @@ rst_context.current_footnote_number = 0 rst_context.current_symbolnote_number = 0 function rst_context.addsetups(item) + local state = thirddata.rst.state state.addme[item] = state.addme[item] or true return 0 end function rst_context.footnote_reference (label) - local tf = state.footnotes + local tf = thirddata.rst.state.footnotes if label:match("^%d+$") then -- all digits local c = tonumber(label) return [[\\footnote{\\getbuffer[__footnote_number_]].. c .."]}" @@ -1219,7 +1220,7 @@ function rst_context.simple_table(tab) end function rst_context.footnote (label, content) - local tf = state.footnotes + local tf = thirddata.rst.state.footnotes rst_context.addsetups("footnotes") if label:match("^%d+$") then -- all digits tf.numbered[tonumber(label)] = rst_context.escape(inline_parser:match(content)) diff --git a/mod/tex/context/third/rst/rst_helpers.lua b/mod/tex/context/third/rst/rst_helpers.lua index e90a55a..3ff53fe 100644 --- a/mod/tex/context/third/rst/rst_helpers.lua +++ b/mod/tex/context/third/rst/rst_helpers.lua @@ -515,7 +515,7 @@ do return false end - local trc = state.roman_cache + local trc = thirddata.rst.state.roman_cache n_str = trc[str] or nil n_old = trc[old] or nil if not n_str then @@ -549,7 +549,7 @@ do end - local trc = state.roman_cache + local trc = thirddata.rst.state.roman_cache n_str = trc[str] or nil n_old = trc[old] or nil if not n_str then @@ -578,7 +578,7 @@ do return false end - local trc = state.roman_cache + local trc = thirddata.rst.state.roman_cache n_str = trc[str] or nil if not n_str then n_str = roman_to_arab(str:lower()) diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua index 4e6db41..d0d8de9 100644 --- a/mod/tex/context/third/rst/rst_parser.lua +++ b/mod/tex/context/third/rst/rst_parser.lua @@ -70,7 +70,9 @@ local P, R, S, V, match local utf = unicode.utf8 -state = {} +local state = {} +thirddata.rst.state = state + state.depth = 0 state.bullets = {} -- mapping bullet forms to depth state.bullets.max = 0 @@ -1484,7 +1486,7 @@ end do local Cs, P = lpeg.Cs, lpeg.P - local percent = P"\%" + local percent = P"%" local eol = P"\n" local comment = percent * (1 - eol)^0 * eol / "\n" strip_comments = Cs((comment + 1)^0) @@ -1535,7 +1537,7 @@ function thirddata.rst.get_rst_inclusion (iname) if rst_inclusions[iname] then context.input(rst_inclusions[iname]) else - context(stringformat("{\\bf File for inclusion ā€œ%sā€ not found.}\par ", iname)) + context(stringformat([[{\bf File for inclusion ā€œ%sā€ not found.}\par ]], iname)) end end diff --git a/mod/tex/context/third/rst/rst_setups.lua b/mod/tex/context/third/rst/rst_setups.lua index ccf3967..93084d9 100644 --- a/mod/tex/context/third/rst/rst_setups.lua +++ b/mod/tex/context/third/rst/rst_setups.lua @@ -12,6 +12,7 @@ local optional_setups = { } thirddata.rst_setups = optional_setups local rst_directives = thirddata.rst_directives local rst_context = thirddata.rst +local state = rst_context.state local fmt = string.format local stringstrip = string.strip -- cgit v1.2.3