Commits

Philipp Gesang committed a3b84d8

fix spurious global; workaround buffer idiosyncrasy in manual

Comments (0)

Files changed (6)

mod/doc/context/third/rst/documentation.rst

 .. |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

mod/scripts/context/lua/third/rst/mtx-t-rst.lua

 
 environment.loadluafile("rst_parser")
 
-local ea    = environment.argument
+local ea = environment.argument
 
 local helpinfo = [[
 ===============================================================

mod/tex/context/third/rst/rst_context.lua

 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 .."]}"
 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))

mod/tex/context/third/rst/rst_helpers.lua

                 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
             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
                 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())

mod/tex/context/third/rst/rst_parser.lua

 
 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
 
 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)
     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
 

mod/tex/context/third/rst/rst_setups.lua

 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