aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-08-03 14:59:35 +0200
committerJohn MacFarlane <[email protected]>2025-08-06 12:54:12 -0700
commit7639e800c5af85e5ded862a6e218d54489d17bfc (patch)
treecd6274889de4baae6b47abb67926c0b1bf19d592 /src
parent90afbea1db63dd0b84a17fdd5702dc43107725d8 (diff)
Org template: add `#+options` lines if necessary
The default template now adds `#+options` lines if non-default settings are used for the `smart_quotes` and `special_strings` extensions.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Org.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 6c05467cb..f1a516a66 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -71,6 +71,17 @@ pandocToOrg (Pandoc meta blocks) = do
let main = body $+$ notes
let context = defField "body" main
. defField "math" hasMath
+ . defField "options"
+ (M.fromList
+ ((if isEnabled Ext_smart_quotes opts
+ then (("'", "t"):)
+ else id) .
+ (if not (isEnabled Ext_special_strings opts)
+ then (("-", "nil"):)
+ else id)
+ $ ([] :: [(Text, Text)])))
+ . defField "option-special-strings"
+ (isEnabled Ext_special_strings opts)
$ metadata
return $ render colwidth $
case writerTemplate opts of