From c076d705c5ee80d02ad726ecda86f8249ed58f11 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 7 Dec 2015 06:36:29 -0800 Subject: HTML doc: table of contents improvements. * genman.txr: TOC extraction code renames Index to Contents, and adds expand/collapse links. Javascript added to handle expand/collapse. --- genman.txr | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'genman.txr') diff --git a/genman.txr b/genman.txr index 0fe17b7d..57b43dea 100644 --- a/genman.txr +++ b/genman.txr @@ -4,6 +4,11 @@ @(bind txlhash @(hash :equal-based)) @(bind tgthash txrhash) @(bind tagmap @(hash :equal-based)) +@(bind closedtxt "[+]") +@(bind opentxt "[-]") +@(bind xpnall "[expand all]") +@(bind clpsall "[collapse all]") +@(bind closed t) @(do (defvar dupes (hash)) (defvar tagnum (hash :equal-based)) @@ -66,9 +71,13 @@ Content-type: text/html @(collect :vars (TOC)) @ (some) @ (cases) -
@rest +
@num @rest +@ (bind TOC `
@num @rest`) +@ (or) +@(skip) @ (output :into TOC) -
@rest +

Contents

+
@clpsall @ (end) @ (or) @TOC @@ -80,10 +89,23 @@ Content-type: text/html
@(coll :vars (sym))@sym@(end) @ (do (mapdo (do unless [tgthash @1] (set [tgthash @1] [tagmap tag])) sym)) +@ (and) +
@num @rest +
+@ (cat TOC) +@ (bind pos @(car (search-regex TOC #/@(if closed closedtxt opentxt)`)) +@ (output :into TOC) +@TOC +
+@ (end) @ (end) @(until) This document was created by @(end) +@(flatten TOC) @(set BODY @(let ((inside-tt nil) (inside-syntax nil)) (mapcar (do cond @@ -126,6 +148,34 @@ This document was created by @(output) Manpage for TXR @VERSION +

Manpage for TXR @VERSION

@(time-string-utc TIME "%b %d, %Y")

@@ -138,9 +188,11 @@ This document was created by

+
@(repeat) @TOC @(end) +
@(repeat) @BODY @(first) -- cgit v1.2.3