diff options
author | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2011-01-13 12:23:36 +0100 |
---|---|---|
committer | Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de> | 2011-01-13 12:23:36 +0100 |
commit | 91a40ccaffce74728d109c726985f67773b0617e (patch) | |
tree | 5b379a972cfa12f027375f71da21238ff6f9396b | |
parent | 9d00a058df52d261861fcc7a9d4dd6474a5f7f53 (diff) | |
download | context-rst-91a40ccaffce74728d109c726985f67773b0617e.tar.gz |
adapted ConTeXt escaping -- waiting for ‘_’ to generally get letter catcode
-rw-r--r-- | doc/hybridtest.tex | 8 | ||||
-rw-r--r-- | mod/tex/context/third/rst/rst_context.lua | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/doc/hybridtest.tex b/doc/hybridtest.tex index ba3bed5..6b74a8a 100644 --- a/doc/hybridtest.tex +++ b/doc/hybridtest.tex @@ -21,10 +21,10 @@ there are some :bold:`drawbacks` to expect when mixing markups: directives and hyperlink targets that have already been specified somewhere above the current section will *stay* accessible in later passages until you redefine them. Also, certain letters -need to be thoroughly escaped in order to make it through to the -*reST*-parser, e.g. *\\\{* (<left brace>), and you’ll have to be -inventive to make a backslash (*\\letterbackslash*) pass through -the parser. +need to be thoroughly escaped in order for them to make it +through to the *reST*-parser, e.g. *\\\{* (<left brace>), and +you’ll have to be inventive to make a backslash +(*\\letterbackslash*) pass through the parser. } diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua index a18086b..5ed7812 100644 --- a/mod/tex/context/third/rst/rst_context.lua +++ b/mod/tex/context/third/rst/rst_context.lua @@ -331,10 +331,17 @@ function rst_context.substitution_reference (str, underscores) return sub .. [[{\\RSTsubstitution]] .. str:gsub("%s", "") .. "}" end +-- see catc-sym.tex +local escape_me = { + ["&"] = [[\letterampersand ]], + ["#"] = [[\letterhash ]], + ["^"] = [[\letterhat ]], + ["_"] = [[\letterunderscore ]], +} + function rst_context.escape (str) - str = str:gsub("\\(.)", "%1") - str = str:gsub("&", "\\letterampersand") - return str + str = str:gsub("\\(.)", "%1") -- literalize escaped sequences + return str:gsub("[&#^_]", escape_me) -- escape chars with special meaning end function rst_context.joinindented (tab) |