~ubuntu-branches/ubuntu/hoary/docbook-dsssl/hoary

« back to all changes in this revision

Viewing changes to debian/freebsd.dsl

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2004-11-06 12:28:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20041106122809-jm39fcli9ndotthy
Tags: 1.79-1
* New upstream release
* Removed the debconf and site configuration stuff; use a customization
  layer.
* Removed freebsd.dsl; it's useless without an up-to-date FreeBSD
  source tree.
* Removed basic.dsl; there is better information in the documentation.
* Removed obsolete symlink in /var/www
* Added watch file
* Simplified debian/rules
* Install frames subdirectory normally, not as documentation
* Install only one combined changelog, not one per directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!-- $FreeBSD: doc/share/sgml/freebsd.dsl,v 1.68 2002/11/20 19:41:10 ceri Exp $ -->
2
 
 
3
 
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
4
 
<!ENTITY % output.html          "IGNORE">
5
 
<!ENTITY % output.html.images   "IGNORE">
6
 
<!ENTITY % output.print         "IGNORE">
7
 
<!ENTITY % output.print.pdf     "IGNORE">
8
 
<!ENTITY % output.print.justify "IGNORE">
9
 
<!ENTITY % output.print.twoside "IGNORE">
10
 
 
11
 
<![ %output.html; [
12
 
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
13
 
]]>
14
 
<![ %output.print; [
15
 
<!ENTITY docbook.dsl PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
16
 
 
17
 
]]>
18
 
]>
19
 
 
20
 
<style-sheet>
21
 
  <style-specification use="docbook">
22
 
    <style-specification-body>
23
 
 
24
 
      (declare-flow-object-class formatting-instruction
25
 
        "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")
26
 
 
27
 
      <!-- HTML only .................................................... -->
28
 
      
29
 
      <![ %output.html; [
30
 
        <!-- Configure the stylesheet using documented variables -->
31
 
 
32
 
        (define %hyphenation% #f)        <!-- Silence a warning -->
33
 
 
34
 
        (define %gentext-nav-use-tables%
35
 
          ;; Use tables to build the navigation headers and footers?
36
 
          #t)
37
 
 
38
 
        (define %html-ext%
39
 
          ;; Default extension for HTML output files
40
 
          ".html")
41
 
 
42
 
        (define %shade-verbatim%
43
 
          ;; Should verbatim environments be shaded?
44
 
          #f)
45
 
 
46
 
        (define %use-id-as-filename%
47
 
          ;; Use ID attributes as name for component HTML files?
48
 
          #t)
49
 
 
50
 
        (define %root-filename%
51
 
          ;; Name for the root HTML document
52
 
          "index")
53
 
 
54
 
        (define html-manifest
55
 
          ;; Write a manifest?
56
 
          #f)
57
 
 
58
 
        (define %generate-legalnotice-link%
59
 
          ;; Should legal notices be a link to a separate file?
60
 
          ;;
61
 
          ;; Naturally, this has no effect if you're building one big
62
 
          ;; HTML file.
63
 
          #t)
64
 
 
65
 
        (define (book-titlepage-recto-elements)
66
 
          (list (normalize "title")
67
 
                (normalize "subtitle")
68
 
                (normalize "graphic")
69
 
                (normalize "mediaobject")
70
 
                (normalize "corpauthor")
71
 
                (normalize "authorgroup")
72
 
                (normalize "author")
73
 
                (normalize "editor")
74
 
                (normalize "copyright")
75
 
                (normalize "abstract")
76
 
                (normalize "legalnotice")
77
 
                (normalize "isbn")))
78
 
 
79
 
        <!-- This is the text to display at the bottom of each page.
80
 
             Defaults to nothing.  The individual stylesheets should
81
 
             redefine this as necessary. -->
82
 
        (define ($email-footer$)
83
 
          (empty-sosofo))
84
 
 
85
 
        (define html-index-filename
86
 
          (if nochunks
87
 
            "html.index"
88
 
            "html-split.index"))
89
 
 
90
 
        (define %stylesheet%
91
 
          "docbook.css")
92
 
 
93
 
        <!-- This code handles displaying $email-footer$ at the bottom
94
 
             of each page.
95
 
 
96
 
             If "nochunks" is turned on then we make sure that an <hr>
97
 
             is shown first.
98
 
 
99
 
             Then create a centered paragraph ("<p>"), and reduce the font
100
 
             size ("<small>").  Then run $email-footer$, which should
101
 
             create the text and links as necessary. -->
102
 
        (define ($html-body-end$)
103
 
          (if (equal? $email-footer$ (normalize ""))
104
 
            (empty-sosofo)
105
 
            (make sequence
106
 
              (if nochunks
107
 
                  (make empty-element gi: "hr")
108
 
                  (empty-sosofo))
109
 
              ($email-footer$))))
110
 
 
111
 
        (define %refentry-xref-link%
112
 
          ;; REFENTRY refentry-xref-link
113
 
          ;; PURP Generate URL links when cross-referencing RefEntrys?
114
 
          ;; DESC
115
 
          ;; If true, a web link will be generated, presumably
116
 
          ;; to an online man->HTML gateway.  The text of the link is
117
 
          ;; generated by the $create-refentry-xref-link$ function.
118
 
          ;; /DESC
119
 
          ;; AUTHOR N/A
120
 
          ;; /REFENTRY
121
 
          #f)
122
 
 
123
 
        ; Empty function to quiet warnings
124
 
        (define ($create-refentry-xref-link$)
125
 
          (literal ""))
126
 
 
127
 
        (element citerefentry
128
 
          (let ((href          ($create-refentry-xref-link$)))
129
 
            (if %refentry-xref-link%
130
 
              (create-link (list (list "HREF" href))
131
 
                (if %refentry-xref-italic%
132
 
                  ($italic-seq$)
133
 
                  ($charseq$)))
134
 
              (if %refentry-xref-italic%
135
 
                ($italic-seq$)
136
 
                ($charseq$)))))
137
 
 
138
 
        (element filename
139
 
          (let* ((class         (attribute-string (normalize "role"))))
140
 
            (cond
141
 
             ((equal? class "package")
142
 
              (let* ((urlurl    "http://www.FreeBSD.org/cgi/url.cgi")
143
 
                     (href      (string-append urlurl "?ports/"
144
 
                                               (data (current-node))
145
 
                                               "/pkg-descr")))
146
 
                (create-link (list (list "HREF" href)) ($mono-seq$))))
147
 
             (else ($mono-seq$)))))
148
 
 
149
 
        ;; Ensure that we start with no preferred mediaobject notations,
150
 
        ;; so that in the text-only case we don't choose any of the
151
 
        ;; possible images, and fallback to the most appropriate
152
 
        ;; textobject
153
 
        (define preferred-mediaobject-notations
154
 
          '())
155
 
      ]]>
156
 
 
157
 
      <!-- HTML with images  ............................................ -->
158
 
 
159
 
      <![ %output.html.images [
160
 
 
161
 
; The new Cascading Style Sheets for the HTML output are very confused
162
 
; by our images when used with div class="mediaobject".  We can
163
 
; clear up the confusion by ignoring the whole mess and just
164
 
; displaying the image.
165
 
 
166
 
        (element mediaobject
167
 
          (make element gi: "P"
168
 
            ($mediaobject$)))
169
 
 
170
 
        (define %graphic-default-extension%
171
 
          "png")
172
 
 
173
 
        (define %callout-graphics%
174
 
          ;; Use graphics in callouts?
175
 
          #t)
176
 
 
177
 
        (define %callout-graphics-ext%
178
 
          ;; The extension to use for callout images.  This is an extension
179
 
          ;; to the stylesheets, they do not support this functionality
180
 
          ;; natively.
181
 
          ".png")
182
 
 
183
 
        (define %callout-graphics-path%
184
 
          ;; Path to callout graphics
185
 
          "./imagelib/callouts/")
186
 
 
187
 
        ;; Redefine $callout-bug$ to support the %callout-graphic-ext%
188
 
        ;; variable.
189
 
        (define ($callout-bug$ conumber)
190
 
          (let ((number (if conumber (format-number conumber "1") "0")))
191
 
            (if conumber
192
 
                (if %callout-graphics%
193
 
                    (if (<= conumber %callout-graphics-number-limit%)
194
 
                        (make empty-element gi: "IMG"
195
 
                              attributes: (list (list "SRC"
196
 
                                                      (root-rel-path
197
 
                                                       (string-append
198
 
                                                        %callout-graphics-path%
199
 
                                                        number
200
 
                                                        %callout-graphics-ext%)))
201
 
                                                (list "HSPACE" "0")
202
 
                                                (list "VSPACE" "0")
203
 
                                                (list "BORDER" "0")
204
 
                                                (list "ALT"
205
 
                                                      (string-append
206
 
                                                       "(" number ")"))))
207
 
                        (make element gi: "B"
208
 
                              (literal "(" (format-number conumber "1") ")")))
209
 
                    (make element gi: "B"
210
 
                          (literal "(" (format-number conumber "1") ")")))
211
 
                (make element gi: "B"
212
 
               (literal "(??)")))))
213
 
      ]]>
214
 
 
215
 
      <!-- Two-sided Print output ....................................... --> 
216
 
      <![ %output.print.twoside; [
217
 
 
218
 
      ;; From an email by Ian Castle to the DocBook-apps list
219
 
 
220
 
      (define ($component$)
221
 
        (make simple-page-sequence
222
 
          page-n-columns: %page-n-columns%
223
 
          page-number-restart?: (or %page-number-restart% 
224
 
;                             (book-start?) 
225
 
                                    (first-chapter?))
226
 
          page-number-format: ($page-number-format$)
227
 
          use: default-text-style
228
 
          left-header:   ($left-header$)
229
 
          center-header: ($center-header$)
230
 
          right-header:  ($right-header$)
231
 
          left-footer:   ($left-footer$)
232
 
          center-footer: ($center-footer$)
233
 
          right-footer:  ($right-footer$)
234
 
          start-indent: %body-start-indent%
235
 
          input-whitespace-treatment: 'collapse
236
 
          quadding: %default-quadding%
237
 
          (make sequence
238
 
            ($component-title$)
239
 
            (process-children))
240
 
          (make-endnotes)))
241
 
 
242
 
      ;; From an email by Ian Castle to the DocBook-apps list
243
 
 
244
 
      (define (first-part?)
245
 
        (let* ((book (ancestor (normalize "book")))
246
 
               (nd   (ancestor-member (current-node)
247
 
                                      (append
248
 
                                       (component-element-list)
249
 
                                       (division-element-list))))
250
 
               (bookch (children book)))
251
 
        (let loop ((nl bookch))
252
 
          (if (node-list-empty? nl)
253
 
              #f
254
 
              (if (equal? (gi (node-list-first nl)) (normalize "part"))
255
 
                  (if (node-list=? (node-list-first nl) nd)
256
 
                      #t
257
 
                      #f)
258
 
                  (loop (node-list-rest nl)))))))
259
 
 
260
 
 
261
 
      ;; From an email by Ian Castle to the DocBook-apps list
262
 
 
263
 
      (define (first-chapter?)
264
 
      ;; Returns #t if the current-node is in the first chapter of a book
265
 
        (if (has-ancestor-member? (current-node) (division-element-list))
266
 
          #f
267
 
         (let* ((book (ancestor (normalize "book")))
268
 
                (nd   (ancestor-member (current-node)
269
 
                                       (append (component-element-list)
270
 
                                               (division-element-list))))
271
 
                (bookch (children book))
272
 
                (bookcomp (expand-children bookch (list (normalize "part")))))
273
 
           (let loop ((nl bookcomp))
274
 
             (if (node-list-empty? nl)
275
 
                 #f
276
 
                 (if (equal? (gi (node-list-first nl)) (normalize "chapter"))
277
 
                     (if (node-list=? (node-list-first nl) nd)
278
 
                         #t
279
 
                         #f)
280
 
                     (loop (node-list-rest nl))))))))
281
 
 
282
 
 
283
 
      ; By default, the Part I title page will be given a roman numeral,
284
 
      ; which is wrong so we have to fix it
285
 
 
286
 
      (define (part-titlepage elements #!optional (side 'recto))
287
 
        (let ((nodelist (titlepage-nodelist 
288
 
                         (if (equal? side 'recto)
289
 
                             (part-titlepage-recto-elements)
290
 
                             (part-titlepage-verso-elements))
291
 
                         elements))
292
 
              ;; partintro is a special case...
293
 
              (partintro (node-list-first
294
 
                          (node-list-filter-by-gi elements (list (normalize "partintro"))))))
295
 
          (if (part-titlepage-content? elements side)
296
 
              (make simple-page-sequence
297
 
                page-n-columns: %titlepage-n-columns%
298
 
                ;; Make sure that page number format is correct.
299
 
                page-number-format: ($page-number-format$)
300
 
                ;; Make sure that the page number is set to 1 if this is the first part
301
 
                ;; in the book
302
 
                page-number-restart?: (first-part?)
303
 
                input-whitespace-treatment: 'collapse
304
 
                use: default-text-style
305
 
          
306
 
                ;; This hack is required for the RTF backend. If an
307
 
                ;; external-graphic is the first thing on the page,
308
 
                ;; RTF doesn't seem to do the right thing (the graphic
309
 
                ;; winds up on the baseline of the first line of the
310
 
                ;; page, left justified).  This "one point rule" fixes
311
 
                ;; that problem.
312
 
 
313
 
                (make paragraph
314
 
                  line-spacing: 1pt
315
 
                  (literal ""))
316
 
 
317
 
                (let loop ((nl nodelist) (lastnode (empty-node-list)))
318
 
                  (if (node-list-empty? nl)
319
 
                      (empty-sosofo)
320
 
                      (make sequence
321
 
                        (if (or (node-list-empty? lastnode)
322
 
                                (not (equal? (gi (node-list-first nl))
323
 
                                             (gi lastnode))))
324
 
                            (part-titlepage-before (node-list-first nl) side)
325
 
                            (empty-sosofo))
326
 
                        (cond
327
 
                         ((equal? (gi (node-list-first nl)) (normalize "subtitle"))
328
 
                          (part-titlepage-subtitle (node-list-first nl) side))
329
 
                         ((equal? (gi (node-list-first nl)) (normalize "title"))
330
 
                          (part-titlepage-title (node-list-first nl) side))
331
 
                         (else
332
 
                          (part-titlepage-default (node-list-first nl) side)))
333
 
                        (loop (node-list-rest nl) (node-list-first nl)))))
334
 
                (if (and %generate-part-toc%
335
 
                         %generate-part-toc-on-titlepage%
336
 
                         (equal? side 'recto))
337
 
                    (make display-group
338
 
                      (build-toc (current-node)
339
 
                                 (toc-depth (current-node))))
340
 
                    (empty-sosofo))
341
 
 
342
 
                ;; PartIntro is a special case
343
 
                (if (and (equal? side 'recto)
344
 
                         (not (node-list-empty? partintro))
345
 
                         %generate-partintro-on-titlepage%)
346
 
                    ($process-partintro$ partintro #f)
347
 
                    (empty-sosofo)))
348
 
              (empty-sosofo))))
349
 
 
350
 
      ]]>
351
 
 
352
 
      <!-- Print with justification ..................................... --> 
353
 
      <![ %output.print.justify; [
354
 
 
355
 
        (define %default-quadding%
356
 
          'justify)
357
 
 
358
 
        (define %hyphenation%
359
 
          #t)
360
 
 
361
 
 
362
 
        ;; The url.sty package is making all of the links purple/pink.
363
 
        ;; Someone please fix this!
364
 
 
365
 
        (define (urlwrap)
366
 
          (let ((%factor% (if %verbatim-size-factor% 
367
 
                              %verbatim-size-factor% 
368
 
                              1.0)))
369
 
          (make sequence
370
 
            font-family-name: %mono-font-family%
371
 
            font-size: (* (inherited-font-size) %factor%)
372
 
            (make formatting-instruction data:
373
 
                  (string-append
374
 
                   "\\url|"
375
 
                   (data (current-node))
376
 
                   "|")))))
377
 
 
378
 
        (define (pathwrap)
379
 
          (let ((%factor% (if %verbatim-size-factor% 
380
 
                              %verbatim-size-factor% 
381
 
                              1.0)))
382
 
          (make sequence
383
 
            font-family-name: %mono-font-family%
384
 
            font-size: (* (inherited-font-size) %factor%)
385
 
            (make formatting-instruction data:
386
 
                  (string-append
387
 
                   "\\path|"
388
 
                   (data (current-node))
389
 
                   "|")))))
390
 
 
391
 
        ;; Some others may check the value of %hyphenation% and be
392
 
        ;; specified below
393
 
 
394
 
;        (element email
395
 
;          (make sequence
396
 
;            (literal "<")
397
 
;            (urlwrap)
398
 
;            (literal ">")))
399
 
 
400
 
        (element filename
401
 
            (pathwrap))
402
 
 
403
 
        (element varname
404
 
            (pathwrap))
405
 
 
406
 
      ]]>
407
 
 
408
 
      <!-- Print only ................................................... --> 
409
 
      <![ %output.print; [
410
 
        (define withpgpkeys
411
 
          #f)
412
 
 
413
 
        ;; If a link is entered as "file://localhost/usr/ports" in the docs
414
 
        ;; then we only want to display "/usr/ports" in printed form.
415
 
 
416
 
        (define (fix-url url)
417
 
          (if (and (> (string-length url) 15)
418
 
                   (string=? (substring url 0 16) "file://localhost"))
419
 
              (substring url 16 (string-length url))
420
 
              url))
421
 
 
422
 
 
423
 
        (element (primaryie ulink)
424
 
          (indexentry-link (current-node)))
425
 
        (element (secondaryie ulink)
426
 
          (indexentry-link (current-node)))
427
 
        (element (tertiaryie ulink)
428
 
          (indexentry-link (current-node)))
429
 
 
430
 
        ;; Override the count-footnote? definition from dbblock.dsl
431
 
        ;; to fix a bug.  Basically, the original procedure would count
432
 
        ;; all ulink elements when doing %footnote-ulinks%.  It's
433
 
        ;; actually harder than that, because ulink elements with no
434
 
        ;; content shouldn't generate footnotes (the ulink element
435
 
        ;; definition just inserts the url attribute in-line, thus there
436
 
        ;; is no need for a footnote with the url).  So, when we figure
437
 
        ;; out which footnotes to count for the purpose of determining
438
 
        ;; footnote numbers, we only count the ulink elements containing
439
 
        ;; content.
440
 
        (define (count-footnote? footnote)
441
 
          ;; don't count footnotes in comments (unless you're showing comments)
442
 
          ;; or footnotes in tables which are handled locally in the table
443
 
          (if (or (and (has-ancestor-member? footnote (list (normalize "comment")))
444
 
                       (not %show-comments%))
445
 
                  (has-ancestor-member? footnote (list (normalize "tgroup")))
446
 
                  (and (has-ancestor-member? footnote (list (normalize "ulink")))
447
 
                       (node-list-empty? (children footnote))))
448
 
              #f
449
 
              #t))
450
 
 
451
 
        (element ulink 
452
 
          (make sequence
453
 
            (if (node-list-empty? (children (current-node)))
454
 
              (literal (fix-url (attribute-string (normalize "url"))))
455
 
              (make sequence
456
 
                ($charseq$)
457
 
                (if %footnote-ulinks%
458
 
                    (if (and (equal? (print-backend) 'tex) bop-footnotes)
459
 
                      (make sequence
460
 
                            ($ss-seq$ + (literal (footnote-number (current-node))))
461
 
                            (make page-footnote
462
 
                                  (make paragraph
463
 
                        font-size: (* %footnote-size-factor% %bf-size%)
464
 
                        font-posture: 'upright
465
 
                        quadding: %default-quadding%
466
 
                        line-spacing: (* (* %footnote-size-factor% %bf-size%)
467
 
                                         %line-spacing-factor%)
468
 
                        space-before: %para-sep%
469
 
                        space-after: %para-sep%
470
 
                        start-indent: %footnote-field-width%
471
 
                        first-line-start-indent: (- %footnote-field-width%)
472
 
                        (make line-field
473
 
                          field-width: %footnote-field-width%
474
 
                          (literal (footnote-number (current-node))
475
 
                                   (gentext-label-title-sep (normalize "footnote"))))
476
 
                        (literal (fix-url (attribute-string (normalize "url")))))))
477
 
                      ($ss-seq$ + (literal (footnote-number (current-node)))))
478
 
                    (if (and %show-ulinks% 
479
 
                             (not (equal? (fix-url (attribute-string (normalize "url")))
480
 
                                          (data-of (current-node)))))
481
 
                        (make sequence
482
 
                          (literal " (")
483
 
                          (if %hyphenation%
484
 
                              (make formatting-instruction data:
485
 
                                    (string-append "\\url{"
486
 
                                                   (fix-url (attribute-string
487
 
                                                             (normalize "url")))
488
 
                                                   "}"))
489
 
                              (literal (fix-url (attribute-string (normalize "url")))))
490
 
                          (literal ")"))
491
 
                        (empty-sosofo)))))))
492
 
 
493
 
 
494
 
        (define (toc-depth nd)
495
 
          (if (string=? (gi nd) (normalize "book"))
496
 
              3
497
 
              1))
498
 
 
499
 
        (element programlisting
500
 
          (if (and (equal? (attribute-string (normalize "role")) "pgpkey")
501
 
                   (not withpgpkeys))
502
 
              (empty-sosofo)
503
 
              (next-match)))
504
 
 
505
 
        (define %body-start-indent% 
506
 
          0pi)
507
 
 
508
 
        (define (book-titlepage-verso-elements)
509
 
          (list (normalize "title")
510
 
                (normalize "subtitle")
511
 
                (normalize "corpauthor")
512
 
                (normalize "authorgroup")
513
 
                (normalize "author")
514
 
                (normalize "editor")
515
 
                (normalize "edition")
516
 
                (normalize "pubdate")
517
 
                (normalize "copyright")
518
 
                (normalize "abstract")
519
 
                (normalize "legalnotice")
520
 
                (normalize "revhistory")
521
 
                (normalize "isbn")))
522
 
 
523
 
        ;; Norm's stylesheets are smart about working out what sort of
524
 
        ;; object to display.  But this bites us.  Since we know that the
525
 
        ;; first item is going to be displayable, always use that.
526
 
        (define (find-displayable-object objlist notlist extlist)
527
 
          (let loop ((nl objlist))
528
 
            (if (node-list-empty? nl)
529
 
              (empty-node-list)
530
 
                (let* ((objdata  (node-list-filter-by-gi
531
 
                                  (children (node-list-first nl))
532
 
                                  (list (normalize "videodata")
533
 
                                        (normalize "audiodata")
534
 
                                        (normalize "imagedata"))))
535
 
                       (filename (data-filename objdata))
536
 
                       (extension (file-extension filename))
537
 
                       (notation (attribute-string (normalize "format") objdata)))
538
 
                  (node-list-first nl)))))
539
 
 
540
 
        ;; When selecting a filename to use, don't append the default
541
 
        ;; extension, instead, just use the bare filename, and let TeX
542
 
        ;; work it out.  jadetex will use the .eps file, while pdfjadetex
543
 
        ;; will use the .png file automatically.
544
 
        (define (graphic-file filename)
545
 
          (let ((ext (file-extension filename)))
546
 
            (if (or tex-backend   ;; TeX can work this out itself
547
 
                    (not filename)
548
 
                    (not %graphic-default-extension%)
549
 
                    (member ext %graphic-extensions%))
550
 
                 filename
551
 
                 (string-append filename "." %graphic-default-extension%))))
552
 
 
553
 
        ;; Including bitmaps in the PS and PDF output tends to scale them
554
 
        ;; horribly.  The solution is to scale them down by 50%.
555
 
        ;;
556
 
        ;; You could do this with 'imagedata scale="50"'  in the source,
557
 
        ;; but that will affect all the output formats that we use (because
558
 
        ;; there is only one 'imagedata' per image).
559
 
        ;;
560
 
        ;; Solution is to have the authors include the "FORMAT" attribute,
561
 
        ;; set to PNG or EPS as appropriate, but to omit the extension.
562
 
        ;; If we're using the tex-backend, and the FORMAT is PNG, and the
563
 
        ;; author hasn't already set a scale, then set scale to 0.5.
564
 
        ;; Otherwise, use the supplied scale, or 1, as appropriate.
565
 
        (define ($graphic$ fileref
566
 
                           #!optional (display #f) (format #f)
567
 
                                      (scale #f)   (align #f))
568
 
          (let* ((graphic-format (if format format ""))
569
 
                 (graphic-scale  (if scale
570
 
                                     (/  (string->number scale) 100)
571
 
                                     (if (and tex-backend
572
 
                                              (equal? graphic-format "PNG"))
573
 
                                          0.5 1)))
574
 
                 (graphic-align  (cond ((equal? align (normalize "center"))
575
 
                                        'center)
576
 
                                       ((equal? align (normalize "right"))
577
 
                                        'end)
578
 
                                       (else
579
 
                                        'start))))
580
 
           (make external-graphic
581
 
              entity-system-id: (graphic-file fileref)
582
 
              notation-system-id: graphic-format
583
 
              scale: graphic-scale
584
 
              display?: display
585
 
              display-alignment: graphic-align)))
586
 
      ]]>
587
 
 
588
 
      <![ %output.print.pdf; [
589
 
 
590
 
      ]]>
591
 
 
592
 
      <!-- Both sets of stylesheets ..................................... -->
593
 
 
594
 
      (define %section-autolabel%
595
 
        #t)
596
 
 
597
 
      (define %label-preface-sections%
598
 
        #f)
599
 
 
600
 
      (define %may-format-variablelist-as-table%
601
 
        #f)
602
 
      
603
 
      (define %indent-programlisting-lines%
604
 
        "    ")
605
 
 
606
 
      (define %indent-screen-lines%
607
 
        "    ")
608
 
 
609
 
      (define (article-titlepage-recto-elements)
610
 
        (list (normalize "title")
611
 
              (normalize "subtitle")
612
 
              (normalize "corpauthor")
613
 
              (normalize "authorgroup")
614
 
              (normalize "author")
615
 
              (normalize "releaseinfo")
616
 
              (normalize "copyright")
617
 
              (normalize "pubdate")
618
 
              (normalize "revhistory")
619
 
              (normalize "legalnotice")
620
 
              (normalize "abstract")))
621
 
 
622
 
      (define %admon-graphics%
623
 
        ;; Use graphics in admonitions?
624
 
        #f)
625
 
 
626
 
      (define %admon-graphics-path%
627
 
        ;; Path to admonition images
628
 
        "./imagelib/admon/")
629
 
 
630
 
      (define ($admon-graphic$ #!optional (nd (current-node)))
631
 
        ;; Admonition graphic file
632
 
        (string-append %admon-graphics-path% (case-fold-down (gi nd)) ".png"))
633
 
 
634
 
      <!-- Slightly deeper customisations -->
635
 
 
636
 
      <!-- We would like the author attributions to show up in line
637
 
           with the section they refer to.  Authors who made the same
638
 
           contribution should be listed in a single <authorgroup> and 
639
 
           only one of the <author> elements should contain a <contrib>
640
 
           element that describes what the whole authorgroup was
641
 
           responsible for.  For example:
642
 
 
643
 
           <chapterinfo>
644
 
             <authorgroup>
645
 
               <author>
646
 
                 <firstname>Bob</firstname>
647
 
                 <surname>Jones</surname>
648
 
                 <contrib>Contributed by </contrib>
649
 
               </author>
650
 
               <author>
651
 
                 <firstname>Sarah</firstname>
652
 
                 <surname>Lee</surname>
653
 
               </author>
654
 
             </authorgroup>
655
 
           </chapterinfo>
656
 
 
657
 
           Would show up as "Contributed by Bob Jones and Sarah Lee".  Each
658
 
           authorgroup shows up as a separate sentence. -->
659
 
  
660
 
 
661
 
      (element chapterinfo 
662
 
        (process-children))
663
 
      (element sect1info 
664
 
        (process-children))
665
 
      (element sect2info 
666
 
        (process-children))
667
 
      (element sect3info 
668
 
        (process-children))
669
 
      (element sect4info 
670
 
        (process-children))
671
 
      (element sect5info 
672
 
        (process-children))
673
 
      (element (chapterinfo authorgroup author)
674
 
        (literal (author-list-string)))
675
 
      (element (sect1info authorgroup author)
676
 
        (literal (author-list-string)))
677
 
      (element (sect2info authorgroup author)
678
 
        (literal (author-list-string)))
679
 
      (element (sect3info authorgroup author)
680
 
        (literal (author-list-string)))
681
 
      (element (sect4info authorgroup author)
682
 
        (literal (author-list-string)))
683
 
      (element (sect5info authorgroup author)
684
 
        (literal (author-list-string)))
685
 
 
686
 
      (define (custom-authorgroup)
687
 
        ($italic-seq$
688
 
          (make sequence
689
 
            (process-node-list (select-elements (descendants (current-node))
690
 
                                  (normalize "contrib")))
691
 
            (process-children)
692
 
            (literal ".  "))))
693
 
 
694
 
      (element (chapterinfo authorgroup)
695
 
        (custom-authorgroup))
696
 
      (element (sect1info authorgroup)
697
 
        (custom-authorgroup))
698
 
      (element (sect2info authorgroup)
699
 
        (custom-authorgroup))
700
 
      (element (sect3info authorgroup)
701
 
        (custom-authorgroup))
702
 
      (element (sect4info authorgroup)
703
 
        (custom-authorgroup))
704
 
      (element (sect5info authorgroup)
705
 
        (custom-authorgroup))
706
 
 
707
 
      <!-- I want things marked up with 'sgmltag' eg., 
708
 
 
709
 
              <para>You can use <sgmltag>para</sgmltag> to indicate
710
 
                paragraphs.</para>
711
 
 
712
 
           to automatically have the opening and closing braces inserted,
713
 
           and it should be in a mono-spaced font. -->
714
 
 
715
 
      (element sgmltag ($mono-seq$
716
 
          (make sequence
717
 
            (literal "<")
718
 
            (process-children)
719
 
            (literal ">"))))
720
 
 
721
 
      <!-- Add double quotes around <errorname> text. -->
722
 
 
723
 
      (element errorname
724
 
        (make sequence
725
 
          <![ %output.html;  [ (literal "``") ]]>
726
 
          ($mono-seq$ (process-children))
727
 
          <![ %output.html;  [ (literal "''") ]]>
728
 
          ))
729
 
 
730
 
      <!-- John Fieber's 'instant' translation specification had 
731
 
           '<command>' rendered in a mono-space font, and '<application>'
732
 
           rendered in bold. 
733
 
 
734
 
           Norm's stylesheet doesn't do this (although '<command>' is 
735
 
           rendered in bold).
736
 
 
737
 
           Configure the stylesheet to behave more like John's. -->
738
 
 
739
 
      (element command ($mono-seq$))
740
 
      (element envar ($mono-seq$))
741
 
 
742
 
      (element application ($bold-seq$))
743
 
 
744
 
      <!-- Warnings and cautions are put in boxed tables to make them stand
745
 
           out. The same effect can be better achieved using CSS or similar,
746
 
           so have them treated the same as <important>, <note>, and <tip>
747
 
      -->
748
 
      (element warning ($admonition$))
749
 
      (element (warning title) (empty-sosofo))
750
 
      (element (warning para) ($admonpara$))
751
 
      (element (warning simpara) ($admonpara$))
752
 
      (element caution ($admonition$))
753
 
      (element (caution title) (empty-sosofo))
754
 
      (element (caution para) ($admonpara$))
755
 
      (element (caution simpara) ($admonpara$))
756
 
 
757
 
      <!-- Tell the stylesheet about our local customisations -->
758
 
 
759
 
      (element hostid 
760
 
        (if %hyphenation%
761
 
          (urlwrap)
762
 
          ($mono-seq$)))
763
 
      (element username ($mono-seq$))
764
 
      (element groupname ($mono-seq$))
765
 
      (element devicename ($mono-seq$))
766
 
      (element maketarget ($mono-seq$))
767
 
      (element makevar ($mono-seq$))
768
 
 
769
 
      <!-- Override generate-anchor.  This is used to generate a unique ID for
770
 
           each element that can be linked to.  The element-id function calls
771
 
           this one if there's no ID attribute that it can use.  Normally, we
772
 
           would just use the current element number.  However, if it's a
773
 
           a question then use the question's number, as determined by the
774
 
           question-answer-label function.
775
 
 
776
 
           This generates anchors of the form "Qx.y.", where x.y is the
777
 
           question label.  This will probably break if question-answer-label
778
 
           is changed to generate something that might be the same for two
779
 
           different questions (for example, if question numbering restarts
780
 
           for each qandaset. -->
781
 
      (define (generate-anchor #!optional (nd (current-node)))
782
 
        (cond
783
 
          ((equal? (gi nd) (normalize "question"))
784
 
            (string-append "Q" (question-answer-label)))
785
 
          (else
786
 
            (string-append "AEN" (number->string (all-element-number nd))))))
787
 
      
788
 
      (define (xref-biblioentry target)
789
 
        (let* ((abbrev (node-list-first
790
 
                        (node-list-filter-out-pis (children target))))
791
 
               (label  (attribute-string (normalize "xreflabel") target)))
792
 
                    
793
 
          (if biblio-xref-title
794
 
              (let* ((citetitles (select-elements (descendants target)
795
 
                                                  (normalize "citetitle")))
796
 
                     (titles     (select-elements (descendants target)
797
 
                                                  (normalize "title")))
798
 
                     (isbn       (select-elements (descendants target)
799
 
                                                  (normalize "isbn")))
800
 
                     (publisher  (select-elements (descendants target)
801
 
                                                  (normalize "publishername")))
802
 
                     (title      (if (node-list-empty? citetitles)
803
 
                                     (node-list-first titles)
804
 
                                     (node-list-first citetitles))))
805
 
                (with-mode xref-title-mode
806
 
                  (make sequence
807
 
                    (process-node-list title))))
808
 
              (if biblio-number
809
 
                  (make sequence
810
 
                    (literal "[" (number->string (bibentry-number target)) "]"))
811
 
                  (if label
812
 
                      (make sequence
813
 
                        (literal "[" label "]"))
814
 
                      (if (equal? (gi abbrev) (normalize "abbrev"))
815
 
                          (make sequence
816
 
                            (process-node-list abbrev))
817
 
                          (make sequence
818
 
                            (literal "[" (id target) "]"))))))))
819
 
 
820
 
       <!-- The (create-link) procedure should be used by all FreeBSD
821
 
           stylesheets to create links.  It calls (can-link-here) to
822
 
           determine whether it's okay to make a link in the current
823
 
           position.
824
 
 
825
 
           This check is necessary because links aren't allowed in,
826
 
           for example, <question> tags since the latter cause links
827
 
           to be created by themselves.  Obviously, nested links lead
828
 
           to all kinds of evil.  This normally wouldn't be a problem
829
 
           since no one in their right mind will put a <ulink> or
830
 
           <link> in a <question>, but it comes up when someone uses,
831
 
           say, a man page entity (e.g., &man.ls.1;); the latter may
832
 
           cause a link to be created, but its use inside a <question>
833
 
           is perfectly legal.
834
 
 
835
 
           The (can-link-here) routine isn't perfect; in fact, it's a
836
 
           hack and an ugly one at that.  Ideally, it would detect if
837
 
           the currect output would wind up in an <a> tag and return
838
 
           #f if that's the case.  Slightly less ideally it would
839
 
           check the current mode and return #f if, say, we're
840
 
           currently in TOC mode.  Right now, it makes a best guess
841
 
           attempt at guessing which tags might cause links to be
842
 
           generated.  -->
843
 
      (define (can-link-here)
844
 
        (cond ((has-ancestor-member? (current-node)
845
 
                                     '("TITLE" "QUESTION")) #f)
846
 
              (#t #t)))
847
 
 
848
 
      (define (create-link attrlist target)
849
 
        (if (can-link-here)
850
 
            (make element gi: "A"
851
 
                  attributes: attrlist
852
 
                  target)
853
 
            target))
854
 
    </style-specification-body>
855
 
  </style-specification>
856
 
      
857
 
  <external-specification id="docbook" document="docbook.dsl">
858
 
</style-sheet>