summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/rst/rst_parser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/third/rst/rst_parser.lua')
-rw-r--r--Master/texmf-dist/tex/context/third/rst/rst_parser.lua57
1 files changed, 30 insertions, 27 deletions
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