
目次
はじめに ▼ 必要な知識 ▼ 必要なツールと資料 ▼ レッスン 1−最初の一歩 ▼ レッスン 2−余白の追加 ▼ レッスン 3 ▼ レッスン 4 ▼ レッスン 5−変数の追加 ▼ レッスン 6−異なる順序での要素の表示 ▼ レッスン 7−スタイルを用いて ▼ レッスン 8 ▼ レッスン 9−表の作成 ▼ おわりに ▼
Daniel M. Germ
n氏が著わした“A tutorial on DSSSL”の全訳を掲載します。この訳は1999年2月8日版に基づきます。訳の文責は岸 和孝にあります。この手引きは,DSSSLの具体的なスタイル指定をシェイクスピアの「ハムレット」を題材にしてケーススタディしたものです。この手引きを読む前に,Schemeの知識を必要としない,Paul Prescod氏が著したDSSSL入門(原題:Introduction to DSSSL)を読むことをお勧めします。
著者Daniel M. Germ
n氏へ,この手引きの翻訳・掲載を快諾していただいたことに感謝します。
この手引きでケーススタディを行うには,次のツールと資料が必要です。
この手引きの目的は,DSSSLの基本を紹介することです。私たちは(Jon Bosak氏から送られてきたplay.dslに基づいて)戯曲のためのDSSSLスタイルシートを作り上げます。
あなたは,このケーススタディで使う文書型定義,スタイルシート,結果のRTFファイルを一括してtutorial.zipとしてダウンロードできます。
私たちは,すでにSGMLファイルとそのDTDを持っています。最初のステップは,どんなフォーマットもなしに,戯曲のすべてのテキストをRTFファイルとして生成することです。
; これは,特定のフォーマットなしに戯曲のテキストを出力します。 (root (make simple-page-sequence (process-children) ) )
RTFファイルは,文字列だけです。どんな余白〔margin〕もなく,どんな段落もありません。それはフォントファミリー,フォントサイズ,ページサイズなどについてJadeの省略時値を用います。
(root (make simple-page-sequence ; 余白 left-margin: 1in right-margin: 1in top-margin: 1in bottom-margin: 1in (process-children) ) )
私たちは,SGMLファイルにおいて要素に出会うように,フォーマットを追加しながら,トップダウンで仕事をします。
(element (PLAY TITLE) ; PLAYのTITLE (make paragraph quadding: 'center font-size: 18pt line-spacing: 18pt font-weight: 'bold keep-with-next?: #t (process-children) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 重要なこと ; (element (FM) (make paragraph font-size: 8pt line-spacing: 8pt ; 左右の字下げ start-indent: 5cm end-indent: 5cm ; 直前の間隔 space-before:.5cm ; 直後の間隔 space-after: .5cm (process-children) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 定数の追加 (define *titleFontSize* 18pt) (define *fmFontSize* (/ *titleFontSize* 2)) (define *fmIndent* 3cm) (define *fmSpaceBefore* .5cm) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 戯曲の表題 (element (PLAY TITLE) (make paragraph quadding: 'center font-size: *titleFontSize* line-spacing: *titleFontSize* font-weight: 'bold keep-with-next?: #t (process-children) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 重要なこと ; (element (FM) (make paragraph font-size: *fmFontSize* line-spacing: *fmFontSize* ; 左右の字下げ start-indent: *fmIndent* end-indent: *fmIndent* ; 直前の間隔 space-before: *fmSpaceBefore* ; 直後の間隔 space-after: *fmSpaceBefore* (process-children) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PERSONAE (element PERSONAE (process-children) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PERSONA (element PERSONA ; 登場人物 (make paragraph space-before: *personaSpaceBefore* start-indent: *personaIndent* (process-children) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PERSONAEの内側のTITLE (element (PERSONAE TITLE) (make paragraph font-size: *personaetitleFontSize* line-spacing: *personaetitleFontSize* font-weight: 'bold keep-with-next?: #t (process-children) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PGROUP ; PGROUPの最後にあって,_the beginning_で表示されるグループ ; の記述を私たちは得なければなりません (define (*groupName*) ; 最初に,変数xにGRPDESCR内容を設定します。 (let ( (x (data (select-elements (children (if (equal? (gi) "PGROUP") (current-node) (ancestor "PGROUP")) ) '(GRPDESCR) ) ) ) ) ; 変数xが“.”で終わる場合,後者を落とし,“:”を連結します。 (string-append (if (string=? (substring x (- (string-length x) 1) (string-length x)) "." ) (substring x 0 (- (string-length x) 1)) x ) ":" ) ) ) (element PGROUP (make paragraph start-indent: *personaIndent* space-before: *textSpaceBefore* font-weight: 'bold (literal (*groupName*)) (process-children) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PGROUPの内側のPERSONA (element (PGROUP PERSONA ) (make paragraph space-before: *personaSpaceBefore* start-indent: *pgroupIndent* font-weight: #f (process-children) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; GRPDESCR ; それは引き出されましたが,無視します。 (element GRPDESCR (empty-sosofo) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Scndescr (define *sceneStyle* ; すべての場面の記述のためのスタイル (style quadding: 'center font-size: (+ *textFontSize* 4pt) line-spacing: *textFontSize* font-weight: #f font-posture: 'italic start-indent: *sceneIndent* end-indent: *sceneIndent* ) ) (element SCNDESCR (make paragraph use: *sceneStyle* space-before: *sceneSpaceBefore* (process-children) ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; STAGEDIR ; (element STAGEDIR (make paragraph font-posture: 'italic ; それが行か発言の内側にあるならば,space-beforeを置かない。 ; そうでなければ,ある間隔で飛ばします。 space-before: (if (or (equal? (gi (parent)) "LINE") (equal? (gi (parent)) "SPEECH") ) 0pt *textFontSize* ) ; 突然発言しないように囲みます。 (literal "[") (process-children) (literal "]") ) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; SPEECH (element SPEECH ; 1人以上の話し手による行の集合 (make table ; 複数の話し手に適応するために表を用います。 space-before: (/ *textFontSize* 2) may-violate-keep-after?: #t (make table-column ; 話し手の欄が限られることを保証します。 column-number: 1 width: *speakerWidth* ) (make table-cell ; すべての話し手を集めます。 (make paragraph (with-mode *speechSpeaker* (process-matching-children "SPEAKER") ) ) ) (make table-cell ; すべての行と指示を集めます。 (process-children) ) ) ) (mode *speechSpeaker* ; 一つの欄の中にすべての話し手を集めます。 (element SPEAKER ; 複数であることを示すためにアンパサンドで分離します。 (if (= (child-number) 1) (make sequence font-posture: 'italic (process-children) ) (make sequence font-posture: 'italic (literal " & ") (process-children) ) ) ) (default ; 安全装置−これを誘発してはいけません。 (empty-sosofo) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; SPEAKER ; これはspeechSpeakerモードで注目したので,標準モードでは無視します。 (element SPEAKER ; これはモードだけで,誘発してはいけません。 (empty-sosofo) ) (element LINE ; 与えられた話し手集合のためのすべての行 (make paragraph (process-children) ) )
DSSSLは複雑な言語です。私はその概要を簡単に述べただけです。この手引きを理解したからといって油断しないで下さい。その点で,何をなすべきかの印象を持つべきです。さらに,標準規格書をよく理解すべきです。
成功を祈ります!
この手引きへの批評があれば,どうかdmg@csg.uwaterloo.caへ送って下さい。
© 1997 Daniel M. Germ
n
(1999年3月記)