git.iko.soy/typeable/pandoc
on master help sign in
ConTeXt writer: don't escape `&`,`^`,`<`,`>`.

Simplified escapes for `}` and `{` to `\{` and `\}`. Thanks to Aditya Mahajan.

commit7da913dbd77c8ccad4550d23ee176322e0593820 authorJohn MacFarlane <fiddlosopher@gmail.com> dateWed 27 Jun 2012, 15:05 (14 years ago) parent064af07
3 files changed+19−24
src/Tests/Writers/ConTeXt.hs+1−1 src/Text/Pandoc/Writers/ConTeXt.hs+2−6 tests/writer.context+16−17
src/Tests/Writers/ConTeXt.hs+1−1
@@ -33,7 +33,7 @@ infix 4 =:
3333
3434tests :: [Test]
3535tests = [ testGroup "inline code"
36− [ "with '}'" =: code "}" =?> "\\mono{\\letterclosebrace{}}"
36+ [ "with '}'" =: code "}" =?> "\\mono{\\}}"
3737 , "without '}'" =: code "]" =?> "\\type{]}"
3838 , property "code property" $ \s -> null s ||
3939 if '{' `elem` s || '}' `elem` s
src/Text/Pandoc/Writers/ConTeXt.hs+2−6
@@ -90,18 +90,14 @@ escapeCharForConTeXt :: WriterOptions -> Char -> String
9090escapeCharForConTeXt opts ch =
9191 let ligatures = writerTeXLigatures opts in
9292 case ch of
93− '{' -> "\\letteropenbrace{}"
94− '}' -> "\\letterclosebrace{}"
93+ '{' -> "\\{"
94+ '}' -> "\\}"
9595 '\\' -> "\\letterbackslash{}"
9696 '$' -> "\\$"
9797 '|' -> "\\letterbar{}"
98− '^' -> "\\letterhat{}"
9998 '%' -> "\\letterpercent{}"
10099 '~' -> "\\lettertilde{}"
101− '&' -> "\\&"
102100 '#' -> "\\#"
103− '<' -> "\\letterless{}"
104− '>' -> "\\lettermore{}"
105101 '[' -> "{[}"
106102 ']' -> "{]}"
107103 '\160' -> "~"
tests/writer.context+16−17
@@ -133,7 +133,7 @@ nested
133133\stopblockquote
134134\stopblockquote
135135
136−This should not be a block quote: 2 \lettermore{} 1.
136+This should not be a block quote: 2 > 1.
137137
138138And a following paragraph.
139139
@@ -617,7 +617,7 @@ Superscripts: a\high{bc}d a\high{{\em hello}} a\high{hello~there}.
617617Subscripts: H\low{2}O, H\low{23}O, H\low{many~of~them}O.
618618
619619These should not be superscripts or subscripts, because of the unescaped
620−spaces: a\letterhat{}b c\letterhat{}d, a\lettertilde{}b c\lettertilde{}d.
620+spaces: a^b c^d, a\lettertilde{}b c\lettertilde{}d.
621621
622622\thinrule
623623
@@ -701,15 +701,15 @@ Here is some unicode:
701701 copyright: ©
702702\stopitemize
703703
704−AT\&T has an ampersand in their name.
704+AT&T has an ampersand in their name.
705705
706−AT\&T is another way to write it.
706+AT&T is another way to write it.
707707
708−This \& that.
708+This & that.
709709
710−4 \letterless{} 5.
710+4 < 5.
711711
712−6 \lettermore{} 5.
712+6 > 5.
713713
714714Backslash: \letterbackslash{}
715715
@@ -719,9 +719,9 @@ Asterisk: *
719719
720720Underscore: _
721721
722−Left brace: \letteropenbrace{}
722+Left brace: \{
723723
724−Right brace: \letterclosebrace{}
724+Right brace: \}
725725
726726Left bracket: {[}
727727
@@ -731,7 +731,7 @@ Left paren: (
731731
732732Right paren: )
733733
734−Greater-than: \lettermore{}
734+Greater-than: >
735735
736736Hash: \#
737737
@@ -801,7 +801,7 @@ Here's a \useURL[url23][http://example.com/?foo=1&bar=2][][link with an
801801ampersand in the URL]\from[url23].
802802
803803Here's a link with an amersand in the link text:
804−\useURL[url24][http://att.com/][][AT\&T]\from[url24].
804+\useURL[url24][http://att.com/][][AT&T]\from[url24].
805805
806806Here's an \useURL[url25][/script?foo=1&bar=2][][inline link]\from[url25].
807807
@@ -811,7 +811,7 @@ braces]\from[url26].
811811\subsection[autolinks]{Autolinks}
812812
813813With an ampersand:
814−\useURL[url27][http://example.com/?foo=1&bar=2][][\hyphenatedurl{http://example.com/?foo=1\&bar=2}]\from[url27]
814+\useURL[url27][http://example.com/?foo=1&bar=2][][\hyphenatedurl{http://example.com/?foo=1&bar=2}]\from[url27]
815815
816816\startitemize
817817\item
@@ -864,11 +864,10 @@ Here is a footnote reference,\footnote{Here is the footnote. It can go
864864
865865 If you want, you can indent every line, but you can also be lazy and just
866866 indent the first line of each block.\stopbuffer\footnote{\getbuffer} This
867−should {\em not} be a footnote reference, because it contains a
868−space.{[}\letterhat{}my note{]} Here is an inline note.\footnote{This is
869− {\em easier} to type. Inline notes may contain
870− \useURL[url31][http://google.com][][links]\from[url31] and \type{]} verbatim
871− characters, as well as {[}bracketed text{]}.}
867+should {\em not} be a footnote reference, because it contains a space.{[}^my
868+note{]} Here is an inline note.\footnote{This is {\em easier} to type. Inline
869+ notes may contain \useURL[url31][http://google.com][][links]\from[url31] and
870+ \type{]} verbatim characters, as well as {[}bracketed text{]}.}
872871
873872\startblockquote
874873Notes can go in quotes.\footnote{In quote.}