bc027579f81bd61a816afc1e63ef6232d840e042 braney Wed Jul 29 12:16:12 2026 -0700 Docent: publish the language reference as a generated page refs #37892 mkref.sh renders README.md to a standalone HTML page (default ~/public_html/docent.html), so the published reference is regenerated from the README rather than hand-maintained -- the previous hand-written page went stale as soon as the language was renamed. Also document the top-of-file `position:` key, which docent.js reads but the README did not list. Co-Authored-By: Claude Opus 5 (1M context) diff --git src/hg/utils/docent/mkref.sh src/hg/utils/docent/mkref.sh new file mode 100755 index 00000000000..2e287e992c4 --- /dev/null +++ src/hg/utils/docent/mkref.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Render README.md (the Docent language reference) to a standalone HTML page. +# +# ./mkref.sh # -> ~/public_html/docent.html +# ./mkref.sh /some/where/ref.html +# +# The published page is generated, never hand-edited: edit README.md and re-run. +# (The previous hand-written page went stale the moment the language was renamed.) + +set -e +out="${1:-$HOME/public_html/docent.html}" +here="$(cd "$(dirname "$0")" && pwd)" +css="$(mktemp)" +trap 'rm -f "$css"' EXIT + +cat > "$css" <<'EOF' + +EOF + +pandoc "$here/README.md" \ + --from=gfm --to=html5 --standalone \ + --metadata title="Docent — a language for authoring Genome Browser tours" \ + --include-in-header="$css" \ + -o "$out" + +# Pandoc repeats the metadata title as an

; the README supplies its own. +perl -0pi -e 's{
.*?
\n}{}s' "$out" + +cat >> "$out" <Generated from kent/src/hg/utils/docent/README.md by +mkref.sh — edit the README, not this page.

+ +EOF +# The appended footer follows pandoc's own ; strip the first pair. +perl -0pi -e 's{\n\n(?=