From 001738e26e1b841a4042b3597ba28d9c3d04aef6 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 28 Aug 2011 14:30:54 +0200 Subject: fixed solitary substitution bug (reported by Philipp A.) --- mod/tex/context/third/rst/rst_setups.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'mod/tex/context/third/rst/rst_setups.lua') diff --git a/mod/tex/context/third/rst/rst_setups.lua b/mod/tex/context/third/rst/rst_setups.lua index 7502621..08f21c5 100644 --- a/mod/tex/context/third/rst/rst_setups.lua +++ b/mod/tex/context/third/rst/rst_setups.lua @@ -8,12 +8,13 @@ -------------------------------------------------------------------------------- -- ---local rst_directives = context and thirddata.rst_directives or require "rst_directives" local optional_setups = { } thirddata.rst_setups = optional_setups local rst_directives = thirddata.rst_directives local rst_context = thirddata.rst - --rst_directives = require "rst_directives" + +local fmt = string.format +local stringstrip = string.strip function optional_setups.footnote_symbol () local setup = [[ @@ -42,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 @@ -95,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 @@ -125,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 -- cgit v1.2.3