From 8d40fbb4fb8d57890cbf02013aa2344b9894c9f2 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 27 Mar 2013 00:24:28 +0100 Subject: cleanup; rewrite directives; update manual --- mod/tex/context/third/rst/rst_setups.lua | 74 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 37 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 64e9171..de70d4b 100644 --- a/mod/tex/context/third/rst/rst_setups.lua +++ b/mod/tex/context/third/rst/rst_setups.lua @@ -4,7 +4,7 @@ -- USAGE: called by rst_parser.lua -- DESCRIPTION: Complement to the reStructuredText parser -- AUTHOR: Philipp Gesang (Phg), --- CHANGED: 2012-06-05 22:17:10+0200 +-- CHANGED: 2013-03-26 23:55:20+0100 -------------------------------------------------------------------------------- -- @@ -14,14 +14,14 @@ local rst_directives = thirddata.rst_directives local rst_context = thirddata.rst local state = rst_context.state -local fmt = string.format -local stringstrip = string.strip +local stringformat = string.format +local stringstrip = string.strip function optional_setups.footnote_symbol () local setup = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Footnotes with symbol conversion % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \definenote[symbolnote][footnote] \setupnote [symbolnote][way=bypage,numberconversion=set 2] ]] @@ -32,9 +32,9 @@ function optional_setups.footnotes () local tf = state.footnotes local fn = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Footnotes % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% ]] local buffer = [[ @@ -44,13 +44,13 @@ function optional_setups.footnotes () ]] for nf, note in next, tf.numbered do - fn = fn .. fmt(buffer, "Autonumbered footnote", "__footnote_number_"..nf, note) + fn = fn .. stringformat(buffer, "Autonumbered footnote", "__footnote_number_"..nf, note) end for nf, note in next, tf.autolabel do - fn = fn .. fmt(buffer, "Labeled footnote", "__footnote_label_"..nf, note) + fn = fn .. stringformat(buffer, "Labeled footnote", "__footnote_label_"..nf, note) end for nf, note in next, tf.symbol do - fn = fn .. fmt(buffer, "Symbol footnote", "__footnote_symbol_"..nf, note) + fn = fn .. stringformat(buffer, "Symbol footnote", "__footnote_symbol_"..nf, note) end return fn end @@ -82,9 +82,9 @@ function optional_setups.references () local refsection = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % References % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% ]] local references = {} @@ -97,7 +97,7 @@ function optional_setups.references () if arefs[ref_text] then ref_text = rst_context.anonymous_links[tonumber(arefs[ref_text])] end - references[#references+1] = fmt([[ + references[#references+1] = stringformat([[ \useURL[__target_%s] [%s] [] [%s] ]], rst_context.whitespace_to_underscore(ref), urlescape(target), ref_text) end end @@ -120,9 +120,9 @@ function optional_setups.substitutions () local directives = rst_directives local substitutions = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Substitutions % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% ]] local rs = rst_context.substitutions for name, content in next, rs do @@ -141,9 +141,9 @@ end function optional_setups.directive () --local dirstr = [[ ---%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +--%---------------------------------------------------------------% --% Directives % ---%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +--%---------------------------------------------------------------% --]] --return dirstr return "" @@ -152,9 +152,9 @@ end function optional_setups.blockquote () return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Blockquotes % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \setupdelimitedtext [blockquote][style={\tfx}] % awful placeholder \definedelimitedtext[attribution][blockquote] \setupdelimitedtext [attribution][style={\tfx\it}] @@ -164,9 +164,9 @@ end function optional_setups.deflist () return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Definitionlist % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \def\startRSTdefinitionlist{ \bgroup \def \RSTdeflistterm##1{{\bf ##1}} @@ -189,9 +189,9 @@ end function optional_setups.lines () return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Lines environment (line blocks) % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \setuplines[% space=on,% @@ -204,9 +204,9 @@ end function optional_setups.breaks () return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Fancy transitions % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Get Wolfgang’s module at . \usemodule[fancybreak] @@ -217,9 +217,9 @@ end function optional_setups.fieldlist () return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Fieldlists % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \def\startRSTfieldlist{% \bgroup% @@ -252,9 +252,9 @@ function optional_setups.dbend () -- There's just no reason for not providing this. optional_setups.dbend_done = true return [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Dangerous bend % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \loadmapfile [manfnt.map] \definefontsynonym [bends] [manfnt] @@ -278,9 +278,9 @@ function optional_setups.caution () --result = result .. optional_setups.dbend() --end return result .. [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Caution directive % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \usemodule[lettrine] @@ -310,9 +310,9 @@ function optional_setups.danger () --result = result .. optional_setups.dbend() --end return result .. [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Danger directive % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \usemodule[lettrine] @@ -329,9 +329,9 @@ end function optional_setups.citations () local cit = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Citations % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \setupbibtex[database=\jobname] ]] @@ -341,9 +341,9 @@ end function optional_setups.citator () local cit = [[ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% % Citator Options % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%---------------------------------------------------------------% \usemodule[citator] \loadbibdb{\jobname.bib} \setupcitator[sortmode=authoryear] -- cgit v1.2.3