summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/third/rst/rst_setups.lua')
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_setups.lua26
1 files changed, 12 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/context/third/rst/rst_setups.lua b/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
index b7bda950976..08f21c526ec 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
@@ -4,19 +4,17 @@
-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
-- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- CHANGED: 2011-05-08 17:55:37+0200
+-- CHANGED: 2011-08-28 13:47:24+0200
--------------------------------------------------------------------------------
--
---local rst_directives = context and thirddata.rst_directives or require "rst_directives"
local optional_setups = { }
-local rst_directives
-if context then
- thirddata.rst_setups = optional_setups
- rst_directives = thirddata.rst_directives
-else
- rst_directives = require "rst_directives"
-end
+thirddata.rst_setups = optional_setups
+local rst_directives = thirddata.rst_directives
+local rst_context = thirddata.rst
+
+local fmt = string.format
+local stringstrip = string.strip
function optional_setups.footnote_symbol ()
local setup = [[
@@ -45,13 +43,13 @@ function optional_setups.footnotes ()
]]
for nf, note in next, tf.numbered do
- fn = fn .. string.format(buffer, "Autonumbered footnote", "__footnote_number_"..nf, note)
+ fn = fn .. fmt(buffer, "Autonumbered footnote", "__footnote_number_"..nf, note)
end
for nf, note in next, tf.autolabel do
- fn = fn .. string.format(buffer, "Labeled footnote", "__footnote_label_"..nf, note)
+ fn = fn .. fmt(buffer, "Labeled footnote", "__footnote_label_"..nf, note)
end
for nf, note in next, tf.symbol do
- fn = fn .. string.format(buffer, "Symbol footnote", "__footnote_symbol_"..nf, note)
+ fn = fn .. fmt(buffer, "Symbol footnote", "__footnote_symbol_"..nf, note)
end
return fn
end
@@ -98,7 +96,7 @@ function optional_setups.references ()
if arefs[ref_text] then
ref_text = rst_context.anonymous_links[tonumber(arefs[ref_text])]
end
- references[#references+1] = string.format([[
+ references[#references+1] = fmt([[
\useURL[__target_%s] [%s] [] [%s] ]], rst_context.whitespace_to_underscore(ref), urlescape(target), ref_text)
end
end
@@ -128,7 +126,7 @@ function optional_setups.substitutions ()
local rs = rst_context.substitutions
for name, content in next, rs do
local directive, data = content.directive, content.data
- name, data = name:gsub("%s", ""), string.strip(data)
+ name, data = name:gsub("%s", ""), stringstrip(data)
if directives[directive] then
substitutions = substitutions .. directives[directive](name, data)
else