summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--genman.txr26
2 files changed, 31 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d4abcaf0..20792a0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-26 Kaz Kylheku <kaz@kylheku.com>
+
+ * genman.txr: New filter to add hyperlinks within code in
+ more places such as examples and summary lists.
+
2015-06-24 Kaz Kylheku <kaz@kylheku.com>
* txr.1: partition example: wrong use of where function.
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>