mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 18:26:36 +00:00
Org reader: set classoption meta from LaTeX_class_options
This commit is contained in:
@@ -78,6 +78,10 @@ metaValue key =
|
||||
"latex_header" -> (inclKey,) <$>
|
||||
accumulatingList inclKey (metaExportSnippet "latex")
|
||||
"latex_class" -> ("documentclass",) <$> metaString
|
||||
-- Org-mode expects class options to contain the surrounding brackets,
|
||||
-- pandoc does not.
|
||||
"latex_class_options" -> ("classoption",) <$>
|
||||
metaModifiedString (filter (`notElem` "[]"))
|
||||
_ -> (key,) <$> metaString
|
||||
|
||||
metaInlines :: OrgParser (F MetaValue)
|
||||
@@ -92,7 +96,10 @@ metaInlinesCommaSeparated = do
|
||||
return $ MetaList . map toMetaInlines <$> sequence authors
|
||||
|
||||
metaString :: OrgParser (F MetaValue)
|
||||
metaString = return . MetaString <$> anyLine
|
||||
metaString = metaModifiedString id
|
||||
|
||||
metaModifiedString :: (String -> String) -> OrgParser (F MetaValue)
|
||||
metaModifiedString f = return . MetaString . f <$> anyLine
|
||||
|
||||
-- | Read an format specific meta definition
|
||||
metaExportSnippet :: String -> OrgParser (F MetaValue)
|
||||
|
||||
@@ -508,6 +508,11 @@ tests =
|
||||
let meta = setMeta "documentclass" (MetaString "article") nullMeta
|
||||
in Pandoc meta mempty
|
||||
|
||||
, "LaTeX_class_options is translated to classoption" =:
|
||||
"#+LATEX_CLASS_OPTIONS: [a4paper]" =?>
|
||||
let meta = setMeta "classoption" (MetaString "a4paper") nullMeta
|
||||
in Pandoc meta mempty
|
||||
|
||||
, "later meta definitions take precedence" =:
|
||||
unlines [ "#+AUTHOR: this will not be used"
|
||||
, "#+author: Max"
|
||||
|
||||
Reference in New Issue
Block a user