Capítulo 5. Crear estilos propios: dsl

Vamos a ver como poder modificar el aspecto (DSSL) de los documentos pdf y html. Para ellos nos debermos crear el fichero estilo.dsl

Fichero: estilo.dsl

<!DOCTYPE style-sheet PUBLIC
          "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY % html "IGNORE"
<![%html;[
<!ENTITY % print "IGNORE"
<!ENTITY docbook.dsl PUBLIC
         "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
         CDATA dsssl
]]
<!ENTITY % print "INCLUDE"
<![%print;[
<!ENTITY docbook.dsl PUBLIC
         "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
         CDATA dsssl
]]
]

<style-sheet
<style-specification id="print" use="docbook"
<style-specification-body

(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")


<!-- print stylesheet --

; los márgenes
(define %left-margin%  3cm)
(define %right-margin% 2cm)
(define %top-margin% 3cm)
(define %bottom-margin% 3cm)
(define %header-margin% 2cm)
(define %footer-margin% 2cm)

</style-specification-body
</style-specification

<style-specification id="html" use="docbook"
<style-specification-body

; Nota al pie izquierdo en las paginas impares
(define (page-inner-footer gi)
       (make sequence
             font-posture: 'italic
             font-family-name: "Helvetica"
             font-size: 8pt
            (literal "Por Paco Aldarias Raya")
))

;Que las secciones tengan numero
(define %section-autolabel%
 #t)

; Titulos en Mayusculas
;(mode component-title-mode
;  (element title
;    (literal (case-fold-up (data (current-node))))
;  (element subtitle
;     (process-children))
;)

; Tamano del texto
(define %visual-acuity%
  ;; General measure of document text size
  ;; "tiny"
  "presbyopic"
  ;; "large-type"
  ;; "normal")

;; Full justification.
(define %default-quadding%
  'justify)

;;Para impresion a doble cara, t (true), si no f (false).
(define %two-side%
  ;; Is two-sided output being produced?
    #t)

;;Sangrado de todo
;;(define %body-start-indent%
  ;; Default indent of body text
;;  9pi)

;Para que los capitulos lleven numeracion
(define %chapter-autolabel%
 #t)

;Para que los titulos no lleven la palabra capitulo
(define (gentext-es-element-name gind)
 (let* ((giname (if (string? gind) gind (gi gind)))
         (name   (normalize giname))
         (pname  (assoc name (es-element-name))))
   (if pname
        ""
        (let* ((msg (string-append
                     "gentext-es-element-name: : "
                     name))
               (err (node-list-error msg (current-node))))
          msg))))



(define %newline% "
")

;Para centrar imagenes
(element imagedata
      (if (have-ancestor? (normalize "mediaobject"))
        ($img$ (current-node) #t)
        ($img$ (current-node) #f)))

; Tamaño del papel
(define %paper-type% "A4")

;;Personalización de la cabecera titulo centrado 
;; en todas las cabeceras paginas
;;------------------------------------------------
;; (define ($custom-header-footer$)
;;  (make sequence
;;     (literal "Introducción al hardware")
;;      ))

;;(define (page-center-header gi)
;;  ($custom-header-footer$))

;;We put the header on each first page, except for the table of contents

;;(define (first-page-center-header gi)
;;  (cond
;;     ((equal? (normalize gi) (normalize "toc")) (empty-sosofo))
;;        (else ($custom-header-footer$))))




<!-- html stylesheet--
(define ($generate-book-lot-list$)
  ;; Which Lists of Titles should be produced for Books?
  (list (normalize "equation")))

(define %shade-verbatim%
  ;; Should verbatim environments be shaded?
  #f)

(define %gentext-nav-use-ff%
  ;; Add "fast-forward" to the navigation links?
  #t)
(define %html-ext%
  ;; when producing HTML files, use this extension
  ".html")
(define %use-id-as-filename%
  ;; Use ID attributes as name for component HTML files?
  #t)
</style-specification-body
</style-specification
<external-specification id="docbook" document="docbook.dsl"
</style-sheet

Para crear documentos::