tools/pandoc-{site,drop-toc}, Shake, site/, doc/: switch from bulletlist to metainline toc marker

Files `site/doc/{1.0,1.1}/hledger-ui.md` had to be treated specially because
thay had some other elements inside the same `BulletList` that the `toc` lived
inside. Because only the first element of the `BulletList` is compared, these
extra HTML elements were either dropped or replaced with a TOC at compile time.
By switching to the meta-inline `\$toc\$`, they started to persist into the
resulting HTML. The fix was to drop them from the source markdown.
This commit is contained in:
Everett Hildenbrandt 2018-05-10 22:01:25 -06:00 committed by Simon Michael
parent ae987b236b
commit 946fa1d498
70 changed files with 75 additions and 112 deletions

View File

@ -267,7 +267,7 @@ main = do
webmanall %> \out -> do
need webmanpages
liftIO $ writeFile webmanall "* toc\n\n" -- # Big Manual\n\n -- TOC style is better without main heading,
liftIO $ writeFile webmanall "\\$toc\\$" -- # Big Manual\n\n -- TOC style is better without main heading,
forM_ webmanpages $ \f -> do -- site/hledger.md, site/journal.md
cmd Shell ("printf '\\n\\n' >>") webmanall :: Action ExitCode
cmd Shell "pandoc" f "-t markdown-fenced_divs --atx-headers"

View File

@ -31,7 +31,7 @@ m4_dnl | <a href="/doc/0.27/manual.html#$1">0.27</a>
</span>)m4_dnl
m4_dnl
m4_define({{_toc_}},{{
* toc
\$toc\$
}})m4_dnl
m4_dnl
m4_dnl _table_({{

View File

@ -10,7 +10,7 @@ $include-before$
$endfor$
-->
<!-- * toc -->
<!-- $toc$ -->
$body$

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,20 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
<style>
.highslide img {max-width:250px; float:right; margin:0 0 1em 1em;}
.highslide-caption {color:white; background-color:black;}
</style>
<a href="images/hledger-ui/hledger-ui-sample-acc2.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc2.png" title="Accounts screen with query and depth limit" /></a>
<a href="images/hledger-ui/hledger-ui-sample-acc.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc.png" title="Accounts screen" /></a>
<a href="images/hledger-ui/hledger-ui-sample-acc-greenterm.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc-greenterm.png" title="Accounts screen with greenterm theme" /></a>
<a href="images/hledger-ui/hledger-ui-sample-txn.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-txn.png" title="Transaction screen" /></a>
<a href="images/hledger-ui/hledger-ui-sample-reg.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-reg.png" title="Register screen" /></a>
<!-- <br clear=all> -->
<a href="images/hledger-ui/hledger-ui-bcexample-acc.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc.png" title="beancount example accounts" /></a>
<a href="images/hledger-ui/hledger-ui-bcexample-acc-etrade-cash.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc-etrade-cash.png" title="beancount example's etrade cash subaccount" /></a>
<a href="images/hledger-ui/hledger-ui-bcexample-acc-etrade.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc-etrade.png" title="beancount example's etrade investments, all commoditiess" /></a>
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.0**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,20 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
<style>
.highslide img {max-width:250px; float:right; margin:0 0 1em 1em;}
.highslide-caption {color:white; background-color:black;}
</style>
<a href="images/hledger-ui/hledger-ui-sample-acc2.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc2.png" title="Accounts screen with query and depth limit" /></a>
<a href="images/hledger-ui/hledger-ui-sample-acc.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc.png" title="Accounts screen" /></a>
<a href="images/hledger-ui/hledger-ui-sample-acc-greenterm.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-acc-greenterm.png" title="Accounts screen with greenterm theme" /></a>
<a href="images/hledger-ui/hledger-ui-sample-txn.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-txn.png" title="Transaction screen" /></a>
<a href="images/hledger-ui/hledger-ui-sample-reg.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-sample-reg.png" title="Register screen" /></a>
<!-- <br clear=all> -->
<a href="images/hledger-ui/hledger-ui-bcexample-acc.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc.png" title="beancount example accounts" /></a>
<a href="images/hledger-ui/hledger-ui-bcexample-acc-etrade-cash.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc-etrade-cash.png" title="beancount example's etrade cash subaccount" /></a>
<a href="images/hledger-ui/hledger-ui-bcexample-acc-etrade.png" class="highslide" onclick="return hs.expand(this)"><img src="images/hledger-ui/hledger-ui-bcexample-acc-etrade.png" title="beancount example's etrade investments, all commoditiess" /></a>
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.1**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.2**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.3**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.4**. <span class="docversions"></span>
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.5**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
* toc
\$toc\$

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -2,7 +2,7 @@
This doc is for version **1.9 (dev)**. []{.docversions}
- toc
\$toc\$
## NAME

View File

@ -1,4 +1,4 @@
- toc
\$toc\$
# Download

View File

@ -1,16 +1,6 @@
function keepBi(bi)
if not (bi[1].t == "Plain") then return true end
if not (bi[1].content[1].t == "Str") then return true end
if not (string.find(bi[1].content[1].text, "toc") == 1) then return true end
return false
end
function BulletList(bl)
local newBl = { }
for i,bi in pairs(bl.content) do
if keepBi(bi)
then table.insert(newBl, bi)
end
end
return pandoc.BulletList(newBl)
function Para(p)
if not p.content[1] then return p end
if not (p.content[1].t == "Str") then return p end
if not (p.content[1].text == "$toc$") then return p end
return pandoc.Null()
end

View File

@ -65,9 +65,8 @@ createTable alignment headers
in RawBlock "html" (navBegin ++ "\n" ++ tocString ++ "\n" ++ navEnd)
generateTOC :: Block -> Block -> Block
generateTOC toc (BulletList (( (( Plain ((Str "toc"):_)):_)):_))
= toc
generateTOC _ x = x
generateTOC toc (Para [Str "$toc$"]) = toc
generateTOC _ x = x
tableOfContents :: TOCAlignment -> Pandoc -> Pandoc
tableOfContents TOCOff ast = walk ignoreTOC ast