summaryrefslogtreecommitdiff
path: root/mod/tex
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-05 00:10:35 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-05 00:10:35 +0200
commitd275bb566ac22f1fee8b6a566a0b5bd47cecdd56 (patch)
tree6872e37cd5d8e81b873295f71aef6c7399993700 /mod/tex
parent0d1e5b2eb7522b2af210f3e4b9d832c5a4467242 (diff)
downloadcontext-rst-d275bb566ac22f1fee8b6a566a0b5bd47cecdd56.tar.gz
revisited module code
Diffstat (limited to 'mod/tex')
-rw-r--r--mod/tex/context/third/rst/rst_context.lua8
-rw-r--r--mod/tex/context/third/rst/t-rst.mkiv53
2 files changed, 20 insertions, 41 deletions
diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua
index 5d35906..d2fb002 100644
--- a/mod/tex/context/third/rst/rst_context.lua
+++ b/mod/tex/context/third/rst/rst_context.lua
@@ -118,9 +118,7 @@ function rst_context.strong_emphasis (str)
end
function rst_context.literal (str)
- str = str:gsub([[\]], [[\\]]) -- evade escaping of backslashes
return [[\\type{]] .. str .. [[}]]
- --return [[\\starttyping ]] .. str .. [[\\stoptyping]]
end
--- ROLES for interpreted text
@@ -336,11 +334,15 @@ do
end
local p_escape = P{
- [1] = Cs((V"skip" + chars + 1)^1),
+ [1] = Cs((V"skip"
+ --+ V"literal" -- achieved via gsub later
+ + chars
+ + 1)^1),
skip1 = P"\\starttyping" * (1 - P"\\stoptyping")^1,
balanced = P"{" * (V"balanced" + (1 - P"}"))^0 * P"}",
skip2 = P"\\type" * V"balanced",
skip = V"skip1" + V"skip2",
+ --literal = Cs(P"\\" / "") * 1
}
function rst_context.escape (str)
diff --git a/mod/tex/context/third/rst/t-rst.mkiv b/mod/tex/context/third/rst/t-rst.mkiv
index e047775..a64a0d1 100644
--- a/mod/tex/context/third/rst/t-rst.mkiv
+++ b/mod/tex/context/third/rst/t-rst.mkiv
@@ -69,55 +69,32 @@
%D The environment \type{\[start|stop]RST} and the macro
%D \type{\RST} allow access to reST-parser from inside a
%D \CONTEXT-document when the module is loaded.
-\unexpanded\def\startRST{%
- \setcatcodetable \RST_catcodes%
+
+% Wolfgang’s code below.
+\unexpanded \def \startRST{%
+ \begingroup
+ \setcatcodetable \RST_catcodes
\do_start_RST%
}
-\let\stopRST\relax
+\let \stopRST \relax
-\def\do_start_RST#1\stopRST{%
- \edef\RST_data{#1}%
- \setcatcodetable \ctxcatcodes%
- \ctxlua{thirddata.rst.do_rst_snippet([[\RST_data]])}%
+\def \do_start_RST#1\stopRST{%
+ \endgroup%
+ \ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}%
}
-\def\RST{%
- \setcatcodetable \RST_catcodes%
+\def \RST{%
+ \begingroup
+ \setcatcodetable \RST_catcodes
\do_RST%
}
-\def\do_RST#1{%
- \def\RST_data{#1}%
- \setcatcodetable \ctxcatcodes%
- \ctxlua{thirddata.rst.do_rst_snippet([[\RST_data]])}%
+\def \do_RST#1{%
+ \endgroup%
+ \ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}%
}
-%%% Wolfgang’s code below; needs testing
-%\unexpanded\def\startRST{%
- %\begingroup
- %\setcatcodetable \RST_catcodes
- %\dostartRST%
-%}
-
-%\let\stopRST\relax
-
-%\def\dostartRST#1\stopRST{%
- %\ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}%
- %\endgroup%
-%}
-
-%\def\RST{%
- %\begingroup
- %\setcatcodetable \RST_catcodes
- %\doRST%
-%}
-
-%\def\doRST#1{%
- %\ctxlua{thirddata.rst.do_rst_snippet(\!!bs#1\!!es)}%
- %\endgroup%
-%}
-
\protect \endinput
% vim:ft=context:sw=2:ts=2