jah             Sun Aug 26 10:00:31 2001 EDT

  Modified files:              
    /phpdoc     print.dsl.in 
  Log:
  Added link generation from function name to the target.
  
  
Index: phpdoc/print.dsl.in
diff -u phpdoc/print.dsl.in:1.15 phpdoc/print.dsl.in:1.16
--- phpdoc/print.dsl.in:1.15    Wed May 16 13:52:54 2001
+++ phpdoc/print.dsl.in Sun Aug 26 10:00:30 2001
@@ -7,7 +7,7 @@
 
 <!--
 
-  $Id: print.dsl.in,v 1.15 2001/05/16 17:52:54 hholzgra Exp $
+  $Id: print.dsl.in,v 1.16 2001/08/26 14:00:30 jah Exp $
 
   This file contains printout-specific stylesheet customization.
 
@@ -304,18 +304,47 @@
    (make sequence ( literal " (...)" )))
    
 (element function
-  (cond
-   ;; function names should be plain in FUNCDEF
-   ((equal? (gi (parent)) "funcdef")
-    (process-children))
-   
-   ;; else make the function name bold and add "()"
-   ;; we should add some cross-reference here later
-   (else
-    ($bold-seq$
-     (make sequence
-       (process-children)
-       (literal "()"))))))
+  (let* ((function-name (data (current-node)))
+     (linkend 
+      (string-append
+       "function." 
+       (string-replace
+        (string-replace function-name "_" "-")
+        "::" ".")))
+     (target (element-with-id linkend))
+     (parent-gi (gi (parent))))
+    (cond
+     ;; function names should be plain in FUNCDEF
+     ((equal? parent-gi "funcdef")
+      (process-children))
+     
+     ;; if a valid ID for the target function is not found, or if the
+     ;; FUNCTION tag is within the definition of the same function,
+     ;; make it bold, add (), but don't make a link
+     ((or (node-list-empty? target)
+      (equal? (case-fold-down
+           (data (node-list-first
+              (select-elements
+               (node-list-first
+                (children
+                 (select-elements
+                  (children
+                   (ancestor-member (parent) (list "refentry")))
+                  "refnamediv")))
+               "refname"))))
+          function-name))
+      ($bold-seq$
+       (make sequence
+     (process-children)
+     (literal "()"))))
+     
+     ;; else make a link to the function and add ()
+     (else
+      (make sequence
+       (make link
+         destination: (node-list-address target)
+         )
+       (literal "()"))))))
 
 
 


Reply via email to