SGML/XML'97 - Jade stylesheet for formatting proposals to speak From: ftp://ftp.mulberrytech.com/pub/mulberrytech/sgml97/prop.dsl, 970723 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables to be overridden from the Jade command line (define %show-all-info% #f) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constants (define %term-indent% 2in) (define %para-sep% 6pt) (define %generic-line-field-width% 1in) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; External procedures (define if-first-page (external-procedure "UNREGISTERED::James Clark//Procedure::if-first-page")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Styles for use for various elements (define generic-title-style (style font-weight: 'bold font-family-name: "Times New Roman")) (define proposal-title-style (style use: generic-title-style font-size: 18pt line-spacing: 22pt)) (define section-title-style (style use: generic-title-style font-size: 16pt line-spacing: 20pt)) (define subsection-title-style (style use: generic-title-style font-size: 14pt line-spacing: 18pt)) (define header-footer-style (style font-size: 9pt font-posture: 'upright font-family-name: "Arial")) (define mono-para-style (style font-size: 9pt font-posture: 'upright lines: 'asis line-spacing: 11pt input-whitespace-treatment: 'preserve quadding: 'start font-family-name: "Courier New")) (define abstract-style (style font-posture: 'italic font-size: 10pt line-spacing: 12pt)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Initial values for selected inherited characteristics (declare-initial-value font-family-name "Times New Roman") (declare-initial-value font-size 12pt) (declare-initial-value line-spacing 14pt) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Structural elements ;; This is the root element. Set up the page size and the headers ;; and footers, then process the proposal in the order we want. (element PROPOSAL (let ((footer-purpose (make sequence use: header-footer-style (literal "SGML/XML'97 Peer Review"))) ;; The page number (footer-page-number (make sequence use: header-footer-style (page-number-sosofo))) ;; The document title (header-doc-title (make sequence use: header-footer-style (with-mode header (process-first-descendant "TITLE")))) ;; The document ID extracted from the ID attribute of ;; proposal, or "****" if the ID is missing (header-doc-id (make sequence use: header-footer-style (literal (if (string? (attribute-string "ID")) (attribute-string "ID") "****"))))) (make simple-page-sequence top-margin: 1.25in bottom-margin: 1.25in right-margin: 1in left-margin: 1in header-margin: 0.75in footer-margin: 0.75in ;; We don't put a header on the first page left-header: (if-first-page (empty-sosofo) (make sequence header-doc-id (literal " \bullet ") header-doc-title)) left-footer: footer-purpose right-footer: footer-page-number ;; Process the children of PROPOSAL in the order that ;; we want. Some of them only show up if we're not ;; producing output for the blind review (make sequence ;; Extract the ID attribute from PROPOSAL (make paragraph use: proposal-title-style font-size: 12pt line-spacing: 14pt keep-with-next?: #t space-after: 6pt start-indent: %generic-line-field-width% first-line-start-indent: (- %generic-line-field-width%) ;; This uses the same line-width as the ;; generic line-field defined elsewhere, but ;; the space before and after is different ;; so we don't just use the generic function. (make line-field field-width: %generic-line-field-width% (literal "Identifier:")) (literal (if (string? (attribute-string "ID")) (attribute-string "ID") "****"))) ;; Extract the TARGET attribute from SUMMARY (make paragraph use: proposal-title-style font-size: 12pt line-spacing: 14pt keep-with-next?: #t space-after: 6pt start-indent: %generic-line-field-width% first-line-start-indent: (- %generic-line-field-width%) ;; This uses the same line-width as the ;; generic line-field defined elsewhere, but ;; the space before and after is different ;; so we don't just use the generic function. (make line-field field-width: %generic-line-field-width% (literal "Audience:")) (literal ;; Get the contents of the TARGET attribute, ;; if it is present, then use it to decide ;; what string to output (let ((categ (attribute-string "TARGET" (node-list-first (select-elements (children (current-node)) "SUMMARY"))))) (case categ (("NOVICE") "Novice") (("USER") "User") (("EXPERT") "Expert") (else "No Category assigned"))))) ;; Process the main title (process-matching-children "TITLE") ;; Show the presenters' names (perhaps). ;; This is just a list of the presenters' names ;; appearing under the title. The full information ;; about the presenters may appear after the abstract. (if %show-all-info% (make display-group space-before: 12pt space-after: 12pt font-weight: 'bold (with-mode person-name-list (process-children))) (empty-sosofo)) ;; Process the abstract (process-matching-children "ABSTRACT") ;; A poor way of getting to the PREVIOUS element ;; within SUMMARY (if %show-all-info% (with-mode previous (process-matching-children "SUMMARY")) (empty-sosofo)) ;; Process whatever PERSON elements we have, but ;; they'll only produce output if we're not ;; producing output for blind review (if %show-all-info% (process-matching-children "PERSON") (empty-sosofo)) ;; Process the guts of the proposal (process-matching-children "SUMMARY"))))) ;; The main title of the proposal (element (PROPOSAL TITLE) (make paragraph use: proposal-title-style keep-with-next?: #t space-before: 12pt)) ;; This is used when we want just the presenter's names to appear after ;; the main title (mode person-name-list (element (PERSON NAME) (make paragraph)) (default (apply process-matching-children '("PERSON" "NAME")))) ;; We don't want the full-size title in the header, so we process the TITLE ;; element using the "header" mode when we make the header (mode header (element TITLE (make sequence use: header-footer-style))) ;; Title of a first-level section (element (SECTION TITLE) (make paragraph use: section-title-style keep-with-next?: #t space-before: 12pt space-after: 6pt)) ;; Title of a second-level section (element (SECTION SECTION TITLE) (make paragraph use: subsection-title-style keep-with-next?: #t space-before: 8pt space-after: 6pt)) ;; The DTD allows the main title twice. We don't use this second one. (element (SYNOPSIS TITLE) (empty-sosofo)) ;; Proposal abstract (element ABSTRACT (make display-group use: abstract-style space-before: 18pt space-after: 18pt)) ;; Many elements use a line-field flow object, so we defined this procedure ;; to save space. (define (generic-line-field label contents) (make paragraph start-indent: %generic-line-field-width% first-line-start-indent: (- %generic-line-field-width%) (make line-field field-width: %generic-line-field-width% (literal label)) contents)) ;; The information about an individual presenter. ;; Another case of processing the child elements in the order that we want. ;; Some of the information is in elements, and some of it in attributes. ;; Nearly everything uses the generic-line-field procedure to identify and ;; output the information. (element PERSON (make display-group space-before: 18pt space-after: 18pt font-size: 10pt line-spacing: 12pt (process-matching-children "NAME") (process-matching-children "AFFIL") (process-matching-children "SNAIL") (process-matching-children "PHONE") (process-matching-children "FAX") (process-matching-children "EMAIL") (generic-line-field "Attended:" (literal (attribute-string "ATTEND"))) (generic-line-field "Discount:" (literal (attribute-string "DISC"))) (generic-line-field "Presenter:" (literal (attribute-string "MOUTH"))) (generic-line-field "Previous:" (literal (attribute-string "PRESENT"))) (generic-line-field "Typ. Audience:" (literal (attribute-string "TARGET"))) (process-matching-children "BIO") (process-matching-children "REFER"))) ;; The person's name is made bold and larger than the rest of the ;; information so it stands out on the page (element (PERSON NAME) (make paragraph space-before: 12pt font-size: (+ (inherited-font-size) 2pt) font-weight: 'bold)) ;; Affiliation also appears for references (element (PERSON AFFIL) (make paragraph)) ;; Snail-mail address lines (element (SNAIL LINE) (make paragraph)) ;; Phone number (element (PERSON PHONE) (generic-line-field "Phone:" (process-children-trim))) ;; Fax number (element (PERSON FAX) (generic-line-field "Fax:" (process-children-trim))) ;; Email address (element (PERSON EMAIL) (generic-line-field "Email:" (process-children-trim))) ;; A person's references ;; For the first reference, we output "References" (element REFER (make display-group space-before: 6pt space-after: 6pt (if (first-sibling? (current-node)) (make paragraph font-posture: 'italic (literal "References")) (empty-sosofo)) (process-children))) ;; The person's name was not a line-field, but the reference's name is. (element (REFER NAME) (generic-line-field "Name:" (process-children-trim))) ;; The person's affiliation is not a line-field, but the reference's is. (element (REFER AFFIL) (generic-line-field "Affil:" (process-children-trim))) ;; Reference's email address (element (REFER EMAIL) (generic-line-field "Email:" (process-children-trim))) ;; Reference's phone number (element (REFER PHONE) (generic-line-field "Phone:" (process-children-trim))) ;; Do not output anything when the PREVIOUS element is processed as part ;; of processing SUMMARY (element PREVIOUS (empty-sosofo)) ;; Do ouput only the information in the PREVIOUS element when it is not ;; a blind review and the summary is processed with this mode after the ;; abstract is output (mode previous (element PREVIOUS (make display-group space-before: 18pt space-after: 18pt font-size: 10pt (generic-line-field "Previous:" (process-children-trim)))) (default (process-matching-children "PREVIOUS"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Paragraph-level elements ;; Paragraph (element PARA (make paragraph space-before: 6pt)) ;; SGML sample (element SGML (make paragraph use: mono-para-style space-before: 6pt space-after: 6pt)) ;; Bulleted list (element BUL.LIST (make display-group start-indent: (+ (inherited-start-indent) 0.5in) space-before: 6pt space-after: 6pt)) ;; Bulleted list title (element (BUL.LIST TITLE) (make paragraph start-indent: (- (inherited-start-indent) 0.5in) space-before: 6pt space-after: 6pt)) ;; Bulleted list item ;; The list processing depends on the fact that list items can only ;; contain paragraphs, therefore we emit the bullet for the first ;; paragraph in an item. (element (BUL.LIST ITEM PARA) (if (absolute-first-sibling? (current-node)) (make paragraph space-before: 6pt first-line-start-indent: -0.25in (make line-field field-width: 0.25in (literal "\bullet")) (process-children)) (make paragraph space-before: 6pt))) ;; Numbered list (element NUM.LIST (make display-group start-indent: (+ (inherited-start-indent) 0.5in) space-before: 6pt space-after: 6pt)) ;; Numbered list title (element (NUM.LIST TITLE) (make paragraph start-indent: (- (inherited-start-indent) 0.5in) space-before: 6pt space-after: 6pt)) ;; Numbered list item ;; The list processing depends on the fact that list items can only ;; contain paragraphs, therefore we emit the number for the first ;; paragraph in an item. (element (NUM.LIST ITEM PARA) (if (absolute-first-sibling? (current-node)) (make paragraph space-before: 6pt first-line-start-indent: -0.25in (make line-field field-width: 0.25in (literal (string-append (number->string (child-number (parent (current-node)))) "."))) (process-children)) (make paragraph space-before: 6pt))) ;; Definition list (element DEF.LIST (make display-group space-before: 6pt space-after: 6pt)) ;; Definition list title (element (DEF.LIST TITLE) (make paragraph font-weight: 'bold)) ;; Definition list item ;; Make the TERM a line-field, and the DEF, either the contents of the ;; paragraph for the DEF.ITEM and possibly separate paragraphs after that. (element DEF.ITEM (make paragraph space-before: 6pt first-line-start-indent: (- %term-indent%) start-indent: (+ (inherited-start-indent) %term-indent%) (process-first-descendant "TERM") (process-first-descendant "DEF"))) ;; Definition list term (element (DEF.ITEM TERM) (make line-field field-width: %term-indent% font-weight: 'bold (process-children-trim))) ;; Paragraph (all that is allowed) inside a definition list definition (element (DEF.ITEM DEF PARA) (if (absolute-first-sibling?) ;; If this is the first paragraph, process the contents as ;; part of the paragraph flow object for the DEF.ITEM (process-children-trim) ;; otherwise make a paragraph flow object for the PARA (make paragraph first-line-start-indent: 0pt space-before: %para-sep% space-after: %para-sep% (process-children-trim)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Text-level elements (element EMPH (make sequence font-posture: 'italic))