git.iko.soy/typeable/pandoc
on master help sign in
stateCitations -> readerCitations.
commit070b968ae042238c86740c2aea21aacc4f62f618 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 25 Jul 2012, 20:27 (14 years ago) parent856aa8c
4 files changed+6−6
src/Text/Pandoc/Options.hs+2 src/Text/Pandoc/Parsing.hs−2 src/Text/Pandoc/Readers/Markdown.hs+2−2 src/pandoc.hs+2−2
src/Text/Pandoc/Options.hs+2
@@ -61,6 +61,7 @@ data ReaderOptions = ReaderOptions{
6161 -- in parsing dashes; -- is em-dash;
6262 -- - before numerial is en-dash
6363 , readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
64+ , readerCitations :: [String] -- ^ List of available citations
6465} deriving (Show, Read)
6566
6667instance Default ReaderOptions
@@ -73,4 +74,5 @@ instance Default ReaderOptions
7374 , readerTabStop = 4
7475 , readerOldDashes = False
7576 , readerLiterateHaskell = False
77+ , readerCitations = []
7678 }
src/Text/Pandoc/Parsing.hs−2
@@ -693,7 +693,6 @@ data ParserState = ParserState
693693 stateMaxNestingLevel :: Int, -- ^ Max # of nested Strong/Emph
694694 stateLastStrPos :: Maybe SourcePos, -- ^ Position after last str parsed
695695 stateKeys :: KeyTable, -- ^ List of reference keys
696− stateCitations :: [String], -- ^ List of available citations
697696 stateNotes :: NoteTable, -- ^ List of notes
698697 stateTitle :: [Inline], -- ^ Title of document
699698 stateAuthors :: [[Inline]], -- ^ Authors of document
@@ -720,7 +719,6 @@ defaultParserState =
720719 stateMaxNestingLevel = 6,
721720 stateLastStrPos = Nothing,
722721 stateKeys = M.empty,
723− stateCitations = [],
724722 stateNotes = [],
725723 stateTitle = [],
726724 stateAuthors = [],
src/Text/Pandoc/Readers/Markdown.hs+2−2
@@ -1405,8 +1405,8 @@ citeKey = try $ do
14051405 let internal p = try $ p >>~ lookAhead (letter <|> digit)
14061406 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~")
14071407 let key = first:rest
1408− st <- getState
1409− guard $ key `elem` stateCitations st
1408+ citations' <- getOption readerCitations
1409+ guard $ key `elem` citations'
14101410 return (suppress_author, key)
14111411
14121412suffix :: Parser [Char] ParserState [Inline]
src/pandoc.hs+2−2
@@ -936,8 +936,7 @@ main = do
936936 then "."
937937 else takeDirectory (head sources)
938938
939− let startParserState = def{ stateCitations = map CSL.refId refs,
940− stateOptions = def{
939+ let startParserState = def{ stateOptions = def{
941940 readerStrict = strict
942941 , readerSmart = smart || (texLigatures &&
943942 (laTeXOutput || writerName' == "context"))
@@ -948,6 +947,7 @@ main = do
948947 , readerLiterateHaskell =
949948 "+lhs" `isSuffixOf` readerName' ||
950949 lhsExtension sources
950+ , readerCitations = map CSL.refId refs
951951 },
952952 stateIndentedCodeClasses = codeBlockClasses,
953953 stateApplyMacros = not laTeXOutput