summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-07-29 17:10:07 +0000
committerKarl Berry <karl@freefriends.org>2012-07-29 17:10:07 +0000
commitc8454de77c687a7d1556434032f9461862f1a02b (patch)
treee63752fd87560bda17147ec416680bf5ba672248 /Master
parentb158cfe399c46202ccea23ba5b628ed582e78b50 (diff)
context-rst (6jun12)
git-svn-id: svn://tug.org/texlive/trunk@27236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/context/third/rst/COPYING2
-rw-r--r--Master/texmf-dist/doc/context/third/rst/README.rst9
-rw-r--r--Master/texmf-dist/doc/context/third/rst/manual.pdfbin112951 -> 120193 bytes
-rw-r--r--Master/texmf-dist/doc/context/third/rst/manual.tex88
-rw-r--r--Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua2
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_context.lua138
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_directives.lua43
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_helpers.lua40
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_parser.lua57
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_setups.lua4
10 files changed, 225 insertions, 158 deletions
diff --git a/Master/texmf-dist/doc/context/third/rst/COPYING b/Master/texmf-dist/doc/context/third/rst/COPYING
index 05f08de1457..6d4166538b7 100644
--- a/Master/texmf-dist/doc/context/third/rst/COPYING
+++ b/Master/texmf-dist/doc/context/third/rst/COPYING
@@ -1,4 +1,4 @@
-Copyright 2010-2011 Philipp Gesang. All rights reserved.
+Copyright 2010-2012 Philipp Gesang. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/Master/texmf-dist/doc/context/third/rst/README.rst b/Master/texmf-dist/doc/context/third/rst/README.rst
index 1ab41ce94e8..8c0e6fd75db 100644
--- a/Master/texmf-dist/doc/context/third/rst/README.rst
+++ b/Master/texmf-dist/doc/context/third/rst/README.rst
@@ -4,8 +4,8 @@ General Advice
Read the section *Features Not Implemented* in the manual first.
-*Note*: if you happen to read this on BitBucket, the error messages some lines
-below just mean that *their* implementation doesn’t understand TeX directives.
+*Note*: if you happen to read this on BitBucket_, the error messages some lines
+below just mean that *their* implementation doesn’t understand |TeX| directives.
Don’t worry, |rstcontext| does.
============
@@ -57,12 +57,13 @@ the maintainer_ (Contact_).
Contact
=======
-|rstcontext| was written by Philipp Gesang, ``megas.kapaneus`` at ``gmail`` dot
+|rstcontext| was written by Philipp Gesang, ``phg42.2a`` at ``gmail`` dot
``com`` (find me on BitBucket_).
.. |rstcontext| ctx:: {{\em rst}\kern.5pt\CONTEXT}
+.. |TeX| ctx:: {\TEX}
.. |CONTEXT| ctx:: {\CONTEXT}
-.. _Contact: megas.kapaneus@gmail.com
+.. _Contact: phg42.2a@gmail.com
.. _BitBucket: http://bitbucket.org/phg
.. _maintainer: Contact_
diff --git a/Master/texmf-dist/doc/context/third/rst/manual.pdf b/Master/texmf-dist/doc/context/third/rst/manual.pdf
index de331b5fed5..60e26dd060b 100644
--- a/Master/texmf-dist/doc/context/third/rst/manual.pdf
+++ b/Master/texmf-dist/doc/context/third/rst/manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/third/rst/manual.tex b/Master/texmf-dist/doc/context/third/rst/manual.tex
index 460051b69c3..cbb0382d968 100644
--- a/Master/texmf-dist/doc/context/third/rst/manual.tex
+++ b/Master/texmf-dist/doc/context/third/rst/manual.tex
@@ -1,8 +1,13 @@
-\usemodule[bib]
-
\setuppapersize[A5][A5]
-\setupcombinedlist[content][interaction=all,focus=standard]
+\setupcombinedlist[content][interaction=all,]
+
+\setupinteraction[
+ state=start,
+ focus=standard,
+ color=darkcyan,
+ contrastcolor=\interactionparameter{color},
+]
\setupindenting[yes,next,medium] % -> lead to the glue node error in mkiv
@@ -13,7 +18,16 @@
\setupheads[indentnext=yes]
\setupfloats[indentnext=yes]
-\setupbodyfont[10pt]
+\setupbodyfont[latin-modern,10pt]
+\definefontfeature [textfigures] [onum=yes]
+\definefontfeature [liningfigures] [onum=no]
+\definefontfeature [texligatures] [tlig=yes]
+\definefontfeature [notexligatures] [tlig=yes]
+\addfs{textfigures,texligatures}
+
+\setuptyping[
+ style={\addff{liningfigures,notexligatures}\ttx},
+]
% title page
\startbuffer[frontpage]
@@ -38,10 +52,10 @@
\startstandardmakeup
\vfill
\framed [align=right,frame=off,topframe=on] {%
-\tfxx\ss\setupinterlinespace[small]
-Copyright 2010--2011 by Philipp Gesang, Dossenheim.\par
-Mail any patches or suggestions to\par
-\type{string.format("%s@%s.com", "megas.kapaneus", "gmail")}\par
+\tfxx\ss\setupinterlinespace[small]\noindentation
+Copyright 2010--2012 by Philipp Gesang, Heidelberg.\par
+Mail any bug reports, patches or suggestions to\par
+\type{string.format("%s@%s.com", "phg42.2a", "gmail")}\par
or pay a visit to \goto{my BitBucket home}[url(http://bitbucket.org/phg/)].\par
}
\stopstandardmakeup
@@ -49,17 +63,51 @@ or pay a visit to \goto{my BitBucket home}[url(http://bitbucket.org/phg/)].\par
% table of contents
-\startbuffer[toc]
-\setuppagenumbering[state=start,alternative=doublesided,location=]
-\setupheadertexts
- [{\tfx\sc\getmarking[chapter]}] [{\tfx\bf \pagenumber}]
- [{\tfx\bf \pagenumber}] [{\tfx{\em rst}{\kern.5pt\CONTEXT}}]
-\completecontent
+\startbuffer [toc]
+\setuppagenumbering[
+ state=start,
+ alternative=doublesided,
+ location=,
+]
+\setuplayout [grid=no]
+\setuptolerance [verytolerant]
+\setuptolerance [vertical,verytolerant]
+
+\newdimen \mypagenumdistance \mypagenumdistance .7em
+\def\fillercmd{\nobreak\hskip\mypagenumdistance}
+
+\definelistplacement[my_list_placement][command]#1#2#3%
+ {#2\fillercmd#3\hskip1.5em}
+
+\setuplist [chapter] [alternative=a,style=\word\sc]
+\setuplist [section] [alternative=my_list_placement,]
+
+\startsetups toc:subsection
+ \noindentation\placelist[subsection]
+\stopsetups
+
+\startsetups toc:section
+ \blank
+ \setupnarrower [middle=9em,]
+ \startnarrower[middle]\tfx
+ \noindentation\placelist[section][after=\setups{toc:subsection}]
+ \stopnarrower
+ \blank
+\stopsetups
+
+\title{Contents}
+
+\placelist [chapter] [criterium=text,after=\setups{toc:section}]
+
+% \setupheadertexts
+% [{\tfx\sc\getmarking[chapter]}] [{\tfx\bf \pagenumber}]
+% [{\tfx\bf \pagenumber}] [{\tfx{\em rst}{\kern.5pt\CONTEXT}}]
+% \completecontent
\stopbuffer
% something radically changed in mkiv
\startluacode
-jobvariables = jobvariables or {}
+jobvariables = job.variables or {}
jobvariables.tobesaved = jobvariables.tobesaved or {}
\stopluacode
@@ -72,9 +120,13 @@ jobvariables.tobesaved = jobvariables.tobesaved or {}
\completepublications
\stopbuffer
-\appendtoks \getbuffer[frontpage] \to \everystarttext
-\appendtoks \getbuffer[author] \to \everystarttext
-\appendtoks \getbuffer[toc] \to \everystarttext
+\appendtoks
+ \startfrontmatter
+ \getbuffer[frontpage]
+ \getbuffer[author]
+ \getbuffer[toc]
+ \stopfrontmatter
+\to \everystarttext
%\prependtoks \getbuffer[pubs] \to \everystoptext
diff --git a/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua b/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua
index c7aa459bc75..08782a9a8d3 100644
--- a/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua
+++ b/Master/texmf-dist/scripts/context/lua/third/rst/mtx-t-rst.lua
@@ -43,7 +43,7 @@ Optional arguments:
local application = logs.application {
name = "mtx-rst",
- banner = "The reStructuredText module for ConTeXt, hg-rev 135+",
+ banner = "The reStructuredText module for ConTeXt, hg-rev 125+",
helpinfo = helpinfo,
}
diff --git a/Master/texmf-dist/tex/context/third/rst/rst_context.lua b/Master/texmf-dist/tex/context/third/rst/rst_context.lua
index 6a5aa05daaf..e7637b3bf52 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_context.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_context.lua
@@ -3,16 +3,16 @@
-- FILE: rst_context.lua
-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- CHANGED: 2011-08-28 13:46:46+0200
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
+-- CHANGED: 2012-06-05 22:18:11+0200
--------------------------------------------------------------------------------
--
--- TODO
--- - Find an appropriate way to handle generic tables irrespective of the grid
--- settings. The problem is:
--- http://archive.contextgarden.net/message/20100912.112605.8a1aaf13.en.html
--- Seems we'll have to choose either the grid or split tables as default. Not
--- good.
+--- Find an appropriate way to handle generic tables irrespective of the grid
+--- settings. The problem is:
+--- http://archive.contextgarden.net/message/20100912.112605.8a1aaf13.en.html
+--- Seems we'll have to choose either the grid or split tables as default. Not
+--- good.
local helpers = helpers or thirddata and thirddata.rst_helpers
@@ -26,8 +26,10 @@ local iowrite = io.write
local dbg_write = helpers.dbg_writef
-local C, Cb, Cc, Cg, Cmt, Cp, Cs, Ct, P, R, S, V, match =
- lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match
+local C, Cb, Cc, Cg, Cmt, Cp,
+ Cs, Ct, P, R, S, V, match
+ = lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp,
+ lpeg.Cs, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match
-- This one should ignore escaped spaces.
do
@@ -40,10 +42,10 @@ do
}
function string.strip(str)
return stripper:match(str) or ""
- end
+ end
end
-local stringstrip = string.strip
-local fmt = string.format
+local stringstrip = string.strip
+local stringformat = string.format
local err = function(str)
if str then
@@ -106,8 +108,8 @@ do
end
end
--- So we can use crefs[n][2] to refer to the place where the reference was
--- created.
+--- So we can use crefs[n][2] to refer to the place where the reference was
+--- created.
local function get_context_reference (str)
local crefs = rst_context.context_references
local srefs = rst_context.structure_references
@@ -164,9 +166,9 @@ rst_context.roles.color = function(color, str)
local definition = color:match("^color_(.+)$")
if definition:match("^rgb_") then -- assume rgb
local rgb = p.rgbvalues:match(definition)
- definition = fmt([[r=%s,g=%s,b=%s]], rgb[1], rgb[2], rgb[3])
+ definition = stringformat([[r=%s,g=%s,b=%s]], rgb[1], rgb[2], rgb[3])
end
- return fmt([[\\colored[%s]{%s}]], definition, str)
+ return stringformat([[\\colored[%s]{%s}]], definition, str)
end
--------------------------------------------------------------------------------
@@ -195,7 +197,7 @@ end
-- wrong if you can! Or go tell those digital publishers and their willing
-- subordinates, the authors, who think they can save a few pennys,
-- substituting the typesetter and editor by some fancy software. Keep in mind
--- that zapf.tex is not just random dummy text. Now, where was I?
+-- that zapf.tex is not just random dummy text. </rant>
function rst_context.roles.ctsh(str) -- shorthand
rst_context.addsetups("citator")
@@ -283,7 +285,7 @@ function rst_context.anon_reference (str)
str = str:match("^`?([^`]+)`?__$")
rst_context.anonymous_links[#rst_context.anonymous_links+1] = str
link = "__target_anon_" .. #rst_context.anonymous_links
- return fmt([[\\RSTchoosegoto{%s}{%s}]], link, str)
+ return stringformat([[\\RSTchoosegoto{%s}{%s}]], link, str)
end
local whitespace = S" \n\t\v"
@@ -368,7 +370,7 @@ do
skip2 = P"\\type" * V"balanced",
skip3 = P"\\mathematics" * V"balanced",
skip = V"skip1" + V"skip2" + V"skip3",
- --literal = Cs(P"\\" / "") * 1
+ --literal = Cs(P"\\" / "") * 1
}
function rst_context.escape (str)
@@ -393,13 +395,13 @@ local corresponding = {
local inline_parser = P{
[1] = "block",
- block = Cs(V"inline_as_first"^-1 * (V"except" + V"inline_element" + 1)^0),
+ block = Cs(V"inline_as_first"^-1 * (V"except" + V"inline_element" + V"normal_char")^0),
inline_element = V"precede_inline"
- * Cs(V"inline_do_elements")
- * #V"succede_inline"
- + V"footnote_reference"
- ,
+ * Cs(V"inline_do_elements")
+ * #V"succede_inline"
+ + V"footnote_reference"
+ ,
-- Ugly but needed in case the first element of a paragraph is inline
-- formatted.
@@ -410,15 +412,15 @@ local inline_parser = P{
,
inline_do_elements = V"strong_emphasis"
- + V"substitution_reference"
- + V"anon_reference"
- + V"inline_literal"
- + V"reference"
- + V"emphasis"
- + V"interpreted_text"
- + V"inline_internal_target"
- + V"link_standalone"
- ,
+ + V"substitution_reference"
+ + V"anon_reference"
+ + V"inline_literal"
+ + V"reference"
+ + V"emphasis"
+ + V"interpreted_text"
+ + V"inline_internal_target"
+ + V"link_standalone"
+ ,
precede_inline = V"spacing"
+ V"eol"
@@ -489,15 +491,19 @@ local inline_parser = P{
lparenthesis = P"(",
rparenthesis = P")",
- lsquare = P"[",
- rsquare = P"]",
- lbrace = P"{",
- rbrace = P"}",
+ lsquare = P"[" / [[{\\letterleftbracket}]],
+ rsquare = P"]" / [[{\\letterrightbracket}]],
+ lbrace = P"{" / [[{\\letterleftbrace}]],
+ rbrace = P"}" / [[{\\letterrightbrace}]],
less = P"<",
greater = P">",
leftpar = V"lparenthesis" + V"lsquare" + V"lbrace" + V"less",
rightpar = V"rparenthesis" + V"rsquare" + V"rbrace" + V"greater",
+ normal_char = V"lbrace" + V"rbrace" + V"lsquare" + V"rsquare" -- escape those if in input
+ + 1
+ ,
+
--groupchars = S"()[]{}",
groupchars = V"leftpar" + V"rightpar",
apostrophe = P"’" + P"'",
@@ -512,47 +518,47 @@ local inline_parser = P{
letter = R"az" + R"AZ",
punctuation = V"apostrophe"
- + V"colon"
- + V"comma"
+ + V"colon"
+ + V"comma"
+ V"dashes"
- + V"dot"
+ + V"dot"
+ V"ellipsis"
+ V"exclamationmark"
+ V"guillemets"
+ V"hyphen"
+ V"interpunct"
+ V"interrobang"
- + V"questionmark"
+ + V"questionmark"
+ V"quotationmarks"
- + V"semicolon"
+ + V"semicolon"
+ V"slash"
+ V"solidus"
+ V"underscore"
,
- emphasis = (V"asterisk" - V"double_asterisk")
- * Cs((1 - V"spacing" - V"eol" - V"asterisk")
- * ((1 - (1 * V"asterisk"))^0
- * (1 - V"spacing" - V"eol" - V"asterisk"))^-1)
- * V"asterisk"
+ emphasis = (V"asterisk" - V"double_asterisk")
+ * Cs((V"normal_char" - V"spacing" - V"eol" - V"asterisk")
+ * ((V"normal_char" - (V"normal_char" * V"asterisk"))^0
+ * (V"normal_char" - V"spacing" - V"eol" - V"asterisk"))^-1)
+ * V"asterisk"
/ rst_context.emphasis,
- strong_emphasis = V"double_asterisk"
- * Cs((1 - V"spacing" - V"eol" - V"asterisk")
- * ((1 - (1 * V"double_asterisk"))^0
- * (1 - V"spacing" - V"eol" - V"asterisk"))^-1)
- * V"double_asterisk"
+ strong_emphasis = V"double_asterisk"
+ * Cs((V"normal_char" - V"spacing" - V"eol" - V"asterisk")
+ * ((V"normal_char" - (V"normal_char" * V"double_asterisk"))^0
+ * (V"normal_char" - V"spacing" - V"eol" - V"asterisk"))^-1)
+ * V"double_asterisk"
/ rst_context.strong_emphasis,
inline_literal = V"double_bareia"
* C ((V"escaped_bareia" - V"spacing" - V"eol" - V"bareia")
- * ((V"escaped_bareia" - (1 * V"double_bareia"))^0
+ * ((V"escaped_bareia" - (V"normal_char" * V"double_bareia"))^0
* (V"escaped_bareia" - V"spacing" - V"eol" - V"bareia"))^-1)
* V"double_bareia"
/ rst_context.literal,
- interpreted_single_char = (1 - V"spacing" - V"eol" - V"bareia") * #V"bareia",
- interpreted_multi_char = (1 - V"spacing" - V"eol" - V"bareia") * (1 - (1 * V"bareia"))^0 * (1 - V"spacing" - V"eol" - V"bareia"),
+ interpreted_single_char = (V"normal_char" - V"spacing" - V"eol" - V"bareia") * #V"bareia",
+ interpreted_multi_char = (V"normal_char" - V"spacing" - V"eol" - V"bareia") * (V"normal_char" - (1 * V"bareia"))^0 * (1 - V"spacing" - V"eol" - V"bareia"),
interpreted_text = C(V"role_marker"^-1)
* (V"bareia" - V"double_bareia")
@@ -586,9 +592,9 @@ local inline_parser = P{
* V"bareia" * V"underscore"
,
- footnote_reference = V"lsquare"
- * Cs(V"footnote_label" + V"citation_reference_label")
- * V"rsquare"
+ footnote_reference = V"lsquare"
+ * Cs(V"footnote_label" + V"citation_reference_label")
+ * V"rsquare"
* V"underscore"
/ rst_context.footnote_reference
,
@@ -638,7 +644,7 @@ function rst_context.paragraph (data)
else
str = data
end
- return fmt([[
+ return stringformat([[
\\startparagraph
%s
@@ -688,7 +694,7 @@ function rst_context.section (...) -- TODO general cleanup; move validity
ref = get_context_reference (str)
- str = fmt("\n\\\\%s[%s]{%s}\n", sectionlevels[level], ref, str)
+ str = stringformat("\n\\\\%s[%s]{%s}\n", sectionlevels[level], ref, str)
else
return [[{\\bf fix your sectioning!}\\endgraf}]]
end
@@ -811,7 +817,7 @@ function rst_context.bullet_item (tab)
-- just leave it alone
elseif helpers.list.greater(itemtype, li[current_itemdepth]) then
local itemnum = tonumber(stringstrip(itemtype)) or helpers.list.get_decimal(itemtype)
- result = result .. fmt([[
+ result = result .. stringformat([[
\\setnumber[itemgroup:itemize]{%s}
]], itemnum)
end
@@ -894,7 +900,7 @@ end
function rst_context.field (tab)
local name, body = tab[1], tab[2]
- return fmt([[
+ return stringformat([[
\\RSTfieldname{%s}
\\RSTfieldbody{%s}
@@ -906,7 +912,7 @@ function rst_context.line_comment (str)
end
function rst_context.block_comment (str)
- return fmt([[
+ return stringformat([[
\iffalse %% start block comment
%s\fi %% stop block comment
@@ -934,7 +940,7 @@ function rst_context.option_list (str)
end
function rst_context.option_item (tab)
- return fmt([[\\bTR\\bTC %s \\eTC\\bTC %s \\eTC\\eTR
+ return stringformat([[\\bTR\\bTC %s \\eTC\\bTC %s \\eTC\\eTR
]], tab[1], tab[2])
end
@@ -1160,7 +1166,7 @@ function rst_context.simple_table(tab)
dbg_write("%7s | ", cell.content)
local celltext = inline_parser:match(cell.content)
if cell.span then
- head = head .. fmt([=[\\bTH[nc=%s]%s\\eTH]=], cell.span.x, celltext or "")
+ head = head .. stringformat([=[\\bTH[nc=%s]%s\\eTH]=], cell.span.x, celltext or "")
else
head = head .. [[\\bTH ]] .. celltext .. [[\\eTH]]
end
@@ -1199,7 +1205,7 @@ function rst_context.simple_table(tab)
dbg_write("%7s | ", cell.content)
local celltext = inline_parser:match(cell.content)
if cell.span then
- body = body .. fmt([=[\\bTC[nc=%s]%s\\eTC]=], cell.span.x, celltext or "")
+ body = body .. stringformat([=[\\bTC[nc=%s]%s\\eTC]=], cell.span.x, celltext or "")
else
body = body .. [[\\bTC ]] .. celltext .. [[\\eTC]]
end
diff --git a/Master/texmf-dist/tex/context/third/rst/rst_directives.lua b/Master/texmf-dist/tex/context/third/rst/rst_directives.lua
index 96eaf591fa5..78b184c91a4 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_directives.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_directives.lua
@@ -3,8 +3,8 @@
-- FILE: rst_directives.lua
-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- CHANGED: 2011-08-28 13:47:00+0200
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
+-- CHANGED: 2012-06-05 22:17:51+0200
--------------------------------------------------------------------------------
--
@@ -18,8 +18,8 @@ local rst_directives = { }
thirddata.rst_directives = rst_directives
local rst_context = thirddata.rst
-local stringstrip = string.strip
-local fmt = string.format
+local stringstrip = string.strip
+local stringformat = string.format
rst_directives.anonymous = 0
rst_directives.images = {}
@@ -108,19 +108,19 @@ rst_directives.image = function(name, data)
local images_done = rd.images.done
if not anon then
if not images_done[name] then
- img = img .. fmt([[
+ img = img .. stringformat([[
\useexternalfigure[%s][%s][]
]], name, data)
images_done[name] = true
end
- img = img .. fmt([[
+ img = img .. stringformat([[
\def\RSTsubstitution%s{%%
\placefigure[here]{%s}{\externalfigure[%s]%s}
}
]], name, rst_context.escape(inline_parser:match(properties.caption)), name, properties.setup)
else -- image won't be referenced but used instantly
- img = img .. fmt([[
+ img = img .. stringformat([[
\placefigure[here]{%s}{\externalfigure[%s]%s}
]], rst_context.escape(inline_parser:match(properties.caption)), data, properties.setup)
@@ -145,7 +145,7 @@ rst_directives.caution = function(raw)
end
end
text = rst_context.escape(helpers.string.wrapat(inline_parser:match(text)))
- return fmt([[
+ return stringformat([[
\startRSTcaution
%s
\stopRSTcaution
@@ -169,7 +169,7 @@ rst_directives.danger = function(raw)
end
end
text = rst_context.escape(helpers.string.wrapat(inline_parser:match(text)))
- return fmt([[
+ return stringformat([[
\startRSTdanger
%s
\stopRSTdanger
@@ -182,7 +182,7 @@ rst_directives.DANGER = function(addendum)
for _,str in ipairs(addendum) do
result = result .. (stringstrip(str))
end
- return fmt([[
+ return stringformat([[
%% The Rabbit of Caerbannog
\startlinecorrection
@@ -213,12 +213,12 @@ rst_directives.DANGER = function(addendum)
end
rst_directives.mp = function(name, data)
- local mpcode = fmt([[
+ local mpcode = stringformat([[
\startreusableMPgraphic{%s}
%s
\stopreusableMPgraphic
]], name, data)
- mpcode = mpcode .. fmt([[
+ mpcode = mpcode .. stringformat([[
\def\RSTsubstitution%s{%%
\reuseMPgraphic{%s}%%
}
@@ -226,28 +226,31 @@ rst_directives.mp = function(name, data)
return mpcode
end
+--- There’s an issue with buffers leaving trailing spaces due to their
+--- implementation.
+--- http://archive.contextgarden.net/message/20111108.175913.1d994624.en.html
rst_directives.ctx = function(name, data)
- local ctx = fmt([[
+ local ctx = stringformat([[
-\startbuffer[%s]
+\startbuffer[%s]%%
%s\stopbuffer
\def\RSTsubstitution%s{%%
- \getbuffer[%s]%%
+ \getbuffer[%s]\removeunwantedspaces%%
}
]], name, data, name, name)
return ctx
end
rst_directives.lua = function(name, data)
- local luacode = fmt([[
+ local luacode = stringformat([[
-\startbuffer[%s]
+\startbuffer[%s]%%
\startluacode
%s
\stopluacode
\stopbuffer
\def\RSTsubstitution%s{%%
- \getbuffer[%s]%%
+ \getbuffer[%s]\removeunwantedspaces%%
}
]], name, data, name, name)
return luacode
@@ -270,7 +273,7 @@ rst_directives.math = function (name, data)
i = i + 1
end
end
- return fmt([[
+ return stringformat([[
\startformula
%s
\stopformula
@@ -282,7 +285,7 @@ end
--------------------------------------------------------------------------------
rst_directives.replace = function(name, data)
- return fmt([[
+ return stringformat([[
\def\RSTsubstitution%s{%s}
]], name, data)
diff --git a/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua b/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua
index 9f388c100d1..e90a55a857a 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_helpers.lua
@@ -3,16 +3,18 @@
-- FILE: rst_helpers.lua
-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- CHANGED: 2011-08-28 13:47:07+0200
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
+-- CHANGED: 2012-06-05 22:17:31+0200
--------------------------------------------------------------------------------
--
local P, R, S, V, match
= lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match
-local C, Carg, Cb, Cc, Cg, Cmt, Cp, Cs, Ct
- = lpeg.C, lpeg.Carg, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct
+local C, Carg, Cb, Cc, Cg,
+ Cmt, Cp, Cs, Ct
+ = lpeg.C, lpeg.Carg, lpeg.Cb, lpeg.Cc, lpeg.Cg,
+ lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct
local helpers
helpers = thirddata.rst_helpers
@@ -22,12 +24,12 @@ helpers.cell = {}
local utf = unicode.utf8
local utflen = utf.len
-local stringstrip = string.strip
-local fmt = string.format
+local stringstrip = string.strip
+local stringformat = string.format
function helpers.dbg_writef(...)
if helpers.rst_debug then
- io.write(fmt(...))
+ io.write(stringformat(...))
end
end
@@ -69,14 +71,14 @@ do
[1] = "cells",
cells = p.celldelim
* (C(V"in_cell")
- * (V"matchwidth" * C(V"in_cell")) ^1),
+ * (V"matchwidth" * C(V"in_cell"))^1),
in_cell = p.cellcontent^1
+ (p.dash - p.cellcontent)^1,
matchwidth = Cmt(C(p.celldelim) * Carg(1), function(s,i,del, layout)
local pos = 1
- local lw = layout.widths
+ local lw = layout.widths
for n=1, #lw do
pos = pos + lw[n] + 1
if (i - 1) == pos then return true end
@@ -166,14 +168,14 @@ end
function helpers.table.create(raw)
local newtab = {}
- newtab.rows = {}
+ newtab.rows = {}
newtab.layout = set_layout(raw[1])
local p = helpers.patterns
newtab.resolve_parent = function(row, col, array)
local array = array or newtab.rows
- local cell = array[row][col]
+ local cell = array[row][col]
local par_row, par_col = row, col
if cell.parent then
par_row, par_col = newtab.resolve_parent(cell.parent.y, cell.parent.x)
@@ -592,9 +594,9 @@ end
helpers.string = {}
do
- -- This grammar inside the function is slightly faster than the same as an upvalue
- -- with the value of “width” repeatedly given via lpeg.Carg(). This holds
- -- for repeated calls as well.
+ --- This grammar inside the function is slightly faster than the
+ --- same as an upvalue with the value of “width” repeatedly given
+ --- via lpeg.Carg(). This holds for repeated calls as well.
local ulen = utflen
function helpers.string.wrapat (str, width)
local width = width or 65
@@ -608,11 +610,11 @@ do
typing = P[[\\type{]] * (1 - P"}")^0 * P"}",
typingenv = P[[\\starttyping]] * (1 - P[[\\stoptyping]])^0 * P[[\\stoptyping]],
ignore = V"typing" + V"typingenv",
- -- the initial whitespace of the “other” pattern must not be
- -- enforced (“^1”) as it will break the exceptions (“ignore”
- -- pattern)! In general it is better to have the wrapper ignore some
- -- valid breaks than to not have it matching some valid strings at
- -- all.
+ --- the initial whitespace of the “other” pattern must not
+ --- be enforced (“^1”) as it will break the exceptions
+ --- (“ignore” pattern)! In general it is better to have the
+ --- wrapper ignore some valid breaks than to not have it
+ --- matching some valid strings at all.
other = Cmt(V"whitespace"^0 * (V"ignore" + (1 - V"whitespace")^1), function(s,i,w)
linelength = linelength + ulen(w)
return true
diff --git a/Master/texmf-dist/tex/context/third/rst/rst_parser.lua b/Master/texmf-dist/tex/context/third/rst/rst_parser.lua
index 9735635e6fe..4e6db410d1d 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_parser.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_parser.lua
@@ -3,9 +3,9 @@
-- FILE: rst_parser.lua
-- USAGE: refer to doc/documentation.rst
-- DESCRIPTION: https://bitbucket.org/phg/context-rst/overview
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
-- VERSION: 0.5
--- CHANGED: 2011-08-28 22:29:33+0200
+-- CHANGED: 2012-06-05 22:17:18+0200
--------------------------------------------------------------------------------
--
@@ -23,18 +23,18 @@ local rst = thirddata.rst
local helpers = thirddata.rst_helpers
local optional_setups = thirddata.rst_setups
-rst.strip_BOM = false
-rst.expandtab = false
+rst.strip_BOM = true
+rst.expandtab = true
rst.shiftwidth = 4
rst.crlf = true
helpers.rst_debug = false
-local iowrite = io.write
-local fmt = string.format
-local stringlen = string.len
-local stringstrip = string.strip
-local utf = unicode.utf8
-local utflen = utf.len
+local iowrite = io.write
+local stringformat = string.format
+local stringlen = string.len
+local stringstrip = string.strip
+local utf = unicode.utf8
+local utflen = utf.len
local warn
do
@@ -44,7 +44,7 @@ do
ndebug = ndebug + 1
local slen = #str + 3
--str = "*["..str.."]"
- str = fmt("*[%4d][%s]", ndebug, str)
+ str = stringformat("*[%4d][%s]", ndebug, str)
for i,j in ipairs({...}) do
if 80 - i * 8 - slen < 0 then
local indent = ""
@@ -53,15 +53,17 @@ do
end
str = str .. "\n" .. indent
end
- str = str .. fmt(" |%6s", stringstrip(tostring(j)))
+ str = str .. stringformat(" |%6s", stringstrip(tostring(j)))
end
iowrite(str .. " |\n")
return 0
end
end
-local C, Cb, Cc, Cg, Cmt, Cp, Cs, Ct
- = lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg, lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct
+local C, Cb, Cc, Cg,
+ Cmt, Cp, Cs, Ct
+ = lpeg.C, lpeg.Cb, lpeg.Cc, lpeg.Cg,
+ lpeg.Cmt, lpeg.Cp, lpeg.Cs, lpeg.Ct
local P, R, S, V, match
= lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.match
@@ -207,7 +209,7 @@ local parser = P{
* C((1 - V"bar" - V"eol")^1)
* V"bar"
,
-
+
data_directive_block = V"data_directive_block_long"
+ V"data_directive_block_short"
,
@@ -284,7 +286,7 @@ local parser = P{
end)
* (1 - V"eol")^1 * V"eol"
,
-
+
fn_matchindent = Cmt(V"space"^1, function(s, i, indent)
local tc = state.currentindent
warn("fn-ma", tc == indent, #tc, #indent, i)
@@ -330,7 +332,7 @@ local parser = P{
st_first_row = V"st_setindent"
* C(V"st_setlayout")
- * V"space"^0
+ * V"space"^0
* V"eol"
,
@@ -1269,19 +1271,19 @@ local parser = P{
punctuation = V"apostrophe"
- + V"colon"
- + V"comma"
+ + V"colon"
+ + V"comma"
+ V"dashes"
- + V"dot"
+ + V"dot"
+ V"ellipsis"
+ V"exclamationmark"
+ V"guillemets"
+ V"hyphen"
+ V"interpunct"
+ V"interrobang"
- + V"questionmark"
+ + V"questionmark"
+ V"quotationmarks"
- + V"semicolon"
+ + V"semicolon"
+ V"slash"
+ V"solidus"
+ V"underscore"
@@ -1291,7 +1293,7 @@ local parser = P{
letter = R"az" + R"AZ",
digit = R"09",
-
+
space = P" ",
spaces = V"space"^1,
whitespace = (P" " + Cs(P"\t") / " " + Cs(S"\v") / " "),
@@ -1387,7 +1389,7 @@ local function load_file (name)
tmp = fh.crlf(tmp)
end
if thirddata.rst.expandtab then
- tmp = fh.expandtab(tmp)
+ tmp = fh.expandtab(tmp)
end
return fh.insert_blank(tmp)
end
@@ -1418,7 +1420,8 @@ local function get_setups (inline)
setups = setups .. [[
\setupcolors[state=start]
-\setupinteraction[state=start,focus=standard,color=darkgreen,contrastcolor=darkgreen]
+%% Interaction is supposed to be handled manually.
+%%\setupinteraction[state=start,focus=standard,color=darkgreen,contrastcolor=darkgreen]
\setupbodyfontenvironment [default] [em=italic]
\sethyphenatedurlnormal{:=?&}
\sethyphenatedurlbefore{?&}
@@ -1510,7 +1513,7 @@ function thirddata.rst.do_rst_inclusion (iname, fname)
local setups = get_setups(true)
local incnr = #rst_incsetups + 1
- local tmp_file = tex.jobname .. fmt("–rst_inclusion-%d.tex.tmp", incnr)
+ local tmp_file = tex.jobname .. stringformat("–rst_inclusion-%d.tex.tmp", incnr)
if processed then
processed = strip_comments:match(processed)
@@ -1532,7 +1535,7 @@ function thirddata.rst.get_rst_inclusion (iname)
if rst_inclusions[iname] then
context.input(rst_inclusions[iname])
else
- context(fmt("{\\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/Master/texmf-dist/tex/context/third/rst/rst_setups.lua b/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
index 08f21c526ec..ccf3967b216 100644
--- a/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
+++ b/Master/texmf-dist/tex/context/third/rst/rst_setups.lua
@@ -3,8 +3,8 @@
-- FILE: rst_setups.lua
-- USAGE: called by rst_parser.lua
-- DESCRIPTION: Complement to the reStructuredText parser
--- AUTHOR: Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--- CHANGED: 2011-08-28 13:47:24+0200
+-- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com>
+-- CHANGED: 2012-06-05 22:17:10+0200
--------------------------------------------------------------------------------
--