summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Options.hs6
-rw-r--r--src/Text/Pandoc/Parsing.hs6
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs10
-rw-r--r--src/pandoc.hs2
4 files changed, 13 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index ab4dda388..bd04a4373 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -57,7 +57,10 @@ data ReaderOptions = ReaderOptions{
, readerParseRaw :: Bool -- ^ Parse raw HTML, LaTeX
, readerColumns :: Int -- ^ Number of columns in terminal
, readerTabStop :: Int -- ^ Tab stop
- } deriving (Show, Read)
+ , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
+ -- in parsing dashes; -- is em-dash;
+ -- - before numerial is en-dash
+} deriving (Show, Read)
instance Default ReaderOptions
where def = ReaderOptions{
@@ -67,4 +70,5 @@ instance Default ReaderOptions
, readerParseRaw = False
, readerColumns = 80
, readerTabStop = 4
+ , readerOldDashes = False
}
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 3d7057936..dd73e01ee 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -699,9 +699,6 @@ data ParserState = ParserState
stateTitle :: [Inline], -- ^ Title of document
stateAuthors :: [[Inline]], -- ^ Authors of document
stateDate :: [Inline], -- ^ Date of document
- stateOldDashes :: Bool, -- ^ Use pandoc <= 1.8.2.1 behavior
- -- in parsing dashes; -- is em-dash;
- -- before numeral is en-dash
stateLiterateHaskell :: Bool, -- ^ Treat input as literate haskell
stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
stateIndentedCodeClasses :: [String], -- ^ Classes to use for indented code blocks
@@ -731,7 +728,6 @@ defaultParserState =
stateTitle = [],
stateAuthors = [],
stateDate = [],
- stateOldDashes = False,
stateLiterateHaskell = False,
stateHeaderTable = [],
stateIndentedCodeClasses = [],
@@ -887,7 +883,7 @@ ellipses = do
dash :: Parsec [Char] ParserState Inline
dash = do
- oldDashes <- stateOldDashes `fmap` getState
+ oldDashes <- getOption readerOldDashes
if oldDashes
then emDashOld <|> enDashOld
else Str `fmap` (hyphenDash <|> emDash <|> enDash)
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 453fa5b4e..e4537f33d 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -71,7 +71,7 @@ readTextile :: ParserState -- ^ Parser state, including options for parser
-> String -- ^ String to parse (assuming @'\n'@ line endings)
-> Pandoc
readTextile state s =
- (readWith parseTextile) state{ stateOldDashes = True } (s ++ "\n\n")
+ (readWith parseTextile) state (s ++ "\n\n")
-- | Generate a Pandoc ADT from a textile document
@@ -79,9 +79,11 @@ parseTextile :: Parser [Char] ParserState Pandoc
parseTextile = do
-- textile allows raw HTML and does smart punctuation by default
oldOpts <- stateOptions `fmap` getState
- updateState $ \state -> state{ stateOptions = oldOpts{ readerSmart = True
- , readerParseRaw = True
- } }
+ updateState $ \state -> state{ stateOptions =
+ oldOpts{ readerSmart = True
+ , readerParseRaw = True
+ , readerOldDashes = True
+ } }
many blankline
startPos <- getPosition
-- go through once just to get list of reference keys and notes
diff --git a/src/pandoc.hs b/src/pandoc.hs
index a3c01133c..8fb9e293b 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -940,7 +940,6 @@ main = do
lhsExtension sources,
stateStandalone = standalone',
stateCitations = map CSL.refId refs,
- stateOldDashes = oldDashes,
stateOptions = def{
readerStrict = strict
, readerSmart = smart || (texLigatures &&
@@ -948,6 +947,7 @@ main = do
, readerParseRaw = parseRaw
, readerColumns = columns
, readerTabStop = tabStop
+ , readerOldDashes = oldDashes
},
stateIndentedCodeClasses = codeBlockClasses,
stateApplyMacros = not laTeXOutput