@# This requires a hacked version of man2html @# See here: http://www.kylheku.com/cgit/man @(bind symhash @(hash :equal-based)) @(bind tagmap @(hash :equal-based)) @(bind tochash @(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)) (defvarl disamb (hash :equal-based)) (defvarl dist-counter 0) (defun hash-str (str) (for ((lim (len str)) (i 0) (h 0) g) ((< i lim) h) ((inc i)) (set h (+ (ash h 4) (int-chr [str i]))) (set g (logand h #x7c000000)) (set h (logtrunc (logxor h (logxor (ash g -26) g)) 32)))) (defun hash-title (title) (let* ((h (logtrunc (hash-str title) 32)) (existing [dupes h])) (when existing (unless (equal title existing) (error "~a ~a hash collision!" existing title))) (set [dupes h] title) (format nil "N-~,08X" h))) (defun toc-tag (sec) `TOC-@sec`) (set [tagmap "lbAB"] (hash-title "NAME")) (defun enumerate (title) (let ((num (inc [tagnum title 0]))) `@title@(if (> num 1) `-@num` "")`)) (defun process-ambiguities (hash) (hash-update hash (do if (eql (length @1) 1) (first @1) (let ((new-tag (format nil "D-~,04X" (inc dist-counter)))) (set [disamb new-tag] (reverse @1)) new-tag))))) Content-type: text/html @(skip 15)

TXR

@(skip)Updated: @YEAR-@MONTH-@DAY
Index @(bind TIME @(make-time-utc (int-str YEAR) (int-str MONTH) (int-str DAY) 0 0 0 nil)) @(bind VERSION nil) @(collect :vars (BODY)) @ (some) @ (cases)   @ (some) @sec @title @ (or) @sec @title @ (end) @ (bind newtag @(hash-title (enumerate title))) @ (do (set [tagmap tag] newtag)) @ (output :into BODY)   @sec @title @ (end) @ (cat BODY "\n") @ (or) @BODY @ (end) @ (and) TXR - text processing language (version @ver) @ (set VERSION ver) @ (end) @(until)
 

Index

@(end)
@(collect :vars (TOC)) @ (some) @ (cases) @ (cases)
@num @rest
@ (or)
@num @rest
@ (end) @ (bind TOC `
@num @rest
`) @ (or) @(skip) @ (output :into TOC)

Contents

@xpnall @ (end) @ (or) @TOC @ (end) @ (and)
@nil TXR LISP
@ (and)
@(coll :vars (sym))@sym@(end) @ (do (let ((n-tag [tagmap tag])) (mapdo (do pushnew n-tag [symhash @1]) sym) (set [tochash n-tag] rest))) @ (and)
@num @nil @ (maybe)
@ (end)
@ (cat TOC) @ (bind pos @(car (search-regex TOC #/<\/dt/))) @ (bind id @(gensym)) @ (do (set [TOC pos..pos] `@(if closed closedtxt opentxt)`)) @ (output :into TOC) @TOC
@ (end) @ (end) @(until) This document was created by @(end) @(flatten TOC) @(do (process-ambiguities symhash)) @(set BODY @(let ((inside-tt nil) (inside-syntax nil)) (mapcar (do cond ((equal @1 "") (set inside-tt t) @1) ((equal @1 "") (set inside-tt nil) (set inside-syntax nil) @1) ((equal @1 "
Syntax:
") (set inside-syntax t) @1) ((or (and inside-tt (not inside-syntax)) (match-regex @1 #/
/)) (regsub #/@?[\(\[][^ )&]+/ (do let* ((at (if (eql [@1 0] #\@) (pop @1))) (tok [@1 1..:]) (bkt [@1 0]) (tag [symhash tok])) (if tag `@at@bkt@tok` `@at@1`)) @1)) ((search-regex @1 #//) @1) (t (regsub #/.%<\/tt>/ (do let* ((tok [@1 4 -5]) (tend (break-str tok ") ")) pfx sym sfx tag) (cond ((match-str tok "@(") (set pfx "@(" sym [tok 2 tend] sfx [tok tend .. :] tag [symhash sym])) (t (set tag [symhash tok] sym tok))) (if tag `@pfx@sym@sfx` @1)) @1))) BODY))) @(bind (d-tag n-tag) @(transpose (hash-pairs disamb))) @(output) Manpage for TXR @VERSION

Manpage for TXR @VERSION

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

@(repeat) @TOC @(end)
@(repeat) @BODY @(first) @(end) @(end) @(bind (name code) @(transpose [nsort (mapcar (tb ((sym code)) (list (html-decode sym) code)) (hash-pairs symhash)) : car])) @(output "share/txr/stdlib/doc-syms.tl") (defparml doc-syms (hash-from-pairs @ (repeat) (@(tostring name) @(tostring code)) @(first) '((@(tostring name) @(tostring code)) @(last) (@(tostring name) @(tostring code))))) @ (end) @(end)