goba            Fri Jun  7 14:14:32 2002 EDT

  Modified files:              
    /phpdoc/dsssl       phpweb.dsl.in 
  Log:
  1. "Beautify" three functions defined here (this makes them quite
     much easier to read). This may not be compatible with any emacs
     scheme editing, but I can read what they do now ;))
  
  2. **Significantly** reduce generated manual page sizes with
     dropping all navigational array elements without title (they
     were discarded by the array displayer functions)
      => makes rsyncs a bit faster, makes generated files smaller ;)
  
  
  
Index: phpdoc/dsssl/phpweb.dsl.in
diff -u phpdoc/dsssl/phpweb.dsl.in:1.1 phpdoc/dsssl/phpweb.dsl.in:1.2
--- phpdoc/dsssl/phpweb.dsl.in:1.1      Sun Jan  6 10:42:27 2002
+++ phpdoc/dsssl/phpweb.dsl.in  Fri Jun  7 14:14:32 2002
@@ -7,7 +7,7 @@
 
 <!--
 
-  $Id: phpweb.dsl.in,v 1.1 2002/01/06 15:42:27 hholzgra Exp $
+  $Id: phpweb.dsl.in,v 1.2 2002/06/07 18:14:32 goba Exp $
 
   HTML-specific stylesheet customization for use by the online manual.
 
@@ -63,42 +63,76 @@
              preferred-title-node)))
     (data title-node)))
               
-(define (phpweb-header-nav-array nd)
-  (let ((href (href-to nd))
-       (title (phpweb-quote (phpweb-node-title nd "titleabbrev"))))
-    (string-append
-     "array('" href "', '" title "')")))
+;; Print out navigational array. Consider if the array was
+;; needed (home, prev, next, up, toc) or not needed (local TOC).
+;; In the later case, nothing should be printed, in the first
+;; case, an emty array need to be injected. For local TOC
+;; entries, text should be indented with 4 spaces.
+;; Parameters are the node and a #t/#f value indicating that the
+;; array is a main navigation array [#t]or local TOC array [#f].
+(define (phpweb-header-nav-array nd main_nav_array)
+       (let 
+               (
+                       (href (href-to nd))
+                       (title (phpweb-quote (phpweb-node-title nd "titleabbrev")))
+               )
+               (if (string=? title "")
+                       (if main_nav_array
+                               (string-append "array('', '')," newline)
+                               ""
+                       )
+                       (if main_nav_array
+                               (string-append "array('" href "', '" title "')," 
+newline)
+                               (string-append "    array('" href "', '" title "')," 
+newline)
+                       )
+               )
+       )
+)
    
 (define (phpweb-node-list-map func ndl)
-  (let* ((node (node-list-first ndl))
-        (rest (node-list-rest ndl))
-        (item (func node)))
-    (if (node-list-empty? rest)
-       (list item)
-       (append (list item) (phpweb-node-list-map func rest)))))
+       (let*
+               (
+                       (node (node-list-first ndl))
+                       (rest (node-list-rest ndl))
+                       (item (func node))
+               )
+               (if (node-list-empty? rest)
+                       (list item)
+                       (append (list item) (phpweb-node-list-map func rest))
+               )
+       )
+)
 
 (define (phpweb-header-navigation nd)
-  (let ((prev (prev-chunk-element nd))
-       (next (next-chunk-element nd))
-       (up (parent nd))
-       (home (sgml-root-element))
-       (toc-nodes (siblings (chunk-parent nd))))
-    (string-append
-     "setupNavigation(array(" newline
-     "  'home' => " (phpweb-header-nav-array home) "," newline
-     "  'prev' => " (phpweb-header-nav-array prev) "," newline
-     "  'next' => " (phpweb-header-nav-array next) "," newline
-     "  'up'   => " (phpweb-header-nav-array up) "," newline
-     "  'toc'  => array(" newline
-     (join 
-      (phpweb-node-list-map (lambda (nnl)
-                             (string-append
-                              "    "
-                              (phpweb-header-nav-array nnl)))
-                           toc-nodes)
-      (string-append "," newline))
-     ")));")))
-    
+       (let
+               (
+                       (prev (prev-chunk-element nd))
+                       (next (next-chunk-element nd))
+                       (up (parent nd))
+                       (home (sgml-root-element))
+                       (toc-nodes (siblings (chunk-parent nd)))
+               )
+               (string-append
+                       "setupNavigation(array(" newline
+                       "  'home' => " (phpweb-header-nav-array home #t)
+                       "  'prev' => " (phpweb-header-nav-array prev #t)
+                       "  'next' => " (phpweb-header-nav-array next #t)
+                       "  'up'   => " (phpweb-header-nav-array up #t)
+                       "  'toc'  => array(" newline
+                       (join
+                               (phpweb-node-list-map 
+                                       (lambda
+                                               (nnl)
+                                               (phpweb-header-nav-array nnl #f)
+                                       )
+                                       toc-nodes
+                               )
+                       )
+                       ")));"
+               )
+       )
+)
+
 (define (html-document title-sosofo body-sosofo)
   (let ((doc-sosofo 
         (if (or (chunk?) (node-list=? (current-node) (sgml-root-element)))


Reply via email to