Skip to content

Commit

Permalink
Org reader: fix planning elements in headers level 3 and higher
Browse files Browse the repository at this point in the history
Planning info is now always placed before the subtree contents.
Previously, the planning info was placed after the content if the
header's subtree was converted to a list, which happens with headers of
level 3 and higher per default.

Fixes: #5494
  • Loading branch information
tarleb committed May 13, 2019
1 parent 00ef038 commit 8b00bc6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Readers/Org/DocumentTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ headlineToHeaderWithList hdln = do
else flattenHeader header
return . mconcat $
[ headerText
, headlineContents hdln
, planningBlock
, headlineContents hdln
, listBlock
]
where
Expand Down
24 changes: 24 additions & 0 deletions test/Tests/Readers/Org/Block/Header.hs
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,29 @@ tests =
, " :END:"
] =?>
headerWith ("look", [], []) 1 "important"

, "third and forth level headers" =:
T.unlines [ "#+OPTIONS: p:t h:3"
, "*** Third"
, " CLOSED: [2018-09-05 Wed 13:58]"
, " Text 3"
, "**** Fourth"
, "SCHEDULED: <2019-05-13 Mon 22:42>"
, "Text 4"
] =?>
mconcat
[ headerWith ("third", [], mempty) 3 "Third"
, plain $
strong "CLOSED:" <> space <> emph (str "[2018-09-05 Wed 13:58]")
, para "Text 3"
, orderedList [
mconcat
[ para "Fourth"
, plain $ strong "SCHEDULED:"
<> space
<> emph (str "<2019-05-13 Mon 22:42>")
, para "Text 4"
]]
]
]
]

0 comments on commit 8b00bc6

Please sign in to comment.