From 68d388f833c1400e2c6a177c9822cf385aabb5fc Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Fri, 20 May 2016 00:15:52 +0200 Subject: Org reader: add :PROPERTIES: drawer support Headers can have optional `:PROPERTIES:` drawers associated with them. These drawers contain key/value pairs like the header's `id`. The reader adds all listed pairs to the header's attributes; `id` and `class` attributes are handled specially to match the way `Attr` are defined. This also changes behavior of how drawers of unknown type are handled. Instead of including all unknown drawers, those are not read/exported, thereby matching current Emacs behavior. This closes #1877. --- tests/Tests/Readers/Org.hs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'tests/Tests/Readers') diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index 666d93a51..6f5a1bd50 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -412,17 +412,17 @@ tests = ] =?> para "Before" <> para "After" - , "Drawer start is the only text in first line of a drawer" =: + , "Drawer markers must be the only text in the line" =: unlines [ " :LOGBOOK: foo" - , " :END:" + , " :END: bar" ] =?> - para (":LOGBOOK:" <> space <> "foo" <> softbreak <> ":END:") + para (":LOGBOOK: foo" <> softbreak <> ":END: bar") - , "Drawers with unknown names are just text" =: + , "Drawers can be arbitrary" =: unlines [ ":FOO:" , ":END:" ] =?> - para (":FOO:" <> softbreak <> ":END:") + (mempty::Blocks) , "Anchor reference" =: unlines [ "<> Target." @@ -597,6 +597,15 @@ tests = , headerWith ("but-this-is", [], []) 2 "But this is" ] + , "Preferences are treated as header attributes" =: + unlines [ "* foo" + , " :PROPERTIES:" + , " :id: fubar" + , " :bar: baz" + , " :END:" + ] =?> + headerWith ("fubar", [], [("bar", "baz")]) 1 "foo" + , "Paragraph starting with an asterisk" =: "*five" =?> para "*five" -- cgit v1.2.3