Skip to content
Permalink
Browse files

;doc: don't add page TOCs any more, sphinx has it covered

[ci skip]
  • Loading branch information...
simonmichael committed Aug 26, 2019
1 parent 10157b8 commit da6718806ab5468bf63b2ebee18d0fe411013816
@@ -339,11 +339,10 @@ main = do
phony "mdcombinedmanual" $ need [ mdcombinedmanual ]
mdcombinedmanual %> \out -> do
need mdmanuals
liftIO $ writeFile mdcombinedmanual $ addToc ""
liftIO $ writeFile mdcombinedmanual ""
forM_ mdmanuals $ \f -> do -- site/hledger.md, site/journal.md
cmd_ Shell ("printf '\\n\\n' >>") mdcombinedmanual
cmd_ Shell pandoc f towebmd
"--lua-filter tools/pandoc-drop-toc.lua"
"--lua-filter tools/pandoc-demote-headers.lua"
">>" mdcombinedmanual

@@ -392,7 +391,6 @@ main = do

-- Render one website page as html, saved in sites/_site/.
-- Github-style wiki links will be hyperlinked.
-- The download page will have a TOC placeholder prepended.
"site/_site//*.html" %> \out -> do
let filename = takeBaseName out
pagename = fileNameToPageName filename
@@ -403,16 +401,13 @@ main = do
| otherwise = "site" </> filename <.> "md"
template = "site/site.tmpl"
siteRoot = if "site/_site/doc//*" ?== out then "../.." else "."
maybeAddToc | isdownloadpage = addToc
| otherwise = id
need [source, template]
-- read markdown source, link any wikilinks, maybe add a heading and TOC, pipe it to pandoc, write html out
Stdin . wikiLink . maybeAddToc <$> (readFile' source) >>=
-- read markdown source, link any wikilinks, pipe it to pandoc, write html out
Stdin . wikiLink <$> (readFile' source) >>=
(cmd Shell pandoc "-" fromsrcmd "-t html"
"--template" template
("--metadata=siteRoot:" ++ siteRoot)
("--metadata=\"title:" ++ pagename ++ "\"")
"--lua-filter=tools/pandoc-toc.lua"
"-o" out )

-- This rule, for updating the live hledger.org site, gets called by:
@@ -727,11 +722,6 @@ type Markdown = String
addHeading :: String -> Markdown -> Markdown
addHeading h = (("# "++h++"\n\n")++)

-- | Prepend a table of contents placeholder.
addToc :: Markdown -> Markdown
addToc = ((tocMarker++"\n\n")++)
where tocMarker = "$TOC$"

-- | Convert Github-style wikilinks to hledger website links.
wikiLink :: Markdown -> Markdown
wikiLink =
@@ -31,11 +31,6 @@ m4_dnl (dev)
<span class="docversions">m4_dnl
</span>)m4_dnl
m4_dnl
m4_dnl Insert a table of contents marker, which doc build scripts will populate.
m4_define({{_toc_}},{{
\$TOC\$
}})m4_dnl
m4_dnl
m4_dnl Helpers for generating table markup.
m4_dnl _table_({{
m4_dnl | cell1 | cell2 ...
@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{hledger-api}})
_toc_
}})

_man_({{
@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{csv}})
_toc_
}})
_man_({{

@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{journal}})
_toc_
}})
_man_({{

@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{timeclock}})
_toc_
}})
_man_({{

@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{timedot}})
_toc_
}})
_man_({{

@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{hledger-ui}})
_toc_
}})

_man_({{
@@ -4,7 +4,6 @@

_web_({{
_docversionlinks_({{hledger-web}})
_toc_
}})

_man_({{
@@ -15,7 +15,6 @@ m4_dnl hledger_troubleshooting.m4.md

_web_({{
_docversionlinks_({{hledger}})
_toc_
}})

_man_({{
@@ -1,3 +1,4 @@
-- Remove a $TOC$ marker (cf pandoc-toc.lua) from the document.
function Para(p)
if not p.content[1] then return p end
if not (p.content[1].t == "Str") then return p end
@@ -1,3 +1,5 @@
-- Replace a $TOC$ marker with a table of contents generated from the document's headings.

local headers = {}

function Header(h)

0 comments on commit da67188

Please sign in to comment.
You can’t perform that action at this time.