diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-02-24 15:34:41 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-02-24 15:34:41 +0100 |
commit | 0448b7d1fc8bb12d1288287ea01bb2ef091ea7d5 (patch) | |
tree | 2c157b3a9fddfbef8ad0d3097d0a33a15c14af6c /src/Text/Pandoc/Readers | |
parent | b8674519d5a8e1e78d41368d54700317fbc0158f (diff) | |
download | pandoc-0448b7d1fc8bb12d1288287ea01bb2ef091ea7d5.tar.gz |
Implemented `\graphicspath` in LaTeX reader.
Closes #736.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index fbbdc1873..cc8176162 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -53,7 +53,7 @@ import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension) import Text.Pandoc.ImageSize (numUnit, showFl) import Control.Monad.Except (throwError) import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv, report, - readFileFromDirs) + readFileFromDirs, setResourcePath) -- | Parse LaTeX from string and return 'Pandoc' document. readLaTeX :: PandocMonad m @@ -372,6 +372,7 @@ blockCommands = M.fromList $ addMeta "bibliography" . splitBibs)) -- includes , ("lstinputlisting", inputListing) + , ("graphicspath", graphicsPath) ] ++ map ignoreBlocks -- these commands will be ignored unless --parse-raw is specified, -- in which case they will appear as raw latex blocks @@ -390,6 +391,12 @@ blockCommands = M.fromList $ , "newpage" ] +graphicsPath :: PandocMonad m => LP m Blocks +graphicsPath = do + ps <- bgroup *> (manyTill braced egroup) + setResourcePath (".":ps) + return mempty + addMeta :: PandocMonad m => ToMetaValue a => String -> a -> LP m () addMeta field val = updateState $ \st -> st{ stateMeta = addMetaField field val $ stateMeta st } |