;doc: BACKLOG, ROADMAP: improve page TOC

This commit is contained in:
Simon Michael 2021-09-27 11:49:25 -10:00
parent e53e95540e
commit 030b1f5d00
2 changed files with 30 additions and 3 deletions

View File

@ -1,4 +1,5 @@
* BACKLOG.org * BACKLOG.org
#+OPTIONS: H:2
An efficient public store of tasks/changes/design notes, mostly from An efficient public store of tasks/changes/design notes, mostly from
SM's private backlog; things that I/we feel would be nice to have, or SM's private backlog; things that I/we feel would be nice to have, or

View File

@ -768,14 +768,40 @@ main = do
] |%> \out -> do ] |%> \out -> do
let src = drop 1 out -<.> "org" let src = drop 1 out -<.> "org"
need [src] need [src]
liftIO $ writeFile out $ unlines [ -- replace the generated top heading with our own so we can insert the TOC after it
let heading = dropExtension $ drop 1 out
mdlines <- drop 1 . lines . fromStdout <$> (cmd Shell pandoc fromorg towebmd src :: Action (Stdout String))
liftIO $ writeFile out $ unlines $ [
"<!-- " ++ "Generated by \"Shake " ++ out ++ " from " ++ src ++ " -->" "<!-- " ++ "Generated by \"Shake " ++ out ++ " from " ++ src ++ " -->"
,""
,"# " ++ heading
,""
,"<div class=\"pagetoc\">" ,"<div class=\"pagetoc\">"
,"<!-- toc -->" ,"<!-- toc -->"
,"</div>" ,"</div>"
,"" ,""
] ] ++ mdlines
cmd_ Shell pandoc fromorg towebmd src ">>" out
-- XXX try to style backlog items as unnumbered or nested-numbered list items
{-
<style>
main>ol {
list-style: none;
padding-inline-start: 1em;
counter-reset: item;
}
/* XXX when there are subitems, pandoc wraps all in a <p>,
* which forces a line break after the :before text
*/
main>ol>li:before {
content: counters(item, ".") ". ";
counter-increment: item;
}
*/
main>ol>li {
}
</style>
-}
-- MISC -- MISC