Org reader: make tildes create inline code.

Closes #1345.  Also relabeled 'code' and 'verbatim' parsers
to accord with the org-mode manual.

I'm not sure what the distinction between code and verbatim
is supposed to be, but I'm pretty sure both should be represented
as Code inlines in pandoc.  The previous behavior resulted in the
text not appearing in any output format.
This commit is contained in:
John MacFarlane 2014-06-16 22:03:26 -07:00
parent f9b97e6bfb
commit 78ee2416d1
2 changed files with 7 additions and 7 deletions

View file

@ -1148,11 +1148,11 @@ strikeout = fmap B.strikeout <$> emphasisBetween '+'
underline :: OrgParser (F Inlines) underline :: OrgParser (F Inlines)
underline = fmap B.strong <$> emphasisBetween '_' underline = fmap B.strong <$> emphasisBetween '_'
code :: OrgParser (F Inlines)
code = return . B.code <$> verbatimBetween '='
verbatim :: OrgParser (F Inlines) verbatim :: OrgParser (F Inlines)
verbatim = return . B.rawInline "" <$> verbatimBetween '~' verbatim = return . B.code <$> verbatimBetween '='
code :: OrgParser (F Inlines)
code = return . B.code <$> verbatimBetween '~'
subscript :: OrgParser (F Inlines) subscript :: OrgParser (F Inlines)
subscript = fmap B.subscript <$> try (char '_' *> subOrSuperExpr) subscript = fmap B.subscript <$> try (char '_' *> subOrSuperExpr)

View file

@ -50,13 +50,13 @@ tests =
"+Kill Bill+" =?> "+Kill Bill+" =?>
para (strikeout . spcSep $ [ "Kill", "Bill" ]) para (strikeout . spcSep $ [ "Kill", "Bill" ])
, "Code" =: , "Verbatim" =:
"=Robot.rock()=" =?> "=Robot.rock()=" =?>
para (code "Robot.rock()") para (code "Robot.rock()")
, "Verbatim" =: , "Code" =:
"~word for word~" =?> "~word for word~" =?>
para (rawInline "" "word for word") para (code "word for word")
, "Math $..$" =: , "Math $..$" =:
"$E=mc^2$" =?> "$E=mc^2$" =?>