summaryrefslogtreecommitdiffstats
path: root/genman.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-06-26 08:02:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-06-26 08:02:12 -0700
commit526ff444979c6829ec52cc619136747354e57630 (patch)
tree5d4ebe317d6552850391308576a7db08d95c5b27 /genman.txr
parent069f2e879d2ad0ed7ab111f15cbf9d4901f864df (diff)
downloadtxr-526ff444979c6829ec52cc619136747354e57630.tar.gz
txr-526ff444979c6829ec52cc619136747354e57630.tar.bz2
txr-526ff444979c6829ec52cc619136747354e57630.zip
* genman.txr: New filter to add hyperlinks within code in
more places such as examples and summary lists.
Diffstat (limited to 'genman.txr')
-rw-r--r--genman.txr26
1 files changed, 26 insertions, 0 deletions
diff --git a/genman.txr b/genman.txr
index 423a8e38..b90c8387 100644
--- a/genman.txr
+++ b/genman.txr
@@ -93,6 +93,32 @@ This document was created by
@1))
BODY
LOOKUP))
+@(set BODY @(let ((inside-tt nil)
+ (inside-syntax nil))
+ (mapcar (do cond
+ ((equal @1 "<TT>") (set inside-tt t) @1)
+ ((equal @1 "</TT>") (set inside-tt nil)
+ (set inside-syntax nil)
+ @1)
+ ((equal @1 "<DT>Syntax:<DD>") (set inside-syntax t) @1)
+ ((or (and inside-tt (not inside-syntax))
+ (match-regex @1 #/<DT><TT>/))
+ (let* ((out0 (regsub #/@\([a-z0-9\-]+/
+ (do let* ((tok [@1 2..:])
+ (tag (or [txlhash tok]
+ [@@2 tok])))
+ (if tag
+ `@[@1 0](<A HREF="#@tag">@tok</A>`
+ @1)) @1)))
+ (regsub #/[\(\[][^ )&]+/
+ (do let* ((tok [@1 1..:])
+ (tag [txlhash tok]))
+ (if tag
+ `(<A HREF="#@tag">@tok</A>`
+ @1)) out0)))
+ (t @1))
+ BODY
+ LOOKUP)))
@(output)
<HTML>
<HEAD><TITLE>Manpage for TXR @VERSION</TITLE>