home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / wpfaq / ldp.dsl < prev    next >
Text File  |  2002-08-09  |  9KB  |  316 lines

  1. <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
  2. <!ENTITY % html "IGNORE">
  3. <![%html;[
  4. <!ENTITY % print "IGNORE">
  5. <!ENTITY docbook.dsl SYSTEM "/usr/share/sgml/docbook/stylesheet/dsssl/modular/html/docbook.dsl" CDATA dsssl>
  6. ]]>
  7. <!ENTITY % print "INCLUDE">
  8. <![%print;[
  9. <!ENTITY docbook.dsl SYSTEM "/usr/share/sgml/docbook/stylesheet/dsssl/modular/print/docbook.dsl" CDATA dsssl>
  10. ]]>
  11. ]>
  12.  
  13. <style-sheet>
  14.  
  15. <style-specification id="print" use="docbook">
  16. <style-specification-body> 
  17.  
  18. ;; ==============================
  19. ;; customize the print stylesheet
  20. ;; ==============================
  21.  
  22. (declare-characteristic preserve-sdata?
  23.   ;; this is necessary because right now jadetex does not understand
  24.   ;; symbolic entities, whereas things work well with numeric entities.
  25.   "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
  26.   #f)
  27.  
  28. (define %generate-article-toc%
  29.   ;; Should a Table of Contents be produced for Articles?
  30.   #t)
  31.  
  32. (define (toc-depth nd)
  33.   2)
  34.  
  35. (define %generate-article-titlepage-on-separate-page%
  36.   ;; Should the article title page be on a separate page?
  37.   #t)
  38.  
  39. (define %section-autolabel%
  40.   ;; Are sections enumerated?
  41.   #t)
  42.  
  43. (define %footnote-ulinks%
  44.   ;; Generate footnotes for ULinks?
  45.   #f)
  46.  
  47. (define %bop-footnotes%
  48.   ;; Make "bottom-of-page" footnotes?
  49.   #f)
  50.  
  51. (define %body-start-indent%
  52.   ;; Default indent of body text
  53.   0pi)
  54.  
  55. (define %para-indent-firstpara%
  56.   ;; First line start-indent for the first paragraph
  57.   0pt)
  58.  
  59. (define %para-indent%
  60.   ;; First line start-indent for paragraphs (other than the first)
  61.   0pt)
  62.  
  63. (define %block-start-indent%
  64.   ;; Extra start-indent for block-elements
  65.   0pt)
  66.  
  67. (define formal-object-float
  68.   ;; Do formal objects float?
  69.   #t)
  70.  
  71. (define %hyphenation%
  72.   ;; Allow automatic hyphenation?
  73.   #t)
  74.  
  75. (define %admon-graphics%
  76.   ;; Use graphics in admonitions?
  77.   #f)
  78.  
  79. </style-specification-body>
  80. </style-specification>
  81.  
  82.  
  83. <!--
  84. ;; ===================================================
  85. ;; customize the html stylesheet; borrowed from Cygnus
  86. ;; at http://sourceware.cygnus.com/ (cygnus-both.dsl)
  87. ;; ===================================================
  88. -->
  89.  
  90. <style-specification id="html" use="docbook">
  91. <style-specification-body> 
  92.  
  93. (declare-characteristic preserve-sdata?
  94.   ;; this is necessary because right now jadetex does not understand
  95.   ;; symbolic entities, whereas things work well with numeric entities.
  96.   "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
  97.   #f)
  98.  
  99. (declare-flow-object-class element
  100.   ;; for redhat
  101.   "UNREGISTERED::James Clark//Flow Object Class::element")
  102.  
  103. (define %generate-legalnotice-link%
  104.   ;; put the legal notice in a separate file
  105.   #t)
  106.  
  107. (define %admon-graphics-path%
  108.   ;; use graphics in admonitions, set their
  109.   "../images/")
  110.  
  111. (define %admon-graphics%
  112.   #t)
  113.  
  114. (define %funcsynopsis-decoration%
  115.   ;; make funcsynopsis look pretty
  116.   #t)
  117.  
  118. (define %html-ext%
  119.   ;; when producing HTML files, use this extension
  120.   ".html")
  121.  
  122. (define %generate-book-toc%
  123.   ;; Should a Table of Contents be produced for books?
  124.   #t)
  125.  
  126. (define %generate-article-toc% 
  127.   ;; Should a Table of Contents be produced for articles?
  128.   #t)
  129.  
  130. (define %generate-part-toc%
  131.   ;; Should a Table of Contents be produced for parts?
  132.   #t)
  133.  
  134. (define %generate-book-titlepage%
  135.   ;; produce a title page for books
  136.   #t)
  137.  
  138. (define %generate-article-titlepage%
  139.   ;; produce a title page for articles
  140.   #t)
  141.  
  142. (define (chunk-skip-first-element-list)
  143.   ;; forces the Table of Contents on separate page
  144.   '())
  145.  
  146. (define (list-element-list)
  147.   ;; fixes bug in Table of Contents generation
  148.   '())
  149.  
  150. (define %root-filename%
  151.   ;; The filename of the root HTML document (e.g, "index").
  152.   "index")
  153.  
  154. (define %shade-verbatim%
  155.   ;; verbatim sections will be shaded if t(rue)
  156.   #t)
  157.  
  158. (define %use-id-as-filename%
  159.   ;; Use ID attributes as name for component HTML files?
  160.   #t)
  161.  
  162. (define %graphic-extensions%
  163.   ;; graphic extensions allowed
  164.   '("gif" "png" "jpg" "jpeg" "tif" "tiff" "eps" "epsf" ))
  165.  
  166. (define %graphic-default-extension% 
  167.   "gif")
  168.  
  169. (define %section-autolabel%
  170.   ;; For enumerated sections (1.1, 1.1.1, 1.2, etc.)
  171.   #t)
  172.  
  173. (define (toc-depth nd)
  174.   ;; more depth (2 levels) to toc; instead of flat hierarchy
  175.   2)
  176.  
  177. (element emphasis
  178.   ;; make role=strong equate to bold for emphasis tag
  179.   (if (equal? (attribute-string "role") "strong")
  180.      (make element gi: "STRONG" (process-children))
  181.      (make element gi: "EM" (process-children))))
  182.  
  183. (define (book-titlepage-recto-elements)
  184.   ;; elements on a book's titlepage
  185.   ;; note: added revhistory to the default list
  186.   (list (normalize "title")
  187.         (normalize "subtitle")
  188.         (normalize "graphic")
  189.         (normalize "mediaobject")
  190.         (normalize "corpauthor")
  191.         (normalize "authorgroup")
  192.         (normalize "author")
  193.         (normalize "editor")
  194.         (normalize "copyright")
  195.         (normalize "pubdate")
  196.         (normalize "revhistory")
  197.         (normalize "abstract")
  198.         (normalize "legalnotice")))
  199.  
  200. (define (article-titlepage-recto-elements)
  201.   ;; elements on an article's titlepage
  202.   ;; note: added othercredit to the default list
  203.   (list (normalize "title")
  204.         (normalize "subtitle")
  205.         (normalize "authorgroup")
  206.         (normalize "author")
  207.         (normalize "othercredit")
  208.         (normalize "releaseinfo")
  209.         (normalize "copyright")
  210.         (normalize "pubdate")
  211.         (normalize "revhistory")
  212.         (normalize "abstract")))
  213.  
  214. (mode article-titlepage-recto-mode
  215.  
  216.  (element contrib
  217.   ;; print out with othercredit information; for translators, etc.
  218.   (make sequence
  219.     (make element gi: "SPAN"
  220.           attributes: (list (list "CLASS" (gi)))
  221.           (process-children))))
  222.  
  223.  (element othercredit
  224.   ;; print out othercredit information; for translators, etc.
  225.   (let ((author-name  (author-string))
  226.         (author-contrib (select-elements (children (current-node))
  227.                                           (normalize "contrib"))))
  228.     (make element gi: "P"
  229.          attributes: (list (list "CLASS" (gi)))
  230.          (make element gi: "B"  
  231.               (literal author-name)
  232.               (literal " - "))
  233.          (process-node-list author-contrib))))
  234. )
  235.  
  236. (define (article-title nd)
  237.   (let* ((artchild  (children nd))
  238.          (artheader (select-elements artchild (normalize "artheader")))
  239.          (artinfo   (select-elements artchild (normalize "articleinfo")))
  240.          (ahdr (if (node-list-empty? artheader)
  241.                    artinfo
  242.                    artheader))
  243.          (ahtitles  (select-elements (children ahdr)
  244.                                      (normalize "title")))
  245.          (artitles  (select-elements artchild (normalize "title")))
  246.          (titles    (if (node-list-empty? artitles)
  247.                         ahtitles
  248.                         artitles)))
  249.     (if (node-list-empty? titles)
  250.         ""
  251.         (node-list-first titles))))
  252.  
  253.  
  254. (mode subtitle-mode
  255.   ;; do not print subtitle on subsequent pages
  256.   (element subtitle (empty-sosofo)))
  257.  
  258.  
  259. ;; Redefinition of $verbatim-display$
  260. ;; Origin: dbverb.dsl
  261. ;; Different foreground and background colors for verbatim elements
  262. ;; Author: Philippe Martin (feloy@free.fr) 2001-04-07
  263.  
  264. (define ($verbatim-display$ indent line-numbers?)
  265.   (let ((verbatim-element (gi))
  266.         (content (make element gi: "PRE"
  267.                        attributes: (list
  268.                                     (list "CLASS" (gi)))
  269.                        (if (or indent line-numbers?)
  270.                            ($verbatim-line-by-line$ indent line-numbers?)
  271.                            (process-children)))))
  272.     (if %shade-verbatim%
  273.         (make element gi: "TABLE"
  274.               attributes: (shade-verbatim-attr-element verbatim-element)
  275.               (make element gi: "TR"
  276.                     (make element gi: "TD"
  277.                           (make element gi: "FONT" 
  278.                                 attributes: (list
  279.                                              (list "COLOR" (car (shade-verbatim-element-colors
  280.                                                                  verbatim-element))))
  281.                                 content))))
  282.         content)))
  283.  
  284. ;;
  285. ;; Customize this function
  286. ;; to change the foreground and background colors
  287. ;; of the different verbatim elements
  288. ;; Return (list "foreground color" "background color")
  289. ;;
  290. (define (shade-verbatim-element-colors element)
  291.   (case element
  292.     (("SYNOPSIS") (list "#000000" "#6495ED"))
  293.     ;; ...
  294.     ;; Add your verbatim elements here
  295.     ;; ...
  296.     (else (list "#000000" "#E0E0E0"))))
  297.  
  298. (define (shade-verbatim-attr-element element)
  299.   (list
  300.    (list "BORDER" 
  301.     (cond
  302.         ((equal? element (normalize "SCREEN")) "1")
  303.         (else "0")))
  304.    (list "BGCOLOR" (car (cdr (shade-verbatim-element-colors element))))
  305.    (list "WIDTH" ($table-width$))))
  306.  
  307. ;; End of $verbatim-display$ redefinition
  308.  
  309. </style-specification-body>
  310. </style-specification>
  311.  
  312. <external-specification id="docbook" document="docbook.dsl">
  313.  
  314. </style-sheet>
  315.  
  316.