@@ -204,6 +204,7 @@ headlineToHeaderWithList hdln = do
204204 maxHeadlineLevels <- getExportSetting exportHeadlineLevels
205205 header <- headlineToHeader hdln
206206 listElements <- mapM headlineToBlocks (headlineChildren hdln)
207+ planningBlock <- planningToBlock (headlinePlanning hdln)
207208 let listBlock = if null listElements
208209 then mempty
209210 else B.orderedList listElements
@@ -213,6 +214,7 @@ headlineToHeaderWithList hdln = do
213214 return . mconcat $
214215 [ headerText
215216 , headlineContents hdln
217+ , planningBlock
216218 , listBlock
217219 ]
218220 where
@@ -225,8 +227,9 @@ headlineToHeaderWithList hdln = do
225227headlineToHeaderWithContents :: Monad m => Headline -> OrgParser m Blocks
226228headlineToHeaderWithContents hdln = do
227229 header <- headlineToHeader hdln
230+ planningBlock <- planningToBlock (headlinePlanning hdln)
228231 childrenBlocks <- mconcat <$> mapM headlineToBlocks (headlineChildren hdln)
229− return $ header <> headlineContents hdln <> childrenBlocks
232+ return $ header <> planningBlock <> headlineContents hdln <> childrenBlocks
230233
231234headlineToHeader :: Monad m => Headline -> OrgParser m Blocks
232235headlineToHeader hdln = do
@@ -287,6 +290,27 @@ tagsToInlines tags =
287290tagSpan :: Tag -> Inlines -> Inlines
288291tagSpan t = B.spanWith ("", ["tag"], [("tag-name", fromTag t)])
289292
293+-- | Render planning info as a block iff the respective export setting is
294+-- enabled.
295+planningToBlock :: Monad m => PlanningInfo -> OrgParser m Blocks
296+planningToBlock planning = do
297+ includePlanning <- getExportSetting exportWithPlanning
298+ return $
299+ if includePlanning
300+ then B.plain . mconcat . intersperse B.space . filter (/= mempty) $
301+ [ datumInlines planningClosed "CLOSED"
302+ , datumInlines planningDeadline "DEADLINE"
303+ , datumInlines planningScheduled "SCHEDULED"
304+ ]
305+ else mempty
306+ where
307+ datumInlines field name =
308+ case field planning of
309+ Nothing -> mempty
310+ Just time -> B.strong (B.str name <> B.str ":")
311+ <> B.space
312+ <> B.emph (B.str time)
313+
290314-- | An Org timestamp, including repetition marks. TODO: improve
291315type Timestamp = String
292316