git.iko.soy/typeable/pandoc
on master help sign in
Moved stateOldDashes to readerOldDashes in ReaderOptions.
95570baJohn MacFarlane
src/Text/Pandoc/Options.hs+5−1
@@ -57,7 +57,10 @@ data ReaderOptions = ReaderOptions{
57 , readerParseRaw :: Bool -- ^ Parse raw HTML, LaTeX
57 , readerParseRaw :: Bool -- ^ Parse raw HTML, LaTeX
58 , readerColumns :: Int -- ^ Number of columns in terminal
58 , readerColumns :: Int -- ^ Number of columns in terminal
59 , readerTabStop :: Int -- ^ Tab stop
59 , readerTabStop :: Int -- ^ Tab stop
60+ , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
61+ -- in parsing dashes; -- is em-dash;
62+ -- - before numerial is en-dash
60− } deriving (Show, Read)
63+} deriving (Show, Read)
61
64
62instance Default ReaderOptions
65instance Default ReaderOptions
63 where def = ReaderOptions{
66 where def = ReaderOptions{
@@ -67,4 +70,5 @@ instance Default ReaderOptions
67 , readerParseRaw = False
70 , readerParseRaw = False
68 , readerColumns = 80
71 , readerColumns = 80
69 , readerTabStop = 4
72 , readerTabStop = 4
73+ , readerOldDashes = False
70 }
74 }
src/Text/Pandoc/Parsing.hs+1−5
@@ -699,9 +699,6 @@ data ParserState = ParserState
699 stateTitle :: [Inline], -- ^ Title of document
699 stateTitle :: [Inline], -- ^ Title of document
700 stateAuthors :: [[Inline]], -- ^ Authors of document
700 stateAuthors :: [[Inline]], -- ^ Authors of document
701 stateDate :: [Inline], -- ^ Date of document
701 stateDate :: [Inline], -- ^ Date of document
702− stateOldDashes :: Bool, -- ^ Use pandoc <= 1.8.2.1 behavior
703− -- in parsing dashes; -- is em-dash;
704− -- before numeral is en-dash
705 stateLiterateHaskell :: Bool, -- ^ Treat input as literate haskell
702 stateLiterateHaskell :: Bool, -- ^ Treat input as literate haskell
706 stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
703 stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
707 stateIndentedCodeClasses :: [String], -- ^ Classes to use for indented code blocks
704 stateIndentedCodeClasses :: [String], -- ^ Classes to use for indented code blocks
@@ -731,7 +728,6 @@ defaultParserState =
731 stateTitle = [],
728 stateTitle = [],
732 stateAuthors = [],
729 stateAuthors = [],
733 stateDate = [],
730 stateDate = [],
734− stateOldDashes = False,
735 stateLiterateHaskell = False,
731 stateLiterateHaskell = False,
736 stateHeaderTable = [],
732 stateHeaderTable = [],
737 stateIndentedCodeClasses = [],
733 stateIndentedCodeClasses = [],
@@ -887,7 +883,7 @@ ellipses = do
887
883
888dash :: Parsec [Char] ParserState Inline
884dash :: Parsec [Char] ParserState Inline
889dash = do
885dash = do
890− oldDashes <- stateOldDashes `fmap` getState
886+ oldDashes <- getOption readerOldDashes
891 if oldDashes
887 if oldDashes
892 then emDashOld <|> enDashOld
888 then emDashOld <|> enDashOld
893 else Str `fmap` (hyphenDash <|> emDash <|> enDash)
889 else Str `fmap` (hyphenDash <|> emDash <|> enDash)
src/Text/Pandoc/Readers/Textile.hs+6−4
@@ -71,7 +71,7 @@ readTextile :: ParserState -- ^ Parser state, including options for parser
71 -> String -- ^ String to parse (assuming @'\n'@ line endings)
71 -> String -- ^ String to parse (assuming @'\n'@ line endings)
72 -> Pandoc
72 -> Pandoc
73readTextile state s =
73readTextile state s =
74− (readWith parseTextile) state{ stateOldDashes = True } (s ++ "\n\n")
74+ (readWith parseTextile) state (s ++ "\n\n")
75
75
76
76
77-- | Generate a Pandoc ADT from a textile document
77-- | Generate a Pandoc ADT from a textile document
@@ -79,9 +79,11 @@ parseTextile :: Parser [Char] ParserState Pandoc
79parseTextile = do
79parseTextile = do
80 -- textile allows raw HTML and does smart punctuation by default
80 -- textile allows raw HTML and does smart punctuation by default
81 oldOpts <- stateOptions `fmap` getState
81 oldOpts <- stateOptions `fmap` getState
82− updateState $ \state -> state{ stateOptions = oldOpts{ readerSmart = True
82+ updateState $ \state -> state{ stateOptions =
83+ oldOpts{ readerSmart = True
83− , readerParseRaw = True
84+ , readerParseRaw = True
85+ , readerOldDashes = True
84− } }
86+ } }
85 many blankline
87 many blankline
86 startPos <- getPosition
88 startPos <- getPosition
87 -- go through once just to get list of reference keys and notes
89 -- go through once just to get list of reference keys and notes
src/pandoc.hs+1−1
@@ -940,7 +940,6 @@ main = do
940 lhsExtension sources,
940 lhsExtension sources,
941 stateStandalone = standalone',
941 stateStandalone = standalone',
942 stateCitations = map CSL.refId refs,
942 stateCitations = map CSL.refId refs,
943− stateOldDashes = oldDashes,
944 stateOptions = def{
943 stateOptions = def{
945 readerStrict = strict
944 readerStrict = strict
946 , readerSmart = smart || (texLigatures &&
945 , readerSmart = smart || (texLigatures &&
@@ -948,6 +947,7 @@ main = do
948 , readerParseRaw = parseRaw
947 , readerParseRaw = parseRaw
949 , readerColumns = columns
948 , readerColumns = columns
950 , readerTabStop = tabStop
949 , readerTabStop = tabStop
950+ , readerOldDashes = oldDashes
951 },
951 },
952 stateIndentedCodeClasses = codeBlockClasses,
952 stateIndentedCodeClasses = codeBlockClasses,
953 stateApplyMacros = not laTeXOutput
953 stateApplyMacros = not laTeXOutput