summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-04-26 12:14:42 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-04-26 12:14:42 -0700
commit22e36e104058b0ea93dbda106374f6c02bbf36d6 (patch)
tree70446b7d55913453fa4e848756138b4b5655ad02 /src/Text/Pandoc
parent35ea8de3690fcd9bf06532576ced4d82fd51f26d (diff)
LaTeX reader: Made `\nocite` work.
This adds nocite citations to a metadata field, `nocite`. These will appear in the bibliography but not in the text (unless you use a `$nocite$` variable in your template, of course).
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index fd761dbec..b5d529eb9 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -322,7 +322,8 @@ blockCommands = M.fromList $
]
addMeta :: ToMetaValue a => String -> a -> LP ()
-addMeta field val = updateState $ setMeta field val
+addMeta field val = updateState $ \st ->
+ st{ stateMeta = addMetaField field val $ stateMeta st }
setCaption :: Inlines -> LP Blocks
setCaption ils = do
@@ -341,7 +342,7 @@ authors = try $ do
-- skip e.g. \vspace{10pt}
auths <- sepBy oneAuthor (controlSeq "and")
char '}'
- addMeta "authors" (map trimInlines auths)
+ addMeta "author" (map trimInlines auths)
section :: Attr -> Int -> LP Blocks
section (ident, classes, kvs) lvl = do
@@ -525,10 +526,12 @@ inlineCommands = M.fromList $
, ("citeauthor", (try (tok *> optional sp *> controlSeq "citetext") *>
complexNatbibCitation AuthorInText)
<|> citation "citeauthor" AuthorInText False)
+ , ("nocite", mempty <$ (citation "nocite" NormalCitation False >>=
+ addMeta "nocite"))
] ++ map ignoreInlines
-- these commands will be ignored unless --parse-raw is specified,
-- in which case they will appear as raw latex blocks:
- [ "noindent", "index", "nocite" ]
+ [ "noindent", "index" ]
mkImage :: String -> LP Inlines
mkImage src = do