git.iko.soy/typeable/pandoc
on master help sign in
Got rid of stateStandalone, which was hardly used anyway.

The only possible effect will be with rst fragments that begin with an rst title block, which will now cause the header transform.

commit1dba82f25ee17590bf03b00659662240460b7824 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 25 Jul 2012, 20:08 (14 years ago) parent95570ba
6 files changed+7−11
Benchmark.hs+4−3 src/Tests/Readers/Markdown.hs+1−1 src/Tests/Readers/RST.hs+1−1 src/Text/Pandoc/Parsing.hs−2 src/Text/Pandoc/Readers/RST.hs+1−3 src/pandoc.hs−1
Benchmark.hs+4−3
@@ -9,8 +9,8 @@ readerBench :: Pandoc
99 -> Benchmark
1010readerBench doc (name, reader) =
1111 let writer = case lookup name writers of
12− Just w -> w
13− Nothing -> error $ "Could not find writer for " ++ name
12+ Just (PureStringWriter w) -> w
13+ _ -> error $ "Could not find writer for " ++ name
1414 inp = writer defaultWriterOptions{ writerWrapText = True
1515 , writerLiterateHaskell =
1616 "+lhs" `isSuffixOf` name } doc
@@ -41,5 +41,6 @@ main = do
4141 let ps = defaultParserState{ stateSmart = True }
4242 let doc = readMarkdown ps inp
4343 let readerBs = map (readerBench doc) readers
44− defaultMain $ map (writerBench doc) writers ++ readerBs ++ normalizeBench doc
44+ let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
45+ defaultMain $ map (writerBench doc) writers' ++ readerBs ++ normalizeBench doc
4546
src/Tests/Readers/Markdown.hs+1−1
@@ -10,7 +10,7 @@ import Text.Pandoc.Builder
1010import Text.Pandoc
1111
1212markdown :: String -> Pandoc
13−markdown = readMarkdown defaultParserState{ stateStandalone = True }
13+markdown = readMarkdown defaultParserState
1414
1515markdownSmart :: String -> Pandoc
1616markdownSmart = readMarkdown defaultParserState{ stateOptions =
src/Tests/Readers/RST.hs+1−1
@@ -9,7 +9,7 @@ import Text.Pandoc.Builder
99import Text.Pandoc
1010
1111rst :: String -> Pandoc
12−rst = readRST defaultParserState{ stateStandalone = True }
12+rst = readRST defaultParserState
1313
1414infix 4 =:
1515(=:) :: ToString c
src/Text/Pandoc/Parsing.hs−2
@@ -695,7 +695,6 @@ data ParserState = ParserState
695695 stateKeys :: KeyTable, -- ^ List of reference keys
696696 stateCitations :: [String], -- ^ List of available citations
697697 stateNotes :: NoteTable, -- ^ List of notes
698− stateStandalone :: Bool, -- ^ Parse bibliographic info?
699698 stateTitle :: [Inline], -- ^ Title of document
700699 stateAuthors :: [[Inline]], -- ^ Authors of document
701700 stateDate :: [Inline], -- ^ Date of document
@@ -724,7 +723,6 @@ defaultParserState =
724723 stateKeys = M.empty,
725724 stateCitations = [],
726725 stateNotes = [],
727− stateStandalone = False,
728726 stateTitle = [],
729727 stateAuthors = [],
730728 stateDate = [],
src/Text/Pandoc/Readers/RST.hs+1−3
@@ -106,9 +106,7 @@ parseRST = do
106106 blocks <- parseBlocks
107107 let blocks' = filter (/= Null) blocks
108108 state <- getState
109− let (blocks'', title) = if stateStandalone state
110− then titleTransform blocks'
111− else (blocks', [])
109+ let (blocks'', title) = titleTransform blocks'
112110 let authors = stateAuthors state
113111 let date = stateDate state
114112 let title' = if (null title) then (stateTitle state) else title
src/pandoc.hs−1
@@ -938,7 +938,6 @@ main = do
938938
939939 let startParserState = def{ stateLiterateHaskell = "+lhs" `isSuffixOf` readerName' ||
940940 lhsExtension sources,
941− stateStandalone = standalone',
942941 stateCitations = map CSL.refId refs,
943942 stateOptions = def{
944943 readerStrict = strict