git.iko.soy/typeable/pandoc
on master help sign in
stateCitations -> readerCitations.
070b968John MacFarlane
src/Text/Pandoc/Options.hs+2
@@ -61,6 +61,7 @@ data ReaderOptions = ReaderOptions{
61 -- in parsing dashes; -- is em-dash;
61 -- in parsing dashes; -- is em-dash;
62 -- - before numerial is en-dash
62 -- - before numerial is en-dash
63 , readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
63 , readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
64+ , readerCitations :: [String] -- ^ List of available citations
64} deriving (Show, Read)
65} deriving (Show, Read)
65
66
66instance Default ReaderOptions
67instance Default ReaderOptions
@@ -73,4 +74,5 @@ instance Default ReaderOptions
73 , readerTabStop = 4
74 , readerTabStop = 4
74 , readerOldDashes = False
75 , readerOldDashes = False
75 , readerLiterateHaskell = False
76 , readerLiterateHaskell = False
77+ , readerCitations = []
76 }
78 }
src/Text/Pandoc/Parsing.hs−2
@@ -693,7 +693,6 @@ data ParserState = ParserState
693 stateMaxNestingLevel :: Int, -- ^ Max # of nested Strong/Emph
693 stateMaxNestingLevel :: Int, -- ^ Max # of nested Strong/Emph
694 stateLastStrPos :: Maybe SourcePos, -- ^ Position after last str parsed
694 stateLastStrPos :: Maybe SourcePos, -- ^ Position after last str parsed
695 stateKeys :: KeyTable, -- ^ List of reference keys
695 stateKeys :: KeyTable, -- ^ List of reference keys
696− stateCitations :: [String], -- ^ List of available citations
697 stateNotes :: NoteTable, -- ^ List of notes
696 stateNotes :: NoteTable, -- ^ List of notes
698 stateTitle :: [Inline], -- ^ Title of document
697 stateTitle :: [Inline], -- ^ Title of document
699 stateAuthors :: [[Inline]], -- ^ Authors of document
698 stateAuthors :: [[Inline]], -- ^ Authors of document
@@ -720,7 +719,6 @@ defaultParserState =
720 stateMaxNestingLevel = 6,
719 stateMaxNestingLevel = 6,
721 stateLastStrPos = Nothing,
720 stateLastStrPos = Nothing,
722 stateKeys = M.empty,
721 stateKeys = M.empty,
723− stateCitations = [],
724 stateNotes = [],
722 stateNotes = [],
725 stateTitle = [],
723 stateTitle = [],
726 stateAuthors = [],
724 stateAuthors = [],
src/Text/Pandoc/Readers/Markdown.hs+2−2
@@ -1405,8 +1405,8 @@ citeKey = try $ do
1405 let internal p = try $ p >>~ lookAhead (letter <|> digit)
1405 let internal p = try $ p >>~ lookAhead (letter <|> digit)
1406 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~")
1406 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~")
1407 let key = first:rest
1407 let key = first:rest
1408− st <- getState
1408+ citations' <- getOption readerCitations
1409− guard $ key `elem` stateCitations st
1409+ guard $ key `elem` citations'
1410 return (suppress_author, key)
1410 return (suppress_author, key)
1411
1411
1412suffix :: Parser [Char] ParserState [Inline]
1412suffix :: Parser [Char] ParserState [Inline]
src/pandoc.hs+2−2
@@ -936,8 +936,7 @@ main = do
936 then "."
936 then "."
937 else takeDirectory (head sources)
937 else takeDirectory (head sources)
938
938
939− let startParserState = def{ stateCitations = map CSL.refId refs,
940− stateOptions = def{
939+ let startParserState = def{ stateOptions = def{
941 readerStrict = strict
940 readerStrict = strict
942 , readerSmart = smart || (texLigatures &&
941 , readerSmart = smart || (texLigatures &&
943 (laTeXOutput || writerName' == "context"))
942 (laTeXOutput || writerName' == "context"))
@@ -948,6 +947,7 @@ main = do
948 , readerLiterateHaskell =
947 , readerLiterateHaskell =
949 "+lhs" `isSuffixOf` readerName' ||
948 "+lhs" `isSuffixOf` readerName' ||
950 lhsExtension sources
949 lhsExtension sources
950+ , readerCitations = map CSL.refId refs
951 },
951 },
952 stateIndentedCodeClasses = codeBlockClasses,
952 stateIndentedCodeClasses = codeBlockClasses,
953 stateApplyMacros = not laTeXOutput
953 stateApplyMacros = not laTeXOutput