diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-07-25 12:37:04 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-07-25 12:37:04 -0700 |
commit | 95570ba34c4e7675295b6eefcfcc4dac4ac720af (patch) | |
tree | 0273b7118ae94122d263923b377d4bf79cb44b9c /src/Text | |
parent | 335cd5de4d785f09ae1c14e961df8c4137300252 (diff) | |
download | pandoc-95570ba34c4e7675295b6eefcfcc4dac4ac720af.tar.gz |
Moved stateOldDashes to readerOldDashes in ReaderOptions.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Textile.hs | 10 |
3 files changed, 12 insertions, 10 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 |