~cypheon/idris2-quickdocs

cbb5a4250b228ddc56b0e55d22f6ec772f3ca124 — Johann Rudloff 3 months ago bafccda main
Include the version of the _documented_ soruce code in the output
3 files changed, 15 insertions(+), 2 deletions(-)

M mkhome.py
M rebuild_all.sh
M templates/home.md.j2
M mkhome.py => mkhome.py +8 -0
@@ 1,6 1,7 @@
#!/usr/bin/env python3

from pathlib import Path
from subprocess import check_output
import sys

from jinja2 import Template


@@ 13,6 14,11 @@ HTML_TRAILER = '''</article></body></html>'''

def main():
    root = Path(sys.argv[1])
    idris_src_root = Path(sys.argv[2])

    idris_src_version = check_output(["git", "describe", "--tags"], cwd=idris_src_root, encoding='utf-8').strip()
    idris_commit_id = check_output(["git", "rev-list", "--max-count=1", "HEAD"], cwd=idris_src_root, encoding='utf-8').strip()

    with open('templates/home.md.j2') as f:
        tpl = Template(f.read())



@@ 28,6 34,8 @@ def main():
    context = {
        'packages': packages,
        'downloads': downloads,
        'idris_src_version': idris_src_version,
        'idris_commit_id': idris_commit_id,
    }

    with open(root / 'home.html', 'w') as f:

M rebuild_all.sh => rebuild_all.sh +5 -2
@@ 5,7 5,7 @@ set -u
set -o pipefail
set -x

src_root=${IDRIS2_SRC:-$PWD/../Idris2-SH}
src_root=${IDRIS2_SRC:-$PWD/../Idris2-vanilla}
idris2=${IDRIS2_EXECUTABLE:-idris2}

build_doc() {


@@ 28,4 28,7 @@ for pkg in base contrib network prelude test; do
done

poetry run ./mkindex.py data
poetry run ./mkhome.py data
poetry run ./mkhome.py data "$src_root"

echo "Docs build complete, documented Idris2 version:"
(cd "$src_root" && git describe --tags)

M templates/home.md.j2 => templates/home.md.j2 +2 -0
@@ 13,6 13,8 @@ find `Control.Monad.State.runState`
{% for pkg in packages %} * [{{ pkg }}]({{ pkg }}/index.html)
{% endfor %}

The version of the documented source code is: <a href="https://github.com/idris-lang/Idris2/tree/{{ idris_commit_id }}" target="_blank">{{ idris_src_version }}</a>

### Downloads

Each `tar.gz` contains self-contained HTML for offline viewing (but without