diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 3b6b0673f..2676fadc8 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -548,7 +548,13 @@ inlineToOrg (Cite cs lst) = do _ -> mempty return $ "[cite" <> sty <> ":" <> citeItems <> "]" else inlineListToOrg lst -inlineToOrg (Code _ str) = return $ "=" <> literal str <> "=" +inlineToOrg (Code _ str) = return $ + -- Org offers no escape mechanism inside verbatim text; if the + -- content contains the delimiter, fall back to the other verbatim + -- delimiter. + if "=" `T.isInfixOf` str && not ("~" `T.isInfixOf` str) + then "~" <> literal str <> "~" + else "=" <> literal str <> "=" inlineToOrg (Str str) = do opts <- gets stOptions let str' = if isEnabled Ext_smart opts || isEnabled Ext_special_strings opts diff --git a/test/writer.org b/test/writer.org index 8c2974752..eb43db2b9 100644 --- a/test/writer.org +++ b/test/writer.org @@ -598,7 +598,7 @@ Ellipses...and...and.... These shouldn't be math: -- To get the famous equation, write =$e = mc^2$=. +- To get the famous equation, write ~$e = mc^2$~. - $22,000 is a /lot/ of money. So is $34,000. (It worked if “lot” is emphasized.) - Shoes ($20) and socks ($5).