Org reader: set classoption meta from LaTeX_class_options

This commit is contained in:
Albert Krewinkel
2016-08-29 14:10:57 +02:00
parent 825ce8ca73
commit d164ead379
2 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -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)
+5
View File
@@ -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"