DocBookの概要

Download Report

Transcript DocBookの概要

DocBookの概要
イースト株式会社
コミュニケーション事業部
渋谷 誠
[email protected]
1
DocBookとは
 SGMLのDTD
 OASISが維持管理
• the DocBook Technical Committee
 コンピューター関連の書籍や
文献に適している
 http://www.oasis-open.org/docbook/
2
歴史(1)
 HAL&O’Reilly時代
• 1991年: HaL Computer Systemsと
O‘Reilly & Associatesの共同プロジェクト
として生まれる
• V1.1発表後、Davenport Groupで活発に
議論され始める
• V1.2はNovell と Digitalの影響大
3
Davenport Group
O‘Reillyの作った
コンピュータードキュメント作成者のフォーラム
 初期メンバー

•
•
•
•
•
•
•
•
•
•
Jon Bosak, Novell
Dale Dougherty, O'Reilly & Associates
Ralph Ferris, Fujitsu OSSI
Dave Hollander, Hewlett-Packard
Eve Maler, Digital Equipment Corporation
Murray Maloney, SCO
Conleth O'Connell, HaL Computer Systems
Nancy Paisner, Hitachi Computer Products
Mike Rogers, SunSoft
Jean Tappan, Unisys
4
歴史(2)
 Davenport時代
• 1994年: V1.2.2リリース。
同時にDavenport Groupが公認機関に
• 最大ユーザーであるNovelとSunの影響力
高まる
• 1997年: V3.0 リリース
• メンバーが増えて開発速度は低下
• スポンサーがDavenport解散と
OASISへの移管を決定
5
OASIS
 Organization for the Advancement of
Structured Information Standards
 SGML/XML/HTML 普及促進を目的とした
非営利団体
 http://www.oasis-open.org/
6
歴史(3)
 OASIS時代
• 1998年7月
OASIS DocBook Technical Committee発足
• 1999年2月 V3.1リリース
• XML版を計画中
7
仕様はWebで公開
 The Davenport archive
• http://www.ora.com/davenport/
• ftp://ftp.ora.com/pub/davenport/
8
著作権
 DocBook
•
•
•
•
DTDの著作権は以下の4社
HaL Computer Systems, Inc.
O'Reilly & Associates, Inc.
Fujitsu Software Corporation
ArborText, Inc.
 が、権利は放棄されている
9
リビジョン管理方針
 Majorリビジョンの変更
• 要素や属性の互換性のない変更が生じた時のみ
• 年に2回以上は更新しない
• 1回以下が望ましい
 過去のリビジョン履歴
• 1.0 - 1.1 - 1.2 - 1.2.1
• 2.0 - 2.2.1 - 2.3 - 2.4 - 2.4.1
• 3.0 - 3.1
 今回の説明図は2.4.1のもの
10
XMLへの対応
 委員会でもXML版の計画はある
 非公式のものならば既に存在する
• http://www.nwalsh.com/docbook/xml/
11
文書構造の定義
12
Set
Set
?
?
SetInfo
ToC
2+
Book
?
SetIndex
?
Title
TitleAbbrev
+
set info
char mix
13
Setの構成例
Set
Title
SetInfo
Book
Book
Book
SetIndex
14
Book
Book
?
?
BookInfo
?
*
ToC
LoT
?
Title
Preface
TitleAbbrev
*
BookBiblio
*
LegalNotice
*
Glossary
ModeSpec
Bibliography
15
Book (続)
Book
*
*
*
Appendix
+
Part
+
Chapter
+
+
Reference
Article
Glossary
Index
Bibliography
SetIndex
*
?
LoT
ToC
*
Reference
16
Bookの構成例
Book
Book
BookInfo
ToC
LoT
(for figures)
LoT
(for tables)
Preface
Chapter
Chapter
Chapter
Chapter
Reference
Appendix
Appendix
Glossary
Bibliography
Index
Book (Reference Manual)
BookInfo
Preface
Part
BookInfo
ToC
PartIntro
Chapter
Chapter
Part
LoT
Preface
Reference
Reference
PartIntro
Chapter
Chapter
Chapter
Part
PartIntro
Appendix
Appendix
Reference
Reference
Appendix
Appendix
Appendix
Appendix
Index
17
Part
Part
?
?
DocInfo
Title
+
?
TitleAbbrev
PartIntro
Chapter
Appendix
*
?
Title
?
TitleAbbrev
div component
mix
*
Sect1
*
RefEntry
*
ToC
LoT
Index
Bibliography
Glossary
Preface
RefEntry
SimpleSect
Reference
18
Chapter
Chapter
?
DocInfo
?
Title
TitleAbbrev
?
ToCchap
*
*
div component
mix
Glossary
Index
*
Sect1
*
RefEntry
*
SimpleSect
Bibliography
19
Sect<n>
Sect<n>
?
Sect<n>Info
n = 1,2,3,4,5
?
Title
TitleAbbrev
*
*
div component
mix
Glossary
Index
*
Sect<n+1>
*
RefEntry
*
SimpleSect
Bibliography
20
SimpleSect
SimpleSect
?
Title
TitleAbbrev
*
div component
mix
21
Preface
Preface
?
DocInfo
?
Title
TitleAbbrev
*
div component
mix
*
Sect1
*
RefEntry
*
SimpleSect
22
Appendix
Appendix
?
DocInfo
?
Title
TitleAbbrev
?
ToCchap
*
div component
mix
*
Sect1
*
RefEntry
*
SimpleSect
23
Reference
Reference
?
DocInfo
?
Title
TitleAbbrev
*
?
PartIntro
RefEntry
24
RefEntry
RefEntry
?
DocInfo
*
?
?
RefNameDiv
RefMeta
RefSynopsisDiv
+
RefSect1
Comment
?
RefEntryTitle
ManVolNum
*
Link char
class
RefMiscInfo
25
BookBiblio
BookBiblio
?
?
Subtitle
?
Edition
?
?
AuthorGroup
?
InvPartNumber ProductNumber
?
ProductName
?
Title
TitleAbbrev
ISSN
?
VolumeNum
?
IssueNum
?
PageNum
ISBN
?
VolumeNum
26
BookBiblio(続)
BookBiblio
?
PubsNumber
?
ReleaseInfo
*
PubDate
*
Publisher
?
?
Copyright
+
Year
SeriesInfo
*
Abstract
*
ConfGroup
*
Holder
27
BookBiblio(続)
BookBiblio
*
?
?
PrintHistory
RevHistory
*
ContractNum
Revision
ContractSponsor
RevNumber
Date
*
AuthorInitials
?
RevRemark
28
本文内容モデル
 本文内容として定義されている要素
 種類別にクラス分けされている
 そのクラスも大きく2つのに分類
• Objectレベルクラス
• Characterレベルクラス
29
Objectレベルクラス(1)

list.class
CalloutList
GlossList
ItemizedList
OrderedList
SegmentedList
SimpleList
VariableList

admon.class
Caution
Important
Note
Tip
Warning
30
Objectレベルクラス(2)

linespecific.class
LiteralLayout
ProgramListing
ProgramListingCO
Screen
ScreenCO
ScreenShot

synop.class
Synopsis
CmdSynopsis
FuncSynopsis

para.class
FormalPara
Para
SimPara
31
Objectレベルクラス(3)

informal.class
Address
BlockQuote
Graphic
GraphicCO
MediaObject
MediaObjectCO
InformalEquation
InformalExample
InformalFigure
InformalTable

formal.class
Equation
Example
Figure
Table

compound.class
MsgSet
Procedure
Sidebar
QandASet
32
Objectレベルクラス(4)

compound.class
MsgSet
Procedure
Sidebar
QandASet


descobj.class
Abstract
AuthorBlurb
Epigraph
genobj.class
Anchor
BridgeHead
Comment
Highlights
33
Characterレベルクラス(1)

ndxterm.class
IndexTerm

xref.char.class
FootnoteRef
XRef

link.char.class
Link
OLink
ULink

gen.char.class
Abbrev
Acronym
Citation
CiteRefEntry
CiteTitle
Emphasis
FirstTerm
ForeignPhrase
GlossTerm
Footnote
Phrase
Quote
Trademark
WordAsWord
34
Characterレベルクラス(2)

base.char.class
Anchor

other.char.class
Comment
Subscript
Superscript

inlineobj.char.class
InlineGraphic
InlineMediaObject
InlineEquation

docinfo.char.class
Author
AuthorInitials
CorpAuthor
ModeSpec
OtherCredit
ProductName
ProductNumber
RevHistory
35
Characterレベルクラス(3)

tech.char.class
Action
Application
ClassName
Command
ComputerOutput
Database
Email
EnVar
ErrorCode
ErrorName
ErrorType
Filename
Function
GUIButton
GUIIcon
GUILabel
GUIMenu
GUIMenuItem
GUISubmenu
Hardware
Interface
InterfaceDefinition
KeyCap
KeyCode
KeyCombo
KeySym
Literal
Constant
Markup
MediaLabel
MenuChoice
MouseButton
MsgText
Option
Optional
Parameter
Prompt
Property
Replaceable
ReturnValue
SGMLTag
StructField
StructName
Symbol
SystemItem
Token
Type
UserInput
VarName
36
関数仕様定義
<funcsynopsis>
<funcsynopsisinfo>#include <stdlib.h></funcsynopsisinfo>
<funcdef>double <function>atof</function></funcdef>
<paramdef>const char *<parameter>nptr</parameter></paramdef>
</funcsynopsis>
#include <stdlib.h>
double atof(const char *nptr);
37
ソースコード
<example>
<title>A simple C program</title>
<programlisting role="C">
#include <stdio.h>
main()
{
printf("Hello, world!\n");
}
</programlisting>
</example>
#include <stdio.h>
main()
{
printf("Hello, world!\n");
}
38
カスタマイズ可能な設計
 カスタマイズする事を前提としている
• Customizer‘s Guideが用意されている
 モジュールごとに再利用が可能
• うまくモジュール分割されている
 サブセットの定義や追加定義が可能
• 外部ファイルのみでカスタマイズ可能
39
ファイル構成
40
基本構成図
docbook.dtd
(driver file, notation, ISO entities)
dbgenent.dtd
dbhier.mod (document hierarchies)
dbpool.mod (information pool)
docbook.dcl
SGML declaration
calstbl.mod
(CALS tables)
docbook.cat
DocBook DTD
Catalog data
41
docbook.dtd
dbgenent.dtd
docbook.dcl
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 SGML宣言ファイル
<!SGML “ISO 8879:1986”
.
.
.
>
42
docbook.dtd
dbgenent.dtd
docbook.dtd
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
SGMLドライバファイル=DocBook DTD の本体
 dbhier.mod, dbhier.mod, dbpool.modを
インクルード
 rdbXXX.mod を条件付きインクルード

43
docbook.dtd
dbgenent.dtd
docbook.dtd

calstbl.mod
docbook.cat
ISO標準の19種の文字エンティティ宣言をインクルード
(V3.1ではdbcent.modに分離)
"ISO
"ISO
"ISO
"ISO
"ISO
"ISO
"ISO

docbook.dcl
dbhier.mod
dbpool.mod
8879:1986//ENTITIES
8879:1986//ENTITIES
8879:1986//ENTITIES
8879:1986//ENTITIES
8879:1986//ENTITIES
8879:1986//ENTITIES
8879:1986//ENTITIES
・ ・ ・ ・
Diacritical Marks//EN"
Numeric and Special Graphic//EN"
Publishing//EN"
General Technical//EN"
Added Latin 1//EN"
Added Latin 2//EN"
Greek Letters//EN”
文字エンティティ宣言
<!ENTITY aacute SDATA "[aacute]"--=small a, acute accent-->
 文字エンティティ参照
%aacute;
44
docbook.dtd
dbgenent.dtd
docbook.dtd
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
各種記法宣言をインクルード
(V3.1ではdbnotn.modに分離)
 各種外部参照フォーマットの宣言

BMP, CGM-CHAR , CGM-BINARY , CGM-CLEAR , DITROFF , DVI
EPS , EQN , FAX , GIF , GIF87a , GIF89a , JPG , JPEG , IGES , PCX
PIC , PS , SGML , TBL , TEX , TIFF , WMF , WPG
 記法宣言例
<!NOTATION BMP
PUBLIC
"+//ISBN 0-7923-9432-1::Graphic Notation//NOTATION Microsoft Windows bitmap//EN">
45
docbook.dtd
dbgenent.dtd
dbhier.mod
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 ドキュメントの階層構造の定義
 rdbhier.mod, rdbhier2.mod を
条件付きでインクルード
46
docbook.dtd
dbgenent.dtd
dbpool.mod
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 階層構造以外の定義
本文内容のクラス等
 calstbl.modをインクルード
(V3.1 では cals-tbl.dtd)
47
docbook.dtd
dbgenent.dtd
calstbl.mod
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 CALS仕様の表の定義
(V3.1では cals-tbl.dtd)
48
docbook.dtd
dbgenent.dtd
dbgenent.mod
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 一般エンティティ宣言
 コメントのみの空ファイル
 追加定義をここに記述できる
49
docbook.dtd
dbgenent.dtd
docbook.cat
docbook.dcl
dbhier.mod
dbpool.mod
calstbl.mod
docbook.cat
 SGMLカタログデータファイル
 共通の外部参照ファイルの位置などを
環境に合わせて定義するファイル
 C言語で言えばインクルードファイルの検
索パスの指定のようなもの
50
カスタマイザ使用時の構成
docbook.dtd
(driver file, notation, ISO entities)
rdbmods.dtd
dbgenent.dtd
dbhier.mod (document hierarchies)
rdbhier.dtd
rdbhier2.dtd
dbpool.mod (information pool)
docbook.dcl
SGML declaration
rdbpool.dtd
calstbl.mod
(CALS tables)
docbook.cat
Catalog data
51
rdbXXXX.mod
 カスタマイズ時に使用
 定義の変更や追加を記述
 標準では提供はされない
•
•
•
•
rdbmods.mod
rdbhier1.mod
rdbhier2.mod
rdbpool.mod
52
ファイル参照関係
docbook.dtd
dbpool.mod
rdbpool.mod
rdbmods.dtd
calstbl.dtd
dbhier.mod
rdbhier.mod
dbgenent.dtd
rdbhier2.dtd
53
カスタマイズの仕組み
 モジュール単位での選択
 定義の上書き
 定義の追加
54
モジュール単位での選択
 モジュールは条件付きセクションで
括られている
<!ENTITY % biblioentry.module "INCLUDE">
<![ %biblioentry.module; [
…
(書誌情報の各種定義)
…
<!--end of biblioentry.module-->]]>

外部ファイルでのモジュール無視の指定
<!ENTITY % biblioentry.module "IGNORE">
55
定義の上書き
 要素の定義はパラメータを使用
<!ELEMENT Set - O (SetInfo?, Book+, SetIndex?) >
<!ENTITY % book.class
"Book">
<!ELEMENT Set - O (SetInfo?, (%book.class;)+, SetIndex?) >
Set = (SetInfo?, Book+, SetIndex?)
 外部での定義の上書き
<!ENTITY % book.class
"Article">
Set = (SetInfo?, Article+, SetIndex?)
56
定義の追加
 パラメータの定義にはlocalパラメータを付加
<!ENTITY % local.book.class "">
<!ENTITY % book.class "Book %local.book.class;">
%book.class; = Book
 外部ファイルで定義を追加
<!ENTITY % local.book.class ”| Article">
%book.class; = Book|Article
57
まとめ
 企業ベースで開発
 SGMLの模範的応用例のひとつ
 DTDは複雑
• DTDテクニックを駆使してモジュール化
 カスタマイズが前提
 コンピュータ書籍にフォーカス
 コンピュータ業界での利用例が多い
58