(maybe-not-sosofo predicate sosofo) |
Returns empty-sosofo if predicate evaluates to a true value, or sosofo if it does not.
(define (maybe-not-sosofo predicate sosofo)
(if predicate (empty-sosofo) sosofo)) |
(maybe-not-sosofo predicate sosofo) |
Returns sosofo if predicate evaluates to a true value, or empty-sosofo if it does not.
;; Conditionally use the sosofo or the empty one.
(define (maybe-sosofo predicate sosofo)
(if predicate sosofo (empty-sosofo))) |
This procedure outlines a mechanism that preserves
entity references for special characters and SDATA entity references
in Jade output.
It relies on some DSSSL extensions implemented in Jade, and may not
work with other DSSSL engines.
If query construction rules are available in your DSSSL engine,
better solutions are possible.
;; Process the text under 'snl', replacing any special characters
;; and SDATA entities with appropriate entity references.
(define (process-text #!optional (osnl (current-node)))
(let p-t-loop ((this-node (node-list-first (children snl)))
(other-nodes (node-list-rest (children snl))))
(if (node-list-empty? this-node)
(empty-sosofo)
(sosofo-append (case (node-property 'class-name this-node)
;; handle special characters
((data-char) (case (node-property 'char this-node)
;; ampersand
((#\&) (make entity-ref name: "amp"))
;; etc....
(else (process-node-list this-node))))
;; handle SDATA entity references
((sdata) (case (node-property 'system-data this-node)
;; a with grave accent
(("[agrave]") (make entity-ref name: "agrave"))
;; ampersand
(("[amp ]") (make entity-ref name: "amp"))
;; etc.... no else
))
(else (process-node-list this-node)))
(p-t-loop (node-list-first other-nodes)
(node-list-rest other-nodes))))))
;; An example use for a DocBook to HTML convertor, using the SGML backend.
;; Use (process-text) as the content-expression for any element construction
;; rule where the element has mixed-content.
;;(element CITETITLE
;; (make element
;; gi: "CITE"
;; attributes: (list (list "CLASS"
;; "CITETITLE"))
;; (process-text (current-node)))) |
This procedure is sets the glyph-subst-table
characteristic to a glyph table with glyphs for small caps letters in
place of the glyphs for lowercase letters. Jade's RTF backend, at least,
recognises those glyphs and outputs the correct information for the text
to be formatted as small caps.
;; From code posted to the DSSSList by James Clark 4/29/97
(define small-caps-glyph-table
(letrec ((signature (* #o375 256))
(make-afii
(lambda (n)
(glyph-id (string-append "ISO/IEC 10036/RA//Glyphs::"
(number->string n)))))
(gen
(lambda (from count)
(if (= count 0)
'()
(cons (cons (make-afii from)
(make-afii (+ from signature)))
(gen (+ 1 from)
(- count 1)))))))
(glyph-subst-table (gen #o141 26))))
(define (small-caps children)
(make sequence
glyph-subst-table: small-caps-glyph-table
children)) |