summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-01-01 13:48:28 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-01-01 13:48:28 -0800
commitda8425598a8ab4a98388e8ee346a2ae7ec540aa0 (patch)
tree20078094309f4fc57ea67e5b2d17163f86078ec1 /src/pandoc.hs
parent3cf60c73061f247b531da4b3c18664c6134bee53 (diff)
New treatment of dashes in --smart mode.
* `---` is always em-dash, `--` is always en-dash. * pandoc no longer tries to guess when `-` should be en-dash. * A new option, `--old-dashes`, is provided for legacy documents. Rationale: The rules for en-dash are too complex and language-dependent for a guesser to work reliably. This change gives users greater control. The alternative of using unicode isn't very good, since unicode em- and en- dashes are barely distinguishable in a monospace font.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index fc28c4c3f..3660fc167 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -103,6 +103,7 @@ data Opt = Opt
, optSelfContained :: Bool -- ^ Make HTML accessible offline
, optXeTeX :: Bool -- ^ Format latex for xetex
, optSmart :: Bool -- ^ Use smart typography
+ , optOldDashes :: Bool -- ^ Parse dashes like pandoc <=1.8.2.1
, optHtml5 :: Bool -- ^ Produce HTML5 in HTML
, optHighlight :: Bool -- ^ Highlight source code
, optHighlightStyle :: Style -- ^ Style to use for highlighted code
@@ -149,6 +150,7 @@ defaultOpts = Opt
, optSelfContained = False
, optXeTeX = False
, optSmart = False
+ , optOldDashes = False
, optHtml5 = False
, optHighlight = True
, optHighlightStyle = pygments
@@ -245,6 +247,12 @@ options =
(\opt -> return opt { optSmart = True }))
"" -- "Use smart quotes, dashes, and ellipses"
+ , Option "" ["old-dashes"]
+ (NoArg
+ (\opt -> return opt { optSmart = True
+ , optOldDashes = True }))
+ "" -- "Use smart quotes, dashes, and ellipses"
+
, Option "5" ["html5"]
(NoArg
(\opt -> do
@@ -735,6 +743,7 @@ main = do
, optIncremental = incremental
, optSelfContained = selfContained
, optSmart = smart
+ , optOldDashes = oldDashes
, optHtml5 = html5
, optHighlight = highlight
, optHighlightStyle = highlightStyle
@@ -858,6 +867,7 @@ main = do
stateCitations = map CSL.refId refs,
stateSmart = smart || writerName' `elem`
["latex", "context", "latex+lhs", "beamer"],
+ stateOldDashes = oldDashes,
stateColumns = columns,
stateStrict = strict,
stateIndentedCodeClasses = codeBlockClasses,