From 90afbea1db63dd0b84a17fdd5702dc43107725d8 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 24 Jul 2025 11:27:12 +0200 Subject: Org writer: disable smart quotes by default --- src/Text/Pandoc/Writers/Org.hs | 12 ++++++++++-- test/writer.org | 16 ++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 8def0cf8b..6c05467cb 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -496,10 +496,18 @@ inlineToOrg (Subscript lst) = do inlineToOrg (SmallCaps lst) = inlineListToOrg lst inlineToOrg (Quoted SingleQuote lst) = do contents <- inlineListToOrg lst - return $ "'" <> contents <> "'" + opts <- gets stOptions + return $ + if isEnabled Ext_smart opts || isEnabled Ext_smart_quotes opts + then "'" <> contents <> "'" + else "‘" <> contents <> "’" inlineToOrg (Quoted DoubleQuote lst) = do contents <- inlineListToOrg lst - return $ "\"" <> contents <> "\"" + opts <- gets stOptions + return $ + if isEnabled Ext_smart opts || isEnabled Ext_smart_quotes opts + then "\"" <> contents <> "\"" + else "“" <> contents <> "”" inlineToOrg (Cite cs lst) = do opts <- gets stOptions if isEnabled Ext_citations opts diff --git a/test/writer.org b/test/writer.org index ee081d35d..17e7ad3ac 100644 --- a/test/writer.org +++ b/test/writer.org @@ -563,16 +563,16 @@ a^b c^d, a~b c~d. :PROPERTIES: :CUSTOM_ID: smart-quotes-ellipses-dashes :END: -"Hello," said the spider. "'Shelob' is my name." +“Hello,” said the spider. “‘Shelob’ is my name.” -'A', 'B', and 'C' are letters. +‘A’, ‘B’, and ‘C’ are letters. -'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.' +‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ -'He said, "I want to go."' Were you alive in the 70's? +‘He said, “I want to go.”’ Were you alive in the 70's? -Here is some quoted '=code=' and a -"[[http://example.com/?foo=1&bar=2][quoted link]]". +Here is some quoted ‘=code=’ and a +“[[http://example.com/?foo=1&bar=2][quoted link]]”. Some dashes: one---two --- three---four --- five. @@ -599,7 +599,7 @@ Ellipses...and...and.... These shouldn't be math: - 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 +- $22,000 is a /lot/ of money. So is $34,000. (It worked if “lot” is emphasized.) - Shoes ($20) and socks ($5). - Escaped =$=: $73 /this should be emphasized/ 23$. @@ -762,7 +762,7 @@ or here: :PROPERTIES: :CUSTOM_ID: images :END: -From "Voyage dans la Lune" by Georges Melies (1902): +From “Voyage dans la Lune” by Georges Melies (1902): #+caption: lalune [[file:lalune.jpg]] -- cgit v1.2.3