git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Skip \index commands.
commitd033fc9d3e2ea572bf00ca0dd04426795fab4c49 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 5 Jan 2011, 10:11 (16 years ago) parentc949530
1 file changed+8−1
src/Text/Pandoc/Readers/LaTeX.hs+8−1
src/Text/Pandoc/Readers/LaTeX.hs+8−1
@@ -40,7 +40,7 @@ import Text.Pandoc.Parsing
4040import Data.Maybe ( fromMaybe )
4141import Data.Char ( chr, toUpper )
4242import Data.List ( isPrefixOf, isSuffixOf )
43−import Control.Monad ( when )
43+import Control.Monad ( when, guard )
4444
4545-- | Parse LaTeX from string and return 'Pandoc' document.
4646readLaTeX :: ParserState -- ^ Parser state, including options for parser
@@ -478,6 +478,7 @@ inline = choice [ str
478478 , accentedChar
479479 , nonbreakingSpace
480480 , cite
481+ , index
481482 , specialChar
482483 , rawLaTeXInline'
483484 , escapedChar
@@ -814,6 +815,12 @@ footnote = try $ do
814815cite :: GenParser Char ParserState Inline
815816cite = simpleCite <|> complexNatbibCites
816817
818+index :: GenParser Char ParserState Inline
819+index = try $ do
820+ (name, _, _) <- command
821+ guard $ name == "index"
822+ return $ Str ""
823+
817824simpleCiteArgs :: GenParser Char ParserState [Citation]
818825simpleCiteArgs = try $ do
819826 first <- optionMaybe $ (char '[') >> manyTill inline (char ']')