mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 09:32:53 -06:00
TOC for Markdown should now work for both Pandoc < 2.0 and >= 2.0
The use of $toc$ and $table-of-contents$ flags changed, see: https://pandoc.org/releases.html#pandoc-2.0-29-oct-2017 under "Behaviour changes"
This commit is contained in:
@@ -54,7 +54,13 @@ $endif$
|
|||||||
$endif$
|
$endif$
|
||||||
$if(toc)$
|
$if(toc)$
|
||||||
<nav id="$idprefix$TOC">
|
<nav id="$idprefix$TOC">
|
||||||
|
$if(table-of-contents)$
|
||||||
|
<!-- pandoc >= 2.0 -->
|
||||||
$table-of-contents$
|
$table-of-contents$
|
||||||
|
$else$
|
||||||
|
<!-- pandoc < 2.0 -->
|
||||||
|
$toc$
|
||||||
|
$endif$
|
||||||
</nav>
|
</nav>
|
||||||
$endif$
|
$endif$
|
||||||
$body$
|
$body$
|
||||||
|
|||||||
@@ -93,18 +93,18 @@ function render_md_html {
|
|||||||
html="$2"
|
html="$2"
|
||||||
relroot="$( dirname $md | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )"
|
relroot="$( dirname $md | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )"
|
||||||
|
|
||||||
# Look for `toc: true` in metadata (first ten lines of file)
|
# Look for `show-toc: true` in metadata (first ten lines of file)
|
||||||
if head -n 10 "$md" | grep --quiet 'toc: true' ; then
|
if head -n 10 "$md" | grep --quiet 'show-toc: true' ; then
|
||||||
toc='--table-of-contents'
|
tocflag='--table-of-contents'
|
||||||
else
|
else
|
||||||
toc=''
|
tocflag=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pandoc \
|
pandoc \
|
||||||
--from=markdown \
|
--from=markdown \
|
||||||
--to=html5 \
|
--to=html5 \
|
||||||
--standalone \
|
--standalone \
|
||||||
$toc \
|
$tocflag \
|
||||||
--template="$template" \
|
--template="$template" \
|
||||||
--variable="lang:en" \
|
--variable="lang:en" \
|
||||||
--variable="rel-root:$relroot" \
|
--variable="rel-root:$relroot" \
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
title: GF Language Reference Manual
|
title: GF Language Reference Manual
|
||||||
author: Aarne Ranta, Krasimir Angelov
|
author: Aarne Ranta, Krasimir Angelov
|
||||||
date: June 2014, GF 3.6
|
date: June 2014, GF 3.6
|
||||||
toc: true
|
show-toc: true
|
||||||
---
|
---
|
||||||
|
|
||||||
This document is a reference manual to the GF programming language. GF,
|
This document is a reference manual to the GF programming language. GF,
|
||||||
|
|||||||
Reference in New Issue
Block a user