hacked-up-hyde pasted by andyjpb on Tue Nov 15 12:26:10 2011

$ diff -ru hyde.orig hyde
Only in hyde: hyde
Only in hyde: hyde-atom.import.scm
Only in hyde: hyde-atom.import.so
Only in hyde: hyde-atom.so
Only in hyde: hyde.import.scm
Only in hyde: hyde.import.so
diff -ru hyde.orig/hyde.scm hyde/hyde.scm
--- hyde.orig/hyde.scm  2011-11-14 18:01:19.667867515 +0000
+++ hyde/hyde.scm       2011-11-14 22:20:01.316740294 +0000
@@ -22,7 +22,8 @@
  uri-path-prefix
  markdown-program
  link-shortcuts
- sxml-conversion-rules)
+ sxml-conversion-rules
+ ajpb-rules)
 
 (import chicken scheme files data-structures extras srfi-1 ports srfi-13 utils)
 (require-extension regex)
@@ -79,6 +80,8 @@
 (define current-page (make-parameter #f))
 (define pages (make-parameter '()))
 (define page-eval-env (make-parameter (environment-copy (interaction-environment) #t)))
+(define sxml-conversion-rules (make-parameter '()))
+(define ajpb-rules (make-parameter '()))
 
 (define-syntax define-hyde-environment 
   (syntax-rules ()
@@ -138,12 +141,13 @@
                               (colorize-code (car els) (cdr els))))
     ,@alist-conv-rules*))
 
-(define sxml-conversion-rules 
-  `((inject *preorder* . ,(lambda (tag sxml) sxml))
-    (shortcut . ,(lambda (tag attrs)
-                   (apply expand-link-shortcut attrs)))
-    ,@doctype-rules
-    ,@universal-conversion-rules*))
+(sxml-conversion-rules (cons*
+  `(inject *preorder* . ,(lambda (tag sxml) sxml))
+  `(shortcut . ,(lambda (tag attrs)
+                  (apply expand-link-shortcut attrs)))
+  (append doctype-rules
+          universal-conversion-rules*
+          (sxml-conversion-rules))))
 
 (define (expand-link-shortcut alias . args)
   (let ((uri-template (alist-ref alias (link-shortcuts))))
@@ -397,7 +401,7 @@
 
 (define (translate/sxml)
   (output-xml (map (lambda (e) (eval e (page-eval-env))) (read-file))
-             (list sxml-colorize-rules sxml-conversion-rules)))
+             (list sxml-colorize-rules (sxml-conversion-rules))))
 
 (translators (cons (list "sxml" translate/sxml) (translators)))
 
@@ -448,13 +452,17 @@
           uri
           (cdr attrs))))
 
+;(ajpb-rules (cons
+;             `(toc . ,(lambda (tag rest) `(toc ,rest moris-dancing-is-best)))
+;             (ajpb-rules)))
 (define (translate/svnwiki)
   (let* ((doc (svnwiki->sxml (current-input-port)))
          (doc (pre-post-order* doc `((int-link . ,expand-link-shortcut/svnwiki)
                                      ,@alist-conv-rules*)))
+         (doc (pre-post-order* doc `(,@(ajpb-rules) ,@alist-conv-rules* )))
          (rules (multidoc-html-transformation-rules doc))
          (rules (append (butlast rules)
-                        (list (cons (assq 'inject sxml-conversion-rules)
+                        (list (cons (assq 'inject (sxml-conversion-rules))
                                     (last rules))))))
 
     (output-xml doc (cons sxml-colorize-rules rules))))
Only in hyde: hyde.scm~
Only in hyde: hyde.so

hyde.scm that puts the page title in the toc added by andyjpb on Tue Nov 15 12:27:35 2011

$ more hyde.scm
(use hyde environments defstruct)

(ajpb-rules (cons
                          `(toc . ,(lambda (tag rest) `(toc ,rest
                                                  ,(let* ((current-page ((environment-ref (page-eval-env) 'current-page)))
                                                                  (vars (record-instance-slot current-page (- (record-instance-len
gth current-page) 1)))
                                                                  (title (cdr (assq 'title vars))))
                                                         `(h1 ,title)))))
                          (ajpb-rules)))