hholzgra                Mon Jan 16 23:14:18 2006 UTC

  Modified files:              
    /phpdoc/dsssl       html-common.dsl 
  Log:
  make default role attribute of <function> context-aware
  
  
http://cvs.php.net/viewcvs.cgi/phpdoc/dsssl/html-common.dsl?r1=1.26&r2=1.27&diff_format=u
Index: phpdoc/dsssl/html-common.dsl
diff -u phpdoc/dsssl/html-common.dsl:1.26 phpdoc/dsssl/html-common.dsl:1.27
--- phpdoc/dsssl/html-common.dsl:1.26   Mon Jan 16 15:54:11 2006
+++ phpdoc/dsssl/html-common.dsl        Mon Jan 16 23:14:18 2006
@@ -1,6 +1,6 @@
 ;; -*- Scheme -*-
 ;;
-;; $Id: html-common.dsl,v 1.26 2006/01/16 15:54:11 hholzgra Exp $
+;; $Id: html-common.dsl,v 1.27 2006/01/16 23:14:18 hholzgra Exp $
 ;;
 
 ;; Returns the depth of the auto-generated TOC (table of
@@ -152,31 +152,40 @@
 )
 
 
-
+(define (my-href-to target)
+  (cond ((node-list-empty? target) (normalize ""))
+        (else (href-to target)))
+  )
 
 (element function
-    (let* (
-           (function-name (data (current-node)))
-           (role-name (if (attribute-string (normalize "role"))
-                          (attribute-string (normalize "role"))
-                        (normalize "php")) 
-                      )
-           (id-base (case-fold-down (string-replace (string-replace 
function-name "_" "-") "::" ".")))
-           (target (cond 
-                     ((equal-ci? role-name "php")        
-                      (href-to (element-with-id (string-append "function."   
id-base ))))
-                     ((equal-ci? role-name "zend-api")   
-                      (href-to (element-with-id (string-append "zend-api."   
id-base ))))
-                     ((equal-ci? role-name "zend-macro") 
-                      (href-to (element-with-id (string-append "zend-macro." 
id-base ))))
-                     ((equal-ci? role-name "libc")       
-                      (string-append %manpage-url-base% function-name 
%manpage-url-ext%))
-                     (else "")
-                     )
-                   )
-           (parent-gi (gi (parent)))
-           )
-         
+  (let* (
+                (function-name (data (current-node)))
+                (chapter-id (attribute-string (normalize "id") 
(ancestor-member (parent) (list "chapter"))))
+                (role-name (if (attribute-string (normalize "role"))
+                                               (attribute-string (normalize 
"role"))
+                        (cond ((or (equal? chapter-id "zend") 
+                                   (equal? chapter-id "tsrm")) 
+                               ( cond ((equal? (case-fold-up function-name) 
function-name) (normalize "zend-macro"))
+                                      (else (normalize "zend-api"))
+                                                                         ))
+                              (else (normalize "php")))
+                                               ))
+                (id-base (case-fold-down (string-replace (string-replace 
function-name "_" "-") "::" ".")))
+                (target (cond 
+                                 ((equal-ci? role-name "php")        
+                                  (my-href-to (element-with-id (string-append 
"function."   id-base ))))
+                                 ((equal-ci? role-name "zend-api")   
+                                  (my-href-to (element-with-id (string-append 
"zend-api."   id-base ))))
+                                 ((equal-ci? role-name "zend-macro") 
+                                  (my-href-to (element-with-id (string-append 
"zend-macro." id-base ))))
+                                 ((equal-ci? role-name "libc")       
+                                  (string-append %manpage-url-base% 
function-name %manpage-url-ext%))
+                                 (else "")
+                                 )
+                                )
+                (parent-gi (gi (parent)))
+                )
+       
     (cond
      ;; function names should be plain in FUNCDEF
      ((equal? parent-gi "funcdef")
@@ -198,7 +207,7 @@
                "refname"))))
           (case-fold-updown function-name)))
       ($bold-seq$
-       (make sequence
+       (make sequence 
      (process-children)
      (literal "()"))))
      

Reply via email to