git.iko.soy/typeable/pandoc
on master help sign in
Got rid of stateStandalone, which was hardly used anyway.
1dba82fJohn MacFarlane
Benchmark.hs+4−3
@@ -9,8 +9,8 @@ readerBench :: Pandoc
9 -> Benchmark
9 -> Benchmark
10readerBench doc (name, reader) =
10readerBench doc (name, reader) =
11 let writer = case lookup name writers of
11 let writer = case lookup name writers of
12− Just w -> w
12+ Just (PureStringWriter w) -> w
13− Nothing -> error $ "Could not find writer for " ++ name
13+ _ -> error $ "Could not find writer for " ++ name
14 inp = writer defaultWriterOptions{ writerWrapText = True
14 inp = writer defaultWriterOptions{ writerWrapText = True
15 , writerLiterateHaskell =
15 , writerLiterateHaskell =
16 "+lhs" `isSuffixOf` name } doc
16 "+lhs" `isSuffixOf` name } doc
@@ -41,5 +41,6 @@ main = do
41 let ps = defaultParserState{ stateSmart = True }
41 let ps = defaultParserState{ stateSmart = True }
42 let doc = readMarkdown ps inp
42 let doc = readMarkdown ps inp
43 let readerBs = map (readerBench doc) readers
43 let readerBs = map (readerBench doc) readers
44+ let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
44− defaultMain $ map (writerBench doc) writers ++ readerBs ++ normalizeBench doc
45+ defaultMain $ map (writerBench doc) writers' ++ readerBs ++ normalizeBench doc
45
46
src/Tests/Readers/Markdown.hs+1−1
@@ -10,7 +10,7 @@ import Text.Pandoc.Builder
10import Text.Pandoc
10import Text.Pandoc
11
11
12markdown :: String -> Pandoc
12markdown :: String -> Pandoc
13−markdown = readMarkdown defaultParserState{ stateStandalone = True }
13+markdown = readMarkdown defaultParserState
14
14
15markdownSmart :: String -> Pandoc
15markdownSmart :: String -> Pandoc
16markdownSmart = readMarkdown defaultParserState{ stateOptions =
16markdownSmart = readMarkdown defaultParserState{ stateOptions =
src/Tests/Readers/RST.hs+1−1
@@ -9,7 +9,7 @@ import Text.Pandoc.Builder
9import Text.Pandoc
9import Text.Pandoc
10
10
11rst :: String -> Pandoc
11rst :: String -> Pandoc
12−rst = readRST defaultParserState{ stateStandalone = True }
12+rst = readRST defaultParserState
13
13
14infix 4 =:
14infix 4 =:
15(=:) :: ToString c
15(=:) :: ToString c
src/Text/Pandoc/Parsing.hs−2
@@ -695,7 +695,6 @@ data ParserState = ParserState
695 stateKeys :: KeyTable, -- ^ List of reference keys
695 stateKeys :: KeyTable, -- ^ List of reference keys
696 stateCitations :: [String], -- ^ List of available citations
696 stateCitations :: [String], -- ^ List of available citations
697 stateNotes :: NoteTable, -- ^ List of notes
697 stateNotes :: NoteTable, -- ^ List of notes
698− stateStandalone :: Bool, -- ^ Parse bibliographic info?
699 stateTitle :: [Inline], -- ^ Title of document
698 stateTitle :: [Inline], -- ^ Title of document
700 stateAuthors :: [[Inline]], -- ^ Authors of document
699 stateAuthors :: [[Inline]], -- ^ Authors of document
701 stateDate :: [Inline], -- ^ Date of document
700 stateDate :: [Inline], -- ^ Date of document
@@ -724,7 +723,6 @@ defaultParserState =
724 stateKeys = M.empty,
723 stateKeys = M.empty,
725 stateCitations = [],
724 stateCitations = [],
726 stateNotes = [],
725 stateNotes = [],
727− stateStandalone = False,
728 stateTitle = [],
726 stateTitle = [],
729 stateAuthors = [],
727 stateAuthors = [],
730 stateDate = [],
728 stateDate = [],
src/Text/Pandoc/Readers/RST.hs+1−3
@@ -106,9 +106,7 @@ parseRST = do
106 blocks <- parseBlocks
106 blocks <- parseBlocks
107 let blocks' = filter (/= Null) blocks
107 let blocks' = filter (/= Null) blocks
108 state <- getState
108 state <- getState
109− let (blocks'', title) = if stateStandalone state
110− then titleTransform blocks'
109+ let (blocks'', title) = titleTransform blocks'
111− else (blocks', [])
112 let authors = stateAuthors state
110 let authors = stateAuthors state
113 let date = stateDate state
111 let date = stateDate state
114 let title' = if (null title) then (stateTitle state) else title
112 let title' = if (null title) then (stateTitle state) else title
src/pandoc.hs−1
@@ -938,7 +938,6 @@ main = do
938
938
939 let startParserState = def{ stateLiterateHaskell = "+lhs" `isSuffixOf` readerName' ||
939 let startParserState = def{ stateLiterateHaskell = "+lhs" `isSuffixOf` readerName' ||
940 lhsExtension sources,
940 lhsExtension sources,
941− stateStandalone = standalone',
942 stateCitations = map CSL.refId refs,
941 stateCitations = map CSL.refId refs,
943 stateOptions = def{
942 stateOptions = def{
944 readerStrict = strict
943 readerStrict = strict