git.iko.soy/typeable/pandoc
on master help sign in
Org reader: give precedence to later meta lines

The last meta-line of any given type is the significant line. Previously the value of the first line was kept, even if more lines of the same type were encounterd.

commit75df1042157e271398e880e64ce95bd83c5d2193 authorAlbert Krewinkel <albert@zeitkraut.de> dateMon 29 Aug 2016, 14:10 (10 years ago) parent2ca2585
2 files changed+9−1
src/Text/Pandoc/Readers/Org/Meta.hs+1−1 tests/Tests/Readers/Org.hs+8
src/Text/Pandoc/Readers/Org/Meta.hs+1−1
@@ -59,7 +59,7 @@ declarationLine = try $ do
5959 value <- metaValue key
6060 updateState $ \st ->
6161 let meta' = B.setMeta key <$> value <*> pure nullMeta
62− in st { orgStateMeta = orgStateMeta st <> meta' }
62+ in st { orgStateMeta = meta' <> orgStateMeta st }
6363
6464metaKey :: OrgParser String
6565metaKey = map toLower <$> many1 (noneOf ": \n\r")
tests/Tests/Readers/Org.hs+8
@@ -496,6 +496,14 @@ tests =
496496 ] =?>
497497 (mempty::Blocks)
498498
499+ , "later meta definitions take precedence" =:
500+ unlines [ "#+AUTHOR: this will not be used"
501+ , "#+author: Max"
502+ ] =?>
503+ let author = MetaInlines [Str "Max"]
504+ meta = setMeta "author" (MetaList [author]) $ nullMeta
505+ in Pandoc meta mempty
506+
499507 , "Logbook drawer" =:
500508 unlines [ " :LogBook:"
501509 , " - State \"DONE\" from \"TODO\" [2014-03-03 Mon 11:00]"