git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: Support <tt> for inline code.
commit1d683be4146678c5d674ecd9ea365943c385774c authorJohn MacFarlane <jgm@berkeley.edu> dateSun 23 Jan 2011, 00:25 (16 years ago) parent50d08ec
3 files changed+14−3
src/Text/Pandoc/Readers/Textile.hs+11−3 tests/textile-reader.native+1 tests/textile-reader.textile+2
src/Text/Pandoc/Readers/Textile.hs+11−3
@@ -368,9 +368,9 @@ inlineParsers = [ autoLink
368368 , str
369369 , whitespace
370370 , endline
371+ , code
371372 , htmlSpan
372373 , rawHtmlInline
373− , code
374374 , note
375375 , simpleInline (string "??") (Cite [])
376376 , simpleInline (string "**") Strong
@@ -490,8 +490,16 @@ symbol = do
490490
491491-- | Inline code
492492code :: GenParser Char ParserState Inline
493−code = surrounded (char '@') anyChar >>=
494− return . Code
493+code = code1 <|> code2
494+
495+code1 :: GenParser Char ParserState Inline
496+code1 = surrounded (char '@') anyChar >>= return . Code
497+
498+code2 :: GenParser Char ParserState Inline
499+code2 = do
500+ htmlTag (tagOpen (=="tt") null)
501+ result' <- manyTill anyChar (try $ htmlTag $ tagClose (=="tt"))
502+ return $ Code result'
495503
496504-- | Html / CSS attributes
497505attributes :: GenParser Char ParserState String
tests/textile-reader.native+1
@@ -25,6 +25,7 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
2525,Para [Str "And",Str ":"]
2626,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
2727,CodeBlock ("",[],[]) "Code block with .bc\n continued\n @</\\\n"
28+,Para [Str "Inline",Space,Str "code",Str ":",Space,Code "<tt>",Str ",",Space,Code "@",Str "."]
2829,Header 1 [Str "Lists"]
2930,Header 2 [Str "Unordered"]
3031,Para [Str "Asterisks",Space,Str "tight",Str ":"]
tests/textile-reader.textile+2
@@ -66,6 +66,8 @@ bc. Code block with .bc
6666 continued
6767 @</\
6868
69+Inline code: @<tt>@, <tt>@</tt>.
70+
6971h1. Lists
7072
7173h2. Unordered