diff options
author | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
commit | 84adefa331c4159d432d22840663c38f155cd4c1 (patch) | |
tree | bff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/docbuilder | |
download | otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2 otp-84adefa331c4159d432d22840663c38f155cd4c1.zip |
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/docbuilder')
113 files changed, 16842 insertions, 0 deletions
diff --git a/lib/docbuilder/AUTHORS b/lib/docbuilder/AUTHORS new file mode 100644 index 0000000000..4f2a8e9361 --- /dev/null +++ b/lib/docbuilder/AUTHORS @@ -0,0 +1,10 @@ +Docbuilder is a rewrite of the Old docbuilder +and takes XML as input instead of SGML. +Docbuilder makes use of xmerl for parsing XML +and produces HTML. Everything is written in Erlang +and there are no dependencies to external tools. + +Original Authors: +Gunilla Arendt + +Contributors: diff --git a/lib/docbuilder/Makefile b/lib/docbuilder/Makefile new file mode 100644 index 0000000000..21f42421d6 --- /dev/null +++ b/lib/docbuilder/Makefile @@ -0,0 +1,37 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +# AB. All Rights Reserved.'' +# +# $Id$ +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# +# Macros +# + +SUB_DIRECTORIES = src dtd etc doc/src + +include vsn.mk +VSN = $(DOCB_VSN) + +SPECIAL_TARGETS = + +# +# Default Subdir Targets +# +include $(ERL_TOP)/make/otp_subdir.mk + + diff --git a/lib/docbuilder/doc/html/.gitignore b/lib/docbuilder/doc/html/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/docbuilder/doc/html/.gitignore diff --git a/lib/docbuilder/doc/man3/.gitignore b/lib/docbuilder/doc/man3/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/docbuilder/doc/man3/.gitignore diff --git a/lib/docbuilder/doc/man6/.gitignore b/lib/docbuilder/doc/man6/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/docbuilder/doc/man6/.gitignore diff --git a/lib/docbuilder/doc/pdf/.gitignore b/lib/docbuilder/doc/pdf/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/docbuilder/doc/pdf/.gitignore diff --git a/lib/docbuilder/doc/src/Makefile b/lib/docbuilder/doc/src/Makefile new file mode 100644 index 0000000000..ae34266844 --- /dev/null +++ b/lib/docbuilder/doc/src/Makefile @@ -0,0 +1,132 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(DOCB_VSN) +APPLICATION=docbuilder + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_APPLICATION_FILES = ref_man.xml +XML_REF3_FILES = \ + docb_gen.xml \ + docb_transform.xml \ + docb_xml_check.xml +XML_REF6_FILES = \ + docbuilder_app.xml + +XML_PART_FILES = part.xml part_notes.xml +XML_CHAPTER_FILES = \ + overview.xml \ + user_guide_dtds.xml \ + refman_dtds.xml \ + fasc_dtds.xml \ + header_tags.xml \ + block_tags.xml \ + inline_tags.xml \ + character_entities.xml \ + notes.xml + +BOOK_FILES = book.xml + +GIF_FILES = \ + man.gif + + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \ + $(XML_APPLICATION_FILES) + +# ---------------------------------------------------- + +HTML_FILES = \ + $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) + +INFO_FILE = ../../info + +MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) +MAN6_FILES = $(XML_REF6_FILES:%_app.xml=$(MAN6DIR)/%.6) + +HTML_REF_MAN_FILE = $(HTMLDIR)/index.html + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: pdf html man + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: gifs $(HTML_REF_MAN_FILE) + +man: $(MAN3_FILES) $(MAN6_FILES) + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR)/* + rm -f $(MAN3DIR)/* + rm -f $(MAN6DIR)/* + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(HTMLDIR)/* \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3 + $(INSTALL_DIR) $(RELEASE_PATH)/man/man6 + $(INSTALL_DATA) $(MAN6_FILES) $(RELEASE_PATH)/man/man6 + +release_spec: diff --git a/lib/docbuilder/doc/src/block_tags.xml b/lib/docbuilder/doc/src/block_tags.xml new file mode 100644 index 0000000000..f5ba083f38 --- /dev/null +++ b/lib/docbuilder/doc/src/block_tags.xml @@ -0,0 +1,431 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Block Tags</title> + <prepared/> + <docno/> + <date/> + <rev/> + <file>block_tags.xml</file> + </header> + + <p>Block tags typically define a separate block of information, such + as a paragraph or a list.</p> + + <p>The following subset of block tags are common for all DTDs in + the DocBuilder DTD suite: + <marker id="block_subset"></marker> + <seealso marker="#pTAG"><p></seealso>, + <seealso marker="#preTAG"><pre></seealso>, + <seealso marker="#codeTAG"><code></seealso>, + <seealso marker="#listTAG"><list></seealso>, + <seealso marker="#taglistTAG"><taglist></seealso>, + <seealso marker="#codeincludeTAG"><codeinclude></seealso> and + <seealso marker="#erlevalTAG"><erleval></seealso>. + </p> + + <section> + <marker id="brTAG"></marker> + <title><br> - Line Break</title> + + <p>Forces a newline. Example:</p> + <pre> +Eat yourself<br/>senseless! + </pre> + <p>results in:</p> + <p>Eat yourself<br/>senseless!</p> + + <p>The <c><![CDATA[<br>]]></c> tag is both a block- and an inline + tag.</p> + </section> + + <section> + <marker id="codeTAG"></marker> + <title><code> - Code Example</title> + + <p>Highlight code examples. Example:</p> + <pre> +<code> +sum([H|T]) -> + H + sum(T); +sum([]) -> + 0. +</code> + </pre> + <p>results in:</p> + <code> +sum([H|T]) -> + H + sum(T); +sum([]) -> + 0. + </code> + + <p>There is an attribute <c>type = "erl" | "c" | "none"</c>, but + currently this attribute is ignored by DocBuilder. Default value + is <c>"none"</c></p> + + <note> + <p>No tags are allowed within the tag and no + <seealso marker="character_entities">character + entities</seealso> are expanded.</p> + </note> + </section> + + <section> + <marker id="codeincludeTAG"></marker> + <title><codeinclude> - Code Inclusion</title> + + <p>Include external code snippets. The attribute <c>file</c> + gives the file name and <c>tag</c> defines a string which + delimits the code snippet. Example:</p> + <pre> +<codeinclude file="gazonk" tag="%% Erlang example"/> + </pre> + <p>results in:</p> + <codeinclude file="gazonk" tag="%% Erlang example"/> + + <p>provided there is a file named <c>gazonk</c> looking like this: + </p> + <code> +... + +%% Erlang example +-module(gazonk). + +start() -> + {error,"Pid required!"}. +start(Pid) -> + spawn(fun() -> init(Pid) end). +%% Erlang example + +... + </code> + + <p>If the <c>tag</c> attribute is omitted, the whole file is + included.</p> + + <p>There is also an attribute <c>type = "erl" | "c" | "none"</c>, but + currently this attribute is ignored by DocBuilder. Default value + is <c>"none"</c></p> + </section> + + <section> + <marker id="erlevalTAG"></marker> + <title><erleval> - Erlang Evaluation</title> + + <p>Include the result from evaluating an Erlang expression. Example: + </p> + <code><![CDATA[ +<erleval expr="{A,b,C}={a,b,c}. "/> + ]]></code> + <p>results in:</p> + <erleval expr="{A,b,C}={a,b,c}. "></erleval> + + <p>Note the '.' and space after the expression.</p> + </section> + + <section> + <marker id="listTAG"></marker> + <title><list> - List</title> + + <p>The attribute <c>type = "ordered"|"bulleted"</c> decides if + the list is numbered or bulleted. Default is <c>"bulleted"</c>. + </p> + + <p>Lists contains list items, tag <c><![CDATA[<item>]]></c>, which + can contain plain text, + the <seealso marker="#block_subset">common subset of block + tags</seealso> and <seealso marker="inline_tags">inline + tags</seealso>. Example:</p> + <pre> +<list type="ordered"> + <item>Askosal: + <list> + <item>Nullalisis</item> + <item>Facilisis</item> + </list> + </item> + <item>Ankara</item> +</list> + </pre> + <p>results in:</p> + <list type="ordered"> + <item> + <p>Askosal:</p> + <list type="bulleted"> + <item>Nullalisis</item> + <item>Facilisis</item> + </list> + </item> + <item>Ankara</item> + </list> + </section> + + <section> + <marker id="markerTAG"></marker> + <title><marker> - Marker</title> + + <p>Used as an anchor for hypertext references. The + <c><![CDATA[<marker>]]></c> tag is both a block- and an inline + tag and is described in + the <seealso marker="inline_tags#markerTAG">Inline Tags</seealso> + section.</p> + </section> + + <section> + <marker id="pTAG"></marker> + <title><p> - Paragraph</title> + + <p>Paragraphs contain plain text and + <seealso marker="inline_tags">inline tags</seealso>. Example:</p> + <pre> +<p>I call specific attention to + the authority given by the <em>21st Amendment</em> + to the Constitution to prohibit transportation + or importation of intoxicating liquors into + any State in violation of the laws of such + State.</p> + </pre> + <p>results in:</p> + <p>I call specific attention to + the authority given by the <em>21st Amendment</em> + to the Constitution to prohibit transportation + or importation of intoxicating liquors into + any State in violation of the laws of such + State.</p> + </section> + + <section> + <marker id="noteTAG"></marker> + <title><note> - Note</title> + + <p>Highlights a note. Can contain block tags except + <c><![CDATA[<note>]]></c>, <c><![CDATA[<warning>]]></c>, + <c><![CDATA[<image>]]></c> and <c><![CDATA[<table>]]></c>. + Example:</p> +<pre> +<note> + <p>This function is mainly intended for debugging.</p> +</note> + </pre> + <p>results in:</p> + <note> + <p>This function is mainly intended for debugging.</p> + </note> + </section> + + <section> + <marker id="preTAG"></marker> + <title><pre> - Pre-formatted Text</title> + + <p>Used for documentation of system interaction. Can contain text, + <seealso marker="inline_tags#seealsoTAG">seealso</seealso>, + <seealso marker="inline_tags#urlTAG">url</seealso> and + <c><![CDATA[<input>]]></c> tags.</p> + + <p>The <c><![CDATA[<input>]]></c> tag is used to highlight user + input. Example:</p> + <pre> +<pre> +$ <input>erl</input> +Erlang (BEAM) emulator version 5.5.3 [async-threads:0] [hipe] [kernel-poll:false] + +Eshell V5.5.3 (abort with ^G) +1> <input>pwd().</input> +/home/user +2> <input>halt().</input> +</pre> + </pre> + <p> results in:</p> + <pre> +$ <input>erl</input> +Erlang (BEAM) emulator version 5.5.3 [async-threads:0] [hipe] [kernel-poll:false] + +Eshell V5.5.3 (abort with ^G) +1> <input>pwd().</input> +/home/user +2> <input>halt().</input> + </pre> + + <p>All <seealso marker="character_entities">character + entities</seealso> are expanded.</p> + </section> + + <section> + <marker id="quoteTAG"></marker> + <title><quote> - Quotation</title> + + <p>Highlight quotations from other works, or dialog spoken by + characters in a narrative. Contains one or more + <seealso marker="#pTAG"><p></seealso> tags. Example:</p> + <pre> +<p>Whereas Section 217(a) of the Act of Congress entitled +"An Act ..." approved June 16, 1933, provides as follows:</p> +<quote> + <p>Section 217(a) The President shall proclaim the law.</p> +</quote> + </pre> + <p>results in:</p> + <p>Whereas Section 217(a) of the Act of Congress entitled + "An Act ..." approved June 16, 1933, provides as follows:</p> + <quote> + <p>Section 217(a) The President shall proclaim the law.</p> + </quote> + </section> + + <section> + <marker id="taglistTAG"></marker> + <marker id="tagTAG"></marker> + <title><taglist> - Definition List</title> + + <p>Definition lists contains pairs of tags, + <c><![CDATA[<tag>]]></c>, and list items, + <c><![CDATA[<item>]]></c>.</p> + + <p><c><![CDATA[<tag>]]></c> can contain plain text, + <seealso marker="inline_tags#cTAG"><c></seealso>, + <seealso marker="inline_tags#emTAG"><em></seealso>, + <seealso marker="inline_tags#seealsoTAG"><seealso></seealso> + and <seealso marker="inline_tags#urlTAG"><url></seealso> + tags.</p> + + <p><c><![CDATA[<item>]]></c> can contain plain text, + the <seealso marker="#block_subset">common subset of block + tags</seealso> and <seealso marker="inline_tags">inline + tags</seealso>. Example:</p> + <pre> +<taglist> + <tag><c>eacces</c></tag> + <item>Permission denied.</item> + <tag><c>enoent</c></tag> + <item>No such file or directory.</item> +</taglist> + </pre> + <p>results in:</p> + <taglist> + <tag><c>eacces</c></tag> + <item>Permission denied.</item> + <tag><c>enoent</c></tag> + <item>No such file or directory.</item> + </taglist> + </section> + + <section> + <marker id="warningTAG"></marker> + <title><warning> - Warning</title> + + <p>Highlights a warning. Can contain block tags except + <c><![CDATA[<note>]]></c>, <c><![CDATA[<warning>]]></c>, + <c><![CDATA[<image>]]></c> and <c><![CDATA[<table>]]></c>. + Example:</p> +<pre> +<warning> + <p>This function might be removed in a future version without + prior warning.</p> +</warning> + </pre> + <p>results in:</p> + <warning> + <p>This function might be removed in a future version without + prior warning.</p> + </warning> + </section> + + <section> + <marker id="imageTAG"></marker> + <marker id="icaptionTAG"></marker> + <title><image> - Image</title> + + <p>Graphics is imported using the <c><![CDATA[<image>]]></c> tag. + An image caption <c><![CDATA[<icaption>]]></c>, containing plain + text, must be supplied. Example:</p> + <pre> +<image file="man"> + <icaption>A Silly Man</icaption> +</image> + </pre> + <p>results in:</p> + <image file="man.gif"> + <icaption>A Silly Man</icaption> + </image> + + <p>This assumes that <c>man.gif</c> exists in the current directory. + </p> + </section> + + <section> + <marker id="tableTAG"></marker> + <marker id="rowTAG"></marker> + <marker id="cellTAG"></marker> + <marker id="tcaptionTAG"></marker> + <title><table> - Table</title> + + <p>The table format is similar to how tables are described in HTML + 3.2. A table contains one or more rows, <c><![CDATA[<row>]]></c>, + and a table caption <c><![CDATA[<tcaption>]]></c>, containing + plain text.</p> + + <p>Each row contains one or more cells, <c><![CDATA[<cell>]]></c>. + The attributes <c>align = "left"|"center"|"right"</c> and + <c>valign = "top"|"middle"|"bottom"</c> decides how text is + aligned in the cell horizontally and vertically. Default is + "<c>left</c>" and "<c>middle</c>".</p> + + <p>Each cell contains plain text and + <seealso marker="inline_tags">inline tags</seealso>. Example:</p> + <pre><![CDATA[ + <table> + <row> + <cell align="left" valign="top"><em>Boys</em></cell> + <cell align="center" valign="middle"><em>Girls</em></cell> + </row> + <row> + <cell align="left" valign="middle">Juda</cell> + <cell align="right" valign="bottom">Susy</cell> + </row> + <row> + <cell align="left" valign="middle">Anders</cell> + <cell align="left" valign="middle">Victoria</cell> + </row> + <tcaption>A table caption</tcaption> + </table> + ]]></pre> + <p>results in:</p> + <table> + <row> + <cell align="left" valign="top"><em>Boys</em></cell> + <cell align="center" valign="middle"><em>Girls</em></cell> + </row> + <row> + <cell align="left" valign="middle">Juda</cell> + <cell align="right" valign="bottom">Susy</cell> + </row> + <row> + <cell align="left" valign="middle">Anders</cell> + <cell align="left" valign="middle">Victoria</cell> + </row> + <tcaption>A table caption</tcaption> + </table> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/book.xml b/lib/docbuilder/doc/src/book.xml new file mode 100644 index 0000000000..a13d56dd8a --- /dev/null +++ b/lib/docbuilder/doc/src/book.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE book SYSTEM "book.dtd"> + +<book xmlns:xi="http://www.w3.org/2001/XInclude"> + <header titlestyle="normal"> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>DocBuilder</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <insidecover> + </insidecover> + <pagetext>Docbuilder</pagetext> + <preamble> + <contents level="2"></contents> + </preamble> + <parts lift="no"> + <xi:include href="part.xml"/> + </parts> + <applications> + <xi:include href="ref_man.xml"/> + </applications> + <releasenotes> + <xi:include href="notes.xml"/> + </releasenotes> + <listoffigures></listoffigures> + <listoftables></listoftables> + <listofterms></listofterms> + <index></index> +</book> + diff --git a/lib/docbuilder/doc/src/character_entities.xml b/lib/docbuilder/doc/src/character_entities.xml new file mode 100644 index 0000000000..e78cf0ebec --- /dev/null +++ b/lib/docbuilder/doc/src/character_entities.xml @@ -0,0 +1,546 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Character Entities</title> + <prepared/> + <docno/> + <date/> + <rev/> + <file>character_entities.xml</file> + </header> + + <section> + <title>Added Latin 1</title> + + <p>The DocBuilder DTD suite uses the same character entities as + defined in HTML 3.2 + (<c>ISO 8879-1986//ENTITIES Added Latin 1//EN//HTML</c>). That is: + for an & (ampersand), use the entity: <c>&amp;</c>, for + ö use the entity <c>&ouml;</c> and so on.</p> + + <table> + <row> + <cell align="left" valign="middle"><em>Character</em></cell> + <cell align="left" valign="middle"><em>Entity</em></cell> + <cell align="left" valign="middle"><em>Description</em></cell> + </row> + <row> + <cell align="left" valign="middle">&</cell> + <cell align="left" valign="middle">&amp;</cell> + <cell align="left" valign="middle">ampersand</cell> + </row> + <row> + <cell align="left" valign="middle">></cell> + <cell align="left" valign="middle">&gt;</cell> + <cell align="left" valign="middle">greater than</cell> + </row> + <row> + <cell align="left" valign="middle"><</cell> + <cell align="left" valign="middle">&lt;</cell> + <cell align="left" valign="middle">less than</cell> + </row> + <row> + <cell align="left" valign="middle"> </cell> + <cell align="left" valign="middle">&nbsp;</cell> + <cell align="left" valign="middle">no-break space</cell> + </row> + <row> + <cell align="left" valign="middle">¡</cell> + <cell align="left" valign="middle">&iexcl;</cell> + <cell align="left" valign="middle">inverted exclamation mark</cell> + </row> + <row> + <cell align="left" valign="middle">¢</cell> + <cell align="left" valign="middle">&cent;</cell> + <cell align="left" valign="middle">cent sign</cell> + </row> + <row> + <cell align="left" valign="middle">£</cell> + <cell align="left" valign="middle">&pound;</cell> + <cell align="left" valign="middle">pound sterling sign</cell> + </row> + <row> + <cell align="left" valign="middle">¤</cell> + <cell align="left" valign="middle">&curren;</cell> + <cell align="left" valign="middle">general currency sign</cell> + </row> + <row> + <cell align="left" valign="middle">¥</cell> + <cell align="left" valign="middle">&yen;</cell> + <cell align="left" valign="middle">yen sign</cell> + </row> + <row> + <cell align="left" valign="middle">¦</cell> + <cell align="left" valign="middle">&brvbar;</cell> + <cell align="left" valign="middle">broken (vertical) bar</cell> + </row> + <row> + <cell align="left" valign="middle">§</cell> + <cell align="left" valign="middle">&sect;</cell> + <cell align="left" valign="middle">section sign</cell> + </row> + <row> + <cell align="left" valign="middle">¨</cell> + <cell align="left" valign="middle">&uml;</cell> + <cell align="left" valign="middle">umlaut (dieresis)</cell> + </row> + <row> + <cell align="left" valign="middle">©</cell> + <cell align="left" valign="middle">&copy;</cell> + <cell align="left" valign="middle">copyright sign</cell> + </row> + <row> + <cell align="left" valign="middle">ª</cell> + <cell align="left" valign="middle">&ordf;</cell> + <cell align="left" valign="middle">ordinal indicator, feminine</cell> + </row> + <row> + <cell align="left" valign="middle">«</cell> + <cell align="left" valign="middle">&laquo;</cell> + <cell align="left" valign="middle">angle quotation mark, left</cell> + </row> + <row> + <cell align="left" valign="middle">¬</cell> + <cell align="left" valign="middle">&not;</cell> + <cell align="left" valign="middle">not sign</cell> + </row> + <row> + <cell align="left" valign="middle">­</cell> + <cell align="left" valign="middle">&shy;</cell> + <cell align="left" valign="middle">soft hyphen</cell> + </row> + <row> + <cell align="left" valign="middle">®</cell> + <cell align="left" valign="middle">&reg;</cell> + <cell align="left" valign="middle">registered sign</cell> + </row> + <row> + <cell align="left" valign="middle">¯</cell> + <cell align="left" valign="middle">&macr;</cell> + <cell align="left" valign="middle">macron</cell> + </row> + <row> + <cell align="left" valign="middle">°</cell> + <cell align="left" valign="middle">&deg;</cell> + <cell align="left" valign="middle">degree sign</cell> + </row> + <row> + <cell align="left" valign="middle">±</cell> + <cell align="left" valign="middle">&plusmn;</cell> + <cell align="left" valign="middle">plus-or-minus</cell> + </row> + <row> + <cell align="left" valign="middle">²</cell> + <cell align="left" valign="middle">&sup2;</cell> + <cell align="left" valign="middle">superscript two</cell> + </row> + <row> + <cell align="left" valign="middle">³</cell> + <cell align="left" valign="middle">&sup3;</cell> + <cell align="left" valign="middle">superscript three</cell> + </row> + <row> + <cell align="left" valign="middle">´</cell> + <cell align="left" valign="middle">&acute;</cell> + <cell align="left" valign="middle">acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">µ</cell> + <cell align="left" valign="middle">&micro;</cell> + <cell align="left" valign="middle">micro sign</cell> + </row> + <row> + <cell align="left" valign="middle">¶</cell> + <cell align="left" valign="middle">&para;</cell> + <cell align="left" valign="middle">pilcrow (paragraph sign)</cell> + </row> + <row> + <cell align="left" valign="middle">·</cell> + <cell align="left" valign="middle">&middot;</cell> + <cell align="left" valign="middle">middle dot</cell> + </row> + <row> + <cell align="left" valign="middle">¸</cell> + <cell align="left" valign="middle">&cedil;</cell> + <cell align="left" valign="middle">cedilla</cell> + </row> + <row> + <cell align="left" valign="middle">¹</cell> + <cell align="left" valign="middle">&sup1;</cell> + <cell align="left" valign="middle">superscript one</cell> + </row> + <row> + <cell align="left" valign="middle">º</cell> + <cell align="left" valign="middle">&ordm;</cell> + <cell align="left" valign="middle">ordinal indicator, masculine</cell> + </row> + <row> + <cell align="left" valign="middle">»</cell> + <cell align="left" valign="middle">&raquo;</cell> + <cell align="left" valign="middle">angle quotation mark, right</cell> + </row> + <row> + <cell align="left" valign="middle">¼</cell> + <cell align="left" valign="middle">&frac14;</cell> + <cell align="left" valign="middle">fraction one-quarter</cell> + </row> + <row> + <cell align="left" valign="middle">½</cell> + <cell align="left" valign="middle">&frac12;</cell> + <cell align="left" valign="middle">fraction one-half</cell> + </row> + <row> + <cell align="left" valign="middle">¾</cell> + <cell align="left" valign="middle">&frac34;</cell> + <cell align="left" valign="middle">fraction three-quarters</cell> + </row> + <row> + <cell align="left" valign="middle">¿</cell> + <cell align="left" valign="middle">&iquest;</cell> + <cell align="left" valign="middle">inverted question mark</cell> + </row> + <row> + <cell align="left" valign="middle">À</cell> + <cell align="left" valign="middle">&Agrave;</cell> + <cell align="left" valign="middle">capital A, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">Á</cell> + <cell align="left" valign="middle">&Aacute;</cell> + <cell align="left" valign="middle">capital A, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">Â</cell> + <cell align="left" valign="middle">&Acirc;</cell> + <cell align="left" valign="middle">capital A, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ã</cell> + <cell align="left" valign="middle">&Atilde;</cell> + <cell align="left" valign="middle">capital A, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">Ä</cell> + <cell align="left" valign="middle">&Auml;</cell> + <cell align="left" valign="middle">capital A, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">Å</cell> + <cell align="left" valign="middle">&Aring;</cell> + <cell align="left" valign="middle">capital A, ring</cell> + </row> + <row> + <cell align="left" valign="middle">Æ</cell> + <cell align="left" valign="middle">&AElig;</cell> + <cell align="left" valign="middle">capital AE diphthong (ligature)</cell> + </row> + <row> + <cell align="left" valign="middle">Ç</cell> + <cell align="left" valign="middle">&Ccedil;</cell> + <cell align="left" valign="middle">capital C, cedilla</cell> + </row> + <row> + <cell align="left" valign="middle">È</cell> + <cell align="left" valign="middle">&Egrave;</cell> + <cell align="left" valign="middle">capital E, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">É</cell> + <cell align="left" valign="middle">&Eacute;</cell> + <cell align="left" valign="middle">capital E, acute accen</cell> + </row> + <row> + <cell align="left" valign="middle">Ê</cell> + <cell align="left" valign="middle">&Ecirc;</cell> + <cell align="left" valign="middle">capital E, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ë</cell> + <cell align="left" valign="middle">&Euml;</cell> + <cell align="left" valign="middle">capital E, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">Ì</cell> + <cell align="left" valign="middle">&Igrave;</cell> + <cell align="left" valign="middle">capital I, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">Í</cell> + <cell align="left" valign="middle">&Iacute;</cell> + <cell align="left" valign="middle">capital I, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">Î</cell> + <cell align="left" valign="middle">&Icirc;</cell> + <cell align="left" valign="middle">capital I, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ï</cell> + <cell align="left" valign="middle">&Iuml;</cell> + <cell align="left" valign="middle">capital I, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">Ð</cell> + <cell align="left" valign="middle">&ETH;</cell> + <cell align="left" valign="middle">capital Eth, Icelandic</cell> + </row> + <row> + <cell align="left" valign="middle">Ñ</cell> + <cell align="left" valign="middle">&Ntilde;</cell> + <cell align="left" valign="middle">capital N, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">Ò</cell> + <cell align="left" valign="middle">&Ograve;</cell> + <cell align="left" valign="middle">capital O, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ó</cell> + <cell align="left" valign="middle">&Oacute;</cell> + <cell align="left" valign="middle">capital O, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ô</cell> + <cell align="left" valign="middle">&Ocirc;</cell> + <cell align="left" valign="middle">capital O, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">Õ</cell> + <cell align="left" valign="middle">&Otilde;</cell> + <cell align="left" valign="middle">capital O, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">Ö</cell> + <cell align="left" valign="middle">&Ouml;</cell> + <cell align="left" valign="middle">capital O, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">×</cell> + <cell align="left" valign="middle">&times;</cell> + <cell align="left" valign="middle">multiply sign</cell> + </row> + <row> + <cell align="left" valign="middle">Ø</cell> + <cell align="left" valign="middle">&Oslash;</cell> + <cell align="left" valign="middle">capital O, slash</cell> + </row> + <row> + <cell align="left" valign="middle">Ù</cell> + <cell align="left" valign="middle">&Ugrave;</cell> + <cell align="left" valign="middle">capital U, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ú</cell> + <cell align="left" valign="middle">&Uacute;</cell> + <cell align="left" valign="middle">capital U, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">Û</cell> + <cell align="left" valign="middle">&Ucirc;</cell> + <cell align="left" valign="middle">capital U, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">Ü</cell> + <cell align="left" valign="middle">&Uuml;</cell> + <cell align="left" valign="middle">capital U, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">Ý</cell> + <cell align="left" valign="middle">&Yacute;</cell> + <cell align="left" valign="middle">capital Y, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">Þ</cell> + <cell align="left" valign="middle">&THORN;</cell> + <cell align="left" valign="middle">capital THORN, Icelandic</cell> + </row> + <row> + <cell align="left" valign="middle">ß</cell> + <cell align="left" valign="middle">&szlig;</cell> + <cell align="left" valign="middle">small sharp s, German (sz ligature)</cell> + </row> + <row> + <cell align="left" valign="middle">à</cell> + <cell align="left" valign="middle">&agrave;</cell> + <cell align="left" valign="middle">small a, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">á</cell> + <cell align="left" valign="middle">&aacute;</cell> + <cell align="left" valign="middle">small a, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">â</cell> + <cell align="left" valign="middle">&acirc;</cell> + <cell align="left" valign="middle">small a, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">ã</cell> + <cell align="left" valign="middle">&atilde;</cell> + <cell align="left" valign="middle">small a, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">ä</cell> + <cell align="left" valign="middle">&auml;</cell> + <cell align="left" valign="middle">small a, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">å</cell> + <cell align="left" valign="middle">&aring;</cell> + <cell align="left" valign="middle">small a, ring</cell> + </row> + <row> + <cell align="left" valign="middle">æ</cell> + <cell align="left" valign="middle">&aelig;</cell> + <cell align="left" valign="middle">small ae diphthong (ligature)</cell> + </row> + <row> + <cell align="left" valign="middle">ç</cell> + <cell align="left" valign="middle">&ccedil;</cell> + <cell align="left" valign="middle">small c, cedilla</cell> + </row> + <row> + <cell align="left" valign="middle">è</cell> + <cell align="left" valign="middle">&egrave;</cell> + <cell align="left" valign="middle">small e, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">é</cell> + <cell align="left" valign="middle">&eacute;</cell> + <cell align="left" valign="middle">small e, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">ê</cell> + <cell align="left" valign="middle">&ecirc;</cell> + <cell align="left" valign="middle">small e, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">ë</cell> + <cell align="left" valign="middle">&euml;</cell> + <cell align="left" valign="middle">small e, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">ì</cell> + <cell align="left" valign="middle">&igrave;</cell> + <cell align="left" valign="middle">small i, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">í</cell> + <cell align="left" valign="middle">&iacute;</cell> + <cell align="left" valign="middle">small i, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">î</cell> + <cell align="left" valign="middle">&icirc;</cell> + <cell align="left" valign="middle">small i, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">ï</cell> + <cell align="left" valign="middle">&iuml;</cell> + <cell align="left" valign="middle">small i, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">ð</cell> + <cell align="left" valign="middle">&eth;</cell> + <cell align="left" valign="middle">small eth, Icelandic</cell> + </row> + <row> + <cell align="left" valign="middle">ñ</cell> + <cell align="left" valign="middle">&ntilde;</cell> + <cell align="left" valign="middle">small n, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">ò</cell> + <cell align="left" valign="middle">&ograve;</cell> + <cell align="left" valign="middle">small o, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">ó</cell> + <cell align="left" valign="middle">&oacute;</cell> + <cell align="left" valign="middle">small o, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">ô</cell> + <cell align="left" valign="middle">&ocirc;</cell> + <cell align="left" valign="middle">small o, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">õ</cell> + <cell align="left" valign="middle">&otilde;</cell> + <cell align="left" valign="middle">small o, tilde</cell> + </row> + <row> + <cell align="left" valign="middle">ö</cell> + <cell align="left" valign="middle">&ouml;</cell> + <cell align="left" valign="middle">small o, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">÷</cell> + <cell align="left" valign="middle">&divide;</cell> + <cell align="left" valign="middle">divide sign</cell> + </row> + <row> + <cell align="left" valign="middle">ø</cell> + <cell align="left" valign="middle">&oslash;</cell> + <cell align="left" valign="middle">small o, slash</cell> + </row> + <row> + <cell align="left" valign="middle">ù</cell> + <cell align="left" valign="middle">&ugrave;</cell> + <cell align="left" valign="middle">small u, grave accent</cell> + </row> + <row> + <cell align="left" valign="middle">ú</cell> + <cell align="left" valign="middle">&uacute;</cell> + <cell align="left" valign="middle">small u, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">û</cell> + <cell align="left" valign="middle">&ucirc;</cell> + <cell align="left" valign="middle">small u, circumflex accent</cell> + </row> + <row> + <cell align="left" valign="middle">ü</cell> + <cell align="left" valign="middle">&uuml;</cell> + <cell align="left" valign="middle">small u, dieresis or umlaut mark</cell> + </row> + <row> + <cell align="left" valign="middle">ý</cell> + <cell align="left" valign="middle">&yacute;</cell> + <cell align="left" valign="middle">small y, acute accent</cell> + </row> + <row> + <cell align="left" valign="middle">þ</cell> + <cell align="left" valign="middle">&thorn;</cell> + <cell align="left" valign="middle">small thorn, Icelandic</cell> + </row> + <row> + <cell align="left" valign="middle">ÿ</cell> + <cell align="left" valign="middle">&yuml;</cell> + <cell align="left" valign="middle">small y, dieresis or umlaut mark</cell> + </row> + <tcaption>Accented Latin-1 alphabetic characters.</tcaption> + </table> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/docb_gen.xml b/lib/docbuilder/doc/src/docb_gen.xml new file mode 100644 index 0000000000..49eb79ae24 --- /dev/null +++ b/lib/docbuilder/doc/src/docb_gen.xml @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="iso-8859-1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>1999</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + <title>docb_gen</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <module>docb_gen</module> + <modulesummary>Generate XML from EDoc comments in Erlang source code. + </modulesummary> + + <description> + <p><c>docb_gen</c> contains functions for generating XML + documentation source code according to the <c>erlref</c> or + <c>chapter</c> DTD from + <seealso marker="edoc:chapter">EDoc</seealso> comments in Erlang + source code or an <c>overview.edoc</c> file, using EDoc.</p> + </description> + + <funcs> + <func> + <name>module(File) -> ok | {error, Reason}</name> + <name>module(File, Options) -> ok | {error, Reason}</name> + <fsummary>Generate XML from EDoc comments in Erlang source code. + </fsummary> + <type> + <v>File = string()</v> + <v>Options = [Opt]</v> + <v>Opt = {def,Defs} | {includes,Dirs} | {preprocess,Bool} + | {sort_functions,Bool}</v> + <v>Defs = [{atom(),string()}]</v> + <v>Dirs = [string()]</v> + <v>Bool = bool()</v> + <v>Reason = badfile | {badopt,term()} | term()</v> + </type> + <desc> + <p>Generates XML documentation source code according to + the <c>erlref</c> DTD from EDoc comments <c>File</c>, using + the EDoc application.</p> + + <p><c>File</c> is an Erlang source file, given with or without + the <c>.erl</c> extension as <c>Name.erl</c> or <c>Name</c>. + The resulting XML file is created in the current working + directory and named <c>Name.xml</c>.</p> + + <p><c>Options</c> is a list of options, see below.</p> + + <p>Returns <c>ok</c> if successful, and an error tuple + otherwise.</p> + </desc> + </func> + + <func> + <name>users_guide(File) -> ok | {error, Reason}</name> + <name>users_guide(File, Options) -> ok | {error, Reason}</name> + <fsummary>Generate XML from EDoc comments in Erlang source code + </fsummary> + <type> + <v>File -- see module/1,2</v> + <v>Options -- see module/1,2</v> + <v>Reason -- see module/1,2</v> + </type> + <desc> + <p>Like <c>module/1,2</c> but generates XML source code + according to the <c>chapter</c> DTD from an + <c>overview.edoc</c> or similar file.</p> + + <p>The resulting file is named <c>chapter.xml</c>.</p> + </desc> + </func> + </funcs> + + <section> + <title>Options</title> + <taglist> + <tag><c>{def, [{Name,Text}]}</c></tag> + <item>Specifies EDoc macro definitions. See + <seealso marker="edoc:edoc">edoc:get_doc/2</seealso>.</item> + + <tag><c>{includes, [Dir]}</c></tag> + <item>Specifies directories where EDoc should search for include + files. See + <seealso marker="edoc:edoc">edoc:read_source/2</seealso>.</item> + + <tag><c>{preprocess, true|false}</c></tag> + <item>Specifies if EDoc should read the source file via the Erlang + preprocessor. Default is <c>false</c>. See + <seealso marker="edoc:edoc">edoc:read_source/2</seealso>.</item> + + <tag><c>{sort_functions, true|false}</c></tag> + <item>Specifies if the functions in the resulting XML file should + be sorted alphabetically. Default is <c>true</c>.</item> + </taglist> + </section> + + <section> + <title>Limitations</title> + <p>The mapping from the EDoc XHTML output to valid Erlang/OTP XML + is not complete. An attempt has been made to cover the most + commonly used XHTML constructs, but there will still be cases + where XML generation fails or where the resulting XML is + inadequate. This is especially true for <c>users_guide/1,2</c>. + </p> + + <p>Known limitations for some XHTML tags:</p> + <taglist> + <tag><c><![CDATA[<a>]]></c></tag> + <item> + <p>All attributes except the first <c>href</c> or <c>name</c> + attribute are ignored.</p> + <p>A <c>href</c> attribute means the <c><![CDATA[<a>]]></c> tag + will be transformed to a <c><![CDATA[<seealso>]]></c> or + <c><![CDATA[<url>]]></c> tag and an attempt is made to + resolve the reference if necessary.</p> + + <p>A <c>name</c> attribute means the <c><![CDATA[<a>]]></c> tag + will be transformed to a <c><![CDATA[<marker>]]></c> tag.</p> + </item> + + <tag><c><![CDATA[<b>, <em>, <pre>]]></c></tag> + <item>Cannot contain other tags in Erlang/OTP XML, content is + converted to plain text. + </item> + + <tag><c><![CDATA[<center>]]></c></tag> + <item>No corresponding Erlang/OTP XML tag, converted to plain + text. + </item> + + <tag><c><![CDATA[<font>]]></c></tag> + <item>No corresponding Erlang/OTP XML tag, converted to plain + text. + </item> + + <tag><c><![CDATA[<h1>, <h2>, ...]]></c></tag> + <item>There is no tag corresponding to a header in Erlang/OTP XML, + so these are converted to plain text instead, with + the exception of <c><![CDATA[<h3>]]></c> and + <c><![CDATA[<h4>]]></c> tags within <c>overview.edoc</c>, see + part about "<c>chapter</c> DTD" below. + </item> + + <tag><c><![CDATA[<sup>]]></c></tag> + <item>There is no tag corresponding to superscript in Erlang/OTP + XML, so this is converted to plain text within brackets "(..)". + </item> + + <tag>References</tag> + <item>The markers automatically inserted by EDoc at each heading + and function will override the markers automatically inserted + by DocBuilder, with the unfortunate result that the links in + the left-hand frame of the User's Guide will not work, and + also that cross referencing a function in a module the usual + Erlang/OTP way + "<c><![CDATA[<seealso marker="edoc:edoc#run/3...>]]></c>" does + not work. (But + "<c><![CDATA[<seealso marker="edoc:edoc#run-3...>]]></c>" does.) + </item> + </taglist> + + <p><em>erlref DTD</em></p> + <taglist> + <tag>Tables</tag> + <item>Tables are not allowed. The contents of a table is + converted to text instead, each row corresponding to one line + of text. + </item> + </taglist> + + <p><em>chapter DTD</em></p> + <taglist> + <tag>Sections</tag> + <item>Only two levels of sections. <c><![CDATA[<h3>]]></c> + (equivalent to EDoc headings "<c>== Heading ==</c>") is + interpreted as start of top-level section, or if there is no + <c><![CDATA[<h3>]]></c> tag, the entire document is made into + one top-level section. <c><![CDATA[<h4>]]></c> (equivalent to + EDoc sub-headings ("<c><![CDATA[=== Sub-heading ===]]></c>") is + interpreted as start of second-level section. + </item> + + <tag>Tables</tag> + <item>Tables without borders are converted to text in the same + manner as for the <c>erlref</c> DTD. + </item> + </taglist> + </section> + +</erlref> + diff --git a/lib/docbuilder/doc/src/docb_transform.xml b/lib/docbuilder/doc/src/docb_transform.xml new file mode 100644 index 0000000000..b8975e2698 --- /dev/null +++ b/lib/docbuilder/doc/src/docb_transform.xml @@ -0,0 +1,224 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2001</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>docb_transform</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <module>docb_transform</module> + <modulesummary>Transform XML to HTML</modulesummary> + <description> + <p><c>docb_transform</c> contains functions for transforming XML + documentation source code to HTML.</p> + </description> + + <funcs> + <func> + <name>file(File) -> ok | {error, Reason}</name> + <name>file(File, Options) -> ok | {error, Reason}</name> + <fsummary>Transform XML to HTML</fsummary> + <type> + <v>File = string()</v> + <v>Options = [Opt]</v> + <v>Opt -- see below</v> + </type> + <desc> + <p>Transforms XML documentation source code to HTML.</p> + + <p><c>File</c> is a documentation source file, given with or + without the <c>.xml</c> extension as <c>Name.xml</c> or + <c>Name</c>.</p> + + <p>If <c>File</c> contains XML code according to a basic DTD + (<c>chapter</c>, <c>erlref</c>, ...), the resulting HTML + file is named <c>Name.html</c>.</p> + + <p>If <c>File</c> contains XML code according to a compound DTD + (<c>application</c> or <c>part</c>), several files are + created:</p> + <list> + <item>A cover page for the application with two frames, + <c>Name_frame.html</c>.</item> + <item>The contents of the left frame and a front page, + <c>Name.html</c> and <c>Name_first.html</c>.</item> + <item>A bibliography and a glossary, <c>Name_cite.html</c> + and <c>Name_term.html</c>.</item> + <item>In the case of an <c>application</c> DTD an index + is created, <c>Name.kwc</c> and <c>Name_index.html</c>. + </item> + <item>One HTML file for each file included from <c>File</c>. + </item> + <item>Also, if there exists a <c>fascicules.xml</c> file where + the value of the <c>entry</c> attribute for <c>File</c> is + <c>"yes"</c>, the cover page is copied to <c>index.html</c>. + </item> + </list> + </desc> + </func> + </funcs> + + <section> + <title>Options</title> + <taglist> + <tag><c>{html_mod, Module}, Module=atom()</c></tag> + <item> + <p>A callback module can be used for specifying HTML snippets + that should be included in the generated HTML files, see + below.</p> + </item> + + <tag><c>{outdir, Dir}, Dir=string()</c></tag> + <item> + <p>Destination for generated files. Default is current working + directory.</p> + </item> + + <tag><c>{number, Number}, Number=int()</c></tag> + <item> + <p>First chapter number when transforming a <c>chapter</c> + file. Default is 1.</p> + </item> + + <tag><c>{ptype, unix|windows}</c></tag> + <item> + <p>For <c>path</c> elements, the specified file path should be + presented.</p> + </item> + + <tag><c>silent</c></tag> + <item> + <p>Silent - no warnings, only error information is printed.</p> + </item> + + <tag><c>{top, Index}, Index=string()</c></tag> + <item> + <p>Specifies the value of "Top" in the left frame of a front + page, which normally should be some kind of top index file + for the documentation.</p> + </item> + + <tag><c>{vsn, Vsn}, Vsn=string()</c></tag> + <item> + <p>Application version number. Overrides a version number + defined in the XML document. Visible in the left frame and + on the front page.</p> + </item> + + <tag><c>{term_defs, File}, File=string()</c></tag> + <item> + <p>Use the global glossary definitions in <c>File</c>, which + should contain a list of tuples <c>{Id, Name, Definition, + Owner}</c>. See the section + <seealso marker="inline_tags#termTAG"><term>, + <termdef> - Glossary</seealso> in the User's Guide. + </p> + </item> + + <tag><c>{cite_defs, File}, File=string()</c></tag> + <item> + <p>Use the global bibliography definitions in <c>File</c>, which + should contain a list of tuples <c>{Id, Title, Info, + Owner}</c>. See the section + <seealso marker="inline_tags#citeTAG"><cite>, + <citedef> - Bibliography</seealso> in the User's + Guide.</p> + </item> + </taglist> + </section> + + <section> + <title>Callback Module</title> + + <p>A <c>html_mod</c> callback module can include the functions + specified below. Note that there is no check that the resulting + HTML code is valid. All functions are optional.</p> + </section> + + <funcs> + <func> + <name>Module:head() -> string()</name> + <fsummary>Snippet to be included in head of a document.</fsummary> + <desc> + <p>Defines a HTML snippet to be included in the head of + a document, after the <c><HEAD></c> start tag and + <c><TITLE></c> tag:</p> + <pre> +<HTML> +<HEAD> + <TITLE>...</TITLE> + - snippet is included here - + ... +</HEAD> +... +</HTML> + </pre> + </desc> + </func> + + <func> + <name>Module:top() -> string()</name> + <fsummary>Snippet to be included at the top of a document. + </fsummary> + <desc> + <p>Defines a HTML snippet to be included at the top of a + document, after the <c><BODY></c> start tag.</p> + </desc> + </func> + + <func> + <name>Module:bottom() -> string()</name> + <fsummary>Snippet to be included at the bottom of a document. + </fsummary> + <desc> + <p>Defines a HTML snippet to be included at the bottom of a + document, before the <c></BODY></c> end tag.</p> + </desc> + </func> + + <func> + <name>Module:seealso(SeeAlso) -> Href</name> + <fsummary></fsummary> + <type> + <v>SeeAlso = Href = string()</v> + </type> + <desc> + <p>When referring to another part of the document, or another + document, the XML tag <c><seealso></c> is used: + <c><![CDATA[<seealso marker="File#Marker">...text...</seealso>]]></c>. + By default, this is translated to + <c><![CDATA[<A HREF="File.html#Marker>...text...</A>]]></c>.</p> + + <p>This function makes it possible to specify an alternative + translation <c>Href</c> of the <c>marker</c> attribute value + <c>SeeAlso</c>. For example, in OTP this is used to resolve + cross references between applications.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/docbuilder/doc/src/docb_xml_check.xml b/lib/docbuilder/doc/src/docb_xml_check.xml new file mode 100644 index 0000000000..7ec456c014 --- /dev/null +++ b/lib/docbuilder/doc/src/docb_xml_check.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2007</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>docb_xml_check</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <module>docb_xml_check</module> + <modulesummary>Validate XML documentation source code</modulesummary> + <description> + <p><c>docb_xml_check</c> contains functions for validating XML + documentation source code.</p> + </description> + + <funcs> + <func> + <name>validate(File) -> ok | error | {error, badfile}</name> + <fsummary>Validate XML source code.</fsummary> + <type> + <v>File = string()</v> + </type> + <desc> + <p>Validates the XML documentation source code in <c>File</c>. + The <c>.xml</c> extension can be omitted.</p> + + <p>Returns <c>ok</c> if successful, otherwise error information + is printed and the function returns <c>error</c>. + If <c>File</c> does not exist, <c>{error, badfile}</c> is + returned.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/docbuilder/doc/src/docbuilder_app.xml b/lib/docbuilder/doc/src/docbuilder_app.xml new file mode 100644 index 0000000000..a1df496258 --- /dev/null +++ b/lib/docbuilder/doc/src/docbuilder_app.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE appref SYSTEM "appref.dtd"> + +<appref> + <header> + <copyright> + <year>2007</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>docbuilder</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <app>docbuilder</app> + <appsummary>The DocBuilder Application</appsummary> + <description> + <p>DocBuilder provides functionality for generating HTML + documentation for Erlang modules and Erlang/OTP applications + from XML source code and/or EDoc comments in Erlang source code. + </p> + </description> + + <section> + <title>Limitations</title> + <p>DocBuilder is primarily intended for generating documentation + for Erlang/OTP itself. That is, no attempt has been made to create + a tool suitable for generating documentation in general.</p> + </section> + + <section> + <title>See Also</title> + <p>DocBuilder User's Guide, + <seealso marker="docb_gen">docb_gen(3)</seealso>, + <seealso marker="docb_transform">docb_transform(3)</seealso> + <seealso marker="docb_xml_check"></seealso></p> + </section> + +</appref> + diff --git a/lib/docbuilder/doc/src/fasc_dtds.xml b/lib/docbuilder/doc/src/fasc_dtds.xml new file mode 100644 index 0000000000..dec8189b55 --- /dev/null +++ b/lib/docbuilder/doc/src/fasc_dtds.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2007</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Fascicules DTDs</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>fasc_dtds.xml</file> + </header> + + <section> + <title>The fascicules DTD</title> + + <p>The <c>fascicules</c> DTD is a special kind of DTD which can be + used to specify the different parts of the documentation, and + which one of those should be shown as default.</p> + + <p>Example:</p> + + <pre><![CDATA[ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> +<fascicules> + <fascicule file="part" href="part_frame.html" entry="no"> + User's Guide + </fascicule> + <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> + Reference Manual + </fascicule> + <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> + Release Notes + </fascicule> +</fascicules> + ]]></pre> + + <p>In the example, it is specified that the documentation for this + application consists of three parts: User's Guide, where + the "cover page" (with the two frames) is located in + <c>part_frame.html</c>, Reference Manual with the cover page + <c>ref_man_frame.html</c> and Release Notes with the cover page + <c>part_notes_frame.html</c>.</p> + + <p>As a result, at the top of the left frame in the generated HTML + documentation, there will be corresponding links to User's Guide, + Reference Manual and Release Notes.</p> + + <p>The attribute <c>entry="yes"</c> specifies that it is + the Reference Manual which should be shown as default. This means + that when generating the HTML files, <c>application_frame.html</c> + will be copied to <c>index.html</c>.</p> + + <note> + <p>DocBuilder assumes that the XML file written according to + the <c>fascicules</c> DTD is called <c>fascicules.xml</c>.</p> + </note> + + <p>This file is optional. If it does not exist, there are no links + to other parts of the documentation (as they are not known) in + the left frame, and no <c>index.html</c> is created.</p> + </section> + + <section> + <marker id="fasciculesTAG"></marker> + <title><fascicules></title> + + <p>Top level tag for the <c>fascicules</c> DTD.</p> + + <p>Contains one or more + <seealso marker="#fasciculeTAG"><fascicule></seealso>.</p> + </section> + + <section> + <marker id="fasciculeTAG"></marker> + <title><fascicule></title> + + <p>Specifies properties for one "part" of the documentation for an + application.</p> + + <p>Contains plain text, the name of this part.</p> + + <p>The <c>file</c> attribute should specify the file name for + the corresponding <c>part</c> or <c>application</c>, without + the <c>.xml</c> extension.</p> + + <p>The <c>href</c> attribute should specify the file name for + the corresponding HTML cover page file, without the <c>.html</c> + extension.</p> + + <p>The optional <c>entry="yes"|"no"</c> attribute specifies if + the HTML cover page should be copied to <c>index.html</c> or + not. Default is <c>"no"</c>.</p> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/fascicules.xml b/lib/docbuilder/doc/src/fascicules.xml new file mode 100644 index 0000000000..1b9d6bc94d --- /dev/null +++ b/lib/docbuilder/doc/src/fascicules.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> + +<fascicules> + <fascicule file="part" href="part_frame.html" entry="no"> + User's Guide + </fascicule> + <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> + Reference Manual + </fascicule> + <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> + Release Notes + </fascicule> +</fascicules> + diff --git a/lib/docbuilder/doc/src/gazonk b/lib/docbuilder/doc/src/gazonk new file mode 100644 index 0000000000..1cf0b8f7bc --- /dev/null +++ b/lib/docbuilder/doc/src/gazonk @@ -0,0 +1,17 @@ +This example code is used in block_tags.xml. + +%% Erlang example +-module(gazonk). + +start() -> + {error,"Pid required!"}. + +start(Pid) -> + spawn(smalltalk,main,[]). +%% Erlang example + +// A little C example +int main() { + for(;;); +} +// A little C example diff --git a/lib/docbuilder/doc/src/header_tags.xml b/lib/docbuilder/doc/src/header_tags.xml new file mode 100644 index 0000000000..b1456d679a --- /dev/null +++ b/lib/docbuilder/doc/src/header_tags.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Header Tags</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>header_tags.xml</file> + </header> + + <p>Each document begins with a header part, which looks the same for + all DTDs. Here the title of the document is specified, as well as + administrative data like who is responsible for the document, which + version is it, when was it last changed and such.</p> + + <p>An full header looks like:</p> + <pre> +<header> + <copyright>...</copyright> + <legalnotice>...</legalnotice> + <title>...</title> + <prepared>...</prepared> + <responsible>...</responsible> + <docno>...</docno> + <approved>...</approved> + <checked>...</checked> + <date>...</date> + <rev>...</rev> + <file>...</file> +</header> + </pre> + + <section> + <marker id="headerTAG"></marker> + <title><header></title> + + <p>Top level tag for the header part.</p> + </section> + + <section> + <marker id="copyrightTAG"></marker> + <title><copyright></title> + + <p>The <c>copyright</c> element holds information about date(s) and holder(s) of + a document copyright. The <c>copyright</c> element is optional. + The <c>copyright</c> element has an inner structure containing one or + more + <c>year</c> elements followed by zero of more <c>holder</c> elements.<br/> + See example below: + </p> + <code><![CDATA[ + <copyright> + <year>1997</year> + <year>2007</year> + <holder>Ericsson AB</holder> + </copyright> + ]]></code> + </section> + + <section> + <marker id="legalnoticeTAG"></marker> + <title><legalnotice></title> + + <p>The <c>legalnotice</c> element is used to express copyright, trademark, + license, and other legal formalities of a document. The element contains + only PCDATA in the same manner as <c>code</c> and <c>pre</c>. + </p> + </section> + + <section> + <marker id="titleTAG"></marker> + <title><title></title> + + <p>For <c>part</c> and <c>application</c> documents, this will be + the title of the document, visible in the left frame and on + the front page.</p> + + <p>For <c>chapter</c> documents, this will be the chapter name.</p> + + <p>For reference manual documents, this tag is ignored.</p> + </section> + + <section> + <title><shorttitle></title> + + <p>This optional tag is ignored by DocBuilder. It will likely be + removed in the future.</p> + </section> + + <section> + <marker id="preparedTAG"></marker> + <title><prepared></title> + + <p>This tag is intended for administrative use and is ignored by + DocBuilder.</p> + </section> + + <section> + <marker id="responsibleTAG"></marker> + <title><responsible></title> + + <p>This optional tag is intended for administrative use and is + ignored by DocBuilder.</p> + </section> + + <section> + <marker id="docnoTAG"></marker> + <title><docno></title> + + <p>Document number.</p> + + <p>For <c>part</c> and <c>application</c> documents, the document + number is visible in the left frame and on the front page.</p> + + <p>For other types of documents, this tag is ignored.</p> + </section> + + <section> + <marker id="approvedTAG"></marker> + <title><approved></title> + + <p>This optional tag is intended for administrative use and is + ignored by DocBuilder.</p> + </section> + + <section> + <marker id="checkedTAG"></marker> + <title><checked></title> + + <p>This optional tag is intended for administrative use and is + ignored by DocBuilder.</p> + </section> + + <section> + <marker id="dateTAG"></marker> + <title><date></title> + + <p>This tag is intended for administrative use and is ignored by + DocBuilder.</p> + </section> + + <section> + <marker id="revTAG"></marker> + <title><rev></title> + + <p>Document version.</p> + + <p>For <c>part</c> and <c>application</c> documents, the document + version is visible in the left frame and on the front page.</p> + + <p>For other types of documents, this tag is ignored.</p> + </section> + + <section> + <marker id="fileTAG"></marker> + <title><file></title> + + <p>This optional tag is intended for administrative use and is + ignored by DocBuilder.</p> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/inline_tags.xml b/lib/docbuilder/doc/src/inline_tags.xml new file mode 100644 index 0000000000..e1d392076a --- /dev/null +++ b/lib/docbuilder/doc/src/inline_tags.xml @@ -0,0 +1,254 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Inline Tags</title> + <prepared/> + <docno/> + <date/> + <rev/> + <file>inline_tags.xml</file> + </header> + + <p>Inline tags are typically used within block tags, for example to + highlight a word within a paragraph.</p> + + <section> + <marker id="brTAG"></marker> + <title><br> - Line Break</title> + + <p>Forces a newline. The <c><![CDATA[<br>]]></c> tag is both a + block- and an inline tag and is described in + the <seealso marker="block_tags#brTAG">Block Tags</seealso> + section.</p> + </section> + + <section> + <marker id="cTAG"></marker> + <title><c> - Code</title> + + <p>Highlights things like variables and file names in a text flow. + Can contain plain text only. Newlines and tabs are ignored as + opposed to the <seealso marker="block_tags#codeTAG">code</seealso> + tag. All <seealso marker="character_entities">character + entities</seealso> are expanded. Example:</p> + <pre> +<p>Returns <c>true</c> if <c>Term</c> is an integer.</p> + </pre> + <p>results in:</p> + <p>Returns <c>true</c> if <c>Term</c> is an integer.</p> + </section> + + <section> + <marker id="emTAG"></marker> + <title><em> - Emphasis</title> + + <p>Highlights words which are important within a text flow. Example: + </p> + <pre> +<p>The application <em>must</em> be up and running.</p> + </pre> + <p>results in:</p> + <p>The application <em>must</em> be up and running.</p> + + <p>Contains plain text or a + <seealso marker="#cTAG"><c></seealso> tag.</p> + </section> + + <section> + <marker id="markerTAG"/> + <title><marker> - Marker</title> + + <p>Used as an anchor for hypertext references. The <c>id</c> + attribute defines the name of the marker. Example:</p> + <marker id="marker_example"/> + <pre> +<marker id="marker_example"/> + </pre> + + <p>The <seealso marker="#seealsoTAG"><seealso></seealso> tag + is used to refer to the marker.</p> + + <p>The <c><![CDATA[<marker>]]></c> tag is both a block- and an + inline tag.</p> + </section> + + <section> + <marker id="pathTAG"></marker> + <title><path> - Path</title> + + <p>Highlights file paths. The attributes <c>unix</c> and + <c>windows</c> makes it possible to specify different paths for + different file path notations. Default for both are "". + Example:</p> + <pre> +<p>Look at the <path unix=".profile" windows="win.ini">start-up file</path> + if you intend to alter the initial behavior.</p> + </pre> + <p>If no <c>ptype</c> option is specified when calling + <seealso marker="docb_transform#file/1">docb_transform:file/1,2</seealso>, + this simply results in:</p> + <p>"Look at the <path>start-up file</path> + if you intend to alter the initial behavior."</p> + + <p>If both the options <c>{ptype,unix}</c> and + <c>{ptype,windows}</c> are specified, the example instead results + in:</p> + <p>"Look at the <path unix=".profile" windows="win.ini">start-up file</path> + if you intend to alter the initial behavior."</p> + </section> + + <section> + <marker id="seealsoTAG"></marker> + <title><seealso> - Local Cross Reference</title> + + <p>A cross reference (hypertext link) to a marker in the same file, + a marker in another file, or (the top of) another file, given by + the <c>marker</c> attribute. Must contain plain text. Examples: + </p> + + <pre><![CDATA[ + <seealso marker="#marker_example">marker example</seealso> + ]]></pre> + <p>results in: + <seealso marker="#marker_example">marker example</seealso> + (a hypertext link to the marker example above).</p> + + <pre><![CDATA[ + <seealso marker="block_tags#markerTAG">marker tag</seealso> + ]]></pre> + <p>results in: + <seealso marker="block_tags#markerTAG">marker tag</seealso> + (a hypertext link to the marker section in the Block Tags + chapter).</p> + + <pre><![CDATA[ + <seealso marker="overview">Overview</seealso> + ]]></pre> + <p>results in: + <seealso marker="overview">Overview</seealso> + (a hypertext link to the Overview chapter).</p> + + <p>Note the use of "#" before the name of the marker. Note also + that the filename extension <c>.html</c> is omitted. This is + because the default behavior of DocBuilder is to translate + <c><![CDATA[<seealso marker="File#Marker">text</seealso>]]></c> + to <c><![CDATA[<A HREF="File.html#Marker">text</A>]]></c>.</p> + + <p>The default behaviour can be modified by using the callback + module option to <c>docb_transform:file/1,2</c> and defining a + callback function + <seealso marker="docb_transform#Module:seealso/1">Module:seealso/1</seealso>. + This possibility is for example used in OTP to resolve cross + references between applications.</p> + </section> + + <section> + <marker id="urlTAG"></marker> + <title><url> - Non-Local Cross Reference</title> + + <p>A reference to a file outside the documentation, a web address or + similar, given by the <c>href</c> attribute. Must contain plain + text. Example:</p> + <pre><![CDATA[ +<url href="http://www.erlang.org">erlang.org</url> + ]]></pre> + <p>results in: <url href="http://www.erlang.org">erlang.org</url> + </p> + </section> + + <section> + <marker id="termTAG"></marker> + <marker id="termdefTAG"></marker> + <title><term>, <termdef> - Glossary</title> + + <p>Used to highlight a term with a local (for this document only) or + global definition. The identity of the term is given by + the <c>id</c> attribute.</p> + + <p>For a locally defined term, the tag contains a + <c><termdef></c>, which in turn contains an explanation of + the term as plain text. Example:</p> + <pre><![CDATA[ +<term id="HTML"><termdef>Hyper-Text Markup Language</termdef></term> + ]]></pre> + + <p>For a globally defined term, the tag is empty. Example:</p> + <pre><![CDATA[ +<term id="HTML"/> + ]]></pre> + + <p>Global definitions are given to DocBuilder in a file, using the + <seealso marker="docb_transform#file/1">docb_transform:file/1,2</seealso> + option <c>term_defs</c>. The file should contain a list of tuples, + one for each term definition, on the format + <c>{Id,Name,Definition,Owner}</c>. The <c>Owner</c> part is just + for administration, if there are several people contributing to a + term definition file. Example:</p> + <pre> +[..., + {"HTML", "HTML", "Hyper-Text Markup Language", "Gunilla"}, + ...]. + </pre> + + <p>DocBuilder will collect both local and global definitions in a + glossary, which can be reached from a link in the left frame of + the HTML documentation.</p> + + <p>In the generated HTML, it is the term name which will be visible. + For locally defined terms, the id and the name are the same. + The name has a hypertext link to the definition in the glossary. + Example:</p> + <pre><![CDATA[ +<term id="HTML"><termdef>Hyper-Text Markup Language</termdef></term> + ]]></pre> + <p>results in: <term id="HTML"><termdef>Hyper-Text Markup Language</termdef></term> + </p> + + <p>If a term is defined both locally and globally, the global + definition takes precedence.</p> + </section> + + <section> + <marker id="citeTAG"></marker> + <marker id="citedefTAG"></marker> + <title><cite>, <citedef> - Bibliography</title> + + <p>Works the same way as <c><term></c> and + <c><termdef></c>, but for a bibliography list rather than + a glossary.</p> + + <p>A global bibliography list is given to DocBuilder in a file, + using the <seealso marker="docb_transform#file/1">docb_transform:file/1,2</seealso> + option <c>cite_defs</c>. The file should contain a list of tuples, + one for each cite, on the format + <c>{Id,Title,Info,Owner}</c>. The <c>Owner</c> part is just + for administration, if there are several people contributing to a + bibliography file. Example:</p> + <pre> +[..., + {"erlbook","Concurrent Programming in ERLANG","J. Armstrong, R. Virding, C. Wikström, M. Williams, Concurrent Programming in ERLANG, Prentice Hall, 1996, ISBN 0-13-508301-X","jocke"}, + ...]. + </pre> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/make.dep b/lib/docbuilder/doc/src/make.dep new file mode 100644 index 0000000000..d9b075e114 --- /dev/null +++ b/lib/docbuilder/doc/src/make.dep @@ -0,0 +1,33 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: block_tags.tex book.tex character_entities.tex \ + docb_gen.tex docb_transform.tex docb_xml_check.tex \ + docbuilder_app.tex fasc_dtds.tex header_tags.tex \ + inline_tags.tex overview.tex part.tex ref_man.tex \ + refman_dtds.tex user_guide_dtds.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +block_tags.tex: gazonk + +book.tex: ref_man.xml + +inline_tags.tex: ../../../../system/doc/definitions/term.defs + +# ---------------------------------------------------- +# Pictures that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: man.ps + diff --git a/lib/docbuilder/doc/src/man.gif b/lib/docbuilder/doc/src/man.gif Binary files differnew file mode 100644 index 0000000000..8656c7443d --- /dev/null +++ b/lib/docbuilder/doc/src/man.gif diff --git a/lib/docbuilder/doc/src/man.ps b/lib/docbuilder/doc/src/man.ps new file mode 100644 index 0000000000..b4d7ef7636 --- /dev/null +++ b/lib/docbuilder/doc/src/man.ps @@ -0,0 +1,750 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: /clearcase/otp/internal_tools/sgml/test/man.ps +%%Creator: XV Version 3.10a Rev: 12/29/94 - by John Bradley +%%BoundingBox: 243 308 369 484 +%%Pages: 1 +%%DocumentFonts: +%%EndComments +%%EndProlog + +%%Page: 1 1 + +% remember original state +/origstate save def + +% build a temporary dictionary +20 dict begin + +% define string to hold a scanline's worth of data +/pix 126 string def + +% define space for color conversions +/grays 126 string def % space for gray scale line +/npixls 0 def +/rgbindx 0 def + +% lower left corner +243 308 translate + +% size of image (on paper, in 1/72inch coords) +126.00000 175.96800 scale + +126 176 8 % dimensions of data +[126 0 0 -176 0 176] % mapping matrix +{currentfile pix readhexstring pop} +image + +110000110011111111111100111111110011110011111111111100111111112222222222 +33445544446655665555665566666655666666888888778899888899aabbaabbbbbbaabb +bbaaaaaaaabbbbbbaabbccddbbaaaaccccccddddccddddccbbccccccbbccccaabbaaaaaa +9999aaaa8899887777554455666655555544 +000000110011110000001100112222111111001111111100001111111111112222112233 +55334444446666775544555555775577777766888888889988889999aaccbbaabb99aaaa +bbbbaaaaaaaabbbbccccccccccccbbccccccccddccddddccbbaaccddccbbaaccbbbbaaaa +999999889977667755554455666655444444 +110011000011000000111111111100111100112211111111110011111111112222222233 +3344444455446677665555667777667788888888667788aa88999999aabbaabbaa889999 +aabbbbbbaaaaaabbddccccccbbccccccbbaaccccccccccccbbccccccccbbbbbbbbaaaa99 +9999aa888877666655555555555544333344 +110000110011110000001111111111000011001122110011111111002211222211224433 +3333444444556677666655667777667777888877666688998899aa99aabbaaaaaaaabbaa +99aabbaabbbbbbbbbbccbbddaabbccbbaa99ccddccccccbbccccccddccbbbbaaccaa9988 +889988887766665566665544443344554444 +000000000000110011000000110000110000001111000000111100221111111133222222 +33444433444455667777555555776666778888667777778888aa998888bbaa99aaaaaabb +bbbbbbaabbccbbbbbbccbbbbbbccccaabbbbbbccccccbbbbbbbbccbbbbbbbbbbbbaa7788 +aa9988889966666655666655553355556644 +110011111111111100111100110011000000001100002211111122221122111122222222 +33443333334455776666776666667766778855668866777788448899889988889999bbaa +aaaabbaaaabbbbaabbbbbbbbbbbbaa99bbaabbccddccccccbbccbbbbaabbbbaaaa777788 +aa9999aa9988776677777755555544556655 +110000001111111122111111000000001111110011111111110022111111111133222233 +223322445555445544667777667777667777887788887799883377999999998899aaaaaa +99aabbbbccbbbbbbbbbbaaaaaabb99aaaabbbbbbccccccbbccccbbbbaabbaaccaa886688 +9999aaaa9988888866667744555544445544 +110000111122111111221100111111110011111111111100111111222222221122333333 +22222244556655445555667788778888aaaa88aa889999aabbaaaa998888998899aa99aa +bbaabbccbbbbaaaabbbbbbbbbbbbaabbaaaaccccccbbccddccbbaabbaabbaabb99888888 +99aa99aa9988888866446655554444444444 +110000001111111111110011110000111100221111001111000011222222222222333344 +223322444466664455667766777788777755556666333344557788aa9999888888aa88aa +aabbbbaabbaaccbbaaaaaaccbbccaa99bbccccccccbbccccccbbbbbbbbaabbaaaa99aa88 +999988999988887766664455445555555544 +110011111100001111111111110000000011111111110011111122111111112233222222 +443333555544444455777788775522000000000000000000000000447799aaaa99888899 +aaaabbaaaaccbbaaaabbbbbbbbaa7788bbddccccbbbbbbbbccbbbbaabbaaaaaaaaaa9999 +aa999988aa99887766666655444455445544 +000000110011110000110000110011001100001111110000111122112211112211222222 +5544444455443333446677772200000000000000000000000000000000337799999999aa +9999aabbbbbbaaaa88aaaabbbb889988ccccccbbccbbbbaaaa9999bb8855889999999988 +998888998888886655667755554455554433 +110011001111001100001100111111000000001100111100111111222211113333222211 +44555544444433445555550000000000000000000000000011000000000000003377aa99 +888899aa99aa9999aaaabbaabb99aabbaabbbbccaabbaaaabb88aaaa995588aaaaaa8888 +8888aa998888887755777766554444332222 +111111110011111111001111001111110000000011000011001111111122332222223322 +334466554444444455441100000000000000000000000000000000001155220000113366 +998888aa99998899bbbbaabbbbaaaaaabbbbbbbbbbaabbaaaa99aaaa8888aa9999889988 +7799aa888888665566666655554433334422 +221111110011000011111111110000000000110011110000111111001111333311223333 +443344443344554488440011553300000000000000000000000000227788883300000011 +4444559999887799aaaaaaccbbaaaa9988ccccbbaabbbbaaaa99aa9988aa999988888888 +776688888877667766554455444444444433 +221111110011111100110011000011000000000000110000110011001111112222221122 +2222333333111111448899ccffddbb77442222221111000000000044bbddccaa33000000 +00000000558888998899bbaabbaabbaa99bbaabbaaaabbaa99aa99999988778888777777 +663355778877776666665544444433333322 +221100222211001111112200111111000011000000000011001100111111112211112211 +332244220011000055ddffeeeeeeeeeeddddddeeddcc88330000000044ddddcc55000000 +000000000077aaaa999999aaaabbbbbbaa99aabbbbaaaabbaaaaaa999999888888557755 +664466666677666655667755443333223322 +221111222211221111111100000011110000110000001100111111110011111122112222 +3322000000000044ddffffeeffeeeeeeeeeeeeeeffeeffdd885511000033aaddaa330011 +2211000000339988889999aaaaaabbaabbbbbbbbbbaaaaaabb99aa8899aa999988665577 +665577777766555544443366443344333322 +221111111122221111001111111100000000000000001111111111111111111111223344 +22000000000077ddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffeebb440000005588661100 +11000000001188888888aa9999aabbbbbbaaaabbaabbbbbbaa8899888899888888776666 +556666776666443366555555445533333333 +112211111122221111221100111100110000000000001111001100000000111122112211 +000000000088eeeeeeeeeeeeffeeeeffffeeeeeeffeeeeeeeeeeffee8811000000118866 +0000000000118899888899aaaabbbbbbbbbbbb99aabbaaaaaa9988888877888877555566 +555555666655446655556655444444443344 +221111111100111111110011111111110011001100110000111100110011111111000000 +0000000088ffeeddeeeeeeeeeeeeeeeeeeeeffeeeeffffeeeeeeeeffffbb775566aaeeee +aa332233000088aa88888899bbaaaa99aabbaaaabbaabbbbaaaa88888877888877555555 +445577666655554455555566665544665533 +110000111111110011111111111111110000000000001100111111000011111111110000 +00000088ddddddddddffeeffeeeeeeeeeeeeffeeeeeeeeffeeeeeeeeeeffffffffffeedd +eecc441111002288997788aa99aaaa99aa99aabbbbaabbaaaa9977778888777777776655 +555577776666666666666677775555555555 +001111110011001100111111112211111100110000000011110011111111001111000000 +000022aaddccddddeeeeeeeeeeeeeeeeeeeeeeeeeeffeeffeeeeeeffeeffeeeeeeeeeeee +eeffdd3311110044998899999999aaaaaaaaaabbaabbbbaaaa8888778877888866776677 +665566667755556644665555554444666666 +110011110011111111001100002211111100110011111100111100111111111100000000 +000022bbcccccccceeeeeeeeeeeeeeeeeeeeffeeffeeffffffeeeeffeeffeeffeeeeeeee +eeddeebb6644000088998899bbbbbbaabbbbbbaabbbbbbcc999988888877888877667777 +557777777766665544555555555555665566 +110011221111111111111111111111221100001100110011111111221100221100000000 +00001199aabbccccddeeeeeeeeeeeeeeeeeeeeeeffffeeffeeffeeeeffeeffeeeeeeeeee +eeddeeeebb88110066aa99aabbccbbaabbbbbbaabbbbbbbbbb99aaaa9988777766667777 +666677777777665544665566555566664455 +221111222222111111111111221111111111111111001111111100221122221100000000 +000022aabbbbaaccddeeeeeeeeddeeeeeeffeeeeeeeeffeeffeeffeeffffeeeeeeeeeeee +eeeeeeeeeecc220066aaaaaaaabbbbbbccaabbaaaabbccbbaaaaaa998888886677887777 +777777888866776655667755665566666655 +222211222222111122111122111111000000001111111111111122111122220000000000 +00002299bbaaaabbddeeeeeeddeeffeeeeeeeeeeffeeeeeeeeffeeeeffffffeeeeeeeeee +eeeeeeeeeecc330044aaaabbaabbbbbbaaaabb99aabbbbbbbbaaaa889988888877888888 +887777778888776644777777666677667766 +222222332233222211221111221111110000111111222222222211222222221100000000 +00001188cc99aabbddddddeeeeeeeeeeeeeeffeeeeeeeeeeffeeeeffeeffeeeeeeeeeeee +eeeeeeeeeeee440044bbaabbbbaabbbb9999aaaabbaabbbbbb9999998888887788888899 +887777778888887755776677667755667755 +221122442222222222332211222222111111001111222222221133112222220000000000 +00001177bbaaaaaaeeddeeddeeeeddeeeeeeeeeeeeeeeeeeffeeffffeeeeeeffeeeeeedd +eeeeffeeddffaa0022aabbbbbbbbbbaaaa99bbbbaabbaabbaa9988888888998888887777 +888866777788888888888877666655445566 +331133442233333333332222332211111111111111112222222233221122220000000000 +0000115599aabbccddddeeddeeeeeeeeeeeeeeeeffeeeeffeeffeeffffffeeffeeffddee +eeeeeeeeeeffdd110088bbbbbbccbbaa99bbaabbaaaabbbbbbbb99888888888888666677 +777777778888666677888877775544444455 +332222332222334422222233222233110011222222112233223322222211221100000000 +000000228899aabbddddeeddeeeeeeeeeeeeeeeeffeeeeeeffeeffeeeeffeeffeeeeeedd +eeffeeeeeeeecc220066bbaabbbbbbaaaa999999aaaaaaaa9999aaaa9988888877776688 +888877778888776677887777666666665544 +333311332233333333222222222233331111113322222222223322332222220000000000 +000000225577aabbccddddddeeeeeeeeeeeeeeeeeeeeeeffffffffeeffffeeeeeeeeeeee +eeeeeeeeeeeedd110044bbaaaabbaabb99999999aabbaa999999aa999999998888777788 +888855888888886677777788777777555555 +222211222222224444111122222211222233221133443344332233333322551100000000 +00000022557788aaccddeeddddeeddeeeeeeeeeeffffeeffeeeeffeeeeeeeeffeeffeedd +eeeeeeeeeeeedd33003399aaaabbbbaaaa88999999aaaaaa99aaaabbaaaaaa9999778888 +887766888888885577776666777766556644 +222211222222222233334422222222112233222233554444332222222222440000000000 +0000001144779988bbccddddddffddeeeeeeffeeeeeeeeffffffeeeeeeffeeffffeeeedd +eeeeeeeeeeeedd2200228899aaaaaa88888899999999bbaa99aabbbbbbaa999988888888 +887777778877665566886666666677775566 +443322111133331111222233332222332222332233223333333333332233331100000000 +000000115555668899ddddddddeeeeeeeeffeeffffffeeffeeeeffeeeeeeeeeeeeeeeedd +eeeeeeeeeeeedd2200339999aabbaa889999aaaa99aabbaaaa99bbbbaaaa998899998888 +888888997777775577777777777777666666 +332211223322222222221122223333221122112233333333332244333333330000000000 +0000000033444466aaccccddddeeeeeeeeeeeeffeeeeeeffeeeeeeeeeeffeeeeffffeedd +eeeeeeeeeeeecc2200228899aaaa9988aaaaaaaa99aa99bbaabbaaaa99999988aa999988 +888888887777776677666666776666556644 +332222222233222233332222333333331133332233224433333344554444331100000000 +000000110044777788aaeeeeddeeeeddddddeeeeeeeeeeffeeffeeeeeeeeeeeeeeeedddd +ddeeddeeeeeedd220011aa9999aa999999bbbbbb99bbbbbbbbbbbbaaaaaa999999888899 +998888888888666677556677666655555555 +332222222222333333443333333322443333443344334433444455553333330000000000 +000000002233557788ccccccccaa775555446688ccddcceeeeeeeeeeddeeeeeeeeeedddd +eeddeeeeeeeedd44003399aa88aaaa99aaaaaaaa99bbbbbbbbbbbbbbbbbbaa999999aa88 +888866887788775577667755556655555544 +331122332222444433333333223333333344444444554433445555664444441100000000 +00000000332244889999777788330000000000116688aaddccddddccddddaa88aa99aadd +ddddeeeeeeddee660022aa99999999bb99bbbbaaaabbbbbbbbccbbbbbbbbaa99aaaa8888 +888877776677667755777755445555556655 +331122333333335544554433333322443344555555554433334433556655441100000000 +000000000000225544221100110000000000001111557799ccbb88778877110011003388 +bbddeeeeeeddee55002299aa999999aaaabbaabbaabbbbbbaaaaaabbaaaabbaa99998888 +887777667788666666666666555555554444 +333333333322444444555555444444444455556666555544334455336666551100000000 +000000001111001100000000000000000000000011224455889966111111000000000011 +66aaddeeeeeeee550033aa99aa999999bb99bbccaabbbbaaaaaaaabbaaaabbaabb888888 +667777777777775577554455553344444444 +223344332233555544556666665533335544556655555533446655555555661100000000 +00001100111100000000000011000000000000000011449999bb77000000000000004433 +225588cceeeeff660044aaaa888899aa9999aaaa99aabbaaaaaa99bbbb9999aaaa998888 +886677777777667766555555443355554455 +443344332233556655666655666633555544555555555555555566555555662200000000 +0000001111110000000000001100000000000000000066ddeeee990000000000000066bb +bb88bbcceeeeee880066aaaa9999bb9999aa99998899aa999999aaaabbaaaaaa99889988 +778888776677666655444455665555554433 +443333442233445577665566666655444444666655667766666666666644443300000000 +0000001133220000000000000000000000000000000055eeeeeebb110000000000000022 +bbffddddeeeeff88007799999999aabbaa9999999988aa99999999bbaaaa888877888888 +887777777766666655664455554455443344 +444422335566557766776666555544444455556666555555556666668899aa5500000000 +0000002233220000000000000044110011110000000055ffeeffcc110000000000000000 +0077ddddddddeebb118899999999aaaaaa8888aa88aaaaaa9999aabbaaaa997755889988 +887766777766775555665555444444443344 +555544333344556666556666445566556666555555665566665555335566999922000000 +0000002244332200000000001177663366330000000088eeeeffdd110000001100112200 +000066cceeeeeebb66ccbbaa9999aaaa998899aaaabbbbaa9988aaaabb99998888888877 +777755776666666655555555554444444444 +445555554444555555557766445544666677665566666666776611000000002233000000 +00000022445544112233442255442211110000000033bbeeeeeeee880000002255999966 +330033ddeeeeeeddddeeeeffccaa99998899aaaabbbbaaaa999999999999999988888877 +777766665566666655665544444444553333 +444444556666445555776666555566667777775566666655665500000000000000000000 +00000000334433337799999988775533112244225599ccddeeeeffee885533111166bbcc +bb6666ddffeeeeeeeeeeaa66aa99aa889999bbbbbbbb99aa999999999999998888888877 +667766555555555555444433444444333322 +334444445577665555556666665566665577666644444466664400000000000000000000 +000000002255667788bbbbbbaabb998866556688aabbddeeeeeeeeeedd8888bbaaccddee +eeeeddeeeeeeddeebb22000066aa88aabbaaccbbaa99aa99889988999999889999888877 +777766666666665544334455443333333333 +333355444466557766776655555555556666664455446666665500000000000000000000 +0000000011335577aaccddddddccbb998899ccddddccddeeffeeeeeeeedd8899ddeeeeee +eeddffeeeeeedddd3322220066aaaaaabb99bbbb99aaaa88888899888888888877887777 +556688553355665533444433334433333344 +444444225555445566888866666666777777776666556666664400000000000000000000 +0000000011224477aaddddeeddddddddddddddddddddeeeeeeffeeeeeeeecc88aaddeeee +eeeeeeeeeeeeeecc66dd8800779988bbbbaabbbbaaaa9988888888999977776677776666 +557766553355556644443333333344221133 +77bbccbb9988774455667777667788888877886666667777666611000000000000000000 +0000001111335577bbccddddeeeeeeddeeeeddddccddeeeeffeeeeeeeeeeffddddddeeee +eeeeffeeeeeeddccddeedd22999988aa99aaaa8899aa9988888888888888776677777766 +776666665555555544444444332222112211 +bbeeffffffeeeedd88444455668899998866776666666677775533000000000000000000 +0011114433446688bbccccccddddeeeeddddbbddeeddeeeeffffeeffeeffeeffffffeeee +ffeeeeffeeeeeebb77eeee88cc889999aaaa99aa99998888778888888888668888997777 +777777667766665533334433332222222222 +77ddeeffeeffeeeeee995555557788888888776677775577776655221100000000001100 +1122225555665588aabbbbccddddddeeccaabbeeddccddeeeeeeffeeffeeeeeeffeeeeee +eeffeeffeeeeffcc33bbeeeebbaaaaaa99aaaa9999888877889999999988777788887777 +888866556677665533334433112211222222 +4499bbbbeeeeeeeeeeee6633667799889988778877667788777777332200110000001100 +444477888866667799aabbccccddddddbb8888aa7755779999bbddeeffffeeeeeeffeeee +eeddeeeeffeeeedd44bbeeeebbaaaa99aaaaaa99889999888888aa99aa88776677888877 +887777666666554433554422222222222211 +003322446677cceeeeeeaa66777788888888888877667788887788662211113300002222 +66887777665566667799aabbccccccaa88443322000011223344446677ccffeeeeeeeeff +eebbeeeeeecceeeeaacceeeebbbbaaaaaabbaabbaa999988778899998888888888778888 +777766776677665555442222222233222222 +00220000000066ccffeeffaa776677887777887777777788888877773311005566115533 +7788996666445566667799bbccbbaaaa9933000000000000000000000066ffeeeeffeeee +eeddeeffeeffeeffeeddeeddbbaaaa99aaaaaabbccaaaa88889988999988888877888877 +888877667766666644332244442222223322 +1111000000000044aaeeffdd777755777788778877777788888888776611221122888844 +88aa77776655445555778899aa7788aaaa44000000000000000000000077ffeeeeddeeee +eeeeeeeeeeeeeeeeeeeeffccaaaaaa9999aaaaaabbaaaa9999888899bb99888866778888 +777777665555554444333322222222221122 +22000000001111001177dddd999999886666888877887788778888888844115544aa8888 +9988888866555555446666666666bbcc99330000000000000000000055eeffeeeeccddee +eeeeeeeeffeeffeeeeeeeeccaaaabbbbaaaabbbbaaaaaa88889999aa8899886688777766 +778888775566554433332233333322331111 +4400000000443300000033bbffeeffeebb666677888888888888777766663333bbbb88bb +aa998888885555554444221144aaccbb330000000000000000000033ccffeeeeffddcccc +cceeeeeeeeffeeeeeeffeebbbbbbbbbbbbaaaaaaaabbaa8899aa99889999888877888877 +667777668888998844332244442244332222 +770000000077ccbb996677eeeeeeeeeeeebb5566777788889988777777777755ccbbaacc +bbaa9988775577664400000055bb6633110000000000000000000077bbddeeeeeeffddaa +bbddddddddddffeeffeeeebbbbccccbbbbbbaaaaaaaa8888888888998899888888888888 +776677aaddeeeedd77223344443344333311 +dd77000011aa99aaddeecccceeeeeeeeeeeebbaa6677888899887788778888cceeccbbbb +ccaa998888888855110000337733000000000000000000000000005599ddccddeeeeeedd +aa99ccddaacceeffeeeeeeeebbaaccbbbbaa99aa99998888887799998899998877888888 +8888cceeeeeeeeddbb553344333333333322 +eeee88000077220033998866aaeeeeeeeeeeeeeeaa777788aa8899997788aaddccbbcccc +ccbbaaaabb9977440000335522000000000000000000000000000000227788aaeeeeeeee +bb8899ccddaaaaeeeeeeeeffcc99aaaa99999999aaaa8888888888777777888877777788 +88cceeeeeeeeddeeeeaa3344444433443333 +eeeedd55004488000011110077ffeeeeeeeeeeeeffbb8877889988999999ddddddddddcc +ddccccbb8866332200113300000000000000000000000000000000000000334488cceeee +ddccaa88bbbb6655bbffeeeeeeccaa9999aaaa99998899997777889999aa998888888866 +3388ddddddddcc88ccdd9944334433443322 +eeeeee88110066110000000088eeeeeeeeeeffeeeeeecc9977889999aacceeddeeeedddd +ddddaa88663300000000000000000000000000000000000000000011000000000022aadd +eeddccbb99aa88111188eeffeeffddaa99aaaaaa88998888888888aaeeeeeebbbbddddaa +1155ccaa55443311aaeedd88222222332211 +ddccdd88440000000000000077ddeeeeeeeeeeffeeeeffeebb99aaaaccddeeeeeeeeeeee +ddbb777777442200000000000000000000000000001188ccbb9999bb8833000000002222 +77ddddddccbb8844000044ddffffffeeaa88aa9999998888888888cceeddeeddeeeeeedd +2288bb991100000066bbddcc551122222222 +cc666622221100000000000055ddeeeeeeeeeeeeeeeeeeeeee9999ccddeeeeffeeeeeeee +eeddccaa884422331100000000000000000000001177eeeeeeeedddddd99550000001133 +1155ddeeddddcc8855000033aaeeeeffdd9999aa9999aa88995555cceeeeddeeeeeeeebb +00559999440000000055bbddbb3322223322 +ffdd4400001100000000000044ddeeeeeeeeeeeeeeeeeeeeeeccbbeeffeeeeeeeeffeeee +eeddeeccbb8866772200000000000000000000001144668899aabbddddccbb66110044bb +bbbbcccceeeeddddcc8877332277cceeeeeebb88999999aadd7799eeeeeeeeeeeeddddaa +4444775577220000000044bbee7711222211 +eeeecc33000000000000000033cceeeeeeeeeeeeeeeeeeffeeffeeffeeeeffeeffeeffff +eeffeeddeeccbb884411000000000000000011000000000000000088ccddddaa6644bbee +ddffeeddeeeeeeeeeeffffeeddbbddeeffeeeeddaa88aaccddbbeeddeeddddeeeeee8844 +7711221100000000001177ccddbb44112211 +eeeeffaa000000000000000066eeeeeeddddeeeeffeeeeeeffeeeeeeffeeeeffeeeeffff +eeeeeeeeeeeeeecc66110000000000000022666655334433446688bbeeddeeddbbccddee +eeeeeeeeeeddeeeeffffeeeeffffffeeeeeeeeffdd99cceeddbbddeeddddeeddeecc2200 +22000000000000003399ccccdddd88111122 +eeeeeeee550000000000000088eeddddddccddddeeeeddeeeeeeeeeeffeeffeeeeffffee +ffffeeeeffeeeeee99220000000011336688bbddddddddeeeeffeeeeeeeeeeeeeeeeeeee +ffeeffeeeeeeeeffeeeeeeffeeffeeeeffeeeeeeffddddeedd99ccddddddeeeedd660000 +00000000000000001166ccddddeeaa222222 +eeeeeeee880000000000000099eecc888888ddccccaa88ccddeeeeeeeeeeffeeffeeffee +ffeeeeffeeeeeeddbb3300001122336688aaddeeeeddeeeeeeeeeeffffeeeeffeeeeeeee +eeffeeffeeeeeeeeeeffeeeeffeeeeeeeeeeeeeeeeccccddcc5588aacceeddeecc220000 +0000000000000000004499bbccddcc331111 +eeeeeeee990000000000000088ddccdd6622bbddbb4455ddbbaaeeeeffeeffeeeeeeffff +eeffeeeeeeeeddcc996633335522335588aaccddeeeeeeeeeeeeeeeeeeffeeffffeeeeff +ffeeeeffffeeeeeeeeffeeeeeeffeeeeeeeeeeeeff99779988003377ccddeeee99000000 +000000000000000000000055bbddcc441122 +ffeeeeeedd3300000000000077cceeee880044aabb55ccffddccddffeeeeffeeeeeeeeff +eeffeeeeeeddccbb776644442211223377aaccddeeeeeeeeeeeeffffffeeffeeeeeeffee +ffeeeeeeeeeeeeffffeeeeffeeeeffffeeffeeffff8811333300001199ddeeee66000000 +0000000000000000001155ccddccdd551111 +eeeeeeeedd991100000000000077ccdd555577111133ddffeeddddffffffeeffffffeeee +ffffeeeeffddccbb7733110000000011336688bbcccceeeeeeeeeeffeeeeffffffeeeeee +ffeeffeeffeeffeeeeffeeffeeffffeeffeeffeeff99000000000066ddddeecc22000000 +00000000000000004499ccdddddddd771122 +eeeeeeeeeedd6600000000000000226677ddee66000088bbcc8866777799ccbbaabbbbcc +ddeeffffffeeeeeebb6644110000000000113355668899bbbbddddddeeeeeeddeeeeeeff +eeeeeeeeeeeeeeffffeeffffeeeeddddccddddddee990000000000aaffeeeeaa00000000 +00000000000000005588bbccccdddd880011 +eeeeffeeeeeebb99220000000000000055bbaa3300000011220000003399aa9988886666 +66888888bbddeeeeeeddcc9933000000000000000011224466778888aabbddddeeeeeeee +ffffeeffffeeeeeeccbbbbaaaa777777774411222211000000000055aaaaaa6622000000 +00000000000000004499bbccddddee991111 +eeeeeeffeeddddcc4422220000000000001133000000000000000000669999aaaa99aa99 +999911000011445588aacccc88110000000000000000222222223322336699bbddeeffee +ffeeeeddccccccaaaaaaaabbbbaabbbbbb66000000220000000000001111110000000000 +000000000000001155aabbddccddddbb2211 +ffeeffeeeeeecccc99aa55000000000000000000000000000000001188888899aaaaaaaa +99770000000000000000113333000000000000000000000011000000002277cceeeeddaa +8888ccccccccccccbbbbccddbbbbbbbbcc88000000000000000000000000000000000000 +00000000000000116699ccddddddeecc2211 +eeeeeeeeeeeeddccddccbb661100000000000000000000000000227788778877889999aa +660000000000000000000000000000000000000000111100000000000011445544331100 +0088ccccccccccccccbbbbccccbbbbbbaa99110000000000000000000000000000000000 +000000000000002266aaccddddddddcc3300 +eeeeeeeeeeeeddddbbccccccaa88887788aa440000000000004488778888887788779977 +110000000000000000000000000000000000001111111111001111000000000000000000 +55ccccbbccccbbccccbbbbbbbbbbbb999999772200000000000000000000000000000000 +000000000000002277aaddddccccdddd5511 +eeeeeeffffddddddddddeeddddeeddeeddcc773311000000337766777777667766776611 +000000000000000000000000000000000000000000000000000000000000000000000055 +ccbbbbccbbccccbbbbbbbbbbbbaaaaaaaa99997711000000000000000000000000000000 +000000000000001166aabbccccdddddd7711 +eeeeffeeeeeeeeeeeeddeeddeeddddddccbb996611001144777777776677776666771100 +0000110000000000000000000000000000000000000000000000000000000000000022dd +8844ccbbbbaabbaabbbbaabbaaaaaa99aa99aa7766110000000000000000000011557777 +66330000000000003388aaccdddddddd9911 +ddeeddeeeeeeeeeeddeeddddeeddddccbbaa883300004466667777666655666688440000 +0000001111000000000000000000000000000000000000000000000000000000000099ff +aa0077bb99aabbbbbbbb99aaaa99999999aa887766440000000000000000003388bbccbb +cc773300110000002277bbbbccccddddaa22 +ddeeddeeeeeeddeeeeddddddddddddbb9988330000336655886688776655556688220000 +00000011222211000000000000000000000000000000000000000000000000000077eeff +bb001199ccbbaaaaaaaaaa889988999999997777777733000000000000001166aaccccdd +ccbb770066550000336699ccddccdddddd55 +99aabbddddeeddeeddddddcceeddcc887755110011556666667777776677775522000000 +000011224455441100000000000000000000000000000000000000000000000066eeeeee +cc0000338899bb999999999988888888aa998888777755000000000000002277bbccccdd +ddcc991177882200336699bbddccddddddaa +22333366ccddddddddccddbbaa9977333311001144666655666688889966330000000000 +0000115555777777551100000000000000000000000000000000000000000044ddeeeeee +ee220000002277aabbaaaaaa99888899aa99aa88777766220000000000000055aaccddcc +ddcc991133885522113388ccccddddccccdd +0000000088aa888888887733221100000000115566776677777799994411000000000000 +00001155777788998877773300000000000000110000000000000000000077cceeeeeeee +ee2200000000003377aabbbbaaaa9988aaaaaa999977665500000000000000117799aabb +ccbb883311443311112266bbccccdddddddd +000000002233001122111100000000002244667766668866888899220000000000000000 +000000777799aaaa99aaaa99550000000000000000000000000000003388ddeeeeeeffee +ee33000000001100003388ccbbaa99999999999988775566330000000000000011558899 +aa9977220011000011335588ccddddeeddee +00000000000000000000000000001144667766667788aa99aa8811000000000000000000 +0000003377aabb99bbbbccaa77663300000000000000000000000055cceeeeeeeeeeeeff +ee3300000000001100000055aaccaaaa9988778888887755553300000000000000115566 +776622000000000000113377bbddccdddddd +00000000000000000000000000336677777788777788aa99661100000000000000000000 +000000117799aaccccccccbbbbaa99440000000000000000002288ddeeeeeeeeffeeeeee +dd22000000000000110000002288aaaaaa99778888778877776644000000000000002222 +22110000000000000000003388aaccddddee +000000000000000000000022667777887788777799884411000000000000000000000000 +0000000077aabbccddddccccddccddbb88442200000000000088ffeeeeeeeeffeeeeeeff +dd1100000000000000110000000044aabbaa999999888888665566440000000000000000 +0000000000000000000000001155bbccdddd +000000000000000022556688776688888877887733000000000000000000000000000000 +0000000055bbccddccddddddddeeeedddddd8800000011110000bbffeeeeeeeeffeeeeff +dd1100000000000000001100000000224444667777778888887766555500000000000000 +00000000000000000000000000003388ccdd +000000001133558899998888887788998899660000000000000000000000000000000000 +0000000022aaccddddddeeeeeeeeeeeeeedd330000117766447733ddeeeeffeeeeeeeeff +aa0000000000000000000000000000000000000000113344667788887766110000000000 +000000000000000000000000000000117799 +0000446688aabb88aa999988998888999977000000000000000000000000000000000000 +0000000000aaccddeeeeeeeeeeeeeeeeffaa00000044dd7788ee77aaeeffeeeeffeeffff +880000000000000000000000000000000000000000000000001122222233441100000000 +000000000000000000000000000000000033 +777788aa9988888888888899aa8899886600000000000000000000000000000000000000 +000000000088ddeeeeeeeeeeeeeeeeffeeaa550066bbdd99cceeccaaffeeeeeeeeffeeff +550000000000000000000000000000000000000000000000000000000000113322000000 +000000000000000000000000000000000000 +884422331100000000000022331100000000000000000000000000000000000000000000 +000000000077ddeeeeeeffeeffffffffbbaa6611aaddeecceeeeeebbeeffeeffffeeffee +440000000000000000000000000000000000000000000000000000000000000022110000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000077ddeeeeeeeeffeeeeffcc1111113399bbee88cceeee99aaffffeeffeeeeee +330000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000044ddeeeeeeeeffeeeeff66002266001166ee66aaeeee6666ffeeeeeeeeffdd +110000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000022ddeeeeeeeeeeffffcc11001155003388eeddddeebb2211ddffeeffeeffcc +110000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000aaffeeeeffeeeeff8800000088221155cceebbbb55000088ffeeeeeeffcc +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000077eeeeeeeeeeeeee3300000088660055ccdd554411000044ffffffeeffbb +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000022ddffeeffffff990055330055990077dddd221111330011ccffeeffff88 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000bbffeeeeeeee442299770022aa0077dddd442266bb9944aaffeeffff88 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000066ffeeeeff882288ddaa000077331188993399eeeeffcc99eeeeeeff77 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000011ddffeeffaa99ddeecc11001111001199bbeeeeeeeeeebbddffeecc11 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000066ffeeeeffeeeeeeee2200000066bbddeeeeeeeeeeffddcceebb5500 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000055ddeeeeeeeeffee550055aaaacceeccddffffeeeeeeeeeeffcc00 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000aaffeeffeeeeee66337788bbeeeeeeeeffeeffeeeeeeeeffcc00 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000033cceeeeeeeeeeee440066ddeeeeeeeeeeeeeeeeffeeffeeffbb00 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000055eeeeffeeffeeee88aacceeddeeeeeeeeeeeeffeeeeffeeff8800 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000011ddeeeeeeeeeeeeddddddeeeeeeeeffeeeeffeeffffeeffff6600 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000088ffeeffeeeeeeeeeeddeeeeeeffeeeeeeeeffeeeeffeeff4400 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000033eeeeeeffeeeeeeeeeeffeeeeeeeeeeddeeeeeeeeffeeee3300 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000011bbffeeeeffeeddeeddddbbaaaaddddcceeffeeffeeffee2200 +000000000000000000000000000000000000000000000000000000002200220000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000088ffeeeeeeddddcc9999aaaaddeeeeeeffeeffeeeeffcc0000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000044eeffeeffccddddccddeeeeeeeeeeeeeeeeeeffffffaa0000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000099ffcc5544cceeddddeeddccddeeddddeeeeeeeeff990000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000044ff9911004499aabbccccccccddbbaabbccddffff660000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000011ccbb996655bbbbaaccbbbbddddaaaaccddcceeee550000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000006688000066ddcccceeeeeeeeffeeddccaabbeeff330000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000001144000066eeeeeeddccbbbbbb7722220022bbee110000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000022665599aaccbbaabb775588778899cc000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000002211001177bbddbbaabbaa99ddeedd8844000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000110077bbddddeeffeeeeffeeffaa00000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000088aaeeffeeddccbbcc776655996600000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000778877555533445588113355882200000000 +441100000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000007799ccccddbbddeeee3300000000 +331100000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000001155bbeeeeeeeeffeeeeeeff5500000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000004488ddeeeeeeeeeeeeeeeedd2200000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000033bbddeeeeeeffeeeeffaa0000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000088ccddeeeeeeeeeeff880000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000044aaeeeeffeeeeeeff550000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000001188ddccccddbb9988000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000022222233774422000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000116699aaccddbb44000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000002288888888992200000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000002255661100000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000011000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000113355882200000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000011778899771100000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000002244110000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000110000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000001100 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000001100 +000000000000000000000000000000000000000000000000000000000033110000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000022440000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000011220000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000001100000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000001100000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000001100000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000110000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000001100000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000 +001100110011001100110011001100110000000000000000000000000000000000000000 +000000000000000000000000000000000000000000221100000000000000000000001111 +110000001100001100110000110000000000000000000000000000000000000000001100 +001100000000000000000000110000001100 + +showpage + +% stop using temporary dictionary +end + +% restore original state +origstate restore + +%%Trailer diff --git a/lib/docbuilder/doc/src/notes.xml b/lib/docbuilder/doc/src/notes.xml new file mode 100644 index 0000000000..1131bbaf91 --- /dev/null +++ b/lib/docbuilder/doc/src/notes.xml @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2007</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>DocBuilder Release Notes</title> + <prepared>otp_appnotes</prepared> + <docno>nil</docno> + <date>nil</date> + <rev>nil</rev> + <file>notes.xml</file> + </header> + <p>This document describes the changes made to the DocBuilder + application.</p> + +<section><title>Docbuilder 0.9.8.6</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The documentation is now built with open source tools + (xsltproc and fop) that exists on most platforms. One + visible change is that the frames are removed.</p> + <p> + Own Id: OTP-8201</p> + </item> + </list> + </section> + +</section> + +<section><title>Docbuilder 0.9.8.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p>The copyright notices have been updated.</p> + <p> + Own Id: OTP-7851</p> + </item> + </list> + </section> + +</section> + +<section><title>Docbuilder 0.9.8.4</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + The element "code" with multiple CDATA or CDATA plus + other data now works as expected, previously it caused a + crash.</p> + <p> + Own Id: OTP-7236</p> + </item> + </list> + </section> + +</section> + +<section><title>Docbuilder 0.9.8</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The generated html should now be valid xhtml (with a few + exceptions to be fixed in next version).</p> + <p> + Own Id: OTP-7027</p> + </item> + </list> + </section> + +</section> + + <section><title>Docbuilder 0.9.7</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + New fonts and new CSS style included in generated html documents. + </p> + </item> + <item> + <p> + Updated DTD's with new header elements copyright and legalnotice. + Element authors changed to optional instead of mandatory. + + </p> + </item> + </list> + </section> + </section> + + <section><title>Docbuilder 0.9.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Line breaks within <c>pre</c> are now always preserved.</p> + <p> + The definition of <c>name</c> in the cref DTD is now + correctly handled.</p> + <p> + <c>docb_transform</c>: The HTML snippet returned by the + <c>Module:head()</c> callback function is now placed + below the title in the HTML file (as specified in the + documentation), not on the same line.</p> + <p> + <c>docb_gen</c>: Added option <c>sort_functions</c>.</p> + <p> + Fixed bugs in cites and terms DTD, and also in book, + bookinsidecover and report DTDs which are not officially + supported (yet).</p> + <p> + License info added to all DTD files.</p> + <p> + Corrections and clarifications made to the User's Guide.</p> + <p> + Own Id: OTP-6775</p> + </item> + </list> + </section> + </section> + + <section> + <title>DocBuilder 0.9</title> + <p>First version of DocBuilder released as part of Erlang/OTP. + Previously it has been used as an internal tool only.</p> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/overview.xml b/lib/docbuilder/doc/src/overview.xml new file mode 100644 index 0000000000..ca13c5d436 --- /dev/null +++ b/lib/docbuilder/doc/src/overview.xml @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + <title>Overview</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>overview.xml</file> + </header> + + <section> + <title>Background</title> + + <p>DocBuilder has been used within the OTP project to generate + documentation for Erlang/OTP itself for more than ten years. + It has now been released as a regular Erlang/OTP application.</p> + + <p>The intention with DocBuilder is that it should be as easy to + use and maintain as possible and generate adequate documentation + for OTP's needs. It uses frames, which can probably be regarded as + old-fashioned today. Hopefully, this should be improved in + the future.</p> + + <p>Originally, DocBuilder input was SGML files and external tools + was used for parsing. The internal version used in the OTP + project can generate not only HTML code but also LaTeX (for PDF + and PostScript) and nroff (for UNIX man pages). (Again, using + external tools). Because of this, the parsed source code is + transformed into a tree structure before being transformed again + into the desired format.</p> + </section> + + <section> + <title>DTD Suite</title> + + <p>Input is written as XML according to one of the DTDs and output + is corresponding HTML. Documentation for an Erlang/OTP application + is usually organized as follows:</p> + <taglist> + <tag><em>User's Guide</em></tag> + <item> + <p>(DTD: + <seealso marker="user_guide_dtds#partDTD">part</seealso>) + A collection of chapters + (<seealso marker="user_guide_dtds#chapterDTD">chapter</seealso>). + </p> + </item> + + <tag><em>Reference Manual</em></tag> + <item> + <p>(DTD: + <seealso marker="refman_dtds#applicationDTD">application</seealso> + A collection of manual pages for modules + (<seealso marker="refman_dtds#erlrefDTD">erlref</seealso>), + applications + (<seealso marker="refman_dtds#apprefDTD">appref</seealso>), + commands + (<seealso marker="refman_dtds#comrefDTD">comref</seealso>), + C libraries + (<seealso marker="refman_dtds#crefDTD">cref</seealso>) and + files + (<seealso marker="refman_dtds#filerefDTD">fileref</seealso>). + </p> + </item> + + <tag><em>Release Notes</em></tag> + <item> + <p>Same structure as the User's Guide.</p> + </item> + </taglist> + + <p>In some cases, one or more of the User's Guide, Reference Manual + and Release Notes are omitted. Also, it is possible to use either + the <c>application</c> or <c>part</c> DTD to write other types + of documentation for the application.</p> + + <p>A special kind of DTD, + <seealso marker="fasc_dtds">fascicules</seealso>, can be used to + specify the different parts of the documentation, and which one + of those should be shown as default.</p> + </section> + + <section> + <title>Structure of Generated HTML</title> + + <p>The generated HTML corresponding to a <c>part</c> or + <c>application</c> document is split into a left frame and a right + frame. The left frame contains information about the document + and links to the included files, that is chapters or manual pages. + The right frame is used to display either the front page for + the document, or the selected chapter/manual page.</p> + + <p>The left frame also contains links to a bibliography and a + glossary, which are automatically generated.</p> + + <p>In the case of an <c>application</c> document, the left frame + also contains a link to an automatically generated index.</p> + </section> + + <section> + <title>Basic Tags</title> + + <p>All DTDs in the DocBuilder DTD suite share a basic set of tags. + An author can easily switch from one DTD to another and still use + the same basic tags. It is furthermore easy to copy pieces of + information from one document to another, even though they do not + use the same DTD.</p> + + <p>The basic set of tags are divided into two categories: + <seealso marker="block_tags">block tags</seealso> and + <seealso marker="inline_tags">inline tags</seealso>. Block tags + typically define a separate block of information, like a + paragraph or a list. Inline tags are typically used within block + tags, for example a highlighted word within a paragraph.</p> + </section> + + <section> + <title>About This Document</title> + + <p>In this User's Guide, the structure of the different documents + and the meaning of the tags are explained. There are numerous + examples of documentation source code.</p> + + <p>For readability and simplicity, the examples have been kept as + short as possible. For an example of what the generated HTML + will look like, it is recommended to look at the DocBuilder + documentation itself:</p> + <list> + <item>This User's Guide is written using the <c>part</c> and + <c>chapter</c> DTDs.</item> + + <item>The Reference Manual is written using + the <c>application</c>, <c>appref</c> and <c>erlref</c> DTDs. + </item> + </list> + </section> + + <section> + <title>Usage</title> + + <list type="ordered"> + <item> + <p>Create the relevant XML files.</p> + + <p>If there are EDoc comments in a module, the function + <seealso marker="docb_gen#module/1">docb_gen:module/1,2</seealso> + can be used to generate an XML file according to + the <c>erlref</c> DTD for this module.</p> + </item> + + <item> + <p>The XML files can be validated using + <seealso marker="docb_xml_check#validate/1">docb_xml_check:validate/1</seealso>. + </p> + </item> + + <item> + <p>Generate HTML files by using + <seealso marker="docb_transform#file/1">docb_transform:file/1,2</seealso>. + </p> + </item> + </list> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/part.xml b/lib/docbuilder/doc/src/part.xml new file mode 100644 index 0000000000..546c6c612e --- /dev/null +++ b/lib/docbuilder/doc/src/part.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2007</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + <title>DocBuilder User's Guide</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <description> + <p><em>Docbuilder</em> provides functionality for generating HTML + documentation for Erlang modules and Erlang/OTP applications + from XML source code and/or EDoc comments in Erlang source code.</p> + </description> + <xi:include href="overview.xml"/> + <xi:include href="user_guide_dtds.xml"/> + <xi:include href="refman_dtds.xml"/> + <xi:include href="fasc_dtds.xml"/> + <xi:include href="header_tags.xml"/> + <xi:include href="block_tags.xml"/> + <xi:include href="inline_tags.xml"/> + <xi:include href="character_entities.xml"/> +</part> + diff --git a/lib/docbuilder/doc/src/part_notes.xml b/lib/docbuilder/doc/src/part_notes.xml new file mode 100644 index 0000000000..2f824630fb --- /dev/null +++ b/lib/docbuilder/doc/src/part_notes.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2007</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>DocBuilder Release Notes</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <description> + <p><em>Docbuilder</em> provides functionality for generating HTML + documentation for Erlang modules and Erlang/OTP applications + from XML source code and/or EDoc comments in Erlang source code.</p> + </description> + <xi:include href="notes.xml"/> +</part> + diff --git a/lib/docbuilder/doc/src/ref_man.xml b/lib/docbuilder/doc/src/ref_man.xml new file mode 100644 index 0000000000..7be8ace32f --- /dev/null +++ b/lib/docbuilder/doc/src/ref_man.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE application SYSTEM "application.dtd"> + +<application xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2007</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>DocBuilder Reference Manual</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + </header> + <description> + <p><em>DocBuilder</em> provides functionality for generating HTML + documentation for Erlang modules and Erlang/OTP applications + from XML source code and/or EDoc comments in Erlang source code.</p> + </description> + <xi:include href="docbuilder_app.xml"/> + <xi:include href="docb_gen.xml"/> + <xi:include href="docb_transform.xml"/> + <xi:include href="docb_xml_check.xml"/> +</application> + diff --git a/lib/docbuilder/doc/src/refman_dtds.xml b/lib/docbuilder/doc/src/refman_dtds.xml new file mode 100644 index 0000000000..a7beaed708 --- /dev/null +++ b/lib/docbuilder/doc/src/refman_dtds.xml @@ -0,0 +1,667 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Reference Manual DTDs</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>refman_dtds.xml</file> + </header> + + <p>There are five DTDs for writing manual pages about applications, + shell commands, C libraries, Erlang modules and files, all with a + similar structure:</p> + + <list type="bulleted"> + <item>A header.</item> + <item>Name of the application/command/library/module/file.</item> + <item>Short summary (one line).</item> + <item>A longer description.</item> + <item>"Formal" definitions of functions or commands.</item> + <item>Optional sections of free text.</item> + <item>Optional section with the name(s) and email(s) of the author(s).</item> + </list> + + <p>The differences between the DTDs are the tags for the name, + the short summary and some tags inside the "formal" definitions.</p> + + <section> + <marker id="applicationDTD"></marker> + <title>The application DTD</title> + + <p>The <c>application</c> DTD is intended for a Reference Manual and + groups a set of manual pages into one unit. The structure is + similar to the part DTD: first an introduction and then the manual + pages, written in separate files with the + <seealso marker="#apprefDTD">appref</seealso>, + <seealso marker="#comrefDTD">comref</seealso>, + <seealso marker="#crefDTD">cref</seealso>, + <seealso marker="#erlrefDTD">erlref</seealso>, or + <seealso marker="#filerefDTD">fileref</seealso> DTD.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE application SYSTEM "application.dtd"> +<application> + <header> + <title>Application name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <description> + <p>Application description...</p> + </description> + + <include file="module1"> + <include file="module2"> +</application> + </pre> + </section> + + <section> + <marker id="applicationTAG"></marker> + <title><application></title> + + <p>The top level tag of an <c>application</c> DTD.</p> + + <p>Contains a + <seealso marker="header_tags"><header></seealso>, + an optional + <seealso marker="user_guide_dtds#descriptionTAG"><description></seealso>, + followed by one or more + <seealso marker="user_guide_dtds#includeTAG"><include></seealso>. + </p> + </section> + + <section> + <marker id="apprefDTD"></marker> + <title>The appref DTD</title> + + <p>This is the DTD for writing an application manual page.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE appref SYSTEM "appref.dtd"> +<appref> + <header> + <title>Application name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <app>Application name</app> + + <appsummary>A short application summary.</appsummary> + + <description> + <p>A longer description of the application.</p> + </description> + + <section> + <title>Configuration</title> + + <p>...</p> + </section> + + ... + + <authors> + <aname>Name of author</aname> + <email>Email of author</email> + </authors> +</appref> + </pre> + + <section> + <marker id="apprefTAG"></marker> + <title><appref></title> + + <p>The top level tag of an <c>appref</c> DTD.</p> + + <p>Contains + <seealso marker="header_tags#headerTAG"><header></seealso>, + <seealso marker="#appTAG"><app></seealso>, + <seealso marker="#appsummaryTAG"><appsummary></seealso>, + <seealso marker="#descriptionTAG"><description></seealso>, + zero or more + <seealso marker="#sectionTAG"><section></seealso> and + <seealso marker="#funcsTAG"><funcs></seealso>, + followed by zero or more + <seealso marker="#authorsTAG"><authors></seealso>.</p> + </section> + + <section> + <marker id="appTAG"></marker> + <title><app></title> + + <p>The application name. Contains plain text.</p> + </section> + + <section> + <marker id="appsummaryTAG"></marker> + <title><appsummary></title> + + <p>Short summary. Contains plain text.</p> + </section> + </section> + + <section> + <marker id="comrefDTD"></marker> + <title>The comref DTD</title> + + <p>This is the DTD for writing a command manual page.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE comref SYSTEM "comref.dtd"> +<comref> + <header> + <title>Command name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <com>Command name</com> + + <comsummary>A short command summary.</comsummary> + + <description> + <p>A long description of the command.</p> + </description> + + <funcs> + <func> + <name>command</name> + <name>command -flag <arg></name> + <fsummary>A short command summary (max 40 characters).</fsummary> + <desc> + <p>An extended command description. + </desc> + </func> + </funcs> + + <section> + <title>Options</title> + + <p>...</p> + </section> + + <authors> + <aname>Name of author</aname> + <email>Email of author</email> + </authors> +</comref> + </pre> + + <section> + <marker id="comrefTAG"></marker> + <title><comref></title> + + <p>The top level tag for a <c>comref</c> DTD.</p> + + <p>Contains + <seealso marker="header_tags#headerTAG"><header></seealso>, + <seealso marker="#comTAG"><com></seealso>, + <seealso marker="#comsummaryTAG"><comsummary></seealso>, + <seealso marker="#descriptionTAG"><description></seealso>, + zero or more + <seealso marker="#sectionTAG"><section></seealso> and + <seealso marker="#funcsTAG"><funcs></seealso>, + followed by zero or more + <seealso marker="#authorsTAG"><authors></seealso>.</p> + </section> + + <section> + <marker id="comTAG"></marker> + <title><com></title> + + <p>The command name. Contains plain text.</p> + </section> + + <section> + <marker id="comsummaryTAG"></marker> + + <title><comsummary></title> + + <p>Short summary. Contains plain text.</p> + </section> + </section> + + <section> + <marker id="crefDTD"></marker> + <title>The cref DTD</title> + + <p>This is the DTD for writing a C library manual page.</p> + + <p>Example:</p> + <pre><![CDATA[ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE cref SYSTEM "cref.dtd"> +<cref> + <header> + <title>C library name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <lib>C library name</lib> + + <libsummary>A short C library summary.</libsummary> + + <description> + <p>A longer description of the C library.</p> + </description> + + <funcs> + <func> + <name><ret>void</ret><nametext>start(bar)</nametext></name> + <name><ret>void</ret><nametext>start(foo)</nametext></name> + <fsummary>A short function summary (max 40 characters).</fsummary> + <type> + <v>char bar</v> + <v>int foo</v> + </type> + <desc> + <p>An extended function description.</p> + </desc> + </func> + + ... + </funcs> + + <section> + <title>A title</title> + + <p>Some text...</p> + </section> + + +</cref> + ]]></pre> + + <section> + <marker id="crefTAG"></marker> + <title><cref></title> + + <p>The top level tag for a <c>cref</c> DTD.</p> + + <p>Contains + <seealso marker="header_tags#headerTAG"><header></seealso>, + <seealso marker="#libTAG"><lib></seealso>, + <seealso marker="#libsummaryTAG"><libsummary></seealso>, + <seealso marker="#descriptionTAG"><description></seealso>, + zero or more + <seealso marker="#sectionTAG"><section></seealso> and + <seealso marker="#funcsTAG"><funcs></seealso>, followed by + zero or more + <seealso marker="#authorsTAG"><authors></seealso>.</p> + </section> + + <section> + <marker id="libTAG"></marker> + <title><lib></title> + + <p>The C library name or acronym. Contains plain text.</p> + </section> + + <section> + <marker id="libsummaryTAG"></marker> + <title><libsummary></title> + + <p>Short summary. Contains plain text.</p> + </section> + </section> + + <section> + <marker id="erlrefDTD"></marker> + <title>The erlref DTD</title> + + <p>This is the DTD for writing Erlang module manual pages.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> +<erlref> + <header> + <title>Module name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <module>Module name</module> + + <modulesummary>A short module summary.</modulesummary> + + <description> + <p>A longer description of the module.</p> + </description> + + <funcs> + <func> + <name>start() -> Result</name> + <name>start(N) -> Result</name> + <fsummary>A short function summary (max 40 characters).</fsummary> + <type> + <v>Pid = pid()</v> + <v>N = int()</v> + <v>Result = {ok, Pid} | {error, Reason}</v> + <v>Reason = term()</v> + <d>A parameter description.</d> + </type> + <desc> + <p>An extended function description.</p> + </desc> + </func> + + ... + </funcs> + + <section> + <title>Some Title</title> + <p>Some text...</p> + </section> + + <authors> + <aname>Name of author</aname> + <email>Email of author</email> + </authors> +</erlref> + </pre> + + <section> + <marker id="erlrefTAG"></marker> + <title><erlref></title> + + <p>The top level tag for an <c>erlref</c> DTD.</p> + + <p>Contains + <seealso marker="header_tags#headerTAG"><header></seealso>, + <seealso marker="#moduleTAG"><module></seealso>, + <seealso marker="#modulesummaryTAG"><modulesummary></seealso>, + <seealso marker="#descriptionTAG"><description></seealso>, + zero or more + <seealso marker="#sectionTAG"><section></seealso> and + <seealso marker="#funcsTAG"><funcs></seealso>, + followed by zero or more + <seealso marker="#authorsTAG"><authors></seealso>.</p> + </section> + + <section> + <marker id="moduleTAG"></marker> + <title><module></title> + + <p>The module name. Contains plain text.</p> + </section> + + <section> + <marker id="modulesummaryTAG"></marker> + <title><modulesummary></title> + + <p>Short summary. Contains plain text.</p> + </section> + </section> + + <section> + <marker id="filerefDTD"></marker> + <title>The fileref DTD</title> + + <p>This is the DTD for writing file manual pages. In OTP, this DTD + is used for defining the format of for example <c>.rel</c> and + <c>.app</c> files.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE fileref SYSTEM "fileref.dtd"> +<fileref> + <header> + <title>File name</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <file>fileref</file> + + <filesummary>A short file summary.</filesummary> + + <description> + <p>A longer description of the file.</p> + </description> + + <section> + <title>File format</title> + + <p>...</p> + </section> + + <authors> + <aname>Name of author</aname> + <email>Email of author</email> + </authors> +</fileref> + </pre> + + <p>The file reference manual can also contain function definitions, + similar to the <c>erlref</c> DTD.</p> + + <section> + <marker id="filerefTAG"></marker> + <title><fileref></title> + + <p>The top level tag for a <c>fileref</c> DTD.</p> + + <p>Contains + <seealso marker="header_tags#headerTAG"><header></seealso>, + <seealso marker="#fileTAG"><file></seealso>, + <seealso marker="#filesummaryTAG"><filesummary></seealso>, + <seealso marker="#descriptionTAG"><description></seealso>, + zero or more + <seealso marker="#sectionTAG"><section></seealso> and + <seealso marker="#funcsTAG"><funcs></seealso>, + followed by zero or more + <seealso marker="#authorsTAG"><authors></seealso>.</p> + </section> + + <section> + <marker id="fileTAG"></marker> + <title><file></title> + + <p>The name of the file or file type. Contains plain text.</p> + </section> + + <section> + <marker id="filesummaryTAG"></marker> + <title><filesummary></title> + + <p>Short summary. Contains plain text.</p> + </section> + </section> + + <section> + <marker id="descriptionTAG"></marker> + <title><description></title> + + <p>The introduction after the title and before sections and + "formal" definitions.</p> + + <p>Contains any combination and any number of + <seealso marker="block_tags">block tags</seealso> except + <c><![CDATA[<image>]]></c> and <c><![CDATA[<table>]]></c>.</p> + </section> + + <section> + <marker id="sectionTAG"></marker> + <title><section></title> + + <p>Subdivisions of the document. Contains an optional + <seealso marker="inline_tags#markerTAG"><marker></seealso>, + a <seealso marker="user_guide_dtds#titleTAG"><title></seealso>, + + followed by any combination and any number of + <seealso marker="block_tags">block tags</seealso> except + <c><![CDATA[<image>]]></c> and <c><![CDATA[<table>]]></c>.</p> + </section> + + <section> + <marker id="funcsTAG"></marker> + <title><funcs></title> + + <p>A group of "formal" function definitions.</p> + + <p>Contains one or more + <seealso marker="#funcTAG"><func></seealso>.</p> + </section> + + <section> + <marker id="funcTAG"></marker> + <title><func></title> + + <p>A "formal" function definition.</p> + + <p>Contains one or more + <seealso marker="#nameTAG"><name></seealso>, followed by + <seealso marker="#fsummaryTAG"><fsummary></seealso>, + <seealso marker="#typeTAG"><type></seealso> (optional) and + <seealso marker="#descTAG"><desc></seealso> (optional).</p> + </section> + + <section> + <marker id="nameTAG"></marker> + <title><name></title> + + <p>Function/command signature with name, arguments and return value. + Contains plain text, except for the <c>cref</c> DTD where it + contains a <c><![CDATA[<ret>]]></c> (return type, plain text) and + a <c><![CDATA[<nametext>]]></c> (function name and arguments, + plain text).</p> + + <p>In the case of an <c>erlref</c> DTD, DocBuilder will + automatically try to add a + <seealso marker="inline_tags#markerTAG">marker</seealso>, + <c><![CDATA[<marker id="Name/Arity">]]></c> or + <c><![CDATA[<marker id="Name">]]></c>, based on the contents of + this tag before the function definition.</p> + + <p>Example: Consider the following name definition</p> + <pre><![CDATA[ +<name>foo(Arg1, Arg2) -> ok | {error, Reason}</name> + ]]></pre> + + <p>DocBuilder will create a marker + <c><![CDATA[<marker id="foo/2">]]></c> before the function + definition in the generated HTML. That is, referring to + the function using + <c><![CDATA[<seealso marker="#foo/2">foo/2</seealso>]]></c> will + automatically work.</p> + </section> + + <section> + <marker id="fsummaryTAG"></marker> + <title><fsummary></title> + + <p>Function/command summary. Contains plain text, + <seealso marker="inline_tags#cTAG"><c></seealso> and + <seealso marker="inline_tags#emTAG"><em></seealso>.</p> + </section> + + <section> + <marker id="typeTAG"></marker> + <title><type></title> + + <p>Type declarations for the function/command.</p> + + <p>Contains one or more pairs of + <seealso marker="#vTAG"><v></seealso> and + <seealso marker="#dTAG"><d></seealso> (optional).</p> + </section> + + <section> + <marker id="vTAG"></marker> + <title><v></title> + + <p>Type declaration for an argument or return value. Contains plain + text.</p> + </section> + + <section> + <marker id="dTAG"></marker> + <title><d></title> + + <p>Description for an argument or return value. Contains plain text, + <seealso marker="inline_tags#cTAG"><c></seealso> and + <seealso marker="inline_tags#emTAG"><em></seealso>.</p> + </section> + + <section> + <marker id="descTAG"></marker> + <title><desc></title> + + <p>Function/command description. Contains + <seealso marker="block_tags">block tags</seealso> except + <c><image></c> and <c><table></c>.</p> + </section> + + <section> + <marker id="authorsTAG"></marker> + <title><authors></title> + + <p>Authors of the manual page. The <c>authors</c> element is optional.</p> + + <p>Contains one or more pairs of + <seealso marker="#anameTAG"><aname></seealso> and + <seealso marker="#emailTAG"><email></seealso>.</p> + </section> + + <section> + <marker id="anameTAG"></marker> + <title><aname></title> + + <p>Author name. Contains plain text.</p> + </section> + + <section> + <marker id="emailTAG"></marker> + <title><email></title> + + <p>Author email address. Contains plain text.</p> + </section> +</chapter> + diff --git a/lib/docbuilder/doc/src/user_guide_dtds.xml b/lib/docbuilder/doc/src/user_guide_dtds.xml new file mode 100644 index 0000000000..a2db44f830 --- /dev/null +++ b/lib/docbuilder/doc/src/user_guide_dtds.xml @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>1997</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>User's Guide DTDs</title> + <prepared></prepared> + <docno></docno> + <date></date> + <rev></rev> + <file>user_guide_dtds.xml</file> + </header> + + <section> + <marker id="partDTD"></marker> + <title>The part DTD</title> + + <p>The <c>part</c> DTD is intended for a "normal" document, like + the User's Guide or Release Notes. First are some paragraphs + introducing the main contents. After that follows chapters, + written in separate files with + the <seealso marker="#chapterDTD">chapter</seealso> DTD.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> +<part> + <header> + <title>The chapter title</title> + <prepared>The author</prepared> + <docno/> + <date/> + <rev/> + </header> + + <description> + <p>Some text..</p> + </description> + + <include file="file1"></include> + <include file="file2"></include> +</part> + </pre> + </section> + + <section> + <marker id="partTAG"></marker> + <title><part></title> + + <p>The top level tag of a <c>part</c> DTD.</p> + + <p>Contains a + <seealso marker="header_tags"><header></seealso>, + an optional + <seealso marker="#descriptionTAG"><description></seealso>, + followed by one or more + <seealso marker="#includeTAG"><include></seealso>.</p> + </section> + + <section> + <marker id="descriptionTAG"/> + <title><description></title> + + <p>The introduction after the title and before the bulk of + included chapters/manual pages.</p> + + <p>Contains any combination and any number + of <seealso marker="block_tags">block tags</seealso> except + <c><![CDATA[<image>]]></c> and <c><![CDATA[<table>]]></c>.</p> + </section> + + <section> + <marker id="includeTAG"></marker> + <title><include></title> + + <p>An empty tag. The attribute <c>file</c> specifies a file to + include. The <c>.xml</c> file extension should be omitted.</p> + + <p>Example:</p> + <pre> +<include file="notes"></include> + </pre> + </section> + + <section> + <marker id="chapterDTD"></marker> + <title>The chapter DTD</title> + + <p>The <c>chapter</c> DTD is intended for a chapter in a User's + Guide or similar with text divided into sections, which can be + nested.</p> + + <p>Example:</p> + <pre> +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<chapter> + <header> + <title>Title on first level</title> + <prepared/> + <docno/> + <date/> + <rev/> + </header> + + <p>Introduction...</p> + + <section> + <title>Title on second level</title> + + <p>First paragraph.</p> + + <p>Second paragraph etc.</p> + + <section> + <title>Title on third level</title> + + <p>...</p> + </section> + </section> + + ... +</chapter> + </pre> + </section> + + <section> + <marker id="chapterTAG"></marker> + <title><chapter></title> + + <p>The top level tag of a <c>chapter</c> DTD.</p> + + <p>Contains a + <seealso marker="header_tags"><header></seealso>, + an optional introduction consisting of any combination of + <seealso marker="block_tags">block tags</seealso>, + followed by one or more + <seealso marker="#sectionTAG"><section></seealso>.</p> + </section> + + <section> + <marker id="sectionTAG"></marker> + <title><section></title> + + <p>Subdivision of a chapter.</p> + + <p>Contains an optional + <seealso marker="inline_tags#markerTAG"><marker></seealso>, + a <seealso marker="#titleTAG"><title></seealso>, + followed by any combination and any number of + <seealso marker="block_tags">block tags</seealso> and + <c><![CDATA[<section>]]></c>.</p> + </section> + + <section> + <marker id="titleTAG"></marker> + <title><title></title> + + <p>Section title, contains plain text.</p> + </section> +</chapter> + diff --git a/lib/docbuilder/dtd/Makefile b/lib/docbuilder/dtd/Makefile new file mode 100644 index 0000000000..05c656f3fc --- /dev/null +++ b/lib/docbuilder/dtd/Makefile @@ -0,0 +1,91 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999-2000, Ericsson +# Utvecklings AB. All Rights Reserved.'' +# +# $Id$ +# + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(DOCB_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/docbuilder-$(VSN) + +# ---------------------------------------------------- +# Common Macros +# ---------------------------------------------------- + +DTD_FILES = \ + application.dtd \ + appref.dtd \ + book.dtd \ + bookinsidecover.dtd \ + chapter.dtd \ + cites.dtd \ + common.dtd \ + common.entities.dtd \ + common.header.dtd \ + common.image.dtd \ + common.refs.dtd \ + common.table.dtd \ + comref.dtd \ + cref.dtd \ + erlref.dtd \ + fascicules.dtd \ + fileref.dtd \ + part.dtd \ + report.dtd \ + terms.dtd \ + xhtml-lat1.ent \ + xhtml-special.ent \ + xhtml-symbol.ent \ + xhtml1-frameset.dtd \ + xhtml1-strict.dtd \ + xhtml1-transitional.dtd + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +debug opt: + +clean: + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: + $(INSTALL_DIR) $(RELSYSDIR)/dtd + $(INSTALL_DATA) $(DTD_FILES) $(RELSYSDIR)/dtd + +release_docs_spec: + + + + + + + diff --git a/lib/docbuilder/dtd/application.dtd b/lib/docbuilder/dtd/application.dtd new file mode 100644 index 0000000000..8a1e8832ec --- /dev/null +++ b/lib/docbuilder/dtd/application.dtd @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common SYSTEM "common.dtd" > +%common; +<!ENTITY % common.header SYSTEM "common.header.dtd" > +%common.header; + +<!ELEMENT application (header,description?,include+) > +<!ELEMENT description (%block;|quote|br|marker|warning|note)* > +<!ELEMENT include EMPTY > +<!ATTLIST include file CDATA #REQUIRED> diff --git a/lib/docbuilder/dtd/appref.dtd b/lib/docbuilder/dtd/appref.dtd new file mode 100644 index 0000000000..70a5ff37af --- /dev/null +++ b/lib/docbuilder/dtd/appref.dtd @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common.refs SYSTEM "common.refs.dtd" > +%common.refs; + +<!-- Structure --> + +<!ELEMENT appref (header,app,appsummary,description, + (section|funcs)*,authors?) > +<!ELEMENT app (#PCDATA) > +<!ELEMENT appsummary (#PCDATA) > + +<!-- `name' is used in common.refs.dtd and must therefore + be defined in each *ref. dtd --> +<!ELEMENT name (#PCDATA) > diff --git a/lib/docbuilder/dtd/book.dtd b/lib/docbuilder/dtd/book.dtd new file mode 100644 index 0000000000..bb89a6d255 --- /dev/null +++ b/lib/docbuilder/dtd/book.dtd @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common SYSTEM "common.dtd" > +%common; +<!ENTITY % common.header SYSTEM "common.header.dtd" > +%common.header; +<!ENTITY % common.table SYSTEM "common.table.dtd" > +%common.table; + +<!ELEMENT book (header, + insidecover?, + pagetext, + preamble, + (applications|parts|headline|pagetext)+, + (listoffigures?, + listoftables?, + listofterms?, + bibliography?, + index?)) > + +<!ELEMENT pagetext (#PCDATA) > +<!ELEMENT preamble (contents?,preface?) > +<!ELEMENT preface (title?,(%block;|quote|br|marker|warning|note|table)*) > + +<!ELEMENT insidecover (#PCDATA|br|theheader|vfill|vspace|tt|bold| + include)* > +<!ELEMENT tt (#PCDATA|br|theheader|vfill)* > +<!ELEMENT bold (#PCDATA|br|theheader|vfill)* > +<!ELEMENT vfill EMPTY > +<!ELEMENT theheader EMPTY > +<!ATTLIST theheader tag (title|prepared|responsible|docno| + approved|checked|date|rev|file| + abbreviation| + none) "none" > + + +<!ELEMENT applications (include)* > +<!ELEMENT parts (title?,description?,(include|onepart)*) > +<!ATTLIST parts lift (yes|no) "no" > +<!ELEMENT headline (#PCDATA) > +<!ELEMENT index EMPTY > +<!ELEMENT listoffigures EMPTY > +<!ELEMENT listoftables EMPTY > +<!ELEMENT listofterms EMPTY > +<!ELEMENT bibliography EMPTY > +<!ELEMENT contents EMPTY > +<!ATTLIST contents level (0|1|2|3) "2"> + +<!ELEMENT onepart (title?,description?,include+) > +<!ATTLIST onepart lift (yes|no) "no" > + +<!ELEMENT description (%block;|quote|br|marker|warning|note)* > + +<!ELEMENT include EMPTY > +<!ATTLIST include file CDATA #REQUIRED> diff --git a/lib/docbuilder/dtd/bookinsidecover.dtd b/lib/docbuilder/dtd/bookinsidecover.dtd new file mode 100644 index 0000000000..d6efbef6a4 --- /dev/null +++ b/lib/docbuilder/dtd/bookinsidecover.dtd @@ -0,0 +1,36 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > + +<!ELEMENT bookinsidecover (#PCDATA|br|theheader|vfill|tt|bold)* > + +<!ELEMENT tt (#PCDATA|br|theheader|vfill)* > +<!ELEMENT bold (#PCDATA|br|theheader|vfill)* > +<!ELEMENT vfill EMPTY > +<!ELEMENT theheader EMPTY > +<!ATTLIST theheader tag (title|prepared|responsible|docno| + approved|checked|date|rev|file| + none) "none" > + +<!ELEMENT br EMPTY > diff --git a/lib/docbuilder/dtd/chapter.dtd b/lib/docbuilder/dtd/chapter.dtd new file mode 100644 index 0000000000..eb2c96b04f --- /dev/null +++ b/lib/docbuilder/dtd/chapter.dtd @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common SYSTEM "common.dtd" > +%common; +<!ENTITY % common.header SYSTEM "common.header.dtd" > +%common.header; +<!ENTITY % common.table SYSTEM "common.table.dtd" > +%common.table; +<!ENTITY % common.image SYSTEM "common.image.dtd" > +%common.image; + +<!-- Structure --> + +<!ELEMENT chapter (header,(%block;|quote|warning|note|br| + image|marker|table)*,section+) > +<!ELEMENT section (marker*,title, + (%block;|quote|warning|note|br|image|marker| + table|section)*) > diff --git a/lib/docbuilder/dtd/cites.dtd b/lib/docbuilder/dtd/cites.dtd new file mode 100644 index 0000000000..334574bff9 --- /dev/null +++ b/lib/docbuilder/dtd/cites.dtd @@ -0,0 +1,35 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > + +<!-- Structure --> + +<!ELEMENT cites (cite)* > +<!ELEMENT cite (id, shortdef, def, resp?) > +<!ELEMENT id (#PCDATA) > +<!ELEMENT shortdef (#PCDATA) > +<!ELEMENT def (#PCDATA|c|em)* > +<!ELEMENT resp (#PCDATA) > +<!ELEMENT c (#PCDATA) > +<!ELEMENT em (#PCDATA|c)* > diff --git a/lib/docbuilder/dtd/common.dtd b/lib/docbuilder/dtd/common.dtd new file mode 100644 index 0000000000..2c4ad51ab1 --- /dev/null +++ b/lib/docbuilder/dtd/common.dtd @@ -0,0 +1,87 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!-- This file contains common stuff for all dtds. --> + +<!ENTITY % common.entities SYSTEM "common.entities.dtd" > +%common.entities; + +<!ENTITY % block "p|pre|code|list|taglist|codeinclude| + erleval" > +<!ENTITY % inline "#PCDATA|c|em|term|cite|br|path|seealso| + url|marker" > +<!-- XXX --> +<!ELEMENT p (%inline;)* > +<!ELEMENT pre (#PCDATA|seealso|url|input)* > +<!ELEMENT input (#PCDATA|seealso|url)* > +<!ELEMENT code (#PCDATA) > +<!ATTLIST code type (erl|c|none) "none" > +<!ELEMENT quote (p)* > +<!ELEMENT warning (%block;|quote|br|marker)* > +<!ELEMENT note (%block;|quote|br|marker)* > +<!ELEMENT c (#PCDATA) > +<!ELEMENT em (#PCDATA|c)* > + +<!-- XXX --> +<!ELEMENT term (termdef?) > +<!ATTLIST term id CDATA #REQUIRED > +<!ELEMENT termdef (#PCDATA) > +<!ELEMENT cite (citedef?) > +<!ATTLIST cite id CDATA #REQUIRED > +<!ELEMENT citedef (ctitle,cauthor,chowpublished) > +<!ELEMENT ctitle (#PCDATA) > +<!ELEMENT cauthor (#PCDATA) > +<!ELEMENT chowpublished (#PCDATA) > + +<!-- XXX --> +<!ELEMENT br EMPTY > + +<!-- Path --> + +<!ELEMENT path (#PCDATA) > +<!ATTLIST path unix CDATA "" + windows CDATA "" > + +<!-- List --> + +<!ELEMENT list (item+) > +<!ATTLIST list type (ordered|bulleted) "bulleted" > +<!ELEMENT taglist (tag,item)+ > +<!ELEMENT tag (#PCDATA|c|em|seealso|url)* > +<!ELEMENT item (%inline;|%block;)* > + +<!-- References --> + +<!ELEMENT seealso (#PCDATA) > +<!ATTLIST seealso marker CDATA #REQUIRED > +<!ELEMENT url (#PCDATA) > +<!ATTLIST url href CDATA #REQUIRED > +<!ELEMENT marker EMPTY > +<!ATTLIST marker id CDATA #REQUIRED > + +<!-- CodeInclude --> + +<!ELEMENT codeinclude EMPTY > +<!ATTLIST codeinclude file CDATA #REQUIRED + tag CDATA "" + type (erl|c|none) "none" > + +<!-- ErlEval --> + +<!ELEMENT erleval EMPTY > +<!ATTLIST erleval expr CDATA #REQUIRED > diff --git a/lib/docbuilder/dtd/common.entities.dtd b/lib/docbuilder/dtd/common.entities.dtd new file mode 100644 index 0000000000..f893ecd070 --- /dev/null +++ b/lib/docbuilder/dtd/common.entities.dtd @@ -0,0 +1,24 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > diff --git a/lib/docbuilder/dtd/common.header.dtd b/lib/docbuilder/dtd/common.header.dtd new file mode 100644 index 0000000000..d422a89693 --- /dev/null +++ b/lib/docbuilder/dtd/common.header.dtd @@ -0,0 +1,42 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ELEMENT header (copyright?,legalnotice?,title,shorttitle?, + prepared,responsible?,docno,approved?, + checked?,date,rev,file?) > + +<!-- +The titlestyle attribute is only defined to make all the book.xml files +go through the validation. The attribute is not used for anything +--> +<!ATTLIST header titlestyle (special|normal) "normal"> + +<!ELEMENT title (#PCDATA) > +<!ELEMENT shorttitle (#PCDATA) > +<!ELEMENT prepared (#PCDATA) > +<!ELEMENT responsible (#PCDATA) > +<!ELEMENT docno (#PCDATA) > +<!ELEMENT approved (#PCDATA) > +<!ELEMENT checked (#PCDATA) > +<!ELEMENT copyright (year+,holder*) > +<!ELEMENT legalnotice (#PCDATA) > +<!ELEMENT date (#PCDATA) > +<!ELEMENT rev (#PCDATA) > +<!ELEMENT file (#PCDATA) > +<!ELEMENT year (#PCDATA) > +<!ELEMENT holder (#PCDATA) > diff --git a/lib/docbuilder/dtd/common.image.dtd b/lib/docbuilder/dtd/common.image.dtd new file mode 100644 index 0000000000..fc95a669dd --- /dev/null +++ b/lib/docbuilder/dtd/common.image.dtd @@ -0,0 +1,21 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ELEMENT image (icaption) > +<!ATTLIST image file CDATA #REQUIRED > +<!ELEMENT icaption (#PCDATA) > diff --git a/lib/docbuilder/dtd/common.refs.dtd b/lib/docbuilder/dtd/common.refs.dtd new file mode 100644 index 0000000000..7b9974fbda --- /dev/null +++ b/lib/docbuilder/dtd/common.refs.dtd @@ -0,0 +1,40 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!-- This file contains common stuff for the *ref.dtd files. + Note that `name' is defined in each *ref.dtd. --> + +<!ENTITY % common SYSTEM "common.dtd" > +%common; +<!ENTITY % common.header SYSTEM "common.header.dtd" > +%common.header; + +<!ELEMENT description (%block;|quote|br|marker|warning|note)* > +<!ELEMENT funcs (func)+ > +<!ELEMENT func (name+,fsummary,type?,desc?) > +<!-- ELEMENT name is defined in each ref dtd --> +<!ELEMENT fsummary (#PCDATA|c|em)* > +<!ELEMENT type (v,d?)+ > +<!ELEMENT v (#PCDATA) > +<!ELEMENT d (#PCDATA|c|em)* > +<!ELEMENT desc (%block;|quote|br|marker|warning|note)* > +<!ELEMENT authors (aname,email)+ > +<!ELEMENT aname (#PCDATA) > +<!ELEMENT email (#PCDATA) > +<!ELEMENT section (marker*,title,(%block;|quote|br|marker| + warning|note)*) > diff --git a/lib/docbuilder/dtd/common.table.dtd b/lib/docbuilder/dtd/common.table.dtd new file mode 100644 index 0000000000..7741da1018 --- /dev/null +++ b/lib/docbuilder/dtd/common.table.dtd @@ -0,0 +1,25 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ELEMENT table (row+,tcaption) > +<!ATTLIST table align (left|center|right) "center" > +<!ELEMENT row (cell+) > +<!ELEMENT cell (%inline;)* > +<!ATTLIST cell align (left|center|right) "left" + valign (top|middle|bottom) "middle" > +<!ELEMENT tcaption (#PCDATA) > diff --git a/lib/docbuilder/dtd/comref.dtd b/lib/docbuilder/dtd/comref.dtd new file mode 100644 index 0000000000..fcdea625d5 --- /dev/null +++ b/lib/docbuilder/dtd/comref.dtd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common.refs SYSTEM "common.refs.dtd" > +%common.refs; + +<!ELEMENT comref (header,com,comsummary,description, + (section|funcs)*,authors?) > +<!ELEMENT com (#PCDATA) > +<!ELEMENT comsummary (#PCDATA) > + +<!-- `name' is used in common.refs.dtd and must therefore + be defined in each *ref. dtd --> +<!ELEMENT name (#PCDATA) > diff --git a/lib/docbuilder/dtd/cref.dtd b/lib/docbuilder/dtd/cref.dtd new file mode 100644 index 0000000000..e43bb2bf51 --- /dev/null +++ b/lib/docbuilder/dtd/cref.dtd @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common.refs SYSTEM "common.refs.dtd" > +%common.refs; + +<!ELEMENT cref (header,lib,libsummary,description, + (section|funcs)*,authors?) > +<!ELEMENT lib (#PCDATA) > +<!ELEMENT libsummary (#PCDATA) > + +<!-- `name' is used in common.refs.dtd and must therefore + be defined in each *ref. dtd --> +<!ELEMENT name (ret,nametext) > +<!ELEMENT ret (#PCDATA) > +<!ELEMENT nametext (#PCDATA) > + diff --git a/lib/docbuilder/dtd/erlref.dtd b/lib/docbuilder/dtd/erlref.dtd new file mode 100644 index 0000000000..21656a1446 --- /dev/null +++ b/lib/docbuilder/dtd/erlref.dtd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common.refs SYSTEM "common.refs.dtd" > +%common.refs; + +<!ELEMENT erlref (header,module,modulesummary,description, + (section|funcs)*,authors?) > +<!ELEMENT module (#PCDATA) > +<!ELEMENT modulesummary (#PCDATA) > + +<!-- `name' is used in common.refs.dtd and must therefore + be defined in each *ref. dtd --> +<!ELEMENT name (#PCDATA) > diff --git a/lib/docbuilder/dtd/fascicules.dtd b/lib/docbuilder/dtd/fascicules.dtd new file mode 100644 index 0000000000..b14276a2c0 --- /dev/null +++ b/lib/docbuilder/dtd/fascicules.dtd @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > + +<!-- Structure --> + +<!ELEMENT fascicules (fascicule)+ > +<!ELEMENT fascicule (#PCDATA) > +<!ATTLIST fascicule file CDATA #REQUIRED + href CDATA #REQUIRED + entry (yes|no) "no" > + diff --git a/lib/docbuilder/dtd/fileref.dtd b/lib/docbuilder/dtd/fileref.dtd new file mode 100644 index 0000000000..5a1cc54afe --- /dev/null +++ b/lib/docbuilder/dtd/fileref.dtd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common.refs SYSTEM "common.refs.dtd" > +%common.refs; + +<!ELEMENT fileref (header,file,filesummary,description, + (section|funcs)*,authors?) > +<!-- Note: ELEMENT file is already defined --> +<!ELEMENT filesummary (#PCDATA) > + +<!-- `name' is used in common.refs.dtd and must therefore + be defined in each *ref. dtd --> +<!ELEMENT name (#PCDATA) > diff --git a/lib/docbuilder/dtd/part.dtd b/lib/docbuilder/dtd/part.dtd new file mode 100644 index 0000000000..3f97199042 --- /dev/null +++ b/lib/docbuilder/dtd/part.dtd @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % common SYSTEM "common.dtd" > +%common; +<!ENTITY % common.header SYSTEM "common.header.dtd" > +%common.header; + +<!ELEMENT part (header,description?,include+) > +<!ELEMENT description (%block;|quote|br|marker|warning|note)* > +<!ELEMENT include EMPTY > +<!ATTLIST include file CDATA #REQUIRED> diff --git a/lib/docbuilder/dtd/report.dtd b/lib/docbuilder/dtd/report.dtd new file mode 100644 index 0000000000..3d07e6e5a7 --- /dev/null +++ b/lib/docbuilder/dtd/report.dtd @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> + +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > + +<!ENTITY % header "title,prepared,responsible,docno,approved, + checked,date,rev,file" > +<!ENTITY % block "p|pre|code|list|taglist|erlinclude| + codeinclude|erleval" > +<!ENTITY % inline "#PCDATA|i|b|c|em|term|cite|br|path|seealso| + url|marker" > + +<!-- Structure --> + +<!ELEMENT report (header,section+) > +<!ELEMENT header (title,prepared,responsible?,docno,approved?, + checked?,date,rev,file?) > +<!ELEMENT title (#PCDATA) > +<!ELEMENT prepared (#PCDATA) > +<!ELEMENT responsible (#PCDATA) > +<!ELEMENT docno (#PCDATA) > +<!ELEMENT approved (#PCDATA) > +<!ELEMENT checked (#PCDATA) > +<!ELEMENT date (#PCDATA) > +<!ELEMENT rev (#PCDATA) > +<!ELEMENT file (#PCDATA) > + +<!ELEMENT section (marker*,title, + (%block;|quote|warning|note|br|image|marker| + table|section)*) > +<!ELEMENT p (%inline;|index)* > +<!ELEMENT pre (#PCDATA|seealso|url|input)* > +<!ELEMENT input (#PCDATA|seealso|url)* > +<!ELEMENT code (#PCDATA) > +<!ATTLIST code type (erl|c|none) "none" > +<!ELEMENT quote (p)* > +<!ELEMENT warning (%block;|quote|br|image|marker|table)* > +<!ELEMENT note (%block;|quote|br|image|marker|table)* > +<!ELEMENT i (#PCDATA|b|c|em)* > +<!ELEMENT b (#PCDATA|i|c|em)* > +<!ELEMENT c (#PCDATA) > +<!ELEMENT em (#PCDATA|i|b|c)* > +<!ELEMENT term (termdef?) > +<!ATTLIST term id CDATA #REQUIRED > +<!ELEMENT termdef (#PCDATA) > +<!ELEMENT cite (citedef?) > +<!ATTLIST cite id CDATA #REQUIRED > +<!ELEMENT citedef (ctitle,cauthor,chowpublished) > +<!ELEMENT ctitle (#PCDATA) > +<!ELEMENT cauthor (#PCDATA) > +<!ELEMENT chowpublished (#PCDATA) > +<!ELEMENT br EMPTY > + +<!-- Path --> + +<!ELEMENT path (#PCDATA) > +<!ATTLIST path unix CDATA "" + windows CDATA "" > + +<!-- List --> + +<!ELEMENT list (item+) > +<!ATTLIST list type (ordered|bulleted) "bulleted" > +<!ELEMENT taglist (tag,item)+ > +<!ELEMENT tag (#PCDATA|i|b|c|em|seealso|url)* > +<!ELEMENT item (%inline;|%block;)* > + +<!-- Image --> + +<!ELEMENT image (icaption?) > +<!ATTLIST image file CDATA #REQUIRED > +<!ELEMENT icaption (#PCDATA) > + +<!-- References --> + +<!ELEMENT seealso (#PCDATA) > +<!ATTLIST seealso marker CDATA #REQUIRED > +<!ELEMENT url (#PCDATA) > +<!ATTLIST url href CDATA #REQUIRED > +<!ELEMENT marker EMPTY > +<!ATTLIST marker id CDATA #REQUIRED > + +<!-- Table --> + +<!ELEMENT table (row+,tcaption?) > +<!ATTLIST table width CDATA "0" + colspec CDATA "" > +<!ELEMENT row (cell+) > +<!ELEMENT cell (%inline;)* > +<!ATTLIST cell align (left|center|right) "left" + valign (top|middle|bottom) "middle" > +<!ELEMENT tcaption (#PCDATA) > + +<!-- ErlInclude --> + +<!ELEMENT erlinclude EMPTY > +<!ATTLIST erlinclude file CDATA #REQUIRED + tag CDATA #REQUIRED > + +<!-- CodeInclude --> + +<!ELEMENT codeinclude EMPTY > +<!ATTLIST codeinclude file CDATA #REQUIRED + tag CDATA "" + type (erl|c|none) "none" > + +<!-- ErlEval --> + +<!ELEMENT erleval EMPTY > +<!ATTLIST erleval expr CDATA #REQUIRED > + +<!-- Index FOR COMPATIBILITY --> + +<!ELEMENT index EMPTY > +<!ATTLIST index txt CDATA #REQUIRED > + diff --git a/lib/docbuilder/dtd/terms.dtd b/lib/docbuilder/dtd/terms.dtd new file mode 100644 index 0000000000..6105ec593e --- /dev/null +++ b/lib/docbuilder/dtd/terms.dtd @@ -0,0 +1,36 @@ +<!-- + ``The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved via the world wide web at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + Portions created by Ericsson are Copyright 1999-2007, Ericsson AB. + All Rights Reserved.'' + + $Id$ +--> +<!ENTITY % ISOlat1 SYSTEM "xhtml-lat1.ent" > +%ISOlat1; + +<!ENTITY amp "&" > +<!ENTITY gt ">" > +<!ENTITY lt "<" > + +<!-- Structure --> + +<!ELEMENT terms (term)* > +<!ELEMENT term (id, shortdef, def, resp?) > +<!ELEMENT id (#PCDATA) > +<!ELEMENT shortdef (#PCDATA) > +<!ELEMENT def (#PCDATA|c|em)* > +<!ELEMENT resp (#PCDATA) > +<!ELEMENT c (#PCDATA) > +<!ELEMENT em (#PCDATA|c)* > + diff --git a/lib/docbuilder/dtd/xhtml-lat1.ent b/lib/docbuilder/dtd/xhtml-lat1.ent new file mode 100644 index 0000000000..aaae738cfc --- /dev/null +++ b/lib/docbuilder/dtd/xhtml-lat1.ent @@ -0,0 +1,196 @@ +<!-- Portions (C) International Organization for Standardization 1986 + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"> + %HTMLlat1; +--> + +<!ENTITY nbsp " "> <!-- no-break space = non-breaking space, + U+00A0 ISOnum --> +<!ENTITY iexcl "¡"> <!-- inverted exclamation mark, U+00A1 ISOnum --> +<!ENTITY cent "¢"> <!-- cent sign, U+00A2 ISOnum --> +<!ENTITY pound "£"> <!-- pound sign, U+00A3 ISOnum --> +<!ENTITY curren "¤"> <!-- currency sign, U+00A4 ISOnum --> +<!ENTITY yen "¥"> <!-- yen sign = yuan sign, U+00A5 ISOnum --> +<!ENTITY brvbar "¦"> <!-- broken bar = broken vertical bar, + U+00A6 ISOnum --> +<!ENTITY sect "§"> <!-- section sign, U+00A7 ISOnum --> +<!ENTITY uml "¨"> <!-- diaeresis = spacing diaeresis, + U+00A8 ISOdia --> +<!ENTITY copy "©"> <!-- copyright sign, U+00A9 ISOnum --> +<!ENTITY ordf "ª"> <!-- feminine ordinal indicator, U+00AA ISOnum --> +<!ENTITY laquo "«"> <!-- left-pointing double angle quotation mark + = left pointing guillemet, U+00AB ISOnum --> +<!ENTITY not "¬"> <!-- not sign = discretionary hyphen, + U+00AC ISOnum --> +<!ENTITY shy "­"> <!-- soft hyphen = discretionary hyphen, + U+00AD ISOnum --> +<!ENTITY reg "®"> <!-- registered sign = registered trade mark sign, + U+00AE ISOnum --> +<!ENTITY macr "¯"> <!-- macron = spacing macron = overline + = APL overbar, U+00AF ISOdia --> +<!ENTITY deg "°"> <!-- degree sign, U+00B0 ISOnum --> +<!ENTITY plusmn "±"> <!-- plus-minus sign = plus-or-minus sign, + U+00B1 ISOnum --> +<!ENTITY sup2 "²"> <!-- superscript two = superscript digit two + = squared, U+00B2 ISOnum --> +<!ENTITY sup3 "³"> <!-- superscript three = superscript digit three + = cubed, U+00B3 ISOnum --> +<!ENTITY acute "´"> <!-- acute accent = spacing acute, + U+00B4 ISOdia --> +<!ENTITY micro "µ"> <!-- micro sign, U+00B5 ISOnum --> +<!ENTITY para "¶"> <!-- pilcrow sign = paragraph sign, + U+00B6 ISOnum --> +<!ENTITY middot "·"> <!-- middle dot = Georgian comma + = Greek middle dot, U+00B7 ISOnum --> +<!ENTITY cedil "¸"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia --> +<!ENTITY sup1 "¹"> <!-- superscript one = superscript digit one, + U+00B9 ISOnum --> +<!ENTITY ordm "º"> <!-- masculine ordinal indicator, + U+00BA ISOnum --> +<!ENTITY raquo "»"> <!-- right-pointing double angle quotation mark + = right pointing guillemet, U+00BB ISOnum --> +<!ENTITY frac14 "¼"> <!-- vulgar fraction one quarter + = fraction one quarter, U+00BC ISOnum --> +<!ENTITY frac12 "½"> <!-- vulgar fraction one half + = fraction one half, U+00BD ISOnum --> +<!ENTITY frac34 "¾"> <!-- vulgar fraction three quarters + = fraction three quarters, U+00BE ISOnum --> +<!ENTITY iquest "¿"> <!-- inverted question mark + = turned question mark, U+00BF ISOnum --> +<!ENTITY Agrave "À"> <!-- latin capital letter A with grave + = latin capital letter A grave, + U+00C0 ISOlat1 --> +<!ENTITY Aacute "Á"> <!-- latin capital letter A with acute, + U+00C1 ISOlat1 --> +<!ENTITY Acirc "Â"> <!-- latin capital letter A with circumflex, + U+00C2 ISOlat1 --> +<!ENTITY Atilde "Ã"> <!-- latin capital letter A with tilde, + U+00C3 ISOlat1 --> +<!ENTITY Auml "Ä"> <!-- latin capital letter A with diaeresis, + U+00C4 ISOlat1 --> +<!ENTITY Aring "Å"> <!-- latin capital letter A with ring above + = latin capital letter A ring, + U+00C5 ISOlat1 --> +<!ENTITY AElig "Æ"> <!-- latin capital letter AE + = latin capital ligature AE, + U+00C6 ISOlat1 --> +<!ENTITY Ccedil "Ç"> <!-- latin capital letter C with cedilla, + U+00C7 ISOlat1 --> +<!ENTITY Egrave "È"> <!-- latin capital letter E with grave, + U+00C8 ISOlat1 --> +<!ENTITY Eacute "É"> <!-- latin capital letter E with acute, + U+00C9 ISOlat1 --> +<!ENTITY Ecirc "Ê"> <!-- latin capital letter E with circumflex, + U+00CA ISOlat1 --> +<!ENTITY Euml "Ë"> <!-- latin capital letter E with diaeresis, + U+00CB ISOlat1 --> +<!ENTITY Igrave "Ì"> <!-- latin capital letter I with grave, + U+00CC ISOlat1 --> +<!ENTITY Iacute "Í"> <!-- latin capital letter I with acute, + U+00CD ISOlat1 --> +<!ENTITY Icirc "Î"> <!-- latin capital letter I with circumflex, + U+00CE ISOlat1 --> +<!ENTITY Iuml "Ï"> <!-- latin capital letter I with diaeresis, + U+00CF ISOlat1 --> +<!ENTITY ETH "Ð"> <!-- latin capital letter ETH, U+00D0 ISOlat1 --> +<!ENTITY Ntilde "Ñ"> <!-- latin capital letter N with tilde, + U+00D1 ISOlat1 --> +<!ENTITY Ograve "Ò"> <!-- latin capital letter O with grave, + U+00D2 ISOlat1 --> +<!ENTITY Oacute "Ó"> <!-- latin capital letter O with acute, + U+00D3 ISOlat1 --> +<!ENTITY Ocirc "Ô"> <!-- latin capital letter O with circumflex, + U+00D4 ISOlat1 --> +<!ENTITY Otilde "Õ"> <!-- latin capital letter O with tilde, + U+00D5 ISOlat1 --> +<!ENTITY Ouml "Ö"> <!-- latin capital letter O with diaeresis, + U+00D6 ISOlat1 --> +<!ENTITY times "×"> <!-- multiplication sign, U+00D7 ISOnum --> +<!ENTITY Oslash "Ø"> <!-- latin capital letter O with stroke + = latin capital letter O slash, + U+00D8 ISOlat1 --> +<!ENTITY Ugrave "Ù"> <!-- latin capital letter U with grave, + U+00D9 ISOlat1 --> +<!ENTITY Uacute "Ú"> <!-- latin capital letter U with acute, + U+00DA ISOlat1 --> +<!ENTITY Ucirc "Û"> <!-- latin capital letter U with circumflex, + U+00DB ISOlat1 --> +<!ENTITY Uuml "Ü"> <!-- latin capital letter U with diaeresis, + U+00DC ISOlat1 --> +<!ENTITY Yacute "Ý"> <!-- latin capital letter Y with acute, + U+00DD ISOlat1 --> +<!ENTITY THORN "Þ"> <!-- latin capital letter THORN, + U+00DE ISOlat1 --> +<!ENTITY szlig "ß"> <!-- latin small letter sharp s = ess-zed, + U+00DF ISOlat1 --> +<!ENTITY agrave "à"> <!-- latin small letter a with grave + = latin small letter a grave, + U+00E0 ISOlat1 --> +<!ENTITY aacute "á"> <!-- latin small letter a with acute, + U+00E1 ISOlat1 --> +<!ENTITY acirc "â"> <!-- latin small letter a with circumflex, + U+00E2 ISOlat1 --> +<!ENTITY atilde "ã"> <!-- latin small letter a with tilde, + U+00E3 ISOlat1 --> +<!ENTITY auml "ä"> <!-- latin small letter a with diaeresis, + U+00E4 ISOlat1 --> +<!ENTITY aring "å"> <!-- latin small letter a with ring above + = latin small letter a ring, + U+00E5 ISOlat1 --> +<!ENTITY aelig "æ"> <!-- latin small letter ae + = latin small ligature ae, U+00E6 ISOlat1 --> +<!ENTITY ccedil "ç"> <!-- latin small letter c with cedilla, + U+00E7 ISOlat1 --> +<!ENTITY egrave "è"> <!-- latin small letter e with grave, + U+00E8 ISOlat1 --> +<!ENTITY eacute "é"> <!-- latin small letter e with acute, + U+00E9 ISOlat1 --> +<!ENTITY ecirc "ê"> <!-- latin small letter e with circumflex, + U+00EA ISOlat1 --> +<!ENTITY euml "ë"> <!-- latin small letter e with diaeresis, + U+00EB ISOlat1 --> +<!ENTITY igrave "ì"> <!-- latin small letter i with grave, + U+00EC ISOlat1 --> +<!ENTITY iacute "í"> <!-- latin small letter i with acute, + U+00ED ISOlat1 --> +<!ENTITY icirc "î"> <!-- latin small letter i with circumflex, + U+00EE ISOlat1 --> +<!ENTITY iuml "ï"> <!-- latin small letter i with diaeresis, + U+00EF ISOlat1 --> +<!ENTITY eth "ð"> <!-- latin small letter eth, U+00F0 ISOlat1 --> +<!ENTITY ntilde "ñ"> <!-- latin small letter n with tilde, + U+00F1 ISOlat1 --> +<!ENTITY ograve "ò"> <!-- latin small letter o with grave, + U+00F2 ISOlat1 --> +<!ENTITY oacute "ó"> <!-- latin small letter o with acute, + U+00F3 ISOlat1 --> +<!ENTITY ocirc "ô"> <!-- latin small letter o with circumflex, + U+00F4 ISOlat1 --> +<!ENTITY otilde "õ"> <!-- latin small letter o with tilde, + U+00F5 ISOlat1 --> +<!ENTITY ouml "ö"> <!-- latin small letter o with diaeresis, + U+00F6 ISOlat1 --> +<!ENTITY divide "÷"> <!-- division sign, U+00F7 ISOnum --> +<!ENTITY oslash "ø"> <!-- latin small letter o with stroke, + = latin small letter o slash, + U+00F8 ISOlat1 --> +<!ENTITY ugrave "ù"> <!-- latin small letter u with grave, + U+00F9 ISOlat1 --> +<!ENTITY uacute "ú"> <!-- latin small letter u with acute, + U+00FA ISOlat1 --> +<!ENTITY ucirc "û"> <!-- latin small letter u with circumflex, + U+00FB ISOlat1 --> +<!ENTITY uuml "ü"> <!-- latin small letter u with diaeresis, + U+00FC ISOlat1 --> +<!ENTITY yacute "ý"> <!-- latin small letter y with acute, + U+00FD ISOlat1 --> +<!ENTITY thorn "þ"> <!-- latin small letter thorn with, + U+00FE ISOlat1 --> +<!ENTITY yuml "ÿ"> <!-- latin small letter y with diaeresis, + U+00FF ISOlat1 --> diff --git a/lib/docbuilder/dtd/xhtml-special.ent b/lib/docbuilder/dtd/xhtml-special.ent new file mode 100644 index 0000000000..ca358b2fec --- /dev/null +++ b/lib/docbuilder/dtd/xhtml-special.ent @@ -0,0 +1,80 @@ +<!-- Special characters for XHTML --> + +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"> + %HTMLspecial; +--> + +<!-- Portions (C) International Organization for Standardization 1986: + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> + +<!-- Relevant ISO entity set is given unless names are newly introduced. + New names (i.e., not in ISO 8879 list) do not clash with any + existing ISO 8879 entity names. ISO 10646 character numbers + are given for each character, in hex. values are decimal + conversions of the ISO 10646 values and refer to the document + character set. Names are Unicode names. +--> + +<!-- C0 Controls and Basic Latin --> +<!ENTITY quot """> <!-- quotation mark, U+0022 ISOnum --> +<!ENTITY amp "&#38;"> <!-- ampersand, U+0026 ISOnum --> +<!ENTITY lt "&#60;"> <!-- less-than sign, U+003C ISOnum --> +<!ENTITY gt ">"> <!-- greater-than sign, U+003E ISOnum --> +<!ENTITY apos "'"> <!-- apostrophe = APL quote, U+0027 ISOnum --> + +<!-- Latin Extended-A --> +<!ENTITY OElig "Œ"> <!-- latin capital ligature OE, + U+0152 ISOlat2 --> +<!ENTITY oelig "œ"> <!-- latin small ligature oe, U+0153 ISOlat2 --> +<!-- ligature is a misnomer, this is a separate character in some languages --> +<!ENTITY Scaron "Š"> <!-- latin capital letter S with caron, + U+0160 ISOlat2 --> +<!ENTITY scaron "š"> <!-- latin small letter s with caron, + U+0161 ISOlat2 --> +<!ENTITY Yuml "Ÿ"> <!-- latin capital letter Y with diaeresis, + U+0178 ISOlat2 --> + +<!-- Spacing Modifier Letters --> +<!ENTITY circ "ˆ"> <!-- modifier letter circumflex accent, + U+02C6 ISOpub --> +<!ENTITY tilde "˜"> <!-- small tilde, U+02DC ISOdia --> + +<!-- General Punctuation --> +<!ENTITY ensp " "> <!-- en space, U+2002 ISOpub --> +<!ENTITY emsp " "> <!-- em space, U+2003 ISOpub --> +<!ENTITY thinsp " "> <!-- thin space, U+2009 ISOpub --> +<!ENTITY zwnj "‌"> <!-- zero width non-joiner, + U+200C NEW RFC 2070 --> +<!ENTITY zwj "‍"> <!-- zero width joiner, U+200D NEW RFC 2070 --> +<!ENTITY lrm "‎"> <!-- left-to-right mark, U+200E NEW RFC 2070 --> +<!ENTITY rlm "‏"> <!-- right-to-left mark, U+200F NEW RFC 2070 --> +<!ENTITY ndash "–"> <!-- en dash, U+2013 ISOpub --> +<!ENTITY mdash "—"> <!-- em dash, U+2014 ISOpub --> +<!ENTITY lsquo "‘"> <!-- left single quotation mark, + U+2018 ISOnum --> +<!ENTITY rsquo "’"> <!-- right single quotation mark, + U+2019 ISOnum --> +<!ENTITY sbquo "‚"> <!-- single low-9 quotation mark, U+201A NEW --> +<!ENTITY ldquo "“"> <!-- left double quotation mark, + U+201C ISOnum --> +<!ENTITY rdquo "”"> <!-- right double quotation mark, + U+201D ISOnum --> +<!ENTITY bdquo "„"> <!-- double low-9 quotation mark, U+201E NEW --> +<!ENTITY dagger "†"> <!-- dagger, U+2020 ISOpub --> +<!ENTITY Dagger "‡"> <!-- double dagger, U+2021 ISOpub --> +<!ENTITY permil "‰"> <!-- per mille sign, U+2030 ISOtech --> +<!ENTITY lsaquo "‹"> <!-- single left-pointing angle quotation mark, + U+2039 ISO proposed --> +<!-- lsaquo is proposed but not yet ISO standardized --> +<!ENTITY rsaquo "›"> <!-- single right-pointing angle quotation mark, + U+203A ISO proposed --> +<!-- rsaquo is proposed but not yet ISO standardized --> + +<!-- Currency Symbols --> +<!ENTITY euro "€"> <!-- euro sign, U+20AC NEW --> diff --git a/lib/docbuilder/dtd/xhtml-symbol.ent b/lib/docbuilder/dtd/xhtml-symbol.ent new file mode 100644 index 0000000000..63c2abfa6f --- /dev/null +++ b/lib/docbuilder/dtd/xhtml-symbol.ent @@ -0,0 +1,237 @@ +<!-- Mathematical, Greek and Symbolic characters for XHTML --> + +<!-- Character entity set. Typical invocation: + <!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"> + %HTMLsymbol; +--> + +<!-- Portions (C) International Organization for Standardization 1986: + Permission to copy in any form is granted for use with + conforming SGML systems and applications as defined in + ISO 8879, provided this notice is included in all copies. +--> + +<!-- Relevant ISO entity set is given unless names are newly introduced. + New names (i.e., not in ISO 8879 list) do not clash with any + existing ISO 8879 entity names. ISO 10646 character numbers + are given for each character, in hex. values are decimal + conversions of the ISO 10646 values and refer to the document + character set. Names are Unicode names. +--> + +<!-- Latin Extended-B --> +<!ENTITY fnof "ƒ"> <!-- latin small letter f with hook = function + = florin, U+0192 ISOtech --> + +<!-- Greek --> +<!ENTITY Alpha "Α"> <!-- greek capital letter alpha, U+0391 --> +<!ENTITY Beta "Β"> <!-- greek capital letter beta, U+0392 --> +<!ENTITY Gamma "Γ"> <!-- greek capital letter gamma, + U+0393 ISOgrk3 --> +<!ENTITY Delta "Δ"> <!-- greek capital letter delta, + U+0394 ISOgrk3 --> +<!ENTITY Epsilon "Ε"> <!-- greek capital letter epsilon, U+0395 --> +<!ENTITY Zeta "Ζ"> <!-- greek capital letter zeta, U+0396 --> +<!ENTITY Eta "Η"> <!-- greek capital letter eta, U+0397 --> +<!ENTITY Theta "Θ"> <!-- greek capital letter theta, + U+0398 ISOgrk3 --> +<!ENTITY Iota "Ι"> <!-- greek capital letter iota, U+0399 --> +<!ENTITY Kappa "Κ"> <!-- greek capital letter kappa, U+039A --> +<!ENTITY Lambda "Λ"> <!-- greek capital letter lamda, + U+039B ISOgrk3 --> +<!ENTITY Mu "Μ"> <!-- greek capital letter mu, U+039C --> +<!ENTITY Nu "Ν"> <!-- greek capital letter nu, U+039D --> +<!ENTITY Xi "Ξ"> <!-- greek capital letter xi, U+039E ISOgrk3 --> +<!ENTITY Omicron "Ο"> <!-- greek capital letter omicron, U+039F --> +<!ENTITY Pi "Π"> <!-- greek capital letter pi, U+03A0 ISOgrk3 --> +<!ENTITY Rho "Ρ"> <!-- greek capital letter rho, U+03A1 --> +<!-- there is no Sigmaf, and no U+03A2 character either --> +<!ENTITY Sigma "Σ"> <!-- greek capital letter sigma, + U+03A3 ISOgrk3 --> +<!ENTITY Tau "Τ"> <!-- greek capital letter tau, U+03A4 --> +<!ENTITY Upsilon "Υ"> <!-- greek capital letter upsilon, + U+03A5 ISOgrk3 --> +<!ENTITY Phi "Φ"> <!-- greek capital letter phi, + U+03A6 ISOgrk3 --> +<!ENTITY Chi "Χ"> <!-- greek capital letter chi, U+03A7 --> +<!ENTITY Psi "Ψ"> <!-- greek capital letter psi, + U+03A8 ISOgrk3 --> +<!ENTITY Omega "Ω"> <!-- greek capital letter omega, + U+03A9 ISOgrk3 --> + +<!ENTITY alpha "α"> <!-- greek small letter alpha, + U+03B1 ISOgrk3 --> +<!ENTITY beta "β"> <!-- greek small letter beta, U+03B2 ISOgrk3 --> +<!ENTITY gamma "γ"> <!-- greek small letter gamma, + U+03B3 ISOgrk3 --> +<!ENTITY delta "δ"> <!-- greek small letter delta, + U+03B4 ISOgrk3 --> +<!ENTITY epsilon "ε"> <!-- greek small letter epsilon, + U+03B5 ISOgrk3 --> +<!ENTITY zeta "ζ"> <!-- greek small letter zeta, U+03B6 ISOgrk3 --> +<!ENTITY eta "η"> <!-- greek small letter eta, U+03B7 ISOgrk3 --> +<!ENTITY theta "θ"> <!-- greek small letter theta, + U+03B8 ISOgrk3 --> +<!ENTITY iota "ι"> <!-- greek small letter iota, U+03B9 ISOgrk3 --> +<!ENTITY kappa "κ"> <!-- greek small letter kappa, + U+03BA ISOgrk3 --> +<!ENTITY lambda "λ"> <!-- greek small letter lamda, + U+03BB ISOgrk3 --> +<!ENTITY mu "μ"> <!-- greek small letter mu, U+03BC ISOgrk3 --> +<!ENTITY nu "ν"> <!-- greek small letter nu, U+03BD ISOgrk3 --> +<!ENTITY xi "ξ"> <!-- greek small letter xi, U+03BE ISOgrk3 --> +<!ENTITY omicron "ο"> <!-- greek small letter omicron, U+03BF NEW --> +<!ENTITY pi "π"> <!-- greek small letter pi, U+03C0 ISOgrk3 --> +<!ENTITY rho "ρ"> <!-- greek small letter rho, U+03C1 ISOgrk3 --> +<!ENTITY sigmaf "ς"> <!-- greek small letter final sigma, + U+03C2 ISOgrk3 --> +<!ENTITY sigma "σ"> <!-- greek small letter sigma, + U+03C3 ISOgrk3 --> +<!ENTITY tau "τ"> <!-- greek small letter tau, U+03C4 ISOgrk3 --> +<!ENTITY upsilon "υ"> <!-- greek small letter upsilon, + U+03C5 ISOgrk3 --> +<!ENTITY phi "φ"> <!-- greek small letter phi, U+03C6 ISOgrk3 --> +<!ENTITY chi "χ"> <!-- greek small letter chi, U+03C7 ISOgrk3 --> +<!ENTITY psi "ψ"> <!-- greek small letter psi, U+03C8 ISOgrk3 --> +<!ENTITY omega "ω"> <!-- greek small letter omega, + U+03C9 ISOgrk3 --> +<!ENTITY thetasym "ϑ"> <!-- greek theta symbol, + U+03D1 NEW --> +<!ENTITY upsih "ϒ"> <!-- greek upsilon with hook symbol, + U+03D2 NEW --> +<!ENTITY piv "ϖ"> <!-- greek pi symbol, U+03D6 ISOgrk3 --> + +<!-- General Punctuation --> +<!ENTITY bull "•"> <!-- bullet = black small circle, + U+2022 ISOpub --> +<!-- bullet is NOT the same as bullet operator, U+2219 --> +<!ENTITY hellip "…"> <!-- horizontal ellipsis = three dot leader, + U+2026 ISOpub --> +<!ENTITY prime "′"> <!-- prime = minutes = feet, U+2032 ISOtech --> +<!ENTITY Prime "″"> <!-- double prime = seconds = inches, + U+2033 ISOtech --> +<!ENTITY oline "‾"> <!-- overline = spacing overscore, + U+203E NEW --> +<!ENTITY frasl "⁄"> <!-- fraction slash, U+2044 NEW --> + +<!-- Letterlike Symbols --> +<!ENTITY weierp "℘"> <!-- script capital P = power set + = Weierstrass p, U+2118 ISOamso --> +<!ENTITY image "ℑ"> <!-- black-letter capital I = imaginary part, + U+2111 ISOamso --> +<!ENTITY real "ℜ"> <!-- black-letter capital R = real part symbol, + U+211C ISOamso --> +<!ENTITY trade "™"> <!-- trade mark sign, U+2122 ISOnum --> +<!ENTITY alefsym "ℵ"> <!-- alef symbol = first transfinite cardinal, + U+2135 NEW --> +<!-- alef symbol is NOT the same as hebrew letter alef, + U+05D0 although the same glyph could be used to depict both characters --> + +<!-- Arrows --> +<!ENTITY larr "←"> <!-- leftwards arrow, U+2190 ISOnum --> +<!ENTITY uarr "↑"> <!-- upwards arrow, U+2191 ISOnum--> +<!ENTITY rarr "→"> <!-- rightwards arrow, U+2192 ISOnum --> +<!ENTITY darr "↓"> <!-- downwards arrow, U+2193 ISOnum --> +<!ENTITY harr "↔"> <!-- left right arrow, U+2194 ISOamsa --> +<!ENTITY crarr "↵"> <!-- downwards arrow with corner leftwards + = carriage return, U+21B5 NEW --> +<!ENTITY lArr "⇐"> <!-- leftwards double arrow, U+21D0 ISOtech --> +<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow + but also does not have any other character for that function. So lArr can + be used for 'is implied by' as ISOtech suggests --> +<!ENTITY uArr "⇑"> <!-- upwards double arrow, U+21D1 ISOamsa --> +<!ENTITY rArr "⇒"> <!-- rightwards double arrow, + U+21D2 ISOtech --> +<!-- Unicode does not say this is the 'implies' character but does not have + another character with this function so rArr can be used for 'implies' + as ISOtech suggests --> +<!ENTITY dArr "⇓"> <!-- downwards double arrow, U+21D3 ISOamsa --> +<!ENTITY hArr "⇔"> <!-- left right double arrow, + U+21D4 ISOamsa --> + +<!-- Mathematical Operators --> +<!ENTITY forall "∀"> <!-- for all, U+2200 ISOtech --> +<!ENTITY part "∂"> <!-- partial differential, U+2202 ISOtech --> +<!ENTITY exist "∃"> <!-- there exists, U+2203 ISOtech --> +<!ENTITY empty "∅"> <!-- empty set = null set, U+2205 ISOamso --> +<!ENTITY nabla "∇"> <!-- nabla = backward difference, + U+2207 ISOtech --> +<!ENTITY isin "∈"> <!-- element of, U+2208 ISOtech --> +<!ENTITY notin "∉"> <!-- not an element of, U+2209 ISOtech --> +<!ENTITY ni "∋"> <!-- contains as member, U+220B ISOtech --> +<!ENTITY prod "∏"> <!-- n-ary product = product sign, + U+220F ISOamsb --> +<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though + the same glyph might be used for both --> +<!ENTITY sum "∑"> <!-- n-ary summation, U+2211 ISOamsb --> +<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' + though the same glyph might be used for both --> +<!ENTITY minus "−"> <!-- minus sign, U+2212 ISOtech --> +<!ENTITY lowast "∗"> <!-- asterisk operator, U+2217 ISOtech --> +<!ENTITY radic "√"> <!-- square root = radical sign, + U+221A ISOtech --> +<!ENTITY prop "∝"> <!-- proportional to, U+221D ISOtech --> +<!ENTITY infin "∞"> <!-- infinity, U+221E ISOtech --> +<!ENTITY ang "∠"> <!-- angle, U+2220 ISOamso --> +<!ENTITY and "∧"> <!-- logical and = wedge, U+2227 ISOtech --> +<!ENTITY or "∨"> <!-- logical or = vee, U+2228 ISOtech --> +<!ENTITY cap "∩"> <!-- intersection = cap, U+2229 ISOtech --> +<!ENTITY cup "∪"> <!-- union = cup, U+222A ISOtech --> +<!ENTITY int "∫"> <!-- integral, U+222B ISOtech --> +<!ENTITY there4 "∴"> <!-- therefore, U+2234 ISOtech --> +<!ENTITY sim "∼"> <!-- tilde operator = varies with = similar to, + U+223C ISOtech --> +<!-- tilde operator is NOT the same character as the tilde, U+007E, + although the same glyph might be used to represent both --> +<!ENTITY cong "≅"> <!-- approximately equal to, U+2245 ISOtech --> +<!ENTITY asymp "≈"> <!-- almost equal to = asymptotic to, + U+2248 ISOamsr --> +<!ENTITY ne "≠"> <!-- not equal to, U+2260 ISOtech --> +<!ENTITY equiv "≡"> <!-- identical to, U+2261 ISOtech --> +<!ENTITY le "≤"> <!-- less-than or equal to, U+2264 ISOtech --> +<!ENTITY ge "≥"> <!-- greater-than or equal to, + U+2265 ISOtech --> +<!ENTITY sub "⊂"> <!-- subset of, U+2282 ISOtech --> +<!ENTITY sup "⊃"> <!-- superset of, U+2283 ISOtech --> +<!ENTITY nsub "⊄"> <!-- not a subset of, U+2284 ISOamsn --> +<!ENTITY sube "⊆"> <!-- subset of or equal to, U+2286 ISOtech --> +<!ENTITY supe "⊇"> <!-- superset of or equal to, + U+2287 ISOtech --> +<!ENTITY oplus "⊕"> <!-- circled plus = direct sum, + U+2295 ISOamsb --> +<!ENTITY otimes "⊗"> <!-- circled times = vector product, + U+2297 ISOamsb --> +<!ENTITY perp "⊥"> <!-- up tack = orthogonal to = perpendicular, + U+22A5 ISOtech --> +<!ENTITY sdot "⋅"> <!-- dot operator, U+22C5 ISOamsb --> +<!-- dot operator is NOT the same character as U+00B7 middle dot --> + +<!-- Miscellaneous Technical --> +<!ENTITY lceil "⌈"> <!-- left ceiling = APL upstile, + U+2308 ISOamsc --> +<!ENTITY rceil "⌉"> <!-- right ceiling, U+2309 ISOamsc --> +<!ENTITY lfloor "⌊"> <!-- left floor = APL downstile, + U+230A ISOamsc --> +<!ENTITY rfloor "⌋"> <!-- right floor, U+230B ISOamsc --> +<!ENTITY lang "〈"> <!-- left-pointing angle bracket = bra, + U+2329 ISOtech --> +<!-- lang is NOT the same character as U+003C 'less than sign' + or U+2039 'single left-pointing angle quotation mark' --> +<!ENTITY rang "〉"> <!-- right-pointing angle bracket = ket, + U+232A ISOtech --> +<!-- rang is NOT the same character as U+003E 'greater than sign' + or U+203A 'single right-pointing angle quotation mark' --> + +<!-- Geometric Shapes --> +<!ENTITY loz "◊"> <!-- lozenge, U+25CA ISOpub --> + +<!-- Miscellaneous Symbols --> +<!ENTITY spades "♠"> <!-- black spade suit, U+2660 ISOpub --> +<!-- black here seems to mean filled as opposed to hollow --> +<!ENTITY clubs "♣"> <!-- black club suit = shamrock, + U+2663 ISOpub --> +<!ENTITY hearts "♥"> <!-- black heart suit = valentine, + U+2665 ISOpub --> +<!ENTITY diams "♦"> <!-- black diamond suit, U+2666 ISOpub --> diff --git a/lib/docbuilder/dtd/xhtml1-frameset.dtd b/lib/docbuilder/dtd/xhtml1-frameset.dtd new file mode 100644 index 0000000000..d128f2eb7c --- /dev/null +++ b/lib/docbuilder/dtd/xhtml1-frameset.dtd @@ -0,0 +1,1235 @@ +<!-- + Extensible HTML version 1.0 Frameset DTD + + This is the same as HTML 4 Frameset except for + changes due to the differences between XML and SGML. + + Namespace = http://www.w3.org/1999/xhtml + + For further information, see: http://www.w3.org/TR/xhtml1 + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + All Rights Reserved. + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" + SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" + + $Revision: 1.2 $ + $Date: 2002/08/01 18:37:55 $ + +--> + +<!--================ Character mnemonic entities =========================--> + +<!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "xhtml-lat1.ent"> +%HTMLlat1; + +<!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "xhtml-symbol.ent"> +%HTMLsymbol; + +<!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "xhtml-special.ent"> +%HTMLspecial; + +<!--================== Imported Names ====================================--> + +<!ENTITY % ContentType "CDATA"> + <!-- media type, as per [RFC2045] --> + +<!ENTITY % ContentTypes "CDATA"> + <!-- comma-separated list of media types, as per [RFC2045] --> + +<!ENTITY % Charset "CDATA"> + <!-- a character encoding, as per [RFC2045] --> + +<!ENTITY % Charsets "CDATA"> + <!-- a space separated list of character encodings, as per [RFC2045] --> + +<!ENTITY % LanguageCode "NMTOKEN"> + <!-- a language code, as per [RFC3066] --> + +<!ENTITY % Character "CDATA"> + <!-- a single character, as per section 2.2 of [XML] --> + +<!ENTITY % Number "CDATA"> + <!-- one or more digits --> + +<!ENTITY % LinkTypes "CDATA"> + <!-- space-separated list of link types --> + +<!ENTITY % MediaDesc "CDATA"> + <!-- single or comma-separated list of media descriptors --> + +<!ENTITY % URI "CDATA"> + <!-- a Uniform Resource Identifier, see [RFC2396] --> + +<!ENTITY % UriList "CDATA"> + <!-- a space separated list of Uniform Resource Identifiers --> + +<!ENTITY % Datetime "CDATA"> + <!-- date and time information. ISO date format --> + +<!ENTITY % Script "CDATA"> + <!-- script expression --> + +<!ENTITY % StyleSheet "CDATA"> + <!-- style sheet data --> + +<!ENTITY % Text "CDATA"> + <!-- used for titles etc. --> + +<!ENTITY % FrameTarget "NMTOKEN"> + <!-- render in this frame --> + +<!ENTITY % Length "CDATA"> + <!-- nn for pixels or nn% for percentage length --> + +<!ENTITY % MultiLength "CDATA"> + <!-- pixel, percentage, or relative --> + +<!ENTITY % MultiLengths "CDATA"> + <!-- comma-separated list of MultiLength --> + +<!ENTITY % Pixels "CDATA"> + <!-- integer representing length in pixels --> + +<!-- these are used for image maps --> + +<!ENTITY % Shape "(rect|circle|poly|default)"> + +<!ENTITY % Coords "CDATA"> + <!-- comma separated list of lengths --> + +<!-- used for object, applet, img, input and iframe --> +<!ENTITY % ImgAlign "(top|middle|bottom|left|right)"> + +<!-- a color using sRGB: #RRGGBB as Hex values --> +<!ENTITY % Color "CDATA"> + +<!-- There are also 16 widely known color names with their sRGB values: + + Black = #000000 Green = #008000 + Silver = #C0C0C0 Lime = #00FF00 + Gray = #808080 Olive = #808000 + White = #FFFFFF Yellow = #FFFF00 + Maroon = #800000 Navy = #000080 + Red = #FF0000 Blue = #0000FF + Purple = #800080 Teal = #008080 + Fuchsia= #FF00FF Aqua = #00FFFF +--> + +<!--=================== Generic Attributes ===============================--> + +<!-- core attributes common to most elements + id document-wide unique id + class space separated list of classes + style associated style info + title advisory title/amplification +--> +<!ENTITY % coreattrs + "id ID #IMPLIED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED" + > + +<!-- internationalization attributes + lang language code (backwards compatible) + xml:lang language code (as per XML 1.0 spec) + dir direction for weak/neutral text +--> +<!ENTITY % i18n + "lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #IMPLIED" + > + +<!-- attributes for common UI events + onclick a pointer button was clicked + ondblclick a pointer button was double clicked + onmousedown a pointer button was pressed down + onmouseup a pointer button was released + onmousemove a pointer was moved onto the element + onmouseout a pointer was moved away from the element + onkeypress a key was pressed and released + onkeydown a key was pressed down + onkeyup a key was released +--> +<!ENTITY % events + "onclick %Script; #IMPLIED + ondblclick %Script; #IMPLIED + onmousedown %Script; #IMPLIED + onmouseup %Script; #IMPLIED + onmouseover %Script; #IMPLIED + onmousemove %Script; #IMPLIED + onmouseout %Script; #IMPLIED + onkeypress %Script; #IMPLIED + onkeydown %Script; #IMPLIED + onkeyup %Script; #IMPLIED" + > + +<!-- attributes for elements that can get the focus + accesskey accessibility key character + tabindex position in tabbing order + onfocus the element got the focus + onblur the element lost the focus +--> +<!ENTITY % focus + "accesskey %Character; #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED" + > + +<!ENTITY % attrs "%coreattrs; %i18n; %events;"> + +<!-- text alignment for p, div, h1-h6. The default is + align="left" for ltr headings, "right" for rtl --> + +<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED"> + +<!--=================== Text Elements ====================================--> + +<!ENTITY % special.extra + "object | applet | img | map | iframe"> + +<!ENTITY % special.basic + "br | span | bdo"> + +<!ENTITY % special + "%special.basic; | %special.extra;"> + +<!ENTITY % fontstyle.extra "big | small | font | basefont"> + +<!ENTITY % fontstyle.basic "tt | i | b | u + | s | strike "> + +<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;"> + +<!ENTITY % phrase.extra "sub | sup"> +<!ENTITY % phrase.basic "em | strong | dfn | code | q | + samp | kbd | var | cite | abbr | acronym"> + +<!ENTITY % phrase "%phrase.basic; | %phrase.extra;"> + +<!ENTITY % inline.forms "input | select | textarea | label | button"> + +<!-- these can occur at block or inline level --> +<!ENTITY % misc.inline "ins | del | script"> + +<!-- these can only occur at block level --> +<!ENTITY % misc "noscript | %misc.inline;"> + + +<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> + +<!-- %Inline; covers inline or "text-level" elements --> +<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> + +<!--================== Block level elements ==============================--> + +<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> +<!ENTITY % lists "ul | ol | dl | menu | dir"> +<!ENTITY % blocktext "pre | hr | blockquote | address | center"> + +<!ENTITY % block + "p | %heading; | div | %lists; | %blocktext; | isindex | fieldset | table"> + +<!-- %Flow; mixes block and inline and is used for list items etc. --> +<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> + +<!--================== Content models for exclusions =====================--> + +<!-- a elements use %Inline; excluding a --> + +<!ENTITY % a.content + "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> + +<!-- pre uses %Inline excluding img, object, applet, big, small, + sub, sup, font, or basefont --> + +<!ENTITY % pre.content + "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; | + %inline.forms; | %misc.inline;)*"> + + +<!-- form uses %Flow; excluding form --> + +<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*"> + +<!-- button uses %Flow; but excludes a, form, form controls, iframe --> + +<!ENTITY % button.content + "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | + table | br | span | bdo | object | applet | img | map | + %fontstyle; | %phrase; | %misc;)*"> + +<!--================ Document Structure ==================================--> + +<!-- the namespace URI designates the document profile --> + +<!ELEMENT html (head, frameset)> +<!ATTLIST html + %i18n; + id ID #IMPLIED + xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' + > + +<!--================ Document Head =======================================--> + +<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*"> + +<!-- content model is %head.misc; combined with a single + title and an optional base element in any order --> + +<!ELEMENT head (%head.misc;, + ((title, %head.misc;, (base, %head.misc;)?) | + (base, %head.misc;, (title, %head.misc;))))> + +<!ATTLIST head + %i18n; + id ID #IMPLIED + profile %URI; #IMPLIED + > + +<!-- The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + --> +<!ELEMENT title (#PCDATA)> +<!ATTLIST title + %i18n; + id ID #IMPLIED + > + +<!-- document base URI --> + +<!ELEMENT base EMPTY> +<!ATTLIST base + id ID #IMPLIED + href %URI; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- generic metainformation --> +<!ELEMENT meta EMPTY> +<!ATTLIST meta + %i18n; + id ID #IMPLIED + http-equiv CDATA #IMPLIED + name CDATA #IMPLIED + content CDATA #REQUIRED + scheme CDATA #IMPLIED + > + +<!-- + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used + with the link element in document head e.g. + start, contents, previous, next, index, end, help + b) to link to a separate style sheet (rel="stylesheet") + c) to make a link to a script (rel="script") + d) by stylesheets to control how collections of + html nodes are rendered into printed documents + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" media="print") +--> + +<!ELEMENT link EMPTY> +<!ATTLIST link + %attrs; + charset %Charset; #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + type %ContentType; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + media %MediaDesc; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- style info, which may include CDATA sections --> +<!ELEMENT style (#PCDATA)> +<!ATTLIST style + %i18n; + id ID #IMPLIED + type %ContentType; #REQUIRED + media %MediaDesc; #IMPLIED + title %Text; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- script statements, which may include CDATA sections --> +<!ELEMENT script (#PCDATA)> +<!ATTLIST script + id ID #IMPLIED + charset %Charset; #IMPLIED + type %ContentType; #REQUIRED + language CDATA #IMPLIED + src %URI; #IMPLIED + defer (defer) #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- alternate content container for non script-based rendering --> + +<!ELEMENT noscript %Flow;> +<!ATTLIST noscript + %attrs; + > + +<!--======================= Frames =======================================--> + +<!-- only one noframes element permitted per document --> + +<!ELEMENT frameset (frameset|frame|noframes)*> +<!ATTLIST frameset + %coreattrs; + rows %MultiLengths; #IMPLIED + cols %MultiLengths; #IMPLIED + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + > + +<!-- reserved frame names start with "_" otherwise starts with letter --> + +<!-- tiled window within frameset --> + +<!ELEMENT frame EMPTY> +<!ATTLIST frame + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + noresize (noresize) #IMPLIED + scrolling (yes|no|auto) "auto" + > + +<!-- inline subwindow --> + +<!ELEMENT iframe %Flow;> +<!ATTLIST iframe + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + scrolling (yes|no|auto) "auto" + align %ImgAlign; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + > + +<!-- alternate content container for non frame-based rendering --> + +<!ELEMENT noframes (body)> +<!ATTLIST noframes + %attrs; + > + +<!--=================== Document Body ====================================--> + +<!ELEMENT body %Flow;> +<!ATTLIST body + %attrs; + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + background %URI; #IMPLIED + bgcolor %Color; #IMPLIED + text %Color; #IMPLIED + link %Color; #IMPLIED + vlink %Color; #IMPLIED + alink %Color; #IMPLIED + > + +<!ELEMENT div %Flow;> <!-- generic language/style container --> +<!ATTLIST div + %attrs; + %TextAlign; + > + +<!--=================== Paragraphs =======================================--> + +<!ELEMENT p %Inline;> +<!ATTLIST p + %attrs; + %TextAlign; + > + +<!--=================== Headings =========================================--> + +<!-- + There are six levels of headings from h1 (the most important) + to h6 (the least important). +--> + +<!ELEMENT h1 %Inline;> +<!ATTLIST h1 + %attrs; + %TextAlign; + > + +<!ELEMENT h2 %Inline;> +<!ATTLIST h2 + %attrs; + %TextAlign; + > + +<!ELEMENT h3 %Inline;> +<!ATTLIST h3 + %attrs; + %TextAlign; + > + +<!ELEMENT h4 %Inline;> +<!ATTLIST h4 + %attrs; + %TextAlign; + > + +<!ELEMENT h5 %Inline;> +<!ATTLIST h5 + %attrs; + %TextAlign; + > + +<!ELEMENT h6 %Inline;> +<!ATTLIST h6 + %attrs; + %TextAlign; + > + +<!--=================== Lists ============================================--> + +<!-- Unordered list bullet styles --> + +<!ENTITY % ULStyle "(disc|square|circle)"> + +<!-- Unordered list --> + +<!ELEMENT ul (li)+> +<!ATTLIST ul + %attrs; + type %ULStyle; #IMPLIED + compact (compact) #IMPLIED + > + +<!-- Ordered list numbering style + + 1 arabic numbers 1, 2, 3, ... + a lower alpha a, b, c, ... + A upper alpha A, B, C, ... + i lower roman i, ii, iii, ... + I upper roman I, II, III, ... + + The style is applied to the sequence number which by default + is reset to 1 for the first list item in an ordered list. +--> +<!ENTITY % OLStyle "CDATA"> + +<!-- Ordered (numbered) list --> + +<!ELEMENT ol (li)+> +<!ATTLIST ol + %attrs; + type %OLStyle; #IMPLIED + compact (compact) #IMPLIED + start %Number; #IMPLIED + > + +<!-- single column list (DEPRECATED) --> +<!ELEMENT menu (li)+> +<!ATTLIST menu + %attrs; + compact (compact) #IMPLIED + > + +<!-- multiple column list (DEPRECATED) --> +<!ELEMENT dir (li)+> +<!ATTLIST dir + %attrs; + compact (compact) #IMPLIED + > + +<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" --> +<!ENTITY % LIStyle "CDATA"> + +<!-- list item --> + +<!ELEMENT li %Flow;> +<!ATTLIST li + %attrs; + type %LIStyle; #IMPLIED + value %Number; #IMPLIED + > + +<!-- definition lists - dt for term, dd for its definition --> + +<!ELEMENT dl (dt|dd)+> +<!ATTLIST dl + %attrs; + compact (compact) #IMPLIED + > + +<!ELEMENT dt %Inline;> +<!ATTLIST dt + %attrs; + > + +<!ELEMENT dd %Flow;> +<!ATTLIST dd + %attrs; + > + +<!--=================== Address ==========================================--> + +<!-- information on author --> + +<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*> +<!ATTLIST address + %attrs; + > + +<!--=================== Horizontal Rule ==================================--> + +<!ELEMENT hr EMPTY> +<!ATTLIST hr + %attrs; + align (left|center|right) #IMPLIED + noshade (noshade) #IMPLIED + size %Pixels; #IMPLIED + width %Length; #IMPLIED + > + +<!--=================== Preformatted Text ================================--> + +<!-- content is %Inline; excluding + "img|object|applet|big|small|sub|sup|font|basefont" --> + +<!ELEMENT pre %pre.content;> +<!ATTLIST pre + %attrs; + width %Number; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!--=================== Block-like Quotes ================================--> + +<!ELEMENT blockquote %Flow;> +<!ATTLIST blockquote + %attrs; + cite %URI; #IMPLIED + > + +<!--=================== Text alignment ===================================--> + +<!-- center content --> +<!ELEMENT center %Flow;> +<!ATTLIST center + %attrs; + > + +<!--=================== Inserted/Deleted Text ============================--> + + +<!-- + ins/del are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. +--> +<!ELEMENT ins %Flow;> +<!ATTLIST ins + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!ELEMENT del %Flow;> +<!ATTLIST del + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!--================== The Anchor Element ================================--> + +<!-- content is %Inline; except that anchors shouldn't be nested --> + +<!ELEMENT a %a.content;> +<!ATTLIST a + %attrs; + %focus; + charset %Charset; #IMPLIED + type %ContentType; #IMPLIED + name NMTOKEN #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + shape %Shape; "rect" + coords %Coords; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!--===================== Inline Elements ================================--> + +<!ELEMENT span %Inline;> <!-- generic language/style container --> +<!ATTLIST span + %attrs; + > + +<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> +<!ATTLIST bdo + %coreattrs; + %events; + lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #REQUIRED + > + +<!ELEMENT br EMPTY> <!-- forced line break --> +<!ATTLIST br + %coreattrs; + clear (left|all|right|none) "none" + > + +<!ELEMENT em %Inline;> <!-- emphasis --> +<!ATTLIST em %attrs;> + +<!ELEMENT strong %Inline;> <!-- strong emphasis --> +<!ATTLIST strong %attrs;> + +<!ELEMENT dfn %Inline;> <!-- definitional --> +<!ATTLIST dfn %attrs;> + +<!ELEMENT code %Inline;> <!-- program code --> +<!ATTLIST code %attrs;> + +<!ELEMENT samp %Inline;> <!-- sample --> +<!ATTLIST samp %attrs;> + +<!ELEMENT kbd %Inline;> <!-- something user would type --> +<!ATTLIST kbd %attrs;> + +<!ELEMENT var %Inline;> <!-- variable --> +<!ATTLIST var %attrs;> + +<!ELEMENT cite %Inline;> <!-- citation --> +<!ATTLIST cite %attrs;> + +<!ELEMENT abbr %Inline;> <!-- abbreviation --> +<!ATTLIST abbr %attrs;> + +<!ELEMENT acronym %Inline;> <!-- acronym --> +<!ATTLIST acronym %attrs;> + +<!ELEMENT q %Inline;> <!-- inlined quote --> +<!ATTLIST q + %attrs; + cite %URI; #IMPLIED + > + +<!ELEMENT sub %Inline;> <!-- subscript --> +<!ATTLIST sub %attrs;> + +<!ELEMENT sup %Inline;> <!-- superscript --> +<!ATTLIST sup %attrs;> + +<!ELEMENT tt %Inline;> <!-- fixed pitch font --> +<!ATTLIST tt %attrs;> + +<!ELEMENT i %Inline;> <!-- italic font --> +<!ATTLIST i %attrs;> + +<!ELEMENT b %Inline;> <!-- bold font --> +<!ATTLIST b %attrs;> + +<!ELEMENT big %Inline;> <!-- bigger font --> +<!ATTLIST big %attrs;> + +<!ELEMENT small %Inline;> <!-- smaller font --> +<!ATTLIST small %attrs;> + +<!ELEMENT u %Inline;> <!-- underline --> +<!ATTLIST u %attrs;> + +<!ELEMENT s %Inline;> <!-- strike-through --> +<!ATTLIST s %attrs;> + +<!ELEMENT strike %Inline;> <!-- strike-through --> +<!ATTLIST strike %attrs;> + +<!ELEMENT basefont EMPTY> <!-- base font size --> +<!ATTLIST basefont + id ID #IMPLIED + size CDATA #REQUIRED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!ELEMENT font %Inline;> <!-- local change to font --> +<!ATTLIST font + %coreattrs; + %i18n; + size CDATA #IMPLIED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!--==================== Object ======================================--> +<!-- + object is used to embed objects as part of HTML pages. + param elements should precede other content. Parameters + can also be expressed as attribute/value pairs on the + object element itself when brevity is desired. +--> + +<!ELEMENT object (#PCDATA | param | %block; | form |%inline; | %misc;)*> +<!ATTLIST object + %attrs; + declare (declare) #IMPLIED + classid %URI; #IMPLIED + codebase %URI; #IMPLIED + data %URI; #IMPLIED + type %ContentType; #IMPLIED + codetype %ContentType; #IMPLIED + archive %UriList; #IMPLIED + standby %Text; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + name NMTOKEN #IMPLIED + tabindex %Number; #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- + param is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced + by attribute value pairs on the object start tag. +--> +<!ELEMENT param EMPTY> +<!ATTLIST param + id ID #IMPLIED + name CDATA #REQUIRED + value CDATA #IMPLIED + valuetype (data|ref|object) "data" + type %ContentType; #IMPLIED + > + +<!--=================== Java applet ==================================--> +<!-- + One of code or object attributes must be present. + Place param elements before other content. +--> +<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST applet + %coreattrs; + codebase %URI; #IMPLIED + archive CDATA #IMPLIED + code CDATA #IMPLIED + object CDATA #IMPLIED + alt %Text; #IMPLIED + name NMTOKEN #IMPLIED + width %Length; #REQUIRED + height %Length; #REQUIRED + align %ImgAlign; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!--=================== Images ===========================================--> + +<!-- + To avoid accessibility problems for people who aren't + able to see the image, you should provide a text + description using the alt and longdesc attributes. + In addition, avoid the use of server-side image maps. +--> + +<!ELEMENT img EMPTY> +<!ATTLIST img + %attrs; + src %URI; #REQUIRED + alt %Text; #REQUIRED + name NMTOKEN #IMPLIED + longdesc %URI; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + ismap (ismap) #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- usemap points to a map element which may be in this document + or an external document, although the latter is not widely supported --> + +<!--================== Client-side image maps ============================--> + +<!-- These can be placed in the same document or grouped in a + separate document although this isn't yet widely supported --> + +<!ELEMENT map ((%block; | form | %misc;)+ | area+)> +<!ATTLIST map + %i18n; + %events; + id ID #REQUIRED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED + name NMTOKEN #IMPLIED + > + +<!ELEMENT area EMPTY> +<!ATTLIST area + %attrs; + %focus; + shape %Shape; "rect" + coords %Coords; #IMPLIED + href %URI; #IMPLIED + nohref (nohref) #IMPLIED + alt %Text; #REQUIRED + target %FrameTarget; #IMPLIED + > + +<!--================ Forms ===============================================--> + +<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> + +<!ATTLIST form + %attrs; + action %URI; #REQUIRED + method (get|post) "get" + name NMTOKEN #IMPLIED + enctype %ContentType; "application/x-www-form-urlencoded" + onsubmit %Script; #IMPLIED + onreset %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + accept-charset %Charsets; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- + Each label must not contain more than ONE field + Label elements shouldn't be nested. +--> +<!ELEMENT label %Inline;> +<!ATTLIST label + %attrs; + for IDREF #IMPLIED + accesskey %Character; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + > + +<!ENTITY % InputType + "(text | password | checkbox | + radio | submit | reset | + file | hidden | image | button)" + > + +<!-- the name attribute is required for all but submit & reset --> + +<!ELEMENT input EMPTY> <!-- form control --> +<!ATTLIST input + %attrs; + %focus; + type %InputType; "text" + name CDATA #IMPLIED + value CDATA #IMPLIED + checked (checked) #IMPLIED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + size CDATA #IMPLIED + maxlength %Number; #IMPLIED + src %URI; #IMPLIED + alt CDATA #IMPLIED + usemap %URI; #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + align %ImgAlign; #IMPLIED + > + +<!ELEMENT select (optgroup|option)+> <!-- option selector --> +<!ATTLIST select + %attrs; + name CDATA #IMPLIED + size %Number; #IMPLIED + multiple (multiple) #IMPLIED + disabled (disabled) #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!ELEMENT optgroup (option)+> <!-- option group --> +<!ATTLIST optgroup + %attrs; + disabled (disabled) #IMPLIED + label %Text; #REQUIRED + > + +<!ELEMENT option (#PCDATA)> <!-- selectable choice --> +<!ATTLIST option + %attrs; + selected (selected) #IMPLIED + disabled (disabled) #IMPLIED + label %Text; #IMPLIED + value CDATA #IMPLIED + > + +<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> +<!ATTLIST textarea + %attrs; + %focus; + name CDATA #IMPLIED + rows %Number; #REQUIRED + cols %Number; #REQUIRED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!-- + The fieldset element is used to group form fields. + Only one legend element should occur in the content + and if present should only be preceded by whitespace. +--> +<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> +<!ATTLIST fieldset + %attrs; + > + +<!ENTITY % LAlign "(top|bottom|left|right)"> + +<!ELEMENT legend %Inline;> <!-- fieldset label --> +<!ATTLIST legend + %attrs; + accesskey %Character; #IMPLIED + align %LAlign; #IMPLIED + > + +<!-- + Content is %Flow; excluding a, form, form controls, iframe +--> +<!ELEMENT button %button.content;> <!-- push button --> +<!ATTLIST button + %attrs; + %focus; + name CDATA #IMPLIED + value CDATA #IMPLIED + type (button|submit|reset) "submit" + disabled (disabled) #IMPLIED + > + +<!-- single-line text input control (DEPRECATED) --> +<!ELEMENT isindex EMPTY> +<!ATTLIST isindex + %coreattrs; + %i18n; + prompt %Text; #IMPLIED + > + +<!--======================= Tables =======================================--> + +<!-- Derived from IETF HTML table standard, see [RFC1942] --> + +<!-- + The border attribute sets the thickness of the frame around the + table. The default units are screen pixels. + + The frame attribute specifies which parts of the frame around + the table should be rendered. The values are not the same as + CALS to avoid a name clash with the valign attribute. +--> +<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> + +<!-- + The rules attribute defines which rules to draw between cells: + + If rules is absent then assume: + "none" if border is absent or border="0" otherwise "all" +--> + +<!ENTITY % TRules "(none | groups | rows | cols | all)"> + +<!-- horizontal placement of table relative to document --> +<!ENTITY % TAlign "(left|center|right)"> + +<!-- horizontal alignment attributes for cell contents + + char alignment char, e.g. char=":" + charoff offset for alignment char +--> +<!ENTITY % cellhalign + "align (left|center|right|justify|char) #IMPLIED + char %Character; #IMPLIED + charoff %Length; #IMPLIED" + > + +<!-- vertical alignment attributes for cell contents --> +<!ENTITY % cellvalign + "valign (top|middle|bottom|baseline) #IMPLIED" + > + +<!ELEMENT table + (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> +<!ELEMENT caption %Inline;> +<!ELEMENT thead (tr)+> +<!ELEMENT tfoot (tr)+> +<!ELEMENT tbody (tr)+> +<!ELEMENT colgroup (col)*> +<!ELEMENT col EMPTY> +<!ELEMENT tr (th|td)+> +<!ELEMENT th %Flow;> +<!ELEMENT td %Flow;> + +<!ATTLIST table + %attrs; + summary %Text; #IMPLIED + width %Length; #IMPLIED + border %Pixels; #IMPLIED + frame %TFrame; #IMPLIED + rules %TRules; #IMPLIED + cellspacing %Length; #IMPLIED + cellpadding %Length; #IMPLIED + align %TAlign; #IMPLIED + bgcolor %Color; #IMPLIED + > + +<!ENTITY % CAlign "(top|bottom|left|right)"> + +<!ATTLIST caption + %attrs; + align %CAlign; #IMPLIED + > + +<!-- +colgroup groups a set of col elements. It allows you to group +several semantically related columns together. +--> +<!ATTLIST colgroup + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + col elements define the alignment properties for cells in + one or more columns. + + The width attribute specifies the width of the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one + col element to apply to more than one column. +--> +<!ATTLIST col + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + Use thead to duplicate headers when breaking table + across page boundaries, or for static headers when + tbody sections are rendered in scrolling panel. + + Use tfoot to duplicate footers when breaking table + across page boundaries, or for static footers when + tbody sections are rendered in scrolling panel. + + Use multiple tbody sections when rules are needed + between groups of table rows. +--> +<!ATTLIST thead + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tfoot + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tbody + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tr + %attrs; + %cellhalign; + %cellvalign; + bgcolor %Color; #IMPLIED + > + +<!-- Scope is simpler than headers attribute for common tables --> +<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> + +<!-- th is for headers, td for data and for cells acting as both --> + +<!ATTLIST th + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Pixels; #IMPLIED + height %Pixels; #IMPLIED + > + +<!ATTLIST td + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Pixels; #IMPLIED + height %Pixels; #IMPLIED + > + diff --git a/lib/docbuilder/dtd/xhtml1-strict.dtd b/lib/docbuilder/dtd/xhtml1-strict.dtd new file mode 100644 index 0000000000..2927b9ece7 --- /dev/null +++ b/lib/docbuilder/dtd/xhtml1-strict.dtd @@ -0,0 +1,978 @@ +<!-- + Extensible HTML version 1.0 Strict DTD + + This is the same as HTML 4 Strict except for + changes due to the differences between XML and SGML. + + Namespace = http://www.w3.org/1999/xhtml + + For further information, see: http://www.w3.org/TR/xhtml1 + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + All Rights Reserved. + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + + $Revision: 1.1 $ + $Date: 2002/08/01 13:56:03 $ + +--> + +<!--================ Character mnemonic entities =========================--> + +<!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "xhtml-lat1.ent"> +%HTMLlat1; + +<!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "xhtml-symbol.ent"> +%HTMLsymbol; + +<!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "xhtml-special.ent"> +%HTMLspecial; + +<!--================== Imported Names ====================================--> + +<!ENTITY % ContentType "CDATA"> + <!-- media type, as per [RFC2045] --> + +<!ENTITY % ContentTypes "CDATA"> + <!-- comma-separated list of media types, as per [RFC2045] --> + +<!ENTITY % Charset "CDATA"> + <!-- a character encoding, as per [RFC2045] --> + +<!ENTITY % Charsets "CDATA"> + <!-- a space separated list of character encodings, as per [RFC2045] --> + +<!ENTITY % LanguageCode "NMTOKEN"> + <!-- a language code, as per [RFC3066] --> + +<!ENTITY % Character "CDATA"> + <!-- a single character, as per section 2.2 of [XML] --> + +<!ENTITY % Number "CDATA"> + <!-- one or more digits --> + +<!ENTITY % LinkTypes "CDATA"> + <!-- space-separated list of link types --> + +<!ENTITY % MediaDesc "CDATA"> + <!-- single or comma-separated list of media descriptors --> + +<!ENTITY % URI "CDATA"> + <!-- a Uniform Resource Identifier, see [RFC2396] --> + +<!ENTITY % UriList "CDATA"> + <!-- a space separated list of Uniform Resource Identifiers --> + +<!ENTITY % Datetime "CDATA"> + <!-- date and time information. ISO date format --> + +<!ENTITY % Script "CDATA"> + <!-- script expression --> + +<!ENTITY % StyleSheet "CDATA"> + <!-- style sheet data --> + +<!ENTITY % Text "CDATA"> + <!-- used for titles etc. --> + +<!ENTITY % Length "CDATA"> + <!-- nn for pixels or nn% for percentage length --> + +<!ENTITY % MultiLength "CDATA"> + <!-- pixel, percentage, or relative --> + +<!ENTITY % Pixels "CDATA"> + <!-- integer representing length in pixels --> + +<!-- these are used for image maps --> + +<!ENTITY % Shape "(rect|circle|poly|default)"> + +<!ENTITY % Coords "CDATA"> + <!-- comma separated list of lengths --> + +<!--=================== Generic Attributes ===============================--> + +<!-- core attributes common to most elements + id document-wide unique id + class space separated list of classes + style associated style info + title advisory title/amplification +--> +<!ENTITY % coreattrs + "id ID #IMPLIED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED" + > + +<!-- internationalization attributes + lang language code (backwards compatible) + xml:lang language code (as per XML 1.0 spec) + dir direction for weak/neutral text +--> +<!ENTITY % i18n + "lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #IMPLIED" + > + +<!-- attributes for common UI events + onclick a pointer button was clicked + ondblclick a pointer button was double clicked + onmousedown a pointer button was pressed down + onmouseup a pointer button was released + onmousemove a pointer was moved onto the element + onmouseout a pointer was moved away from the element + onkeypress a key was pressed and released + onkeydown a key was pressed down + onkeyup a key was released +--> +<!ENTITY % events + "onclick %Script; #IMPLIED + ondblclick %Script; #IMPLIED + onmousedown %Script; #IMPLIED + onmouseup %Script; #IMPLIED + onmouseover %Script; #IMPLIED + onmousemove %Script; #IMPLIED + onmouseout %Script; #IMPLIED + onkeypress %Script; #IMPLIED + onkeydown %Script; #IMPLIED + onkeyup %Script; #IMPLIED" + > + +<!-- attributes for elements that can get the focus + accesskey accessibility key character + tabindex position in tabbing order + onfocus the element got the focus + onblur the element lost the focus +--> +<!ENTITY % focus + "accesskey %Character; #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED" + > + +<!ENTITY % attrs "%coreattrs; %i18n; %events;"> + +<!--=================== Text Elements ====================================--> + +<!ENTITY % special.pre + "br | span | bdo | map"> + + +<!ENTITY % special + "%special.pre; | object | img "> + +<!ENTITY % fontstyle "tt | i | b | big | small "> + +<!ENTITY % phrase "em | strong | dfn | code | q | + samp | kbd | var | cite | abbr | acronym | sub | sup "> + +<!ENTITY % inline.forms "input | select | textarea | label | button"> + +<!-- these can occur at block or inline level --> +<!ENTITY % misc.inline "ins | del | script"> + +<!-- these can only occur at block level --> +<!ENTITY % misc "noscript | %misc.inline;"> + +<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> + +<!-- %Inline; covers inline or "text-level" elements --> +<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> + +<!--================== Block level elements ==============================--> + +<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> +<!ENTITY % lists "ul | ol | dl"> +<!ENTITY % blocktext "pre | hr | blockquote | address"> + +<!ENTITY % block + "p | %heading; | div | %lists; | %blocktext; | fieldset | table"> + +<!ENTITY % Block "(%block; | form | %misc;)*"> + +<!-- %Flow; mixes block and inline and is used for list items etc. --> +<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> + +<!--================== Content models for exclusions =====================--> + +<!-- a elements use %Inline; excluding a --> + +<!ENTITY % a.content + "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> + +<!-- pre uses %Inline excluding big, small, sup or sup --> + +<!ENTITY % pre.content + "(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline; + | %inline.forms;)*"> + +<!-- form uses %Block; excluding form --> + +<!ENTITY % form.content "(%block; | %misc;)*"> + +<!-- button uses %Flow; but excludes a, form and form controls --> + +<!ENTITY % button.content + "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | + table | %special; | %fontstyle; | %phrase; | %misc;)*"> + +<!--================ Document Structure ==================================--> + +<!-- the namespace URI designates the document profile --> + +<!ELEMENT html (head, body)> +<!ATTLIST html + %i18n; + id ID #IMPLIED + xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' + > + +<!--================ Document Head =======================================--> + +<!ENTITY % head.misc "(script|style|meta|link|object)*"> + +<!-- content model is %head.misc; combined with a single + title and an optional base element in any order --> + +<!ELEMENT head (%head.misc;, + ((title, %head.misc;, (base, %head.misc;)?) | + (base, %head.misc;, (title, %head.misc;))))> + +<!ATTLIST head + %i18n; + id ID #IMPLIED + profile %URI; #IMPLIED + > + +<!-- The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + --> +<!ELEMENT title (#PCDATA)> +<!ATTLIST title + %i18n; + id ID #IMPLIED + > + +<!-- document base URI --> + +<!ELEMENT base EMPTY> +<!ATTLIST base + href %URI; #REQUIRED + id ID #IMPLIED + > + +<!-- generic metainformation --> +<!ELEMENT meta EMPTY> +<!ATTLIST meta + %i18n; + id ID #IMPLIED + http-equiv CDATA #IMPLIED + name CDATA #IMPLIED + content CDATA #REQUIRED + scheme CDATA #IMPLIED + > + +<!-- + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used + with the link element in document head e.g. + start, contents, previous, next, index, end, help + b) to link to a separate style sheet (rel="stylesheet") + c) to make a link to a script (rel="script") + d) by stylesheets to control how collections of + html nodes are rendered into printed documents + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" media="print") +--> + +<!ELEMENT link EMPTY> +<!ATTLIST link + %attrs; + charset %Charset; #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + type %ContentType; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + media %MediaDesc; #IMPLIED + > + +<!-- style info, which may include CDATA sections --> +<!ELEMENT style (#PCDATA)> +<!ATTLIST style + %i18n; + id ID #IMPLIED + type %ContentType; #REQUIRED + media %MediaDesc; #IMPLIED + title %Text; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- script statements, which may include CDATA sections --> +<!ELEMENT script (#PCDATA)> +<!ATTLIST script + id ID #IMPLIED + charset %Charset; #IMPLIED + type %ContentType; #REQUIRED + src %URI; #IMPLIED + defer (defer) #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- alternate content container for non script-based rendering --> + +<!ELEMENT noscript %Block;> +<!ATTLIST noscript + %attrs; + > + +<!--=================== Document Body ====================================--> + +<!ELEMENT body %Block;> +<!ATTLIST body + %attrs; + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + > + +<!ELEMENT div %Flow;> <!-- generic language/style container --> +<!ATTLIST div + %attrs; + > + +<!--=================== Paragraphs =======================================--> + +<!ELEMENT p %Inline;> +<!ATTLIST p + %attrs; + > + +<!--=================== Headings =========================================--> + +<!-- + There are six levels of headings from h1 (the most important) + to h6 (the least important). +--> + +<!ELEMENT h1 %Inline;> +<!ATTLIST h1 + %attrs; + > + +<!ELEMENT h2 %Inline;> +<!ATTLIST h2 + %attrs; + > + +<!ELEMENT h3 %Inline;> +<!ATTLIST h3 + %attrs; + > + +<!ELEMENT h4 %Inline;> +<!ATTLIST h4 + %attrs; + > + +<!ELEMENT h5 %Inline;> +<!ATTLIST h5 + %attrs; + > + +<!ELEMENT h6 %Inline;> +<!ATTLIST h6 + %attrs; + > + +<!--=================== Lists ============================================--> + +<!-- Unordered list --> + +<!ELEMENT ul (li)+> +<!ATTLIST ul + %attrs; + > + +<!-- Ordered (numbered) list --> + +<!ELEMENT ol (li)+> +<!ATTLIST ol + %attrs; + > + +<!-- list item --> + +<!ELEMENT li %Flow;> +<!ATTLIST li + %attrs; + > + +<!-- definition lists - dt for term, dd for its definition --> + +<!ELEMENT dl (dt|dd)+> +<!ATTLIST dl + %attrs; + > + +<!ELEMENT dt %Inline;> +<!ATTLIST dt + %attrs; + > + +<!ELEMENT dd %Flow;> +<!ATTLIST dd + %attrs; + > + +<!--=================== Address ==========================================--> + +<!-- information on author --> + +<!ELEMENT address %Inline;> +<!ATTLIST address + %attrs; + > + +<!--=================== Horizontal Rule ==================================--> + +<!ELEMENT hr EMPTY> +<!ATTLIST hr + %attrs; + > + +<!--=================== Preformatted Text ================================--> + +<!-- content is %Inline; excluding "img|object|big|small|sub|sup" --> + +<!ELEMENT pre %pre.content;> +<!ATTLIST pre + %attrs; + xml:space (preserve) #FIXED 'preserve' + > + +<!--=================== Block-like Quotes ================================--> + +<!ELEMENT blockquote %Block;> +<!ATTLIST blockquote + %attrs; + cite %URI; #IMPLIED + > + +<!--=================== Inserted/Deleted Text ============================--> + +<!-- + ins/del are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. +--> +<!ELEMENT ins %Flow;> +<!ATTLIST ins + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!ELEMENT del %Flow;> +<!ATTLIST del + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!--================== The Anchor Element ================================--> + +<!-- content is %Inline; except that anchors shouldn't be nested --> + +<!ELEMENT a %a.content;> +<!ATTLIST a + %attrs; + %focus; + charset %Charset; #IMPLIED + type %ContentType; #IMPLIED + name NMTOKEN #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + shape %Shape; "rect" + coords %Coords; #IMPLIED + > + +<!--===================== Inline Elements ================================--> + +<!ELEMENT span %Inline;> <!-- generic language/style container --> +<!ATTLIST span + %attrs; + > + +<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> +<!ATTLIST bdo + %coreattrs; + %events; + lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #REQUIRED + > + +<!ELEMENT br EMPTY> <!-- forced line break --> +<!ATTLIST br + %coreattrs; + > + +<!ELEMENT em %Inline;> <!-- emphasis --> +<!ATTLIST em %attrs;> + +<!ELEMENT strong %Inline;> <!-- strong emphasis --> +<!ATTLIST strong %attrs;> + +<!ELEMENT dfn %Inline;> <!-- definitional --> +<!ATTLIST dfn %attrs;> + +<!ELEMENT code %Inline;> <!-- program code --> +<!ATTLIST code %attrs;> + +<!ELEMENT samp %Inline;> <!-- sample --> +<!ATTLIST samp %attrs;> + +<!ELEMENT kbd %Inline;> <!-- something user would type --> +<!ATTLIST kbd %attrs;> + +<!ELEMENT var %Inline;> <!-- variable --> +<!ATTLIST var %attrs;> + +<!ELEMENT cite %Inline;> <!-- citation --> +<!ATTLIST cite %attrs;> + +<!ELEMENT abbr %Inline;> <!-- abbreviation --> +<!ATTLIST abbr %attrs;> + +<!ELEMENT acronym %Inline;> <!-- acronym --> +<!ATTLIST acronym %attrs;> + +<!ELEMENT q %Inline;> <!-- inlined quote --> +<!ATTLIST q + %attrs; + cite %URI; #IMPLIED + > + +<!ELEMENT sub %Inline;> <!-- subscript --> +<!ATTLIST sub %attrs;> + +<!ELEMENT sup %Inline;> <!-- superscript --> +<!ATTLIST sup %attrs;> + +<!ELEMENT tt %Inline;> <!-- fixed pitch font --> +<!ATTLIST tt %attrs;> + +<!ELEMENT i %Inline;> <!-- italic font --> +<!ATTLIST i %attrs;> + +<!ELEMENT b %Inline;> <!-- bold font --> +<!ATTLIST b %attrs;> + +<!ELEMENT big %Inline;> <!-- bigger font --> +<!ATTLIST big %attrs;> + +<!ELEMENT small %Inline;> <!-- smaller font --> +<!ATTLIST small %attrs;> + +<!--==================== Object ======================================--> +<!-- + object is used to embed objects as part of HTML pages. + param elements should precede other content. Parameters + can also be expressed as attribute/value pairs on the + object element itself when brevity is desired. +--> + +<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST object + %attrs; + declare (declare) #IMPLIED + classid %URI; #IMPLIED + codebase %URI; #IMPLIED + data %URI; #IMPLIED + type %ContentType; #IMPLIED + codetype %ContentType; #IMPLIED + archive %UriList; #IMPLIED + standby %Text; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + name NMTOKEN #IMPLIED + tabindex %Number; #IMPLIED + > + +<!-- + param is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced + by attribute value pairs on the object start tag. +--> +<!ELEMENT param EMPTY> +<!ATTLIST param + id ID #IMPLIED + name CDATA #IMPLIED + value CDATA #IMPLIED + valuetype (data|ref|object) "data" + type %ContentType; #IMPLIED + > + +<!--=================== Images ===========================================--> + +<!-- + To avoid accessibility problems for people who aren't + able to see the image, you should provide a text + description using the alt and longdesc attributes. + In addition, avoid the use of server-side image maps. + Note that in this DTD there is no name attribute. That + is only available in the transitional and frameset DTD. +--> + +<!ELEMENT img EMPTY> +<!ATTLIST img + %attrs; + src %URI; #REQUIRED + alt %Text; #REQUIRED + longdesc %URI; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + ismap (ismap) #IMPLIED + > + +<!-- usemap points to a map element which may be in this document + or an external document, although the latter is not widely supported --> + +<!--================== Client-side image maps ============================--> + +<!-- These can be placed in the same document or grouped in a + separate document although this isn't yet widely supported --> + +<!ELEMENT map ((%block; | form | %misc;)+ | area+)> +<!ATTLIST map + %i18n; + %events; + id ID #REQUIRED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED + name NMTOKEN #IMPLIED + > + +<!ELEMENT area EMPTY> +<!ATTLIST area + %attrs; + %focus; + shape %Shape; "rect" + coords %Coords; #IMPLIED + href %URI; #IMPLIED + nohref (nohref) #IMPLIED + alt %Text; #REQUIRED + > + +<!--================ Forms ===============================================--> +<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> + +<!ATTLIST form + %attrs; + action %URI; #REQUIRED + method (get|post) "get" + enctype %ContentType; "application/x-www-form-urlencoded" + onsubmit %Script; #IMPLIED + onreset %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + accept-charset %Charsets; #IMPLIED + > + +<!-- + Each label must not contain more than ONE field + Label elements shouldn't be nested. +--> +<!ELEMENT label %Inline;> +<!ATTLIST label + %attrs; + for IDREF #IMPLIED + accesskey %Character; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + > + +<!ENTITY % InputType + "(text | password | checkbox | + radio | submit | reset | + file | hidden | image | button)" + > + +<!-- the name attribute is required for all but submit & reset --> + +<!ELEMENT input EMPTY> <!-- form control --> +<!ATTLIST input + %attrs; + %focus; + type %InputType; "text" + name CDATA #IMPLIED + value CDATA #IMPLIED + checked (checked) #IMPLIED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + size CDATA #IMPLIED + maxlength %Number; #IMPLIED + src %URI; #IMPLIED + alt CDATA #IMPLIED + usemap %URI; #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + > + +<!ELEMENT select (optgroup|option)+> <!-- option selector --> +<!ATTLIST select + %attrs; + name CDATA #IMPLIED + size %Number; #IMPLIED + multiple (multiple) #IMPLIED + disabled (disabled) #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!ELEMENT optgroup (option)+> <!-- option group --> +<!ATTLIST optgroup + %attrs; + disabled (disabled) #IMPLIED + label %Text; #REQUIRED + > + +<!ELEMENT option (#PCDATA)> <!-- selectable choice --> +<!ATTLIST option + %attrs; + selected (selected) #IMPLIED + disabled (disabled) #IMPLIED + label %Text; #IMPLIED + value CDATA #IMPLIED + > + +<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> +<!ATTLIST textarea + %attrs; + %focus; + name CDATA #IMPLIED + rows %Number; #REQUIRED + cols %Number; #REQUIRED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!-- + The fieldset element is used to group form fields. + Only one legend element should occur in the content + and if present should only be preceded by whitespace. +--> +<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> +<!ATTLIST fieldset + %attrs; + > + +<!ELEMENT legend %Inline;> <!-- fieldset label --> +<!ATTLIST legend + %attrs; + accesskey %Character; #IMPLIED + > + +<!-- + Content is %Flow; excluding a, form and form controls +--> +<!ELEMENT button %button.content;> <!-- push button --> +<!ATTLIST button + %attrs; + %focus; + name CDATA #IMPLIED + value CDATA #IMPLIED + type (button|submit|reset) "submit" + disabled (disabled) #IMPLIED + > + +<!--======================= Tables =======================================--> + +<!-- Derived from IETF HTML table standard, see [RFC1942] --> + +<!-- + The border attribute sets the thickness of the frame around the + table. The default units are screen pixels. + + The frame attribute specifies which parts of the frame around + the table should be rendered. The values are not the same as + CALS to avoid a name clash with the valign attribute. +--> +<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> + +<!-- + The rules attribute defines which rules to draw between cells: + + If rules is absent then assume: + "none" if border is absent or border="0" otherwise "all" +--> + +<!ENTITY % TRules "(none | groups | rows | cols | all)"> + +<!-- horizontal alignment attributes for cell contents + + char alignment char, e.g. char=':' + charoff offset for alignment char +--> +<!ENTITY % cellhalign + "align (left|center|right|justify|char) #IMPLIED + char %Character; #IMPLIED + charoff %Length; #IMPLIED" + > + +<!-- vertical alignment attributes for cell contents --> +<!ENTITY % cellvalign + "valign (top|middle|bottom|baseline) #IMPLIED" + > + +<!ELEMENT table + (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> +<!ELEMENT caption %Inline;> +<!ELEMENT thead (tr)+> +<!ELEMENT tfoot (tr)+> +<!ELEMENT tbody (tr)+> +<!ELEMENT colgroup (col)*> +<!ELEMENT col EMPTY> +<!ELEMENT tr (th|td)+> +<!ELEMENT th %Flow;> +<!ELEMENT td %Flow;> + +<!ATTLIST table + %attrs; + summary %Text; #IMPLIED + width %Length; #IMPLIED + border %Pixels; #IMPLIED + frame %TFrame; #IMPLIED + rules %TRules; #IMPLIED + cellspacing %Length; #IMPLIED + cellpadding %Length; #IMPLIED + > + +<!ATTLIST caption + %attrs; + > + +<!-- +colgroup groups a set of col elements. It allows you to group +several semantically related columns together. +--> +<!ATTLIST colgroup + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + col elements define the alignment properties for cells in + one or more columns. + + The width attribute specifies the width of the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one + col element to apply to more than one column. +--> +<!ATTLIST col + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + Use thead to duplicate headers when breaking table + across page boundaries, or for static headers when + tbody sections are rendered in scrolling panel. + + Use tfoot to duplicate footers when breaking table + across page boundaries, or for static footers when + tbody sections are rendered in scrolling panel. + + Use multiple tbody sections when rules are needed + between groups of table rows. +--> +<!ATTLIST thead + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tfoot + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tbody + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tr + %attrs; + %cellhalign; + %cellvalign; + > + + +<!-- Scope is simpler than headers attribute for common tables --> +<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> + +<!-- th is for headers, td for data and for cells acting as both --> + +<!ATTLIST th + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + > + +<!ATTLIST td + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + > + diff --git a/lib/docbuilder/dtd/xhtml1-transitional.dtd b/lib/docbuilder/dtd/xhtml1-transitional.dtd new file mode 100644 index 0000000000..628f27ac50 --- /dev/null +++ b/lib/docbuilder/dtd/xhtml1-transitional.dtd @@ -0,0 +1,1201 @@ +<!-- + Extensible HTML version 1.0 Transitional DTD + + This is the same as HTML 4 Transitional except for + changes due to the differences between XML and SGML. + + Namespace = http://www.w3.org/1999/xhtml + + For further information, see: http://www.w3.org/TR/xhtml1 + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + All Rights Reserved. + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + + $Revision: 1.2 $ + $Date: 2002/08/01 18:37:55 $ + +--> + +<!--================ Character mnemonic entities =========================--> + +<!ENTITY % HTMLlat1 PUBLIC + "-//W3C//ENTITIES Latin 1 for XHTML//EN" + "xhtml-lat1.ent"> +%HTMLlat1; + +<!ENTITY % HTMLsymbol PUBLIC + "-//W3C//ENTITIES Symbols for XHTML//EN" + "xhtml-symbol.ent"> +%HTMLsymbol; + +<!ENTITY % HTMLspecial PUBLIC + "-//W3C//ENTITIES Special for XHTML//EN" + "xhtml-special.ent"> +%HTMLspecial; + +<!--================== Imported Names ====================================--> + +<!ENTITY % ContentType "CDATA"> + <!-- media type, as per [RFC2045] --> + +<!ENTITY % ContentTypes "CDATA"> + <!-- comma-separated list of media types, as per [RFC2045] --> + +<!ENTITY % Charset "CDATA"> + <!-- a character encoding, as per [RFC2045] --> + +<!ENTITY % Charsets "CDATA"> + <!-- a space separated list of character encodings, as per [RFC2045] --> + +<!ENTITY % LanguageCode "NMTOKEN"> + <!-- a language code, as per [RFC3066] --> + +<!ENTITY % Character "CDATA"> + <!-- a single character, as per section 2.2 of [XML] --> + +<!ENTITY % Number "CDATA"> + <!-- one or more digits --> + +<!ENTITY % LinkTypes "CDATA"> + <!-- space-separated list of link types --> + +<!ENTITY % MediaDesc "CDATA"> + <!-- single or comma-separated list of media descriptors --> + +<!ENTITY % URI "CDATA"> + <!-- a Uniform Resource Identifier, see [RFC2396] --> + +<!ENTITY % UriList "CDATA"> + <!-- a space separated list of Uniform Resource Identifiers --> + +<!ENTITY % Datetime "CDATA"> + <!-- date and time information. ISO date format --> + +<!ENTITY % Script "CDATA"> + <!-- script expression --> + +<!ENTITY % StyleSheet "CDATA"> + <!-- style sheet data --> + +<!ENTITY % Text "CDATA"> + <!-- used for titles etc. --> + +<!ENTITY % FrameTarget "NMTOKEN"> + <!-- render in this frame --> + +<!ENTITY % Length "CDATA"> + <!-- nn for pixels or nn% for percentage length --> + +<!ENTITY % MultiLength "CDATA"> + <!-- pixel, percentage, or relative --> + +<!ENTITY % Pixels "CDATA"> + <!-- integer representing length in pixels --> + +<!-- these are used for image maps --> + +<!ENTITY % Shape "(rect|circle|poly|default)"> + +<!ENTITY % Coords "CDATA"> + <!-- comma separated list of lengths --> + +<!-- used for object, applet, img, input and iframe --> +<!ENTITY % ImgAlign "(top|middle|bottom|left|right)"> + +<!-- a color using sRGB: #RRGGBB as Hex values --> +<!ENTITY % Color "CDATA"> + +<!-- There are also 16 widely known color names with their sRGB values: + + Black = #000000 Green = #008000 + Silver = #C0C0C0 Lime = #00FF00 + Gray = #808080 Olive = #808000 + White = #FFFFFF Yellow = #FFFF00 + Maroon = #800000 Navy = #000080 + Red = #FF0000 Blue = #0000FF + Purple = #800080 Teal = #008080 + Fuchsia= #FF00FF Aqua = #00FFFF +--> + +<!--=================== Generic Attributes ===============================--> + +<!-- core attributes common to most elements + id document-wide unique id + class space separated list of classes + style associated style info + title advisory title/amplification +--> +<!ENTITY % coreattrs + "id ID #IMPLIED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED" + > + +<!-- internationalization attributes + lang language code (backwards compatible) + xml:lang language code (as per XML 1.0 spec) + dir direction for weak/neutral text +--> +<!ENTITY % i18n + "lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #IMPLIED" + > + +<!-- attributes for common UI events + onclick a pointer button was clicked + ondblclick a pointer button was double clicked + onmousedown a pointer button was pressed down + onmouseup a pointer button was released + onmousemove a pointer was moved onto the element + onmouseout a pointer was moved away from the element + onkeypress a key was pressed and released + onkeydown a key was pressed down + onkeyup a key was released +--> +<!ENTITY % events + "onclick %Script; #IMPLIED + ondblclick %Script; #IMPLIED + onmousedown %Script; #IMPLIED + onmouseup %Script; #IMPLIED + onmouseover %Script; #IMPLIED + onmousemove %Script; #IMPLIED + onmouseout %Script; #IMPLIED + onkeypress %Script; #IMPLIED + onkeydown %Script; #IMPLIED + onkeyup %Script; #IMPLIED" + > + +<!-- attributes for elements that can get the focus + accesskey accessibility key character + tabindex position in tabbing order + onfocus the element got the focus + onblur the element lost the focus +--> +<!ENTITY % focus + "accesskey %Character; #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED" + > + +<!ENTITY % attrs "%coreattrs; %i18n; %events;"> + +<!-- text alignment for p, div, h1-h6. The default is + align="left" for ltr headings, "right" for rtl --> + +<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED"> + +<!--=================== Text Elements ====================================--> + +<!ENTITY % special.extra + "object | applet | img | map | iframe"> + +<!ENTITY % special.basic + "br | span | bdo"> + +<!ENTITY % special + "%special.basic; | %special.extra;"> + +<!ENTITY % fontstyle.extra "big | small | font | basefont"> + +<!ENTITY % fontstyle.basic "tt | i | b | u + | s | strike "> + +<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;"> + +<!ENTITY % phrase.extra "sub | sup"> +<!ENTITY % phrase.basic "em | strong | dfn | code | q | + samp | kbd | var | cite | abbr | acronym"> + +<!ENTITY % phrase "%phrase.basic; | %phrase.extra;"> + +<!ENTITY % inline.forms "input | select | textarea | label | button"> + +<!-- these can occur at block or inline level --> +<!ENTITY % misc.inline "ins | del | script"> + +<!-- these can only occur at block level --> +<!ENTITY % misc "noscript | %misc.inline;"> + +<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> + +<!-- %Inline; covers inline or "text-level" elements --> +<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> + +<!--================== Block level elements ==============================--> + +<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> +<!ENTITY % lists "ul | ol | dl | menu | dir"> +<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes"> + +<!ENTITY % block + "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table"> + +<!-- %Flow; mixes block and inline and is used for list items etc. --> +<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> + +<!--================== Content models for exclusions =====================--> + +<!-- a elements use %Inline; excluding a --> + +<!ENTITY % a.content + "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> + +<!-- pre uses %Inline excluding img, object, applet, big, small, + font, or basefont --> + +<!ENTITY % pre.content + "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; | + %inline.forms; | %misc.inline;)*"> + +<!-- form uses %Flow; excluding form --> + +<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*"> + +<!-- button uses %Flow; but excludes a, form, form controls, iframe --> + +<!ENTITY % button.content + "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | + table | br | span | bdo | object | applet | img | map | + %fontstyle; | %phrase; | %misc;)*"> + +<!--================ Document Structure ==================================--> + +<!-- the namespace URI designates the document profile --> + +<!ELEMENT html (head, body)> +<!ATTLIST html + %i18n; + id ID #IMPLIED + xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' + > + +<!--================ Document Head =======================================--> + +<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*"> + +<!-- content model is %head.misc; combined with a single + title and an optional base element in any order --> + +<!ELEMENT head (%head.misc;, + ((title, %head.misc;, (base, %head.misc;)?) | + (base, %head.misc;, (title, %head.misc;))))> + +<!ATTLIST head + %i18n; + id ID #IMPLIED + profile %URI; #IMPLIED + > + +<!-- The title element is not considered part of the flow of text. + It should be displayed, for example as the page header or + window title. Exactly one title is required per document. + --> +<!ELEMENT title (#PCDATA)> +<!ATTLIST title + %i18n; + id ID #IMPLIED + > + +<!-- document base URI --> + +<!ELEMENT base EMPTY> +<!ATTLIST base + id ID #IMPLIED + href %URI; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- generic metainformation --> +<!ELEMENT meta EMPTY> +<!ATTLIST meta + %i18n; + id ID #IMPLIED + http-equiv CDATA #IMPLIED + name CDATA #IMPLIED + content CDATA #REQUIRED + scheme CDATA #IMPLIED + > + +<!-- + Relationship values can be used in principle: + + a) for document specific toolbars/menus when used + with the link element in document head e.g. + start, contents, previous, next, index, end, help + b) to link to a separate style sheet (rel="stylesheet") + c) to make a link to a script (rel="script") + d) by stylesheets to control how collections of + html nodes are rendered into printed documents + e) to make a link to a printable version of this document + e.g. a PostScript or PDF version (rel="alternate" media="print") +--> + +<!ELEMENT link EMPTY> +<!ATTLIST link + %attrs; + charset %Charset; #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + type %ContentType; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + media %MediaDesc; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- style info, which may include CDATA sections --> +<!ELEMENT style (#PCDATA)> +<!ATTLIST style + %i18n; + id ID #IMPLIED + type %ContentType; #REQUIRED + media %MediaDesc; #IMPLIED + title %Text; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- script statements, which may include CDATA sections --> +<!ELEMENT script (#PCDATA)> +<!ATTLIST script + id ID #IMPLIED + charset %Charset; #IMPLIED + type %ContentType; #REQUIRED + language CDATA #IMPLIED + src %URI; #IMPLIED + defer (defer) #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!-- alternate content container for non script-based rendering --> + +<!ELEMENT noscript %Flow;> +<!ATTLIST noscript + %attrs; + > + +<!--======================= Frames =======================================--> + +<!-- inline subwindow --> + +<!ELEMENT iframe %Flow;> +<!ATTLIST iframe + %coreattrs; + longdesc %URI; #IMPLIED + name NMTOKEN #IMPLIED + src %URI; #IMPLIED + frameborder (1|0) "1" + marginwidth %Pixels; #IMPLIED + marginheight %Pixels; #IMPLIED + scrolling (yes|no|auto) "auto" + align %ImgAlign; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + > + +<!-- alternate content container for non frame-based rendering --> + +<!ELEMENT noframes %Flow;> +<!ATTLIST noframes + %attrs; + > + +<!--=================== Document Body ====================================--> + +<!ELEMENT body %Flow;> +<!ATTLIST body + %attrs; + onload %Script; #IMPLIED + onunload %Script; #IMPLIED + background %URI; #IMPLIED + bgcolor %Color; #IMPLIED + text %Color; #IMPLIED + link %Color; #IMPLIED + vlink %Color; #IMPLIED + alink %Color; #IMPLIED + > + +<!ELEMENT div %Flow;> <!-- generic language/style container --> +<!ATTLIST div + %attrs; + %TextAlign; + > + +<!--=================== Paragraphs =======================================--> + +<!ELEMENT p %Inline;> +<!ATTLIST p + %attrs; + %TextAlign; + > + +<!--=================== Headings =========================================--> + +<!-- + There are six levels of headings from h1 (the most important) + to h6 (the least important). +--> + +<!ELEMENT h1 %Inline;> +<!ATTLIST h1 + %attrs; + %TextAlign; + > + +<!ELEMENT h2 %Inline;> +<!ATTLIST h2 + %attrs; + %TextAlign; + > + +<!ELEMENT h3 %Inline;> +<!ATTLIST h3 + %attrs; + %TextAlign; + > + +<!ELEMENT h4 %Inline;> +<!ATTLIST h4 + %attrs; + %TextAlign; + > + +<!ELEMENT h5 %Inline;> +<!ATTLIST h5 + %attrs; + %TextAlign; + > + +<!ELEMENT h6 %Inline;> +<!ATTLIST h6 + %attrs; + %TextAlign; + > + +<!--=================== Lists ============================================--> + +<!-- Unordered list bullet styles --> + +<!ENTITY % ULStyle "(disc|square|circle)"> + +<!-- Unordered list --> + +<!ELEMENT ul (li)+> +<!ATTLIST ul + %attrs; + type %ULStyle; #IMPLIED + compact (compact) #IMPLIED + > + +<!-- Ordered list numbering style + + 1 arabic numbers 1, 2, 3, ... + a lower alpha a, b, c, ... + A upper alpha A, B, C, ... + i lower roman i, ii, iii, ... + I upper roman I, II, III, ... + + The style is applied to the sequence number which by default + is reset to 1 for the first list item in an ordered list. +--> +<!ENTITY % OLStyle "CDATA"> + +<!-- Ordered (numbered) list --> + +<!ELEMENT ol (li)+> +<!ATTLIST ol + %attrs; + type %OLStyle; #IMPLIED + compact (compact) #IMPLIED + start %Number; #IMPLIED + > + +<!-- single column list (DEPRECATED) --> +<!ELEMENT menu (li)+> +<!ATTLIST menu + %attrs; + compact (compact) #IMPLIED + > + +<!-- multiple column list (DEPRECATED) --> +<!ELEMENT dir (li)+> +<!ATTLIST dir + %attrs; + compact (compact) #IMPLIED + > + +<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" --> +<!ENTITY % LIStyle "CDATA"> + +<!-- list item --> + +<!ELEMENT li %Flow;> +<!ATTLIST li + %attrs; + type %LIStyle; #IMPLIED + value %Number; #IMPLIED + > + +<!-- definition lists - dt for term, dd for its definition --> + +<!ELEMENT dl (dt|dd)+> +<!ATTLIST dl + %attrs; + compact (compact) #IMPLIED + > + +<!ELEMENT dt %Inline;> +<!ATTLIST dt + %attrs; + > + +<!ELEMENT dd %Flow;> +<!ATTLIST dd + %attrs; + > + +<!--=================== Address ==========================================--> + +<!-- information on author --> + +<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*> +<!ATTLIST address + %attrs; + > + +<!--=================== Horizontal Rule ==================================--> + +<!ELEMENT hr EMPTY> +<!ATTLIST hr + %attrs; + align (left|center|right) #IMPLIED + noshade (noshade) #IMPLIED + size %Pixels; #IMPLIED + width %Length; #IMPLIED + > + +<!--=================== Preformatted Text ================================--> + +<!-- content is %Inline; excluding + "img|object|applet|big|small|sub|sup|font|basefont" --> + +<!ELEMENT pre %pre.content;> +<!ATTLIST pre + %attrs; + width %Number; #IMPLIED + xml:space (preserve) #FIXED 'preserve' + > + +<!--=================== Block-like Quotes ================================--> + +<!ELEMENT blockquote %Flow;> +<!ATTLIST blockquote + %attrs; + cite %URI; #IMPLIED + > + +<!--=================== Text alignment ===================================--> + +<!-- center content --> +<!ELEMENT center %Flow;> +<!ATTLIST center + %attrs; + > + +<!--=================== Inserted/Deleted Text ============================--> + +<!-- + ins/del are allowed in block and inline content, but its + inappropriate to include block content within an ins element + occurring in inline content. +--> +<!ELEMENT ins %Flow;> +<!ATTLIST ins + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!ELEMENT del %Flow;> +<!ATTLIST del + %attrs; + cite %URI; #IMPLIED + datetime %Datetime; #IMPLIED + > + +<!--================== The Anchor Element ================================--> + +<!-- content is %Inline; except that anchors shouldn't be nested --> + +<!ELEMENT a %a.content;> +<!ATTLIST a + %attrs; + %focus; + charset %Charset; #IMPLIED + type %ContentType; #IMPLIED + name NMTOKEN #IMPLIED + href %URI; #IMPLIED + hreflang %LanguageCode; #IMPLIED + rel %LinkTypes; #IMPLIED + rev %LinkTypes; #IMPLIED + shape %Shape; "rect" + coords %Coords; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!--===================== Inline Elements ================================--> + +<!ELEMENT span %Inline;> <!-- generic language/style container --> +<!ATTLIST span + %attrs; + > + +<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> +<!ATTLIST bdo + %coreattrs; + %events; + lang %LanguageCode; #IMPLIED + xml:lang %LanguageCode; #IMPLIED + dir (ltr|rtl) #REQUIRED + > + +<!ELEMENT br EMPTY> <!-- forced line break --> +<!ATTLIST br + %coreattrs; + clear (left|all|right|none) "none" + > + +<!ELEMENT em %Inline;> <!-- emphasis --> +<!ATTLIST em %attrs;> + +<!ELEMENT strong %Inline;> <!-- strong emphasis --> +<!ATTLIST strong %attrs;> + +<!ELEMENT dfn %Inline;> <!-- definitional --> +<!ATTLIST dfn %attrs;> + +<!ELEMENT code %Inline;> <!-- program code --> +<!ATTLIST code %attrs;> + +<!ELEMENT samp %Inline;> <!-- sample --> +<!ATTLIST samp %attrs;> + +<!ELEMENT kbd %Inline;> <!-- something user would type --> +<!ATTLIST kbd %attrs;> + +<!ELEMENT var %Inline;> <!-- variable --> +<!ATTLIST var %attrs;> + +<!ELEMENT cite %Inline;> <!-- citation --> +<!ATTLIST cite %attrs;> + +<!ELEMENT abbr %Inline;> <!-- abbreviation --> +<!ATTLIST abbr %attrs;> + +<!ELEMENT acronym %Inline;> <!-- acronym --> +<!ATTLIST acronym %attrs;> + +<!ELEMENT q %Inline;> <!-- inlined quote --> +<!ATTLIST q + %attrs; + cite %URI; #IMPLIED + > + +<!ELEMENT sub %Inline;> <!-- subscript --> +<!ATTLIST sub %attrs;> + +<!ELEMENT sup %Inline;> <!-- superscript --> +<!ATTLIST sup %attrs;> + +<!ELEMENT tt %Inline;> <!-- fixed pitch font --> +<!ATTLIST tt %attrs;> + +<!ELEMENT i %Inline;> <!-- italic font --> +<!ATTLIST i %attrs;> + +<!ELEMENT b %Inline;> <!-- bold font --> +<!ATTLIST b %attrs;> + +<!ELEMENT big %Inline;> <!-- bigger font --> +<!ATTLIST big %attrs;> + +<!ELEMENT small %Inline;> <!-- smaller font --> +<!ATTLIST small %attrs;> + +<!ELEMENT u %Inline;> <!-- underline --> +<!ATTLIST u %attrs;> + +<!ELEMENT s %Inline;> <!-- strike-through --> +<!ATTLIST s %attrs;> + +<!ELEMENT strike %Inline;> <!-- strike-through --> +<!ATTLIST strike %attrs;> + +<!ELEMENT basefont EMPTY> <!-- base font size --> +<!ATTLIST basefont + id ID #IMPLIED + size CDATA #REQUIRED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!ELEMENT font %Inline;> <!-- local change to font --> +<!ATTLIST font + %coreattrs; + %i18n; + size CDATA #IMPLIED + color %Color; #IMPLIED + face CDATA #IMPLIED + > + +<!--==================== Object ======================================--> +<!-- + object is used to embed objects as part of HTML pages. + param elements should precede other content. Parameters + can also be expressed as attribute/value pairs on the + object element itself when brevity is desired. +--> + +<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST object + %attrs; + declare (declare) #IMPLIED + classid %URI; #IMPLIED + codebase %URI; #IMPLIED + data %URI; #IMPLIED + type %ContentType; #IMPLIED + codetype %ContentType; #IMPLIED + archive %UriList; #IMPLIED + standby %Text; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + name NMTOKEN #IMPLIED + tabindex %Number; #IMPLIED + align %ImgAlign; #IMPLIED + border %Pixels; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- + param is used to supply a named property value. + In XML it would seem natural to follow RDF and support an + abbreviated syntax where the param elements are replaced + by attribute value pairs on the object start tag. +--> +<!ELEMENT param EMPTY> +<!ATTLIST param + id ID #IMPLIED + name CDATA #REQUIRED + value CDATA #IMPLIED + valuetype (data|ref|object) "data" + type %ContentType; #IMPLIED + > + +<!--=================== Java applet ==================================--> +<!-- + One of code or object attributes must be present. + Place param elements before other content. +--> +<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*> +<!ATTLIST applet + %coreattrs; + codebase %URI; #IMPLIED + archive CDATA #IMPLIED + code CDATA #IMPLIED + object CDATA #IMPLIED + alt %Text; #IMPLIED + name NMTOKEN #IMPLIED + width %Length; #REQUIRED + height %Length; #REQUIRED + align %ImgAlign; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!--=================== Images ===========================================--> + +<!-- + To avoid accessibility problems for people who aren't + able to see the image, you should provide a text + description using the alt and longdesc attributes. + In addition, avoid the use of server-side image maps. +--> + +<!ELEMENT img EMPTY> +<!ATTLIST img + %attrs; + src %URI; #REQUIRED + alt %Text; #REQUIRED + name NMTOKEN #IMPLIED + longdesc %URI; #IMPLIED + height %Length; #IMPLIED + width %Length; #IMPLIED + usemap %URI; #IMPLIED + ismap (ismap) #IMPLIED + align %ImgAlign; #IMPLIED + border %Length; #IMPLIED + hspace %Pixels; #IMPLIED + vspace %Pixels; #IMPLIED + > + +<!-- usemap points to a map element which may be in this document + or an external document, although the latter is not widely supported --> + +<!--================== Client-side image maps ============================--> + +<!-- These can be placed in the same document or grouped in a + separate document although this isn't yet widely supported --> + +<!ELEMENT map ((%block; | form | %misc;)+ | area+)> +<!ATTLIST map + %i18n; + %events; + id ID #REQUIRED + class CDATA #IMPLIED + style %StyleSheet; #IMPLIED + title %Text; #IMPLIED + name CDATA #IMPLIED + > + +<!ELEMENT area EMPTY> +<!ATTLIST area + %attrs; + %focus; + shape %Shape; "rect" + coords %Coords; #IMPLIED + href %URI; #IMPLIED + nohref (nohref) #IMPLIED + alt %Text; #REQUIRED + target %FrameTarget; #IMPLIED + > + +<!--================ Forms ===============================================--> + +<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> + +<!ATTLIST form + %attrs; + action %URI; #REQUIRED + method (get|post) "get" + name NMTOKEN #IMPLIED + enctype %ContentType; "application/x-www-form-urlencoded" + onsubmit %Script; #IMPLIED + onreset %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + accept-charset %Charsets; #IMPLIED + target %FrameTarget; #IMPLIED + > + +<!-- + Each label must not contain more than ONE field + Label elements shouldn't be nested. +--> +<!ELEMENT label %Inline;> +<!ATTLIST label + %attrs; + for IDREF #IMPLIED + accesskey %Character; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + > + +<!ENTITY % InputType + "(text | password | checkbox | + radio | submit | reset | + file | hidden | image | button)" + > + +<!-- the name attribute is required for all but submit & reset --> + +<!ELEMENT input EMPTY> <!-- form control --> +<!ATTLIST input + %attrs; + %focus; + type %InputType; "text" + name CDATA #IMPLIED + value CDATA #IMPLIED + checked (checked) #IMPLIED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + size CDATA #IMPLIED + maxlength %Number; #IMPLIED + src %URI; #IMPLIED + alt CDATA #IMPLIED + usemap %URI; #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + accept %ContentTypes; #IMPLIED + align %ImgAlign; #IMPLIED + > + +<!ELEMENT select (optgroup|option)+> <!-- option selector --> +<!ATTLIST select + %attrs; + name CDATA #IMPLIED + size %Number; #IMPLIED + multiple (multiple) #IMPLIED + disabled (disabled) #IMPLIED + tabindex %Number; #IMPLIED + onfocus %Script; #IMPLIED + onblur %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!ELEMENT optgroup (option)+> <!-- option group --> +<!ATTLIST optgroup + %attrs; + disabled (disabled) #IMPLIED + label %Text; #REQUIRED + > + +<!ELEMENT option (#PCDATA)> <!-- selectable choice --> +<!ATTLIST option + %attrs; + selected (selected) #IMPLIED + disabled (disabled) #IMPLIED + label %Text; #IMPLIED + value CDATA #IMPLIED + > + +<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> +<!ATTLIST textarea + %attrs; + %focus; + name CDATA #IMPLIED + rows %Number; #REQUIRED + cols %Number; #REQUIRED + disabled (disabled) #IMPLIED + readonly (readonly) #IMPLIED + onselect %Script; #IMPLIED + onchange %Script; #IMPLIED + > + +<!-- + The fieldset element is used to group form fields. + Only one legend element should occur in the content + and if present should only be preceded by whitespace. +--> +<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> +<!ATTLIST fieldset + %attrs; + > + +<!ENTITY % LAlign "(top|bottom|left|right)"> + +<!ELEMENT legend %Inline;> <!-- fieldset label --> +<!ATTLIST legend + %attrs; + accesskey %Character; #IMPLIED + align %LAlign; #IMPLIED + > + +<!-- + Content is %Flow; excluding a, form, form controls, iframe +--> +<!ELEMENT button %button.content;> <!-- push button --> +<!ATTLIST button + %attrs; + %focus; + name CDATA #IMPLIED + value CDATA #IMPLIED + type (button|submit|reset) "submit" + disabled (disabled) #IMPLIED + > + +<!-- single-line text input control (DEPRECATED) --> +<!ELEMENT isindex EMPTY> +<!ATTLIST isindex + %coreattrs; + %i18n; + prompt %Text; #IMPLIED + > + +<!--======================= Tables =======================================--> + +<!-- Derived from IETF HTML table standard, see [RFC1942] --> + +<!-- + The border attribute sets the thickness of the frame around the + table. The default units are screen pixels. + + The frame attribute specifies which parts of the frame around + the table should be rendered. The values are not the same as + CALS to avoid a name clash with the valign attribute. +--> +<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> + +<!-- + The rules attribute defines which rules to draw between cells: + + If rules is absent then assume: + "none" if border is absent or border="0" otherwise "all" +--> + +<!ENTITY % TRules "(none | groups | rows | cols | all)"> + +<!-- horizontal placement of table relative to document --> +<!ENTITY % TAlign "(left|center|right)"> + +<!-- horizontal alignment attributes for cell contents + + char alignment char, e.g. char=':' + charoff offset for alignment char +--> +<!ENTITY % cellhalign + "align (left|center|right|justify|char) #IMPLIED + char %Character; #IMPLIED + charoff %Length; #IMPLIED" + > + +<!-- vertical alignment attributes for cell contents --> +<!ENTITY % cellvalign + "valign (top|middle|bottom|baseline) #IMPLIED" + > + +<!ELEMENT table + (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> +<!ELEMENT caption %Inline;> +<!ELEMENT thead (tr)+> +<!ELEMENT tfoot (tr)+> +<!ELEMENT tbody (tr)+> +<!ELEMENT colgroup (col)*> +<!ELEMENT col EMPTY> +<!ELEMENT tr (th|td)+> +<!ELEMENT th %Flow;> +<!ELEMENT td %Flow;> + +<!ATTLIST table + %attrs; + summary %Text; #IMPLIED + width %Length; #IMPLIED + border %Pixels; #IMPLIED + frame %TFrame; #IMPLIED + rules %TRules; #IMPLIED + cellspacing %Length; #IMPLIED + cellpadding %Length; #IMPLIED + align %TAlign; #IMPLIED + bgcolor %Color; #IMPLIED + > + +<!ENTITY % CAlign "(top|bottom|left|right)"> + +<!ATTLIST caption + %attrs; + align %CAlign; #IMPLIED + > + +<!-- +colgroup groups a set of col elements. It allows you to group +several semantically related columns together. +--> +<!ATTLIST colgroup + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + col elements define the alignment properties for cells in + one or more columns. + + The width attribute specifies the width of the columns, e.g. + + width=64 width in screen pixels + width=0.5* relative width of 0.5 + + The span attribute causes the attributes of one + col element to apply to more than one column. +--> +<!ATTLIST col + %attrs; + span %Number; "1" + width %MultiLength; #IMPLIED + %cellhalign; + %cellvalign; + > + +<!-- + Use thead to duplicate headers when breaking table + across page boundaries, or for static headers when + tbody sections are rendered in scrolling panel. + + Use tfoot to duplicate footers when breaking table + across page boundaries, or for static footers when + tbody sections are rendered in scrolling panel. + + Use multiple tbody sections when rules are needed + between groups of table rows. +--> +<!ATTLIST thead + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tfoot + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tbody + %attrs; + %cellhalign; + %cellvalign; + > + +<!ATTLIST tr + %attrs; + %cellhalign; + %cellvalign; + bgcolor %Color; #IMPLIED + > + +<!-- Scope is simpler than headers attribute for common tables --> +<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> + +<!-- th is for headers, td for data and for cells acting as both --> + +<!ATTLIST th + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Length; #IMPLIED + height %Length; #IMPLIED + > + +<!ATTLIST td + %attrs; + abbr %Text; #IMPLIED + axis CDATA #IMPLIED + headers IDREFS #IMPLIED + scope %Scope; #IMPLIED + rowspan %Number; "1" + colspan %Number; "1" + %cellhalign; + %cellvalign; + nowrap (nowrap) #IMPLIED + bgcolor %Color; #IMPLIED + width %Length; #IMPLIED + height %Length; #IMPLIED + > + diff --git a/lib/docbuilder/ebin/.gitignore b/lib/docbuilder/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/docbuilder/ebin/.gitignore diff --git a/lib/docbuilder/etc/Makefile b/lib/docbuilder/etc/Makefile new file mode 100644 index 0000000000..a2f669d749 --- /dev/null +++ b/lib/docbuilder/etc/Makefile @@ -0,0 +1,67 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999-2000, Ericsson +# Utvecklings AB. All Rights Reserved.'' +# +# $Id$ +# + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(DOCB_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/docbuilder-$(VSN) + +# ---------------------------------------------------- +# Common Macros +# ---------------------------------------------------- + +VAR_FILES = \ + note.gif \ + warning.gif + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +debug opt: + +clean: + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: + $(INSTALL_DIR) $(RELSYSDIR)/etc + $(INSTALL_DATA) $(VAR_FILES) $(RELSYSDIR)/etc + +release_docs_spec: + + + + + + + diff --git a/lib/docbuilder/etc/note.gif b/lib/docbuilder/etc/note.gif Binary files differnew file mode 100644 index 0000000000..6fffe30419 --- /dev/null +++ b/lib/docbuilder/etc/note.gif diff --git a/lib/docbuilder/etc/warning.gif b/lib/docbuilder/etc/warning.gif Binary files differnew file mode 100644 index 0000000000..96af52360e --- /dev/null +++ b/lib/docbuilder/etc/warning.gif diff --git a/lib/docbuilder/info b/lib/docbuilder/info new file mode 100644 index 0000000000..33ce19fb4b --- /dev/null +++ b/lib/docbuilder/info @@ -0,0 +1,2 @@ +group: tools +short: Tool for generating HTML documentation for applications. diff --git a/lib/docbuilder/src/Makefile b/lib/docbuilder/src/Makefile new file mode 100644 index 0000000000..e8a07a54e8 --- /dev/null +++ b/lib/docbuilder/src/Makefile @@ -0,0 +1,121 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999-2000, Ericsson +# Utvecklings AB. All Rights Reserved.'' +# +# $Id$ +# + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(DOCB_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/docbuilder-$(VSN) + +# ---------------------------------------------------- +# Common Macros +# ---------------------------------------------------- + +MODULES= \ + docb_edoc_xml_cb \ + docb_gen \ + docb_html \ + docb_html_layout \ + docb_html_ref \ + docb_html_util \ + docb_html_util_iso \ + docb_main \ + docb_pretty_format \ + docb_tr_application2html \ + docb_tr_appref2html \ + docb_tr_chapter2html \ + docb_tr_cite2html \ + docb_tr_comref2html \ + docb_tr_cref2html \ + docb_tr_erlref2html \ + docb_tr_fileref2html \ + docb_tr_first2html \ + docb_tr_index2html \ + docb_tr_part2html \ + docb_tr_refs2kwic \ + docb_tr_report2html \ + docb_tr_term2html \ + docb_transform \ + docb_util \ + docb_xmerl_tree_cb \ + docb_xmerl_xml_cb \ + docb_xml_check + +HRL_FILES= \ + docb_util.hrl + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + +APP_FILE= docbuilder.app +APPUP_FILE= docbuilder.appup +APP_SRC= $(APP_FILE).src +APPUP_SRC= $(APPUP_FILE).src +APP_TARGET= $(EBIN)/$(APP_FILE) +APPUP_TARGET= $(EBIN)/$(APPUP_FILE) + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +ERL_FLAGS += +XMERL = ../../xmerl +ERL_COMPILE_FLAGS += -I$(XMERL)/include + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) + +clean: + rm -f $(TARGET_FILES) $(APP_TARGET) + rm -f errs core *~ + +$(APP_TARGET): $(APP_SRC) ../vsn.mk + sed -e 's;%VSN%;$(VSN);' $< > $@ +$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk + sed -e 's;%VSN%;$(VSN);' $< > $@ + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + $(INSTALL_DIR) $(RELSYSDIR)/src + $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR)/src + $(INSTALL_DIR) $(RELSYSDIR)/ebin + $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(RELSYSDIR)/ebin + +release_docs_spec: + + + + + diff --git a/lib/docbuilder/src/docb_edoc_xml_cb.erl b/lib/docbuilder/src/docb_edoc_xml_cb.erl new file mode 100644 index 0000000000..4dba843341 --- /dev/null +++ b/lib/docbuilder/src/docb_edoc_xml_cb.erl @@ -0,0 +1,1163 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the Licence for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson AB. +%% Portions created by Ericsson are Copyright 1999-2006, Ericsson AB. +%% All Rights Reserved.�� +%% +%% $Id$ +%% +-module(docb_edoc_xml_cb). + +%% This is the EDoc callback module for creating DocBuilder erlref +%% documents (man pages) in XML format, and also a DocBuilder chapter +%% document based on "overview.edoc". +%% +%% Usage examples: +%% docb_gen File +%% docb_gen -chapter overview.edoc +%% or (from an Erlang shell) +%% edoc:file(File, [{layout,docb_edoc_xml_cb},{file_suffix,".xml"}, +%% {preprocess,true}]). +%% +%% The origin of this file is the edoc module otpsgml_layout.erl +%% written by Richard Carlsson. + +-export([module/2, overview/2]). + +-include("xmerl.hrl"). + +-define(NL, "\n"). + +%%-User interface------------------------------------------------------- + +%% ERLREF +module(Element, Opts) -> + SortP = proplists:get_value(sort_functions, Opts, true), + XML = layout_module(Element, SortP), + xmerl:export_simple([XML], docb_xmerl_xml_cb, []). + +%% CHAPTER +overview(Element, _Opts) -> + XML = layout_chapter(Element), + xmerl:export_simple([XML], docb_xmerl_xml_cb, []). + +%%--Internal functions-------------------------------------------------- + +layout_module(#xmlElement{name = module, content = Es}=E, SortP) -> + Name = get_attrval(name, E), + Desc = get_content(description, Es), + ShortDesc = text_only(get_content(briefDescription, Desc)), + FullDesc = otp_xmlify(get_content(fullDescription, Desc)), + Types0 = get_content(typedecls, Es), + Types1 = lists:sort([{type_name(Et), Et} || Et <- Types0]), + Functions = + case SortP of + true -> + lists:sort([{function_name(Ef), Ef} || + Ef <- get_content(functions, Es)]); + false -> + [{function_name(Ef), Ef} || + Ef <- get_content(functions, Es)] + end, + Header = {header, [ + ?NL,{title, [Name]}, + ?NL,{prepared, [""]}, + ?NL,{responsible, [""]}, + ?NL,{docno, ["1"]}, + ?NL,{approved, [""]}, + ?NL,{checked, [""]}, + ?NL,{date, [""]}, + ?NL,{rev, ["A"]}, + ?NL,{file, [Name++".xml"]} + ]}, + Module = {module, [Name]}, + ModuleSummary = {modulesummary, ShortDesc}, + Description = {description, [?NL|FullDesc]}, + Types = case Types1 of + [] -> []; + _ -> + [?NL, {section,[{title,["DATA TYPES"]}, + {marker,[{id,"types"}],[]}, + ?NL|types(Types1)]}] + end, + Funcs = functions(Functions), + See = seealso_module(Es), + Authors = {authors, authors(Es)}, + {erlref, + [?NL,Header, + ?NL,Module, + ?NL,ModuleSummary, + ?NL,Description] + ++ Types ++ + [?NL,Funcs, + ?NL,See, + ?NL,Authors] + }. + +layout_chapter(#xmlElement{name=overview, content=Es}) -> + Title = get_text(title, Es), + Header = {header, [ + ?NL,{title,[Title]}, + ?NL,{prepared,[""]}, + ?NL,{docno,[""]}, + ?NL,{date,[""]}, + ?NL,{rev,[""]}, + ?NL,{file, ["chapter.xml"]} + ]}, + DescEs = get_content(description, Es), + FullDescEs = get_content(fullDescription, DescEs), + Sections = chapter_ify(FullDescEs, first), + {chapter, [?NL, Header, ?NL | Sections]}. + +chapter_ify([], _) -> + []; +chapter_ify(Es, first) -> + %% Everything up to the first section should be made into + %% plain paragraphs -- or if no first section is found, everything + %% should be made into one + case find_next(h3, Es) of + {Es, []} -> + SubSections = subchapter_ify(Es, first), + [{section, [?NL,{title,["Overview"]}, + ?NL | SubSections]}]; + {FirstEs, RestEs} -> + otp_xmlify(FirstEs) ++ chapter_ify(RestEs, next) + end; +chapter_ify([#xmlElement{name=h3} = E | Es], next) -> + {SectionEs, RestEs} = find_next(h3, Es), + SubSections = subchapter_ify(SectionEs, first), + {Marker, Title} = chapter_title(E), + [{section, [?NL,{marker,[{id,Marker}],[]}, + ?NL,{title,[Title]}, + ?NL | SubSections]} | chapter_ify(RestEs, next)]. + +subchapter_ify([], _) -> + []; +subchapter_ify(Es, first) -> + %% Everything up to the (possible) first subsection should be + %% made into plain paragraphs + {FirstEs, RestEs} = find_next(h4, Es), + otp_xmlify(FirstEs) ++ subchapter_ify(RestEs, next); +subchapter_ify([#xmlElement{name=h4} = E | Es], next) -> + {SectionEs, RestEs} = find_next(h4, Es), + Elements = otp_xmlify(SectionEs), + {Marker, Title} = chapter_title(E), + [{section, [?NL,{marker,[{id,Marker}],[]}, + ?NL,{title,[Title]}, + ?NL | Elements]} | subchapter_ify(RestEs, next)]. + +chapter_title(#xmlElement{content=Es}) -> % name = h3 | h4 + case Es of + [#xmlElement{name=a} = E] -> + {get_attrval(name, E), get_text(E)} + end. + +%%--XHTML->XML transformation------------------------------------------- + +%% otp_xmlify(Es1) -> Es2 +%% Es1 = Es2 = [#xmlElement{} | #xmlText{}] +%% Fix things that are allowed in XHTML but not in chapter/erlref DTDs. +%% 1) lists (<ul>, <ol>, <dl>) and code snippets (<pre>) can not occur +%% within a <p>, such a <p> must be splitted into a sequence of <p>, +%% <ul>, <ol>, <dl> and <pre>. +%% 2) <a> must only have either a href attribute (corresponds to a +%% <seealso> or <url> in the XML code) in which case its content +%% must be plain text; or a name attribute (<marker>). +%% 3a) <b> content must be plain text. +%% b) <em> content must be plain text (or actually a <code> element +%% as well, but a simplification is used here). +%% c) <pre> content must be plain text (or could actually contain +%% <input> as well, but a simplification is used here). +%% 4) <code> content must be plain text, or the element must be split +%% into a list of elements. +%% 5a) <h1>, <h2> etc is not allowed - replaced by its content within +%% a <b> tag. +%% b) <center> is not allowed - replaced by its content. +%% c) <font> -"- +%% 6) <table> is not allowed in erlref, translated to text instead. +%% Also a <table> in chapter without a border is translated to text. +%% A <table> in chapter with a border must contain a <tcaption>. +%% 7) <sup> is not allowed - is replaced with its text content +%% within parenthesis. +%% 8) <blockquote> contents may need to be made into paragraphs +%% 9) <th> (table header) is not allowed - is replaced by +%% <td><em>...</em></td>. +otp_xmlify([]) -> + []; +otp_xmlify(Es0) -> + Es = case is_paragraph(hd(Es0)) of + + %% If the first element is a <p> xmlElement, then + %% the entire element list is ready to be otp_xmlified. + true -> + Es0; + + %% If the first element is not a <p> xmlElement, then all + %% elements up to the first <p> (or end of list) must be + %% made into a paragraph (using the {p, Es} construction) + %% before the list is otp_xmlified. + false -> + case find_next(p, Es0, []) of + {[#xmlText{value=Str}] = First, Rest} -> + %% Special case: Making a paragraph out of a + %% blank line isn't a great idea. + case is_empty(Str) of + true -> + Rest; + false -> + [{p,First}|Rest] + end; + {First, Rest} -> + [{p,First}|Rest] + end + end, + + %% Fix paragraph breaks not needed in XHTML but in XML + EsFixed = otp_xmlify_fix(Es), + + otp_xmlify_es(EsFixed). + +%% EDoc does not always translate empty lines (with leading "%%") +%% as paragraph break, this is the fix +otp_xmlify_fix(Es) -> + otp_xmlify_fix(Es, []). +otp_xmlify_fix([#xmlText{value="\n \n"++_} = E1, E2 | Es], Res) -> + %% This is how it looks when generating an erlref from a .erl file + case is_paragraph(E2) of + false -> + {P, After} = find_p_ending(Es, []), + otp_xmlify_fix(After, [{p, [E2|P]}, E1 | Res]); + true -> + otp_xmlify_fix([E2|Es], [E1|Res]) + end; +otp_xmlify_fix([#xmlText{value="\n\n"} = E1, E2 | Es], Res) -> + %% This is how it looks when generating a chapter from overview.edoc + case is_paragraph(E2) of + false -> + {P, After} = find_p_ending(Es, []), + otp_xmlify_fix(After, [{p, [E2|P]}, E1 | Res]); + true -> + otp_xmlify_fix([E2|Es], [E1|Res]) + end; +otp_xmlify_fix([E|Es], Res) -> + otp_xmlify_fix(Es, [E|Res]); +otp_xmlify_fix([], Res) -> + lists:reverse(Res). + +otp_xmlify_es([E | Es]) -> + case is_paragraph(E) of + true -> + case otp_xmlify_psplit(E) of + + %% paragraph contained inline tags and text only + nosplit -> + otp_xmlify_e(E) ++ otp_xmlify_es(Es); + + %% paragraph contained dl, ul and/or pre and has been + %% splitted + SubEs -> + lists:flatmap(fun otp_xmlify_e/1, SubEs) ++ + otp_xmlify_es(Es) + end; + false -> + otp_xmlify_e(E) ++ otp_xmlify_es(Es) + end; +otp_xmlify_es([]) -> + []. + +%% otp_xmlify_psplit(P) -> nosplit | [E] +%% Handles case 1) above. +%% Uses the {p, Es} construct, thus replaces an p xmlElement with one +%% or more {p, Es} tuples if splitting the paraghrap is necessary. +otp_xmlify_psplit(P) -> + otp_xmlify_psplit(p_content(P), [], []). +otp_xmlify_psplit([#xmlElement{name=Name}=E | Es], Content, Res) -> + if + Name==blockquote; Name==ul; Name==ol; Name==dl; Name==pre; + Name==table -> + case Content of + [] -> + otp_xmlify_psplit(Es, [], [E|Res]); + [#xmlText{value=Str}] -> + %% Special case: Making a paragraph out of a blank + %% line isn't a great idea. Instead, this can be + %% viewed as the case above, where there is no + %% content to make a paragraph out of + case is_empty(Str) of + true -> + otp_xmlify_psplit(Es, [], [E|Res]); + false -> + Pnew = {p, lists:reverse(Content)}, + otp_xmlify_psplit(Es, [], [E,Pnew|Res]) + end; + _ -> + Pnew = {p, lists:reverse(Content)}, + otp_xmlify_psplit(Es, [], [E,Pnew|Res]) + end; + + true -> + otp_xmlify_psplit(Es, [E|Content], Res) + end; +otp_xmlify_psplit([E | Es], Content, Res) -> + otp_xmlify_psplit(Es, [E|Content], Res); +otp_xmlify_psplit([], _Content, []) -> + nosplit; +otp_xmlify_psplit([], [], Res) -> + lists:reverse(Res); +otp_xmlify_psplit([], [#xmlText{value="\n\n"}], Res) -> + lists:reverse(Res); +otp_xmlify_psplit([], Content, Res) -> + Pnew = {p, lists:reverse(Content)}, + lists:reverse([Pnew|Res]). + +%% otp_xmlify_e(E) -> [E] +%% This is the function which does the actual transformation of +%% single elements, normally by making sure the content corresponds +%% to what is allowed by the OTP DTDs. +%% Returns a list of elements as the xmlification in some cases +%% returns no element or more than one element (although in most cases +%% exactly one element). +otp_xmlify_e(#xmlElement{name=a} = E) -> % 2) above + otp_xmlify_a(E); +otp_xmlify_e(#xmlElement{name=Tag} = E) % 3a-c) + when Tag==b; Tag==em; Tag==pre -> + Content = text_only(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=code} = E) -> % 4) + case catch text_only(E#xmlElement.content) of + {'EXIT', _Error} -> + otp_xmlify_code(E); + Content -> + [E#xmlElement{content=Content}] + end; +otp_xmlify_e(#xmlElement{name=Tag} = E) % 5a + when Tag==h1; Tag==h2; Tag==h3; Tag==h4; Tag==h5; + Tag==center; + Tag==font -> + Content = text_only(E#xmlElement.content), + [E#xmlElement{name=b, content=Content}]; +otp_xmlify_e(#xmlElement{name=Tag} = E) % 5b-c) + when Tag==center; + Tag==font -> + otp_xmlify_e(E#xmlElement.content); +otp_xmlify_e(#xmlElement{name=table} = E) -> % 6) + case parent(E) of + module -> + otp_xmlify_table(E#xmlElement.content); + overview -> + case get_attrval(border, E) of + "" -> % implies border="0" + [{p, otp_xmlify_table(E#xmlElement.content)}]; + "0" -> + [{p, otp_xmlify_table(E#xmlElement.content)}]; + _Val -> + Content0 = otp_xmlify_e(E#xmlElement.content), + Summary = #xmlText{value=get_attrval(summary, E)}, + TCaption = E#xmlElement{name=tcaption, + attributes=[], + content=[Summary]}, + Content = Content0 ++ [TCaption], + [E#xmlElement{attributes=[], content=Content}] + end + end; +otp_xmlify_e(#xmlElement{name=sup} = E) -> % 7) + Text = get_text(E), + [#xmlText{parents = E#xmlElement.parents, + pos = E#xmlElement.pos, + language = E#xmlElement.language, + value = "(" ++ Text ++ ")"}]; +otp_xmlify_e(#xmlElement{name=blockquote} = E) -> % 8) + Content = otp_xmlify_blockquote(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=th} = E) -> % 9) + Content = otp_xmlify_e(E#xmlElement.content), + EmE = E#xmlElement{name=em, content=Content}, + [E#xmlElement{name=td, content=[EmE]}]; +otp_xmlify_e(#xmlElement{name=p} = E) -> % recurse + Content = otp_xmlify_e(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e({p, Content1}) -> + Content2 = otp_xmlify_e(Content1), + [{p, Content2}]; +otp_xmlify_e(#xmlElement{name=ul} = E) -> + Content = otp_xmlify_e(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=li} = E) -> + %% Content may need to be made into <p>s etc. + Content = otp_xmlify(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=dl} = E) -> + Content0 = otp_xmlify_e(E#xmlElement.content), + Content = otp_xmlify_dl(Content0), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=dt} = E) -> + %% Special fix: Markers in <taglist> <tag>s are not allowed, + %% save it using 'put' and place the marker first in the <item> + %% instead + Content = case E#xmlElement.content of + [#xmlElement{name=a} = A] -> + put(dt_marker, otp_xmlify_e(A)), + otp_xmlify_e(A#xmlElement.content); + _ -> + otp_xmlify_e(E#xmlElement.content) + end, + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=dd} = E) -> + %% Content may need to be made into <p>s etc. + Content0 = otp_xmlify(E#xmlElement.content), + Content = case get(dt_marker) of + undefined -> Content0; + [Marker] -> + put(dt_marker, undefined), + [Marker#xmlElement{content=[]}|Content0] + end, + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=tr} = E) -> + Content = otp_xmlify_e(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e(#xmlElement{name=td} = E) -> + Content = otp_xmlify_e(E#xmlElement.content), + [E#xmlElement{content=Content}]; +otp_xmlify_e([E | Es]) -> + otp_xmlify_e(E) ++ otp_xmlify_e(Es); +otp_xmlify_e([]) -> + []; +otp_xmlify_e(E) -> + [E]. + +%%--Tags with special handling------------------------------------------ + +%% otp_xmlify_a(A1) -> [A2] +%% Takes an <a> element and filters the attributes to decide wheather +%% its a seealso/url or a marker. +%% In the case of a seealso/url, the href part is checked, making +%% sure a .xml/.html file extension is removed (as DocBuilder inserts +%% .html extension when resolving cross references). +%% Also, references to other applications //App has a href attribute +%% value "OTPROOT/..." (due to app_default being set to "OTPROOT" in +%% docb_gen.erl), in this case both href attribute and content must be +%% formatted correctly according to DocBuilder requirements. +otp_xmlify_a(A) -> + [Attr0] = filter_a_attrs(A#xmlElement.attributes), + case Attr0 of + #xmlAttribute{name=href, value=Href0} -> % seealso | url + Content0 = text_only(A#xmlElement.content), + {Href, Content} = otp_xmlify_a_href(Href0, Content0), + [A#xmlElement{attributes=[Attr0#xmlAttribute{value=Href}], + content=Content}]; + #xmlAttribute{name=name} -> % marker + Content = otp_xmlify_e(A#xmlElement.content), + [A#xmlElement{attributes=[Attr0], content=Content}] + end. + +%% filter_a_attrs(Attrs) -> [Attr] +%% Removes all attributes from a <a> element except the href or +%% name attribute. +filter_a_attrs([#xmlAttribute{name=href} = Attr | _Attrs]) -> + [Attr]; +filter_a_attrs([#xmlAttribute{name=name} = Attr | _Attrs]) -> + [Attr]; +filter_a_attrs([_Attr|Attrs]) -> + filter_a_attrs(Attrs); +filter_a_attrs([]) -> + []. + +%% otp_xmlify_a_href(Href0, Es0) -> {Href1, Es1} +%% Href = string() +otp_xmlify_a_href("#"++_ = Marker, Es0) -> % <seealso marker="#what"> + {Marker, Es0}; +otp_xmlify_a_href("http:"++_ = URL, Es0) -> % external URL + {URL, Es0}; +otp_xmlify_a_href("OTPROOT"++AppRef, Es0) -> % <.. marker="App:FileRef + case split(AppRef, "/") of + [AppS, "doc", FileRef1] -> + FileRef = AppS++":"++otp_xmlify_a_fileref(FileRef1, AppS), + [#xmlText{value=Str0} = T] = Es0, + Str = case split(Str0, "/") of + %% //Application + [AppS2] -> + %% AppS2 can differ from AppS + %% Example: xmerl/XMerL + AppS2; + [_AppS,ModRef] -> + case split(ModRef, ":") of + %% //Application/Module + [Module] -> + Module++"(3)"; + %% //Application/Module:Type() + [_Module,_Type] -> + ModRef + end; + %% //Application/Module:Function/Arity + [_AppS,ModFunc,Arity] -> + ModFunc++"/"++Arity + end, + {FileRef, [T#xmlText{value=Str}]} + end; +otp_xmlify_a_href("../"++File, Es0) -> + %% Special case: This kind of relative path is used on some + %% places within i.e. EDoc and refers to a file within the same + %% application tree. + %% Correct the path according to the OTP directory structure + {"../../"++File, Es0}; +otp_xmlify_a_href(FileRef1, Es0) -> % File within the same application + FileRef2 = otp_xmlify_a_fileref(FileRef1, this), + {FileRef2, Es0}. + +%% otp_xmlify_a_fileref(FileRef1, AppS|this) -> FileRef2 +%% AppS = FileRef = string() +otp_xmlify_a_fileref(FileRef1, AppS) -> + case split(FileRef1, ".#") of + + %% EDoc default name is "overview-summary.html, + %% name of OTP User's Guide chapter is "chapter.xml" + ["overview-summary", _Ext] -> + "chapter"; + ["overview-summary", _Ext, Marker] -> + "chapter#"++Marker; + + [File, Ext] when Ext=="xml"; + Ext=="html", AppS/=this -> + File; + [File, Ext, Marker0] -> + %% Here is an awkward solution to an awkward problem + %% The marker automatically inserted by DocBuilder at + %% each function does not seem to work for EDoc generated + %% ERLREFs. + %% So if the referenced marker is in an ERLREF generated + %% by EDoc, keep it "as is", ie "function-arity". + %% If the referenced marker is NOT in an ERLREF generated + %% by EDoc, the marker should be on the format + %% "function/arity". + %% The awkward part of the solution is to decide wheather + %% the ERLREF is generated by EDoc or not: Here we make + %% the decision based on which application the module + %% belongs to -- which is ok when the module was written + %% but probably not in the future... + EDocApps = ["edoc","hipe","syntax_tools","xmerl"], + IsEDocGenerated = lists:member(AppS, EDocApps), + Marker = if + %% The marker is in a file in *this* + %% application (which documentation obviously + %% is generated by EDoc), or it is in a file + %% in an application which documentation + %% is assumed to be generated by EDoc + AppS==this; IsEDocGenerated -> + Marker0; + + %% The marker is in a file in an application + %% which documentation is assumed NOT to be + %% generated by EDoc + true -> + case split(Marker0, "-") of + [Func,Arity] -> + Func++"/"++Arity; + _ -> + Marker0 + end + end, + if + %% Ignore file extension in file reference if it either + %% is ".xml" or if it is ".html" but AppS/=this, that + %% is, we're resolving an OTPROOT file reference + Ext=="xml"; + Ext=="html", AppS/=this -> + File++"#"++Marker; + true -> + File++"."++Ext++"#"++Marker + end; + + %% References to other files than XML files are kept as-is + _ -> + FileRef1 + end. + +%% otp_xmlify_blockquote(Es1) -> Es2 +%% Ensures that the content of a <blockquote> is divided into +%% <p>s using the {p, Es} construct. +otp_xmlify_blockquote([#xmlElement{name=p} = E|Es]) -> + [E | otp_xmlify_blockquote(Es)]; +otp_xmlify_blockquote([#xmlText{} = E|Es]) -> + {P, After} = find_p_ending(Es, []), + [{p, [E|P]} | otp_xmlify_blockquote(After)]; +otp_xmlify_blockquote([]) -> + []. + +%% otp_xmlify_code(E) -> Es +%% Takes a <code> xmlElement and split it into a list of <code> and +%% other xmlElements. Necessary when it contains more than a single +%% xmlText element. +%% Example: +%% #xmlElement{name=code, +%% content=[#xmlText{}, #xmlElement{name=br}, #xmlText{}]} +%% => +%% [#xmlElement{name=code, content=[#xmlText{}]}, +%% #xmlElement{name=br}, +%% #xmlElement{name=code, content=[#xmlText{}]}] +otp_xmlify_code(E) -> + otp_xmlify_code(E, E#xmlElement.content, []). +otp_xmlify_code(Code, [#xmlText{} = E|Es], Acc) -> + otp_xmlify_code(Code, Es, [Code#xmlElement{content=[E]}|Acc]); +otp_xmlify_code(Code, [#xmlElement{} = E|Es], Acc) -> + otp_xmlify_code(Code, Es, [E|Acc]); +otp_xmlify_code(_Code, [], Acc) -> + lists:reverse(Acc). + +%% otp_xmlify_dl(Es1) -> Es2 +%% Insert empty <dd> elements if necessary. +%% OTP DTDs does not allow <taglist>s with <tag>s but no <item>s. +otp_xmlify_dl([#xmlElement{name=dt} = E|Es]) -> + [E|otp_xmlify_dl(Es, E)]; +otp_xmlify_dl([E|Es]) -> + [E|otp_xmlify_dl(Es)]; +otp_xmlify_dl([]) -> + []. + +otp_xmlify_dl([#xmlElement{name=dd} = E|Es], _DT) -> + [E|otp_xmlify_dl(Es)]; +otp_xmlify_dl([#xmlElement{name=dt} = E|Es], DT) -> + DD = DT#xmlElement{name=dd, attributes=[], content=[]}, + [DD,E|otp_xmlify_dl(Es, E)]; +otp_xmlify_dl([E|Es], DT) -> + [E|otp_xmlify_dl(Es, DT)]; +otp_xmlify_dl([], DT) -> + DD = DT#xmlElement{name=dd, attributes=[], content=[]}, + [DD]. + +%% otp_xmlify_table(Es1) -> Es2 +%% Transform <table> contents into "text", that is, inline elements. +otp_xmlify_table([#xmlText{} = E|Es]) -> + [E | otp_xmlify_table(Es)]; +otp_xmlify_table([#xmlElement{name=tbody} = E|Es]) -> + otp_xmlify_table(E#xmlElement.content)++otp_xmlify_table(Es); +otp_xmlify_table([#xmlElement{name=tr} = E|Es]) -> + %% Insert newlines between table rows + otp_xmlify_table(E#xmlElement.content)++[{br,[]}]++otp_xmlify_table(Es); +otp_xmlify_table([#xmlElement{name=th} = E|Es]) -> + [{em, E#xmlElement.content} | otp_xmlify_table(Es)]; +otp_xmlify_table([#xmlElement{name=td} = E|Es]) -> + otp_xmlify_e(E#xmlElement.content) ++ otp_xmlify_table(Es); +otp_xmlify_table([]) -> + []. + +%%--Misc help functions used by otp_xmlify/1 et al--------------------- + +%% find_next(Tag, Es) -> {Es1, Es2} +%% Returns {Es1, Es2} where Es1 is the list of all elements up to (but +%% not including) the first element with tag Tag in Es, and Es2 +%% is the remaining elements of Es. +find_next(Tag, Es) -> + find_next(Tag, Es, []). +find_next(Tag, [#xmlElement{name=Tag} = E | Es], AccEs) -> + {lists:reverse(AccEs), [E|Es]}; +find_next(Tag, [E|Es], AccEs) -> + find_next(Tag, Es, [E|AccEs]); +find_next(_Tag, [], AccEs) -> + {lists:reverse(AccEs), []}. + +%% find_p_ending(Es, []) -> {Es1, Es2} +%% Returns {Es1, Es2} where Es1 is the list of all elements up to (but +%% not including) the first paragraph break in Es, and Es2 is +%% the remaining elements of Es2. +%% Paragraph break = <p> tag or empty line +%% the next blank line, <p> or end-of-list as P, and the remaining +%% elements of Es as After. +find_p_ending([#xmlText{value="\n \n"++_} = E|Es], P) -> + {lists:reverse(P), [E|Es]}; +find_p_ending([#xmlElement{name=p} = E|Es], P) -> + {lists:reverse(P), [E|Es]}; +find_p_ending([E|Es], P) -> + find_p_ending(Es, [E|P]); +find_p_ending([], P) -> + {lists:reverse(P), []}. + +%% is_paragraph(E | P) -> bool() +%% P = {p, Es} +is_paragraph(#xmlElement{name=p}) -> true; +is_paragraph({p, _Es}) -> true; +is_paragraph(_E) -> false. + +%% p_content(E | P) -> Es +p_content(#xmlElement{content=Content}) -> Content; +p_content({p, Content}) -> Content. + +%% is_empty(Str) -> bool() +%% Str = string() +%% Returns true if Str is empty in the sense that it contains nothing +%% but spaces, tabs or newlines. +is_empty("\n"++Str) -> + is_empty(Str); +is_empty(" "++Str) -> + is_empty(Str); +is_empty("\t"++Str) -> + is_empty(Str); +is_empty("") -> + true; +is_empty(_) -> + false. + +%% split(Str, Seps) -> [Str] +split(Str, Seps) -> + split(Str, Seps, []). + +split([Ch|Str], Seps, Acc) -> + case lists:member(Ch, Seps) of + true -> split(Str, Seps, Acc); + false -> split(Str, Seps, Acc, [Ch]) + end; +split([], _Seps, Acc) -> + lists:reverse(Acc). + +split([Ch|Str], Seps, Acc, Chs) -> + case lists:member(Ch, Seps) of + true -> split(Str, Seps, [lists:reverse(Chs)|Acc]); + false -> split(Str, Seps, Acc, [Ch|Chs]) + end; +split([], _Seps, Acc, Chs) -> + lists:reverse([lists:reverse(Chs)|Acc]). + +%%--Functions for creating an erlref document--------------------------- + +%% function_name(F) -> string() +%% F = #xmlElement{name=function} +%% Returns the name of a function as "name/arity". +function_name(E) -> + get_attrval(name, E) ++ "/" ++ get_attrval(arity, E). + +%% functions(Fs) -> Es +%% Fs = [{Name, F}] +%% Name = string() "name/arity" +%% F = #xmlElement{name=function} +functions(Fs) -> + Es = lists:flatmap(fun ({Name, E}) -> function(Name, E) end, Fs), + if + Es==[] -> + []; + true -> + {funcs, Es} + end. + +function(_Name, E=#xmlElement{content = Es}) -> + TypeSpec = get_content(typespec, Es), + [?NL,{func, [ ?NL, + {name, + case funcheader(TypeSpec) of + [] -> + signature(get_content(args, Es), + get_attrval(name, E)); + Spec -> Spec + end + }, + ?NL,{fsummary, fsummary(Es)}, + ?NL,local_types(TypeSpec), + ?NL,{desc, + label_anchor(E)++ + deprecated(Es)++ + fulldesc(Es)++ + seealso_function(Es)} + ]}]. + +fsummary([]) -> ["\s"]; +fsummary(Es) -> + Desc = get_content(description, Es), + case get_content(briefDescription, Desc) of + [] -> + fsummary_equiv(Es); % no description at all if no equiv + ShortDesc -> + text_only(ShortDesc) + end. + +fsummary_equiv(Es) -> + case get_content(equiv, Es) of + [] -> ["\s"]; + Es1 -> + case get_content(expr, Es1) of + [] -> ["\s"]; + [Expr] -> + ["Equivalent to ", Expr, ".",?NL] + end + end. + +label_anchor(E) -> + case get_attrval(label, E) of + "" -> []; + Ref -> [{marker, [{id, Ref}],[]},?NL] + end. + +label_anchor(Content, E) -> + case get_attrval(label, E) of + "" -> Content; + Ref -> {p,[{marker, [{id, Ref}],[]}, + {em, Content}]} + end. + +signature(Es, Name) -> + [Name, "("] ++ seq(fun arg/1, Es) ++ [") -> term()", ?NL]. + +arg(#xmlElement{content = Es}) -> + [get_text(argName, Es)]. + +funcheader([]) -> []; +funcheader(Es) -> + [t_name(get_elem(erlangName, Es))] ++ t_utype(get_elem(type, Es)). + +local_types([]) -> []; +local_types(Es) -> + local_defs2(get_elem(localdef, Es)). + +local_defs2([]) -> []; +local_defs2(Es) -> + {type,[?NL | [{v, localdef2(E)} || E <- Es]]}. + +%% Like localdef/1, but does not use label_anchor/2 -- we don't want any +%% markers or em tags in <v> tag, plain text only! +localdef2(#xmlElement{content = Es}) -> + case get_elem(typevar, Es) of + [] -> + t_utype(get_elem(type, Es)); + [V] -> + t_var(V) ++ [" = "] ++ t_utype(get_elem(type, Es)) + end. + +type_name(#xmlElement{content = Es}) -> + t_name(get_elem(erlangName, get_content(typedef, Es))). + +types(Ts) -> + Es = lists:flatmap(fun ({Name, E}) -> typedecl(Name, E) end, Ts), + [?NL, {taglist,[?NL|Es]}]. + +typedecl(Name, #xmlElement{content = Es}) -> + TypedefEs = get_content(typedef, Es), + Id = "type-"++Name, + [{tag, typedef(TypedefEs)}, + ?NL, + {item, [{marker,[{id,Id}],[]} | + local_defs(get_elem(localdef, TypedefEs)) ++ fulldesc(Es)]}, + ?NL]. + +typedef(Es) -> + Name = ([t_name(get_elem(erlangName, Es)), "("] + ++ seq(fun t_utype_elem/1, get_content(argtypes, Es), [")"])), + case get_elem(type, Es) of + [] -> + [{tt, Name}]; + Type -> + [{tt, Name ++ [" = "] ++ t_utype(Type)}] + end. + +local_defs([]) -> []; +local_defs(Es) -> + [?NL, {ul, [{li, [{tt, localdef(E)}]} || E <- Es]}]. + +localdef(E = #xmlElement{content = Es}) -> + Var = case get_elem(typevar, Es) of + [] -> + [label_anchor(t_abstype(get_content(abstype, Es)), E)]; + [V] -> + t_var(V) + end, + Var ++ [" = "] ++ t_utype(get_elem(type, Es)). + +deprecated(Es) -> + case get_content(deprecated, Es) of + [] -> []; + DeprEs -> + Es2 = get_content(fullDescription, + get_content(description, DeprEs)), + Es3 = otp_xmlify_e(Es2), + [{p, [{em, ["This function is deprecated: "]} |Es3]}, ?NL] + end. + +fulldesc(Es) -> + case get_content(fullDescription, get_content(description, Es)) of + [] -> + index_desc(Es); + Desc -> + [?NL|otp_xmlify(Desc)] ++ [?NL] + end. + +index_desc(Es) -> + Desc = get_content(description, Es), + case get_content(briefDescription, Desc) of + [] -> + equiv(Es); % no description at all if no equiv + ShortDesc -> + ShortDesc + end. + +seealso_module(Es) -> + case get_elem(see, Es) of + [] -> []; + Es1 -> + {section,[{title,["See also"]},{p,seq(fun see/1, Es1, [])}]} + end. +seealso_function(Es) -> + case get_elem(see, Es) of + [] -> []; + Es1 -> + [{p, [{em, ["See also:"]}, " "] ++ seq(fun see/1, Es1, ["."])}, + ?NL] + end. + +%% ELEMENT see PCDATA +%% ATTLIST name PCDATA +%% href PCDATA +see(#xmlElement{content=Es0} = E) -> + Href0 = get_attrval(href, E), + {Href, Es} = otp_xmlify_a_href(Href0, Es0), + [{seealso, [{marker, Href}], Es}]. + +equiv(Es) -> + case get_content(equiv, Es) of + [] -> ["\s"]; + Es1 -> + case get_content(expr, Es1) of + [] -> []; + [Expr] -> + Expr1 = [Expr], + Expr2 = case get_elem(see, Es1) of + [] -> + {c,Expr1}; + [E=#xmlElement{}] -> + case get_attrval(href, E) of + "" -> + {c,Expr1}; + Ref -> + {seealso, [{marker, Ref}], Expr1} + end + end, + [{p, ["Equivalent to ", Expr2, "."]}, ?NL] + end + end. + +authors(Es) -> + case get_elem(author, Es) of + [] -> + [?NL,{aname,["\s"]},?NL,{email,["\s"]}]; + Es1 -> + [?NL|seq(fun author/1, Es1, "", [])] + end. + +author(E=#xmlElement{}) -> + Name = case get_attrval(name, E) of + [] -> "\s"; + N -> N + end, + Mail = case get_attrval(email, E) of + [] -> "\s"; + M -> M + end, + [?NL,{aname,[Name]},?NL,{email,[Mail]}]. + +t_name([E]) -> + N = get_attrval(name, E), + case get_attrval(module, E) of + "" -> N; + M -> + S = M ++ ":" ++ N, + case get_attrval(app, E) of + "" -> S; + A -> "//" ++ A ++ "/" ++ S + end + end. + +t_utype([E]) -> + t_utype_elem(E). + +t_utype_elem(E=#xmlElement{content = Es}) -> + case get_attrval(name, E) of + "" -> t_type(Es); + Name -> + T = t_type(Es), + case T of + [Name] -> T; % avoid generating "Foo::Foo" + T -> [Name] ++ ["::"] ++ T + end + end. + +t_type([E=#xmlElement{name = typevar}]) -> + t_var(E); +t_type([E=#xmlElement{name = atom}]) -> + t_atom(E); +t_type([E=#xmlElement{name = integer}]) -> + t_integer(E); +t_type([E=#xmlElement{name = float}]) -> + t_float(E); +t_type([#xmlElement{name = nil}]) -> + t_nil(); +t_type([#xmlElement{name = list, content = Es}]) -> + t_list(Es); +t_type([#xmlElement{name = tuple, content = Es}]) -> + t_tuple(Es); +t_type([#xmlElement{name = 'fun', content = Es}]) -> + t_fun(Es); +t_type([#xmlElement{name = abstype, content = Es}]) -> + t_abstype(Es); +t_type([#xmlElement{name = union, content = Es}]) -> + t_union(Es); +t_type([#xmlElement{name = record, content = Es}]) -> + t_record(Es). + +t_var(E) -> + [get_attrval(name, E)]. + +t_atom(E) -> + [get_attrval(value, E)]. + +t_integer(E) -> + [get_attrval(value, E)]. + +t_float(E) -> + [get_attrval(value, E)]. + +t_nil() -> + ["[]"]. + +t_list(Es) -> + ["["] ++ t_utype(get_elem(type, Es)) ++ ["]"]. + +t_tuple(Es) -> + ["{"] ++ seq(fun t_utype_elem/1, Es, ["}"]). + +t_fun(Es) -> + ["("] ++ seq(fun t_utype_elem/1, get_content(argtypes, Es), + [") -> "] ++ t_utype(get_elem(type, Es))). + +t_record([E|Es]) -> + ["#", get_attrval(value, E), "{"++ seq(fun t_field/1, Es) ++"}"]. +t_field(#xmlElement{name=field, content=[Atom,Type]}) -> + [get_attrval(value, Atom), "="] ++ t_utype_elem(Type). + +t_abstype(Es) -> + case split_at_colon(t_name(get_elem(erlangName, Es)),[]) of + {Mod,Type} -> + [Type, "("] ++ + seq(fun t_utype_elem/1, get_elem(type, Es), [")"]) ++ + [" (see module ", Mod, ")"]; + Type -> + [Type, "("] ++ + seq(fun t_utype_elem/1, get_elem(type, Es), [")"]) + end. + +%% Split at one colon, but not at two (or more) +split_at_colon([$:,$:|_]=Rest,Acc) -> + lists:reverse(Acc)++Rest; +split_at_colon([$:|Type],Acc) -> + {lists:reverse(Acc),Type}; +split_at_colon([Char|Rest],Acc) -> + split_at_colon(Rest,[Char|Acc]); +split_at_colon([],Acc) -> + lists:reverse(Acc). + +t_union(Es) -> + seq(fun t_utype_elem/1, Es, " | ", []). + +%% seq(Fun, Es) +%% seq(Fun, Es, Tail) +%% seq(Fun, Es, Sep, Tail) -> [string()] +%% Fun = function(E) -> [string()] +%% Sep = string() +%% Tail = [string()] +%% Applies Fun to each element E in Es and return the appended list of +%% strings, separated by Sep which defaults to ", " and ended by Tail +%% which defaults to []. +seq(Fun, Es) -> + seq(Fun, Es, []). +seq(Fun, Es, Tail) -> + seq(Fun, Es, ", ", Tail). +seq(Fun, [E], _Sep, Tail) -> + Fun(E) ++ Tail; +seq(Fun, [E | Es], Sep, Tail) -> + Fun(E) ++ [Sep] ++ seq(Fun, Es, Sep, Tail); +seq(_Fun, [], _Sep, Tail) -> + Tail. + +%%--Misc functions for accessing fields etc----------------------------- + +%% Type definitions used below: +%% E = #xmlElement{} | #xmlText{} +%% Es = [E] +%% Tag = atom(), XHTML tag +%% Name = atom(), XHTML attribute name +%% Attrs = [#xmlAttribute{}] +%% Ts = [#xmlText{}] + +%% parent(E) -> module | overview +parent(E) -> + Parents = E#xmlElement.parents, + {Parent,_} = lists:last(Parents), + Parent. + +%% get_elem(Tag, Es1) -> Es2 +%% Returns a list of all elements in Es which have the name Tag. +get_elem(Name, [#xmlElement{name = Name} = E | Es]) -> + [E | get_elem(Name, Es)]; +get_elem(Name, [_ | Es]) -> + get_elem(Name, Es); +get_elem(_, []) -> + []. + +%% get_attr(Name, Attrs1) -> Attrs2 +%% Returns a list of all attributes in Attrs1 which have the name Name. +get_attr(Name, [#xmlAttribute{name = Name} = A | As]) -> + [A | get_attr(Name, As)]; +get_attr(Name, [_ | As]) -> + get_attr(Name, As); +get_attr(_, []) -> + []. + +%% get_attrval(Name, E) -> string() +%% If E has one attribute with name Name, return its value, otherwise "" +get_attrval(Name, #xmlElement{attributes = As}) -> + case get_attr(Name, As) of + [#xmlAttribute{value = V}] -> + V; + [] -> "" + end. + +%% get_content(Tag, Es1) -> Es2 +%% If there is one element in Es1 with name Tag, returns its contents, +%% otherwise [] +get_content(Name, Es) -> + case get_elem(Name, Es) of + [#xmlElement{content = Es1}] -> + Es1; + [] -> [] + end. + +%% get_text(Tag, Es) -> string() +%% If there is one element in Es with name Tag, and its content is +%% a single xmlText, return the value of this xmlText. +%% Otherwise return "". +get_text(Name, Es) -> + case get_content(Name, Es) of + [#xmlText{value = Text}] -> + Text; + [] -> "" + end. + +%% get_text(E) -> string() +%% Return the value of an single xmlText which is the content of E, +%% possibly recursively. +get_text(#xmlElement{content=[#xmlText{value=Text}]}) -> + Text; +get_text(#xmlElement{content=[E]}) -> + get_text(E). + +%% text_only(Es) -> Ts +%% Takes a list of xmlElement and xmlText and return a lists of xmlText. +text_only([#xmlElement{} = E |Es]) -> + text_only(E#xmlElement.content) ++ text_only(Es); +text_only([#xmlText{} = E |Es]) -> + [E | text_only(Es)]; +text_only([]) -> + []. diff --git a/lib/docbuilder/src/docb_gen.erl b/lib/docbuilder/src/docb_gen.erl new file mode 100644 index 0000000000..0d8d640324 --- /dev/null +++ b/lib/docbuilder/src/docb_gen.erl @@ -0,0 +1,138 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_gen). + +-export([module/1, module/2, users_guide/1, users_guide/2]). + +-record(args, {suffix=".xml", + layout=docb_edoc_xml_cb, + def=[], + includes=[], + preprocess=false, + sort_functions=true}). + +%% module(File) -> ok | {error, Reason} +%% module(File, Opts) -> ok | {error, Reason} +%% File = string(), file name with or without ".erl" extension +%% Opts -- see code +%% Reason = badfile | {badopt, Term} +module(File0) -> + module(File0, []). +module(File0, RawOpts) -> + File = case filename:extension(File0) of + ".erl" -> File0; + _ -> File0++".erl" + end, + case filelib:is_regular(File) of + true -> + case parse(RawOpts, #args{}) of + {ok, Args} -> + Opts = [{def, Args#args.def}, + {includes, Args#args.includes}, + {preprocess, Args#args.preprocess}, + {sort_functions, Args#args.sort_functions}, + + {app_default, "OTPROOT"}, + {file_suffix, Args#args.suffix}, + {dir, "."}, + {layout, Args#args.layout}], + edoc:file(File, Opts); + Error -> + Error + end; + false -> + {error, badfile} + end. + +%% users_guide(File) -> ok | {error, Reason} +%% users_guide(File, Opts) -> ok | {error, Reason} +%% File = string() +%% Opts -- see code +%% Reason = badfile | {badopt, Opt} +users_guide(File) -> + users_guide(File, []). +users_guide(File, RawOpts) -> + case filelib:is_regular(File) of + true -> + case parse(RawOpts, #args{}) of + {ok, Args} -> + Opts = [{def, Args#args.def}, + {app_default, "OTPROOT"}, + {file_suffix, Args#args.suffix}, + {layout, Args#args.layout}], + + Env = edoc_lib:get_doc_env(Opts), + + {ok, Tags} = + edoc_extract:file(File, overview, Env, Opts), + Data = + edoc_data:overview("Overview", Tags, Env, Opts), + F = fun(M) -> M:overview(Data, Opts) end, + Text = edoc_lib:run_layout(F, Opts), + + OutFile = "chapter" ++ Args#args.suffix, + edoc_lib:write_file(Text, ".", OutFile); + Error -> + Error + end; + false -> + {error, badfile} + end. + +parse([{output,xml} | RawOpts], Args) -> + parse(RawOpts, Args); % default, no update of record necessary +parse([{output,sgml} | RawOpts], Args) -> + parse(RawOpts, Args#args{suffix=".sgml", layout=docb_edoc_sgml_cb}); +parse([{def,Defs} | RawOpts], Args) -> + case parse_defs(Defs) of + true -> + Args2 = Args#args{def=Args#args.def++Defs}, + parse(RawOpts, Args2); + false -> + {error, {badopt, {def,Defs}}} + end; +parse([{includes,Dirs} | RawOpts], Args) -> + case parse_includes(Dirs) of + true -> + Args2 = Args#args{includes=Args#args.includes++Dirs}, + parse(RawOpts, Args2); + false -> + {error, {badopt, {includes,Dirs}}} + end; +parse([{preprocess,Bool} | RawOpts], Args) when Bool==true; + Bool==false -> + parse(RawOpts, Args#args{preprocess=Bool}); +parse([{sort_functions,Bool} | RawOpts], Args) when Bool==true; + Bool==false -> + parse(RawOpts, Args#args{sort_functions=Bool}); +parse([], Args) -> + {ok, Args}; +parse([Opt | _RawOpts], _Args) -> + {error, {badopt, Opt}}. + +parse_defs(Defs) -> + lists:all(fun({Key,Val}) when is_atom(Key), is_list(Val) -> true; + (_) -> false + end, + Defs). + +parse_includes(Dirs) -> + lists:all(fun(Dir) when is_list(Dir) -> true; + (_) -> false + end, + Dirs). diff --git a/lib/docbuilder/src/docb_html.erl b/lib/docbuilder/src/docb_html.erl new file mode 100644 index 0000000000..9aea4c8a66 --- /dev/null +++ b/lib/docbuilder/src/docb_html.erl @@ -0,0 +1,394 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_html). + +-export([rule/2, rule/3]). + +rule([p, item, list|_], {_, _, _}) -> + {"", "<br />\n"}; +rule([p, item, taglist|_], {_, _, _}) -> + {"", "<br />\n"}; +rule([p|_], _) -> + {"\n<p>", "\n</p>"}; + +rule([pre|_], _) -> + {"\n<div class=\"example\"><pre>\n", "\n</pre></div>\n"}; + +rule([input|_], _) -> + {"<strong>", "</strong>"}; + +rule([quote|_], _) -> + {"\n<blockquote>\n", "\n</blockquote>\n"}; + +rule([i|_], _) -> + {"<em>", "</em>"}; + +rule([b|_], _) -> + {"<strong>", "</strong>"}; + +rule([c|_], _) -> + {"<span class=\"code\">", "</span>"}; + +rule([em|_], _) -> + {"<strong>", "</strong>"}; + +rule([sub|_], _) -> + {"<sub>", "</sub>"}; + +rule([sup|_], _) -> + {"<sup>", "</sup>"}; + +rule([termdef|_], _) -> + {drop, ""}; + +rule([citedef|_], _) -> + {drop, ""}; + +rule([br|_], _) -> + {"<br />\n", ""}; + +rule([digression|_], _) -> + {"<table>\n" + " <tr>\n" + " <td width=\"23\"></td>\n" + " <td>\n" + " <font size=\"-1\">\n", + " </font>\n" + " </td>\n" + " </tr>\n" + "</table>\n"}; + +rule([list, item, list|_], {_, ["ORDERED"], _}) -> + {"\n<ol>\n", "\n</ol>\n"}; +rule([list, item, taglist|_], {_, ["ORDERED"], _}) -> + {"\n<ol>\n", "\n</ol>\n"}; +rule([list|_], {_, ["ORDERED"], _}) -> + {"\n<ol>\n", "\n</ol>\n"}; +rule([list, item, list|_], {_, ["BULLETED"], _}) -> + {"\n<ul>\n", "\n</ul>\n"}; +rule([list, item, taglist|_], {_, ["BULLETED"], _}) -> + {"\n<ul>\n", "\n</ul>\n"}; +rule([list|_], {_, ["BULLETED"], _}) -> + {"\n<ul>\n", "\n</ul>\n"}; + +rule([taglist, item, taglist|_], _) -> + {"\n<dl>\n", "\n</dl>\n"}; +rule([taglist, item, list|_], _) -> + {"\n<dl>\n", "\n</dl>\n"}; +rule([taglist|_], _) -> + {"\n<dl>\n", "\n</dl>\n"}; + +rule([tag|_], _) -> + {"\n<dt>\n", "\n</dt>\n"}; + +rule([item, list|_], _) -> + {"\n<li>\n", "\n</li>\n\n"}; +rule([item, taglist|_], _) -> + {"\n<dd>\n", "\n</dd>\n"}; + +rule([image|_], {_, [File], _}) -> + File2 = + case filename:extension(File) of + [] -> File ++ ".gif"; + _ -> File + end, + {["\n<center>\n", "<img alt=\"", File2, "\" src=\"", File2, + "\"/><br/>\n"], + "\n</center>\n"}; + +rule([icaption|_], _) -> + {"<em>", "</em>\n"}; + +rule([url|_], {_, [HREF], _}) -> + URI = docb_html_util:make_uri(HREF), + {io_lib:format("<a target=\"_top\" href=\"~s\">", [URI]), "</a>"}; + +rule([marker|_], {_, [ID], _}) -> + %% remove all chars before first # including the # + {ok, NewID, _} = regexp:sub(ID, "^[^#]*#", ""), + %% replace "/" with "-" because "/" xhtml does not + %% allow "/" in the name attribute of element <a> + %% so we have to do the same as for marker i.e + %% Function/Arity is translated to an anchor in xhtml + %% like this : <a name="Function-Arity"/> + NewID2 = [case X of $/ -> $-;_->X end||X <- NewID], + {drop, ["<a name=\"", NewID2, "\"><!-- Empty --></a>"]}; + +rule([table|_], {_, ["", ""], Ts}) -> + {newargs, + "\n<center>\n" + "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n", + reorder_table(Ts), + "\n</table>\n" + "</center>\n"}; +rule([table|_], {_, [Width, ""], Ts}) -> + {newargs, + ["\n<center>\n" + "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\" ", + "width=\"", Width, "%\">\n"], + reorder_table(Ts), + "\n</table>\n" + "</center>\n"}; + +%% The clauses above are for the report DTD. This one is for the other +%% DTDs. +rule([table|_], {_, ["LEFT"], Ts}) -> + {newargs, + "\n" + "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n", + reorder_table(Ts), + "\n</table>\n"}; + +rule([table|_], {_, _, Ts}) -> + {newargs, + "\n<center>\n" + "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">\n", + reorder_table(Ts), + "\n</table>\n" + "</center>\n"}; + +rule([row|_], _) -> + {" <tr>\n", "\n </tr>\n"}; + +rule([cell|_], {_, ["", ""], _}) -> + {" <td>\n", "\n </td>\n"}; +rule([cell|_], {_, [Align, ""], _}) -> + {[" <td align=\"", string:to_lower(Align), "\">\n"], "\n </td>\n"}; +rule([cell|_], {_, ["", VAlign], _}) -> + {[" <td valign=\"", string:to_lower(VAlign), "\">\n"], "\n </td>\n"}; +rule([cell|_], {_, [Align, VAlign], _}) -> + {[" <td align=\"", string:to_lower(Align), "\" valign=\"", string:to_lower(VAlign), "\">\n"], + "\n </td>\n"}; + +rule([tcaption|_], _) -> + {" <caption align=\"bottom\"><em>", "</em></caption>\n"}; + +rule([codeinclude|_], {_, [File, Tag, _Type], _}) -> +%% Type can be "ERL", "C" or "NONE" + {ok,Data} = docb_html_util:code_include(File, Tag), + {drop, ["\n<div class=\"example\"><pre>\n", Data, + "\n</pre></div>\n"]}; + +rule([erleval|_], {_, [Expr], _}) -> + docb_html_util:erl_eval(Expr); + +rule([pcdata, pre|_], {_, _, Data}) -> + %% Do not remove leading spaces. + {drop, docb_html_util:pcdata_to_html(Data, false)}; + +rule([pcdata|_], {_, _, Data}) -> + {drop, docb_html_util:pcdata_to_html(Data)}. + +rule([seealso|_], {_, [Marker], _}, Opts) -> + Href = + case docb_util:html_snippet(seealso, Marker, Opts) of + "" -> + %% DocBuilder default behavior: + %% Marker is of format "Path#Fragment", both optional. + %% Translated to <A HREF="Path.html#Fragment"> + case string:chr(Marker, $#) of + 0 -> % No Fragment + Marker++".html"; + 1 -> % No Path + %% replace "/" with "-" because "/" xhtml does not + %% allow "/" in the name attribute of element <a> + %% so we have to do the same as for marker i.e + %% Function/Arity is translated to an anchor in xhtml + %% like this : <a name="Function-Arity"/> + [case X of $/ -> $-;_->X end||X <- Marker]; + _ -> + Marker1 = [case X of $/ -> $-;_->X end||X <- Marker], + case string:tokens(Marker1, "#") of + [Path] -> % # at end, remove it + Path++".html"; + [Path | Frag0] -> + Path++".html#"++ + docb_util:join(Frag0, "#") + end + end; + Href0 -> + %% User defined behavior, use result as-is + Href0 + end, + {{["<a href=\"", Href, "\">"], "</a>"}, Opts}; + +rule([warning|_], _, Opts) -> + docb_html_util:copy_pics("warning.gif", "warning.gif", Opts), + {{"\n<div class=\"warning\">\n" + "<div class=\"label\">Warning</div>\n" + "<div class=\"content\">\n", + "\n</div>" + "\n</div>\n"}, Opts}; + +rule([note|_], _, Opts) -> + docb_html_util:copy_pics("note.gif", "note.gif", Opts), + {{"\n<div class=\"note\">\n" + "<div class=\"label\">Note</div>\n" + "<div class=\"content\">", + "\n</div>" + "\n</div>\n"}, Opts}; + +rule([path|_], {_, [UNIX, Windows], [{pcdata, _, Text}]}, Opts) -> + UnixPart = + docb_util:an_option({ptype,"unix"}, Opts) and (UNIX/=""), + WinPart = + docb_util:an_option({ptype,"windows"}, Opts) and (Windows/=""), + if + UnixPart, WinPart -> + {{drop, [docb_html_util:pcdata_to_html(Text), + " <font size=\"-2\">(<code>UNIX: ", + docb_html_util:attribute_cdata_to_html(UNIX), + ", ", + "Windows: ", + docb_html_util:attribute_cdata_to_html(Windows), + "</code>)</font>"]}, + Opts}; + UnixPart -> + {{drop, [docb_html_util:pcdata_to_html(Text), + " <font size=\"-1\">(<code>UNIX: ", + docb_html_util:attribute_cdata_to_html(UNIX), + "</code>)</font>"]}, + Opts}; + WinPart -> + {{drop, [docb_html_util:pcdata_to_html(Text), + " <font size=\"-1\">(<code>Windows: ", + docb_html_util:attribute_cdata_to_html(Windows), + "</code>)</font>"]}, + Opts}; + true -> + {{drop, docb_html_util:pcdata_to_html(Text)}, Opts} + end; + +rule([term|_], {_, [ID], _}, Opts) -> + case docb_util:an_option(dict, Opts) of + false -> + case docb_util:lookup_option({defs, term}, Opts) of + false -> + {{drop, ["<em><strong>", + ID, + "</strong></em> "]}, Opts}; + TermList -> + case lists:keysearch(ID, 1, TermList) of + false -> + {{drop, ["<em><strong>", ID, + "</strong></em> "]}, + Opts}; + {value, {ID, Name, _Description, _Resp}} -> + {{drop, ["<em><strong>", Name, + "</strong></em> "]}, + Opts}; + {value, {ID, Name, _Description}} -> + {{drop, [ "<em><strong>", Name, + "</strong></em> "]}, + Opts} + end + end; + true -> + case docb_util:lookup_option({defs, term}, Opts) of + false -> + {{drop, ["<em><strong>", ID, + "</strong></em> "]}, Opts}; + TermList -> + PartApplication = + docb_util:lookup_option(part_application, Opts), + case lists:keysearch(ID, 1, TermList) of + false -> + {{drop, ["<a href=\"", PartApplication, + "_term.html#", ID, "\">", ID, + "</a> "]}, Opts}; + {value, {ID, Name, _Description, _Resp}} -> + {{drop, ["<a href=\"", PartApplication, + "_term.html#", ID, "\">", Name, + "</a> "]}, Opts}; + {value, {ID, Name, _Description}} -> + {{drop, ["<a href=\"", PartApplication, + "_term.html#", ID, "\">", Name, + "</a> "]}, Opts} + end + end + end; + +rule([cite|_], {_, [ID], _}, Opts) -> + case docb_util:an_option(dict, Opts) of + false -> + case docb_util:lookup_option({defs, cite}, Opts) of + false -> + {{drop, ["<em><strong>", ID, "</strong></em> "]}, + Opts}; + CiteList -> + case lists:keysearch(ID, 1, CiteList) of + false -> + {{drop, + ["<em><strong>", ID, "</strong></em> "]}, + Opts}; + + {value, {ID, Name, _Description, _Resp}} -> + {{drop, ["<em><strong>", Name, + "</strong></em> "]}, + Opts}; + {value, {ID, Name, _Description}} -> + {{drop, ["<em><strong>", Name, + "</strong></em> "]}, + Opts} + end + end; + true -> + case docb_util:lookup_option({defs, cite}, Opts) of + false -> + {{drop, ["<em><strong>", ID, "</strong></em> "]}, + Opts}; + CiteList -> + PartApp = + docb_util:lookup_option(part_application, Opts), + case lists:keysearch(ID, 1, CiteList) of + false -> + {{drop, ["<a href=\"", PartApp, + "_cite.html#", ID, "\">", ID, + "</a> "]}, + Opts}; + {value, {ID, Name, _Description, _Resp}} -> + {{drop, ["<a href=\"", PartApp, + "_cite.html#", ID, "\">", Name, + "</a> "]}, + Opts}; + {value, {ID, Name, _Description}} -> + {{drop, ["<a href=\"", PartApp, + "_cite.html#", ID, "\">", Name, + "</a> "]}, + Opts} + end + end + end; + +rule([code|_], {_, [Type], [{pcdata, _, Code}]}, Opts) -> + case lists:member(Type,["ERL","C","NONE"]) of + true -> + {{drop, ["\n<div class=\"example\"><pre>\n", docb_html_util:element_cdata_to_html(Code), + "\n</pre></div>\n"]}, Opts}; + false -> + exit({error,"unknown type of <code>"}) + end. + +reorder_table(TableContent) -> + reorder_table(TableContent, [], []). +reorder_table([], Caption, NewTableContent) -> + Caption ++ lists:reverse(NewTableContent); +reorder_table([{tcaption,_,_} = Caption | TableContent], _, NewTableContent) -> + reorder_table(TableContent, [Caption], NewTableContent); +reorder_table([Row | TableContent], Caption, NewTableContent) -> + reorder_table(TableContent, Caption, [Row | NewTableContent]). diff --git a/lib/docbuilder/src/docb_html_layout.erl b/lib/docbuilder/src/docb_html_layout.erl new file mode 100644 index 0000000000..dca80ac58e --- /dev/null +++ b/lib/docbuilder/src/docb_html_layout.erl @@ -0,0 +1,380 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_html_layout). + +-export([report_top/2, report_bot/1, + first_top/2, first_bot/1, + ref_top/2, ref_bot/1, + chapter_top/2, chapter_bot/1, + application_toc_top/3, application_toc_top/4, + part_toc_top/3, part_toc_top/4, part_toc_bot/0, + index_top/1, index_bot/0]). + +%% Report + +report_top(Data, Opts) -> + [Title, Prepared, _Responsible, DocNo, _Approved, _Checked, _Date, + Vsn0, _File] = Data, + html_header(Title, Opts) ++ + docb_util:html_snippet(top, Opts) ++ +"<center> +<h1>" ++ Title ++ "</h1> +<big> + " ++ DocNo ++ version(Opts, Vsn0) ++ "<br /> + " ++ Prepared ++ "<br /> +</big> +</center> +". + +report_bot(Opts) -> + docb_util:html_snippet(bottom, Opts) ++ +"</body> +</html> +". + +%% First + +first_top(Data, Opts) -> + [Title, _Prepared, _Responsible, DocNo, _Approved, _Checked, _Date, + Vsn0, _File] = Data, + html_header(Title, Opts) ++ + docb_util:html_snippet(top, Opts) ++ +"<center> +<h1>" ++ Title ++ "</h1> +<big>" ++ DocNo ++ version(Opts, Vsn0) ++ "<br /> +</big> +</center> +". + +first_bot(Opts) -> + report_bot(Opts). + +%% Reference + +ref_top(Data, Opts) -> + [Title, _Prepared, _Responsible, _DocNo, _Approved, _Checked, + _Date, _Rev, _File] = Data, + ref_html_header(Title, Opts) ++ +"<!-- refpage -->\n" ++ + docb_util:html_snippet(top, Opts) ++ +"<center> +<h1>" ++ Title ++ "</h1> +</center>". + +ref_bot(Opts) -> + docb_util:html_snippet(bottom, Opts) ++ +"</body> +</html> +". + +%% Chapter + +chapter_top(Data, Opts) -> + [Title, _Prepared, _Responsible, _DocNo, _Approved, _Checked, + _Date, _Rev, _File] = Data, + html_header(Title, Opts) ++ + docb_util:html_snippet(top, Opts). + +chapter_bot(Opts) -> + report_bot(Opts). + +%% Application ToC + +application_toc_top(Data, DocName, Opts) -> + [Title, _Prepared, _Responsible, DocNo, _Approved, _Checked, + _Date, Vsn0, _File] = Data, + html_header(Title, []) ++ +"<center> +<strong>" ++ Title ++ "</strong> +<p> +<small> + " ++ DocNo ++ version(Opts, Vsn0) ++ " +</small> +</p> +<p> +<small> + <a target=\"document\" href=\"" ++ DocName ++ "_cite.html\">Bibliography</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_term.html\">Glossary</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_index.html\">Index</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_first.html\">Cover</a>" ++ top_index(Opts) ++ +"</small> +</p> +</center> +<p> +<small> +<strong>Table of Contents</strong> +</small> +</p> +". + +application_toc_top(Data, DocName, Opts, HRefTexts) -> + [Title, _Prepared, _Responsible, DocNo, _Approved, _Checked, + _Date, Vsn0, _File] = Data, + html_header(Title, []) ++ +"<center> +<small> +" ++ + docb_util:join( + lists:map( + fun({HRef, Text}) -> + "<a target=\"_top\" href=\"" ++ HRef ++ "\">" ++ + Text ++ "</a>" + end, + HRefTexts), " | ") ++ top_index(Opts) ++ +"</small> +<p> +<strong>" ++ Title ++ "</strong> +</p> +<p> +<small>" ++ DocNo ++ version(Opts, Vsn0) ++ "<br /> +</small> +</p> +<p> +<small> + <a target=\"document\" href=\"" ++ DocName ++ "_cite.html\">Bibliography</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_term.html\">Glossary</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_index.html\">Index</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_first.html\">Cover</a> +</small> +</p> +</center> +<p> +<small> +<strong>Table of Contents</strong> +</small> +</p> +". + +%% Part ToC + +part_toc_top(Data, DocName, Opts) -> + [Title, _Prepared, _Responsible, DocNo, _Approved, _Checked, + _Date, Vsn0, _File] = Data, + html_header(Title, []) ++ +"<center> +<p> +<strong>" ++ Title ++ "</strong> +</p> +<p> +<small>" ++ DocNo ++ version(Opts, Vsn0) ++ "<br /> +</small> +</p> +<p> +<small> + <a target=\"document\" href=\"" ++ DocName ++ "_cite.html\">Bibliography</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_term.html\">Glossary</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_first.html\">Cover</a>" ++ + top_index(Opts) ++ +"</small> +</p> +</center> +<p> +<small> +<strong>Table of Contents</strong> +</small> +</p> +". + +part_toc_top(Data, DocName, Opts, HRefTexts) -> + [Title, _Prepared, _Responsible, DocNo, _Approved, _Checked, + _Date, Vsn0, _File] = Data, + html_header(Title, []) ++ +"<center> +<p> +<small> +" ++ + docb_util:join( + lists:map( + fun({HRef, Text}) -> + "<a target=\"_top\" href=\"" ++ HRef ++ "\">" ++ + Text ++ "</a>" + end, + HRefTexts), " | ") ++ top_index(Opts) ++ +"</small> +</p> +<p> +<strong>" ++ Title ++ "</strong> +</p> +<p> +<small> + " ++ DocNo ++ version(Opts, Vsn0) ++ "<br /> +</small> +</p> +<p> +<small> + <a target=\"document\" href=\"" ++ DocName ++ "_cite.html\">Bibliography</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_term.html\">Glossary</a> | + <a target=\"document\" href=\"" ++ DocName ++ "_first.html\">Cover</a> +</small> +</p> +</center> +<p> +<small> +<strong>Table of Contents</strong> +</small> +</p> +". + +part_toc_bot() -> +"</body > +</html> +". + +%% Index + +index_top(_Data) -> + ref_html_header("INDEX", []) ++ +"<h1>INDEX</h1> +<p><em>Emphasized</em> index entries refer to <em>modules</em> +and <code>Courier</code> ditos to <code>functions</code>.\n</p>\n". + +index_bot() -> + part_toc_bot(). + +%% Internal functions + +html_header(Title, Opts) -> + Vsn = docb_util:version(), +%%"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> +"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> +<!-- This document was generated using DocBuilder-" ++ Vsn ++ " --> +<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> +<head> + <title>" ++ Title ++ "</title> + <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"/> + " ++ docb_util:html_snippet(head, Opts) ++ " + <style type=\"text/css\"> +<!-- + body { font-family: Verdana, Arial, Helvetica, sans-serif } + span.bold_code { font-family: courier;font-weight: bold} + span.code { font-family: courier;font-weight: normal} + +.note, .warning { + border: solid black 1px; + margin: 1em 3em; +} + +.note .label { + background: #30d42a; + color: white; + font-weight: bold; + padding: 5px 10px; +} +.note .content { + background: #eafeea; + color: black; + line-height: 120%; + font-size: 90%; + padding: 5px 10px; +} +.warning .label { + background: #C00; + color: white; + font-weight: bold; + padding: 5px 10px; +} +.warning .content { + background: #FFF0F0; + color: black; + line-height: 120%; + font-size: 90%; + padding: 5px 10px; +} + + .example { background-color:#eeeeff } + pre { font-family: courier; font-weight: normal } + .REFBODY { margin-left: 13mm } + .REFTYPES { margin-left: 8mm } +--> + </style> +</head> +<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=\"#FF00FF\" alink=\"#FF0000\"> +". + +ref_html_header(Title, Opts) -> + Vsn = docb_util:version(), +%%"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> +"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> +<!-- This document was generated using DocBuilder-" ++ Vsn ++ " --> +<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> +<head> + <title>" ++ Title ++ "</title> + <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"/> + " ++ docb_util:html_snippet(head, Opts) ++ " + <style type=\"text/css\"> +<!-- + body { font-family: Verdana, Arial, Helvetica, sans-serif } + span.bold_code { font-family: courier;font-weight: bold} + span.code { font-family: courier;font-weight: normal} + +.note, .warning { + border: solid black 1px; + margin: 1em 3em; +} + +.note .label { + background: #30d42a; + color: white; + font-weight: bold; + padding: 5px 10px; +} +.note .content { + background: #eafeea; + color: black; + line-height: 120%; + font-size: 90%; + padding: 5px 10px; +} +.warning .label { + background: #C00; + color: white; + font-weight: bold; + padding: 5px 10px; +} +.warning .content { + background: #FFF0F0; + color: black; + line-height: 120%; + font-size: 90%; + padding: 5px 10px; +} + + .example { background-color:#eeeeff } + pre { font-family: courier; font-weight: normal } + .REFBODY { margin-left: 13mm } + .REFTYPES { margin-left: 8mm } +--> + </style> +</head> +<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=\"#FF00FF\" alink=\"#FF0000\"> +". + +version(Opts, Vsn0) -> + case docb_util:lookup_option(vsn, Opts, Vsn0) of + "" -> ""; + Vsn -> " Version " ++ Vsn + end. + +top_index(Opts) -> + case docb_util:lookup_option(top, Opts) of + false -> ""; + TIFile -> + " | <a target=\"_top\" href=\"" ++ TIFile ++ "\">Top</a>" + end. diff --git a/lib/docbuilder/src/docb_html_ref.erl b/lib/docbuilder/src/docb_html_ref.erl new file mode 100644 index 0000000000..c5c166f1ae --- /dev/null +++ b/lib/docbuilder/src/docb_html_ref.erl @@ -0,0 +1,79 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_html_ref). + +-export([rule/2, rule/3]). + +rule([description|_],_) -> + {"\n<h3>DESCRIPTION</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([funcs|_],_) -> + {"\n<h3>EXPORTS</h3>\n",""}; + +rule([func|_],_) -> + {"\n<p>",""}; + +rule([name, func, funcs, RefType|_], {_,_,[{pcdata,[],Name0}]}) -> + Name1 = docb_html_util:make_anchor_name_short(Name0, RefType), + {"<a name=\"" ++ Name1 ++ "\"><span class=\"bold_code\">", + "</span></a><br/>\n"}; + +rule([fsummary|_],_) -> + {drop, "\n</p>\n"}; + +rule([type|_], _) -> + {"\n<div class=\"REFBODY\"><p>Types:</p>\n <div class=\"REFTYPES\">\n<p>\n", + "\n </p> </div>\n</div>\n"}; + +rule([v|_], _) -> + {"<span class=\"bold_code\">","</span><br/>\n"}; + +rule([d|_], _) -> + {"\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([desc|_], _) -> + {"\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([authors|_], _) -> + {"\n<h3>AUTHORS</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([aname|_], _) -> + {"", " - "}; + +rule([section|_], {1,_,_}) -> + {"", ""}; +rule([section|_], {_N,_,_}) -> + {"", "\n</div>\n"}; + +rule([title|_], _) -> + {"\n<h3>", "</h3>\n<div class=\"REFBODY\">\n"}; + +rule(TagHistory, TagBody) -> + docb_html:rule(TagHistory, TagBody). + +rule([email|_], _, Opts) -> + case docb_util:html_snippet(email, Opts) of + "" -> + {{"","<br/>\n"}, Opts}; + Email -> + {{drop, Email++"<br/>\n"}, Opts} + end; + +rule(TagHistory, TagBody, Opts) -> + docb_html:rule(TagHistory, TagBody, Opts). + diff --git a/lib/docbuilder/src/docb_html_util.erl b/lib/docbuilder/src/docb_html_util.erl new file mode 100644 index 0000000000..b2951706ea --- /dev/null +++ b/lib/docbuilder/src/docb_html_util.erl @@ -0,0 +1,543 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_html_util). + +-export([attribute_cdata_to_html/1, + element_cdata_to_html/1, + pcdata_to_html/1, pcdata_to_html/2]). +-export([copy_pics/3]). +-export([extract_header_data/2, all_header_data/1]). +-export([make_uri/1, + make_anchor_href/1, make_anchor_href_short/3, + make_anchor_name_short/2, + make_funcdef_short/2]). +-export([erl_include/2, code_include/2, erl_eval/1]). +-export([number/3, count_sections/1]). +-export([format_toc/1]). +-export([html_latin1_sort_order/1]). + +%%--Handle CDATA and PCDATA--------------------------------------------- + +%% NB: Functions for transforming sgmls/XMerL data output to html. +%% Do not use these for included text files (cf code_include and +%% erl_include). + +attribute_cdata_to_html(Data) -> + data2html(Data, false). + +element_cdata_to_html(Data) -> + data2html(Data, false). + +pcdata_to_html(Data) -> + data2html(Data, true). + +pcdata_to_html(Data, RmSp) -> + data2html(Data, RmSp). + +%% PCDATA, CDATA: Replace entities, and optionally delete +%% leading and multiple spaces. CDATA never contains entities to +%% replace. + +%% data2html(Cs, RmSpace) +data2html([246| Cs], RmSp) -> + [$&, $#, $2, $4, $6, $;| data2html(Cs, RmSp)]; +data2html([$>| Cs], RmSp) -> + [$&, $#, $6, $2, $;| data2html(Cs, RmSp)]; +data2html([$<| Cs], RmSp) -> + [$&, $#, $6, $0, $;| data2html(Cs, RmSp)]; +data2html([$&| Cs], RmSp) -> + [$&, $#, $3, $8, $;| data2html(Cs, RmSp)]; +data2html([$\"| Cs], RmSp) -> + [$&, $#, $3, $4, $;| data2html(Cs, RmSp)]; +data2html([$\n| Cs], RmSp) -> + data2html(Cs, RmSp); +data2html([$\\, $n| Cs], false) -> + [$\n| data2html(Cs, false)]; +data2html([$\\, $n| Cs], true) -> + [$\n| data2html(delete_leading_space(Cs), true)]; +data2html([$ , $ | Cs], true) -> % delete multiple space + [$ | data2html(delete_leading_space(Cs), true)]; +data2html([$\\, $|| Cs0], RmSp) -> + {Ent, Cs1} = collect_entity(Cs0), + [entity_to_html(Ent)| data2html(Cs1, RmSp)]; +data2html([$\\, $0, $1, $2| Cs], RmSp) -> + data2html(Cs, RmSp); +data2html([$\\, $\\, $n| Cs], RmSp) -> + [$\\, $n| data2html(Cs, RmSp)]; +data2html([$\\, O1, O2, O3| Cs], RmSp) + when O1 >= $0, O1 =< $7, O2 >= $0, O2 =< $7, O3 >= $0, O3 =< $7 -> + case octal2dec(O1, O2, O3) of + 173 -> % soft hyphen + data2html(Cs, RmSp); + C when C > 31, C < 256 -> + Ent = io_lib:format("&#~w;", [C]), + [Ent| data2html(Cs, RmSp)]; + C -> + [C| data2html(Cs, RmSp)] + end; +data2html([$\\, $\\| Cs], RmSp) -> + [$\\| data2html(Cs, RmSp)]; +data2html([C| Cs], RmSp) -> + [C| data2html(Cs, RmSp)]; +data2html([], _) -> + []. + +delete_leading_space([$ | Cs]) -> + delete_leading_space(Cs); +delete_leading_space(Cs) -> + Cs. + +collect_entity(Data) -> + collect_entity(Data, []). + +collect_entity([$\\, $|| Cs], Rs) -> + {lists:reverse(Rs), Cs}; +collect_entity([C| Cs], Rs) -> + collect_entity(Cs, [C| Rs]); +collect_entity([], Rs) -> + {[], lists:reverse(Rs)}. + +entity_to_html("&") -> "&"; +entity_to_html("\"") -> """; +entity_to_html("<") -> "<"; +entity_to_html(">") -> ">"; +entity_to_html([$\\, O1, O2, O3]) + when O1 >= $0, O1 =< $7, O2 >= $0, O2 =< $7, O3 >= $0, O3 =< $7 -> + case octal2dec(O1, O2, O3) of + 173 -> % soft hyphen + ""; + Value -> + io_lib:format("&#~w;", [Value]) + end; +entity_to_html(Other) -> + docb_html_util_iso:entity_to_html(Other). + +octal2dec(O1, O2, O3) -> + (O1*8+O2)*8+O3-73*$0. + +%%--Copy images--------------------------------------------------------- + +copy_pics(Src, Dest, Opts) -> + Dir = code:lib_dir(docbuilder), + InFile = filename:join([Dir, "etc", Src]), + OutFile = docb_util:outfile(Dest, "", Opts), + + case filelib:last_modified(OutFile) of + 0 -> % File doesn't exist + file:copy(InFile, OutFile); + + OutMod2 -> + InMod1s = calendar:datetime_to_gregorian_seconds( + filelib:last_modified(InFile)), + OutMod2s = calendar:datetime_to_gregorian_seconds(OutMod2), + if + InMod1s > OutMod2s -> % InFile is newer than OutFile + file:copy(InFile, OutFile); + true -> + ok + end + end. + +%%--Resolve header data------------------------------------------------- + +extract_header_data(Key, {header, [], List}) -> + case lists:keysearch(Key, 1, List) of + {value, {Key, [], []}} -> + ""; + {value, {Key, [], [{pcdata, [], Value}]}} -> + pcdata_to_html(Value); + false -> + "" + end. + +all_header_data(Header) -> + all_header_data(Header, + [title, prepared, responsible, docno, approved, + checked, date, rev, file]). + +all_header_data(_Header, []) -> + []; +all_header_data(Header, [Key| Rest]) -> + [extract_header_data(Key, Header) | all_header_data(Header, Rest)]. + +%%--Resolve hypertext references---------------------------------------- + +%% URI regular expression (RFC 2396): +%% "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?" +%% We split it in five parts: +%% scheme: "^(([^:/?#]+):)?" (includes trailing `:') +%% authority: "^(//([^/?#]*))?" (includes leading `//') +%% path: "^([^?#]*)" +%% query: "^(\\?([^#]*))?" (includes leading `?') +%% fragment: "^(#(.*))?" (includes leading `#') + +make_uri(Cs) -> + lists:flatmap( + fun({path, S}) -> + case regexp:match(S, "\.xml?\$") of + {match, _, _} -> + {ok, NS, _} = regexp:sub(S, "\.xml?\$", ".html"), + NS; + _ -> + S + end; + ({_, S}) -> + S + end, + split_uri(Cs)). + +split_uri(URI) -> + split_uri(URI, [{scheme, "^(([^:/?#]+):)?"}, + {authority, "^(//([^/?#]*))?"}, + {path, "^([^?#]*)"}, + {'query', "^(\\?([^#]*))?"}, + {fragment, "^(#(.*))?"}]). + +split_uri("", [{Tag, _R}| T]) -> + [{Tag, ""}| split_uri("", T)]; +split_uri(Cs0, [{Tag, R}| T]) -> + {match, 1, N} = regexp:match(Cs0, R), + Cs1 = string:substr(Cs0, 1, N), + Cs2 = strip_and_escape_uri_component(Tag, Cs1), + [{Tag, Cs2}| split_uri(string:substr(Cs0, N+1), T)]; +split_uri(_, []) -> + []. + +strip_and_escape_uri_component(authority, "//" ++ Cs) -> + "//" ++ escape_uri(string:strip(Cs)); +strip_and_escape_uri_component(path, Cs) -> + escape_uri(string:strip(Cs)); +strip_and_escape_uri_component('query', "?" ++ Cs) -> + "?" ++ escape_uri(string:strip(Cs)); +strip_and_escape_uri_component(fragment, "#" ++ Cs) -> + "#" ++ escape_uri(string:strip(Cs)); +strip_and_escape_uri_component(_, "") -> + ""; +strip_and_escape_uri_component(_, Cs) -> + escape_uri(string:strip(Cs)). + +escape_uri([C|Cs]) when C =< 32; + C == $<; C == $<; C == $#; C == $%; C == $"; + C == $?; + C == ${; C == $}; C ==$|; C == $\\; C == $^; + C == $[; C == $]; C ==$'; + C >= 127 -> + [$%, mk_hex(C div 16), mk_hex(C rem 16)| escape_uri(Cs)]; +escape_uri([C|Cs]) -> + [C|escape_uri(Cs)]; +escape_uri([]) -> + []. + +mk_hex(C) when C<10 -> + C + $0; +mk_hex(C) -> + C - 10 + $a. + +make_anchor_href(HRef) -> + case regexp:split(HRef, "#") of + {ok, [HRef]} -> + %% No `#' in HRef, i.e. only path + make_anchor_href(HRef, ""); + {ok, [Path, Fragment]}-> + make_anchor_href(Path, Fragment) + end. + +make_anchor_href(Path0, Frag0) -> + Frag1 = string:strip(Frag0), + Path1 = case Path0 of + "" -> + ""; + _ -> + case regexp:match(Path0, "\.xml?\$") of + nomatch -> + Path0 ++ ".html"; + _ -> + {ok, NewPath, _} = regexp:sub(Path0, + "\.xml?\$", + ".html"), + NewPath + end + end, + case Frag1 of + "" -> + attribute_cdata_to_html(Path1); + _ -> + attribute_cdata_to_html(Path1) ++ + "#" ++ + attribute_cdata_to_html([case Ch of $/ -> $-; _ -> Ch end|| + Ch <-Frag1]) + end. + +make_anchor_href_short(Path, Frag, RefType) -> + ShortFrag = make_funcdef_short(Frag, RefType,"-"), + make_anchor_href(Path, ShortFrag). + +make_anchor_name_short(FuncName0, RefType) -> + FuncName1 = make_funcdef_short(FuncName0, RefType,"-"), + attribute_cdata_to_html(FuncName1). + +make_funcdef_short(FuncDef0, RefType) -> + make_funcdef_short(FuncDef0, RefType, "/"). + +make_funcdef_short(FuncDef0, RefType,Delimiter) -> + FuncDef1 = docb_util:trim(FuncDef0), + Any0 = case lists:member(RefType, [cref, erlref]) of + true -> + case catch docb_util:fknidx(FuncDef1, Delimiter) of + {'EXIT', _} -> + false; + Any1 -> + Any1 + end; + false -> + false + end, + case Any0 of + false -> + case string:tokens(FuncDef1, " ") of + [Any2| _] -> + Any2; + _ -> + FuncDef1 + end; + _ -> + Any0 + end. + +%%--Include tags-------------------------------------------------------- + +%% Only used in report DTD +erl_include(File, Tag) -> + case docb_main:include_file(File, Tag) of + {ok, Cs} -> + {drop, "\n<pre>\n" ++ text_to_html(Cs) ++ "\n</pre>\n"}; + error -> + {drop, ""} + end. + +code_include(File, Tag) -> + case docb_main:include(File, Tag, Tag) of + {ok, Cs} -> + {ok,text_to_html(Cs)}; + error -> + {error, {codeinclude,File}} + end. + +erl_eval(Expr) -> + Cs = docb_main:eval_str(Expr), + {drop, "\n<pre>\n" ++ text_to_html(Cs) ++ "\n</pre>\n"}. + +%% Only replaces certain characters. Spaces and new lines etc are kept. +%% Used for plain text (e.g. inclusions of code). +text_to_html([$>| Cs]) -> + [$&, $#, $6, $2, $;| text_to_html(Cs)]; +text_to_html([$<| Cs]) -> + [$&, $#, $6, $0, $;| text_to_html(Cs)]; +text_to_html([$&| Cs]) -> + [$&, $#, $3, $8, $;| text_to_html(Cs)]; +text_to_html([$\"| Cs]) -> + [$&, $#, $3, $4, $;| text_to_html(Cs)]; +text_to_html([C| Cs]) -> + [C| text_to_html(Cs)]; +text_to_html([]) -> + []. + +%%--Number sections----------------------------------------------------- + +number({Tag, Attrs, More}, none, File) -> + {Tag, Attrs, do_number(More, [1], File)}; +number({Tag, Attrs, More}, Prefix, File) -> + {Tag, Attrs, do_number(More, [list_to_integer(Prefix)], File)}. + +do_number([], _, _) -> + []; +do_number([{header, Attrs, More}| Rest], NN, File) -> + [{header, Attrs, More}| do_number(Rest, NN, File)]; +do_number([{section, Attrs, More}| Rest], [N| NN], File) -> + [{section, Attrs, do_number(More, [1, N| NN], File)}| + do_number(Rest, [N+1| NN], File)]; +do_number([{title, _, [{pcdata, _, Title}]}| More], [N| NN], File) -> + Format = make_format(length(NN)), + Number = lists:flatten(io_lib:format(Format, lists:reverse(NN))), + [{marker, [{"ID", "CDATA", Number}], []}, + {title, [{"NUMBER", "CDATA", Number}, + {"FILE", "CDATA", File}], + [{pcdata, [], Title}]}| do_number(More, [N| NN], File)]; +do_number([{pcdata, Attrs, More}| Rest], NN, File) -> + [{pcdata, Attrs, More}| do_number(Rest, NN, File)]; +do_number([{Tag, Attrs, More}| Rest], NN, File) -> + [{Tag, Attrs, do_number(More, NN, File)}|do_number(Rest, NN, File)]. + +make_format(1) -> + "~w"; +make_format(N) -> + "~w." ++ make_format(N-1). + +count_sections([section| Rest]) -> + 1 + count_sections(Rest); +count_sections([_| Rest]) -> + count_sections(Rest); +count_sections([]) -> + 0. + +%%--Make a ToC---------------------------------------------------------- + +format_toc(Toc) -> + lists:map(fun({Number, Title}) -> + [Number, " <a href = \"#", Number, + "\">", Title, "</a><br/>\n"] + end, Toc). + +%%--Convert HTML ISO Latin 1 characters to ordinary characters---------- + +%% To be used for sorting. Cs must be flat. +html_latin1_sort_order(Cs) -> + hlso(Cs). + +hlso([]) -> + []; +hlso([$&, $#, C2, C1, C0, $;| Cs]) + when $0 =< C2, C2 =< $9, $0 =< C1, C1 =< $9, $0 =< C0, C0 =< $9 -> + C = ((C2-$0)*10 + (C1-$0))*10 + C0-$0, + hlso0(C, Cs); +hlso([$&, $#, C1, C0, $;| Cs]) + when $0 =< C1, C1 =< $9, $0 =< C0, C0 =< $9 -> + C = (C1-$0)*10 + C0-$0, + hlso0(C, Cs); +hlso([C| Cs]) -> + [C| hlso(Cs)]. + +hlso0(C, Cs) when 0 =< C, C =< 159 -> + [C| hlso(Cs)]; +hlso0(160, Cs) -> %% no-break space + hlso(Cs); % Remove it. +hlso0(161, Cs) -> %% inverted exclamation mark + [$? |hlso(Cs)]; +hlso0(162, Cs) -> %% cent sign + [$$|hlso(Cs)]; +hlso0(163, Cs) -> %% pound sterling sign + [$$|hlso(Cs)]; +hlso0(164, Cs) -> %% general currency sign + [$$|hlso(Cs)]; +hlso0(165, Cs) -> %% yen sign + [$$|hlso(Cs)]; +hlso0(166, Cs) -> %% broken (vertical) bar + [$| |hlso(Cs)]; +hlso0(167, Cs) -> %% section sign + [$$|hlso(Cs)]; +hlso0(168, Cs) -> %% umlaut (dieresis) + [$: |hlso(Cs)]; +hlso0(169, Cs) -> %% copyright sign + [$c |hlso(Cs)]; +hlso0(170, Cs) -> %% ordinal indicator, feminine + [$f |hlso(Cs)]; +hlso0(171, Cs) -> %% angle quotation mark, left + [$" |hlso(Cs)]; +hlso0(172, Cs) -> %% not sign + [$- |hlso(Cs)]; +hlso0(173, Cs) -> %% soft hyphen + [$- |hlso(Cs)]; +hlso0(174, Cs) -> %% registered sign + [$r |hlso(Cs)]; +hlso0(175, Cs) -> %% macron + [$- |hlso(Cs)]; +hlso0(176, Cs) -> %% degree sign + [$d |hlso(Cs)]; +hlso0(177, Cs) -> %% plus-or-minus sign + [$+ |hlso(Cs)]; +hlso0(178, Cs) -> %% superscript two + [$2 |hlso(Cs)]; +hlso0(179, Cs) -> %% superscript three + [$3 |hlso(Cs)]; +hlso0(180, Cs) -> %% acute accent + [$' |hlso(Cs)]; +hlso0(181, Cs) -> %% micro sign + [$' |hlso(Cs)]; +hlso0(182, Cs) -> %% pilcrow (paragraph sign) + [$$|hlso(Cs)]; +hlso0(183, Cs) -> %% middle dot + [$. |hlso(Cs)]; +hlso0(184, Cs) -> %% cedilla + [$c |hlso(Cs)]; +hlso0(185, Cs) -> %% superscript one + [$1 |hlso(Cs)]; +hlso0(186, Cs) -> %% ordinal indicator, masculine + [$m |hlso(Cs)]; +hlso0(187, Cs) -> %% angle quotation mark, right + [$" |hlso(Cs)]; +hlso0(188, Cs) -> %% fraction one-quarter + [$4 |hlso(Cs)]; +hlso0(189, Cs) -> %% fraction one-half + [$2 |hlso(Cs)]; +hlso0(190, Cs) -> %% fraction three-quarters + [$3 |hlso(Cs)]; +hlso0(191, Cs) -> %% inverted question mark + [$? |hlso(Cs)]; + +hlso0(C, Cs) when 192 =< C, C =< 198 -> %% capital A + [$A |hlso(Cs)]; +hlso0(199, Cs) -> %% capital C, cedilla + [$C |hlso(Cs)]; +hlso0(C, Cs) when 200 =< C, C =< 203 -> %% capital E + [$E |hlso(Cs)]; +hlso0(C, Cs) when 204 =< C, C =< 207 -> %% capital I + [$I |hlso(Cs)]; +hlso0(208, Cs) -> %% capital Eth, Icelandic + [$D |hlso(Cs)]; +hlso0(209, Cs) -> %% capital N, tilde + [$N |hlso(Cs)]; +hlso0(C, Cs) when 210 =< C, C =< 214 -> %% capital O + [$O |hlso(Cs)]; +hlso0(215, Cs) -> %% multiply sign + [$x |hlso(Cs)]; +hlso0(216, Cs) -> %% capital O, slash + [$O |hlso(Cs)]; +hlso0(C, Cs) when 217 =< C, C =< 220 -> %% capital U + [$U |hlso(Cs)]; +hlso0(221, Cs) -> %% capital Y, acute accent + [$Y |hlso(Cs)]; +hlso0(222, Cs) -> %% capital THORN, Icelandic + [$T |hlso(Cs)]; +hlso0(223, Cs) -> %% small sharp s, German (sz + [$s |hlso(Cs)]; +hlso0(C, Cs) when 224 =< C, C =< 230-> %% small a + [$a |hlso(Cs)]; +hlso0(231, Cs) -> %% small c, cedilla + [$c |hlso(Cs)]; +hlso0(C, Cs) when 232 =< C, C =< 235 -> %% small e + [$e |hlso(Cs)]; +hlso0(C, Cs) when 236 =< C, C =< 239 -> %% small i + [$i |hlso(Cs)]; +hlso0(240, Cs) -> %% small eth, Icelandic + [$d |hlso(Cs)]; +hlso0(241, Cs) -> %% small n, tilde + [$n |hlso(Cs)]; +hlso0(C, Cs) when 242 =< C, C =< 246 -> %% small o + [$o |hlso(Cs)]; +hlso0(247, Cs) -> %% divide sign + [$/ |hlso(Cs)]; +hlso0(248, Cs) -> %% small o, slash + [$o |hlso(Cs)]; +hlso0(C, Cs) when 249 =< C, C =< 252 -> %% small u + [$u |hlso(Cs)]; +hlso0(253, Cs) -> %% small y, acute accent + [$y |hlso(Cs)]; +hlso0(254, Cs) -> %% small thorn, Icelandic + [$t |hlso(Cs)]; +hlso0(255, Cs) -> %% small y, dieresis or umlaut + [$y |hlso(Cs)]. diff --git a/lib/docbuilder/src/docb_html_util_iso.erl b/lib/docbuilder/src/docb_html_util_iso.erl new file mode 100644 index 0000000000..c836805cd2 --- /dev/null +++ b/lib/docbuilder/src/docb_html_util_iso.erl @@ -0,0 +1,204 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_html_util_iso). +-export([entity_to_html/1]). + +%% Encodes ISOtech, ISOnum and ISOgrk3. +%% +%% All entities are of the form "[abcdef]". +%% +entity_to_html(Entity) when is_list(Entity), hd(Entity) =/= $[ -> + Entity; +entity_to_html(Entity) -> + case (catch enc(Entity)) of + {'EXIT', _} -> + Entity; + Enc -> + "<font face=symbol>" ++ Enc ++ "</font>" + end. + +enc("[Delta ]") -> "D"; +%% enc("[Dot ]") -> "�"; +%% enc("[DotDot]") -> "�"; +enc("[Gamma ]") -> "G"; +enc("[Lambda]") -> "L"; +enc("[Omega ]") -> "W"; +enc("[Phi ]") -> "F"; +enc("[Pi ]") -> "P"; +enc("[Prime ]") -> "²"; +enc("[Psi ]") -> "Y"; +enc("[Sigma ]") -> "S"; +enc("[Theta ]") -> "Q"; +enc("[Upsi ]") -> "¡"; +%% enc("[Verbar]") -> "�"; +enc("[Xi ]") -> "X"; + +enc("[aleph ]") -> "À"; +enc("[alpha ]") -> "a"; +enc("[amp ]") -> "&"; +enc("[and ]") -> "Ù"; +enc("[ang ]") -> "Ð"; +%% enc("[ang90 ]") -> "�"; +%% enc("[angsph]") -> "�"; +%% enc("[angst ]") -> "�"; +enc("[ap ]") -> "»"; + +%% enc("[becaus]") -> "�"; +%% enc("[bernou]") -> "�"; +enc("[bepsi ]") -> "'"; +enc("[beta ]") -> "b"; +enc("[bottom]") -> "^"; +enc("[bull ]") -> "·"; + +enc("[cap ]") -> "Ç"; +enc("[chi ]") -> "c"; +enc("[clubs ]") -> "§"; +%% enc("[compfn]") -> "�"; +enc("[cong ]") -> "@"; +enc("[copy ]") -> "Ó"; +%% enc("[conint]") -> "�"; +enc("[cup ]") -> "È"; + +enc("[dArr ]") -> "ß"; +enc("[darr ]") -> "¯"; +enc("[deg ]") -> "°"; +enc("[delta ]") -> "d"; +enc("[diam ]") -> "à"; +enc("[diams ]") -> "¨"; +enc("[divide]") -> "¸"; + +enc("[empty ]") -> "Æ"; +%% enc("[epsi ]") -> "�"; +%% enc("[epsis ]") -> "�"; +enc("[epsiv ]") -> "e"; +enc("[equiv ]") -> "º"; +enc("[eta ]") -> "h"; +enc("[exist ]") -> "$"; + +enc("[fnof ]") -> "¦"; +enc("[forall]") -> """; + +enc("[gamma ]") -> "g"; +%% enc("[gammad]") -> "�"; +enc("[ge ]") -> "³"; +enc("[gt ]") -> ">"; + +%% enc("[hamilt]") -> "�"; +enc("[hArr ]") -> "Û"; +enc("[harr ]") -> "«"; +enc("[hearts]") -> "©"; +enc("[horbar]") -> "¾"; + +enc("[iff ]") -> "Û"; +enc("[image ]") -> "Á"; +enc("[infin ]") -> "¥"; +enc("[int ]") -> "ò"; +enc("[iota ]") -> "i"; +enc("[isin ]") -> "Î"; + +enc("[kappa ]") -> "k"; +%%enc("[kappav]") -> "�"; + +enc("[lArr ]") -> "Ü"; +%% enc("[lagran]") -> "�"; +enc("[lambda]") -> "l"; +enc("[lang ]") -> "á"; +enc("[larr ]") -> "¬"; +enc("[le ]") -> "£"; +%% enc("[lowast]") -> "�"; +enc("[lowbar]") -> "_"; +enc("[lt ]") -> "<"; + +enc("[middot]") -> "×"; +enc("[minus ]") -> "-"; +%% enc("[mnplus]") -> "�"; +enc("[mu ]") -> "m"; + +enc("[nabla ]") -> "Ñ"; +enc("[ne ]") -> "¹"; +enc("[ni ]") -> "'"; +enc("[nsub ]") -> "Ë"; +enc("[not ]") -> "Ø"; +enc("[notin ]") -> "Ï"; +enc("[nu ]") -> "n"; + +enc("[omega ]") -> "w"; +enc("[or ]") -> "Ú"; +%% enc("[order ]") -> "�"; +enc("[oplus ]") -> "Å"; +enc("[otimes]") -> "Ä"; + +%% enc("[par ]") -> "�"; +enc("[part ]") -> "¶"; +%% enc("[permil]") -> "�"; +enc("[perp ]") -> "^"; % bottom +enc("[phis ]") -> "f"; +enc("[phiv ]") -> "j"; +%% enc("[phmmat]") -> "�"; +enc("[pi ]") -> "p"; +enc("[piv ]") -> "v"; +enc("[plus ]") -> "+"; +enc("[plusmn]") -> "±"; +enc("[prime ]") -> "¢"; +enc("[prod ]") -> "Õ"; +enc("[prop ]") -> "µ"; +enc("[psi ]") -> "y"; + +enc("[radic ]") -> "Ö"; +enc("[rang ]") -> "ñ"; +enc("[rArr ]") -> "Þ"; +enc("[rarr ]") -> "®"; +enc("[real ]") -> "Â"; +enc("[reg ]") -> "Ò"; +enc("[rho ]") -> "r"; +%% enc("[rhov ]") -> "�"; + +enc("[sigma ]") -> "s"; +enc("[sigmav]") -> "V"; +enc("[sim ]") -> "~"; +%% enc("[sime ]") -> "�"; +%% enc("[square]") -> "�"; +enc("[sol ]") -> "¤"; +enc("[spades]") -> "ª"; +enc("[sub ]") -> "Ì"; +enc("[sube ]") -> "Í"; +enc("[sup ]") -> "É"; +enc("[supe ]") -> "Ê"; +enc("[sum ]") -> "å"; + +enc("[tau ]") -> "t"; +enc("[tdot ]") -> "¼"; +enc("[there4]") -> "\"; +enc("[thetas]") -> "q"; +enc("[thetav]") -> "J"; +enc("[times ]") -> "´"; +%% enc("[tprime]") -> "�"; +enc("[trade ]") -> "Ô"; + +enc("[uArr ]") -> "Ý"; +enc("[uarr ]") -> "­"; +enc("[upsi ]") -> "u"; + +enc("[verbar]") -> "½"; + +%% enc("[wedgeq]") -> "�"; +enc("[weierp]") -> "Ã"; + +enc("[xi ]") -> "x"; + +enc("[zeta ]") -> "z". diff --git a/lib/docbuilder/src/docb_main.erl b/lib/docbuilder/src/docb_main.erl new file mode 100644 index 0000000000..ef21f65557 --- /dev/null +++ b/lib/docbuilder/src/docb_main.erl @@ -0,0 +1,651 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_main). + +-export([process/2, + parse/2, parse1/2, + pp/2, + insert_after/3, + transform/5, pp/5, + include_file/2, include/3, + eval_str/1, + validate_html/1 + ]). +-export([do_parse_sgmls/1]). + +%%---------------------------------------------------------------------- + +%% process(File, Opts) -> errors | ok +%% Parses the source file File and transforms the result to html, +%% latex and/or man page format. +process(File, Opts) -> + + File1 = File ++ ".tmpconv", + os:cmd("sed -e 's/xi:include[ \t]*href/include file/g' -e 's/xmlns:xi=\"http:\\/\\/www.w3.org\\/2001\\/XInclude\"//g' < " ++ + File ++ ".xml > " ++ File1 ++ ".xml"), %LATH + + case parse1(File1, Opts) of + errors -> + file:delete(File1 ++ ".xml"), + errors; + {ok, Tree} -> + From = element(1, Tree), + Tos0 = + lists:foldl( + fun(latex, Acc) -> [latex|Acc]; + (html, Acc) -> [html|Acc]; + ({man, _Section}, Acc) -> [man|Acc]; + (_, Acc) -> Acc + end, [], Opts), + + %% If no target format is specified, assume HTML: + Tos = if + Tos0==[] -> [html]; + true -> Tos0 + end, + + Result = [transform(From, To, Opts, File, Tree)||To <- Tos], + case lists:member(transformation_error,Result) of + true -> + file:delete(File1 ++ ".xml"), + errors; + _ -> + file:delete(File1 ++ ".xml"), + ok + end + + end. + +%%---------------------------------------------------------------------- + +%% parse(File, Opts) -> {ok, Tree} | errors +%% Parses the source file File, resulting in a tree structure. +parse(File, Opts) -> + case docb_util:lookup_option(src_type, Opts) of + ".xml" -> + parse_xml(File++".xml", Opts); + ".sgml" -> + parse_sgml(File, Opts) + end. + +%% parse1(File, Opts) -> {ok, Tree} | errors +%% Like parse/2, but in the SGML case also prints the parse errors +%% (in File.html.sgmls_errs) information to stdout. +parse1(File, Opts) -> + parse(File, [{print_parse_errs, true}|Opts]). + + +validate_html(InFile) -> + ScanOpts = [{validation,true}, {fetch_fun, fun fetch_dtd/2}], + case xmerl_scan:file(InFile, ScanOpts) of + {_XMLTuple,[]} -> % ok + {InFile,ok}; + {'EXIT',Reason} -> + {InFile,Reason} + end. + +fetch_dtd({public,_,"http://www.w3.org/TR/xhtml1/DTD/"++ Rest},GlobalState) -> + Filename = filename:join(docb_util:dtd_dir(),Rest), + {ok,{file,Filename},GlobalState}; +fetch_dtd({public,_,Str},GlobalState) -> + {ok,{file,filename:join(docb_util:dtd_dir(),Str)},GlobalState}. + + + +parse_xml(InFile, Opts) -> + DtdDir = docb_util:dtd_dir(), + ScanOpts = [{validation,true}, {fetch_path, [DtdDir]}], + PrintP = docb_util:lookup_option(print_parse_errs, Opts), + case catch xmerl_scan:file(InFile, ScanOpts) of + {'EXIT', Error} when PrintP -> + docb_util:message(error, + "XML validation error:~n~p", [Error]), + errors; + {'EXIT', _Error} -> + errors; + {error, Reason} -> % probably file error + docb_util:message(error, "XML scan error: ~p", [Reason]), + errors; + {Doc, []} -> + case catch xmerl:export([Doc], docb_xmerl_tree_cb) of + [Tree] -> + verify(Tree), + {ok, Tree}; + {'EXIT', Error} -> + docb_util:message(error, + "XML export error:~n~p", [Error]), + errors + end + end. + +parse_sgml(InFile, Opts) -> + + Pfx = tmp_file_prefix(InFile, Opts), + OutFile = Pfx ++ "sgmls_output", + ErrFile = Pfx ++ "sgmls_errs", + + EntVals = lists:usort(docb_util:lookup_options(ent, Opts)), + Ents = lists:flatten([" -ent " ++ Val || Val <- EntVals]), + Cmd = docb_util:old_docb_dir() ++ "/bin/docb_sgmls_run " ++ + Ents ++ " " ++ InFile ++ ".sgml " ++ OutFile ++ " " ++ ErrFile, + + case os:cmd(Cmd) of + [] -> + PrintP = docb_util:lookup_option(print_parse_errs, Opts), + case filelib:file_size(ErrFile) of + 0 -> % implies no errors + parse_sgmls(InFile, OutFile); + _ when PrintP -> + cat(ErrFile), + errors; + _ -> + errors + end; + Msg -> + docb_util:message(error, "~p", [Msg]), + errors + end. + +tmp_file_prefix(File, Opts) -> + lists:concat( + [File, "." | lists:foldl( + fun(latex, Acc) -> ["latex."|Acc]; + (html, Acc) -> ["html."|Acc]; + ({man, Section}, Acc) -> ["man", Section, "."|Acc]; + (_, Acc) -> Acc + end, [], Opts)]). + +parse_sgmls(InFile, SgmlsFile) -> + case file:open(SgmlsFile, [read]) of + {ok, Fd} -> + Res = case (catch do_parse_sgmls(Fd)) of + {ok, Tree} -> + {ok, Tree}; + {'EXIT', Reason} -> + docb_util:message( + error, + "Cannot parse sgmls output file " + "~s, obtained from parsing ~s, " + "reason: ~w", + [SgmlsFile, InFile, Reason]), + errors; + {error, Reason} -> + docb_util:message( + error, + "Cannot parse sgmls output file " + "~s, obtained from parsing ~s, " + "reason: ~w", + [SgmlsFile, InFile, Reason]), + errors + end, + file:close(Fd), + case Res of + {ok, Tree0} -> + verify(Tree0), + {ok, Tree0}; + _Other -> + errors + end; + {error, Reason} -> + docb_util:message(error, + "Cannot open sgmls output file ~s, " + "obtained from parsing ~s, reason: ~w", + [SgmlsFile, InFile, Reason]), + errors + end. + +do_parse_sgmls(Fd) -> + do_parse_sgmls(Fd, []). + +do_parse_sgmls(Fd, Attrs) -> + case get_line(Fd) of + {attrs, A} -> + do_parse_sgmls(Fd, [A|Attrs]); + {startTag, Tag} -> + {ok, {Tag, Attrs, get_args(Fd)}}; + Other -> + {error, Other} + end. + +get_args(Fd) -> + case get_line(Fd) of + {startTag, Tag} -> + H = {Tag, [], get_args(Fd)}, + [H|get_args(Fd)]; + {dataTag, Str} -> + [{pcdata, [], Str}|get_args(Fd)]; + {attrs, A} -> + get_args_attr(Fd, [A]); + close -> + []; + ok -> + [] + end. + +get_args_attr(Fd, Attrs) -> + case get_line(Fd) of + {startTag, Tag} -> + H = {Tag, lists:reverse(Attrs), get_args(Fd)}, + [H|get_args(Fd)]; + {dataTag, Str} -> + [{pcdata, lists:reverse(Attrs), Str}|get_args(Fd)]; + {attrs, A} -> + get_args_attr(Fd, [A|Attrs]); + close -> + []; + ok -> + [] + end. + +get_line(Fd) -> + Str = io:get_line(Fd, ''), + case Str of + [$(|T] -> + {startTag, tag_name(T)}; + [$-|T] -> + {dataTag, T}; + [$)|_T] -> + close; + [$A|T] -> + {attrs, attrs(remove_nl(T))}; + [$?|_T] -> + get_line(Fd); + [$C|_] -> + ok + end. + +remove_nl([$\n|_]) -> []; +remove_nl([H|T]) -> [H|remove_nl(T)]; +remove_nl([]) -> []. + +%% attrs +%% splits a string like +%% AAAAA BBBBB ...... +%% into {"AAA", "BBB", Rest} + +attrs(T) -> + {X, T1} = get_item(T), + {Y, T2} = get_item(T1), + T3 = skip_blanks(T2), + {X, Y, T3}. + +get_item(T) -> get_item(skip_blanks(T), []). + +get_item([$ |T], L) -> {lists:reverse(L), [$ |T]}; +get_item([H|T], L) -> get_item(T, [H|L]); +get_item([], L) -> {lists:reverse(L), []}. + +skip_blanks([$ |T]) -> skip_blanks(T); +skip_blanks(T) -> T. + +tag_name(Str) -> tag_name(Str, []). + +tag_name([H|T], L) when $A =< H, H =< $Z -> + tag_name(T, [H-$A+$a|L]); +tag_name([$\n], L) -> + list_to_atom(lists:reverse(L)); +tag_name([H|T], L) -> + tag_name(T, [H|L]). + +cat(File) -> + case file:open(File, [read]) of + {ok, Fd} -> + cat1(Fd), + file:close(Fd); + Other -> + Other + end. + +cat1(Fd) -> + case io:get_line(Fd, '') of + eof -> + eof; + Str -> + io:format("~s", [Str]), + cat1(Fd) + end. + +%%---------------------------------------------------------------------- + +verify(Tree) -> verify(Tree, [], 1). + +verify({pcdata, Optional, _}, Path, Level) -> + verify_optional(Optional, Path, Level); +verify({Tag, Optional, Args}, Path, Level) when is_list(Args) -> + case verify_optional(Optional, Path, Level) of + true -> + verify_list(Args, [Tag|Path], Level); + false -> + false + end; +verify(Other, Path, Level) -> + verify_error(Other, Path, Level). + +verify_error(X, Path, Level) -> + docb_util:message(error, "Invalid object found at: ~p level:~w~n~s", + [Path, Level, docb_pretty_format:term(X)]), + false. + +verify_list([H|T], Path, Level) -> + case verify(H, Path, Level) of + true -> + verify_list(T, Path, Level +1); + false -> + false + end; +verify_list([], _, _) -> + true. + +verify_optional([{_, _, _}|T], Path, Level) -> + verify_optional(T, Path, Level); +verify_optional([], _Path, _Level) -> + true; +verify_optional(X, Path, Level) -> + verify_error(X, Path, Level). + +%%---------------------------------------------------------------------- + +%% pp(File, Opts) -> {ok, OutFile} | errors +%% Parses the source file and, if successful, prints the resulting tree +%% structure to a file with the extension ".pp". +pp(File, Opts) -> + case parse(File, Opts) of + {ok, Tree} -> + OutFile = File ++ ".pp", + dump(OutFile, Tree), + {ok, OutFile}; + errors -> + errors + end. + +dump(File, Struct) -> + {ok, Stream} = file:open(File, [write]), + io:format("Info: Dump on ~p ...", [File]), + io:format(Stream, "~n~s~n", [docb_pretty_format:term(Struct)]), + io:format(" done.\n"), + file:close(Stream). + +%%---------------------------------------------------------------------- + +%% insert_after(Tag, Tree, Obj) -> Tree | {'EXIT', Reason} +%% Insert an element in a tree structure +insert_after(Tag, Tree, Obj) -> + edit(Tag, Tree, {insert_after, Obj}). + +%% edit Op = delete, insert_before, insert_after +edit(Tag, Tree, Op) -> + case catch edit1(Tag, Tree, Op) of + error -> + docb_util:message(error, "Cannot do ~p to ~w", [Op, Tag]), + Tree; + Other -> + Other + end. + +edit1(Tag, {Tag, _O, _A}, _Op) -> + throw(error); +edit1(Tag, {Tag1, O, A}, Op) -> + {Tag1, O, edit1_list(Tag, A, Op)}; +edit1(_, _, _) -> + throw(error). + +edit1_list(Tag, [{pcdata, Str}|T], Op) -> + [{pcdata, Str}|edit1_list(Tag, T, Op)]; +edit1_list(Tag, [{Tag, O, A}|T], {insert_after, Obj}) -> + [{Tag, O, A}, Obj|T]; +edit1_list(Tag, [H|T], Op) -> + [H|edit1_list(Tag, T, Op)]; +edit1_list(_Tag, [], _Op) -> + []. + +%%______________________________________________________________________ + +%% transform(From, To, Opts, File, Tree) -> void() +%% Actual transformation of tree structure to desired format. +transform(From, To, Opts, File, Tree) -> + Filter = if + To==html; To==kwic -> + list_to_atom("docb_tr_" ++ atom_to_list(From) ++ + [$2|atom_to_list(To)]); + true -> + list_to_atom("sgml_tr_" ++ atom_to_list(From) ++ + [$2|atom_to_list(To)]) + end, + + case catch apply(Filter, transform, [File, Tree, Opts]) of + + %% R5C + {'EXIT', {undef, [{Filter, transform, [File, Tree, Opts]}|_]}}-> + %% No transformation defined + finish_transform(Tree, File, Opts, Filter); + + {'EXIT', {undef, {Filter, transform, [File, Tree, Opts]}}} -> + %% No transformation defined + finish_transform(Tree, File, Opts, Filter); + + {'EXIT', What} -> + docb_util:message(error, + "Transformation trouble in ~P", [What, 9]), + transformation_error; + + {error, Reason} -> + docb_util:message(error, Reason), + transformation_error; + + {Tree1, Opts1} -> + %% transformation returning both new parse and new options + finish_transform(Tree1, File, Opts1, Filter); + + Tree1 -> + %% transformation returning only new parse + finish_transform(Tree1, File, Opts, Filter) + end. + +finish_transform(Tree, File, Opts, Filter) -> + {Str, NewOpts} = pp(Tree, [], 1, Filter, Opts), + Extension = + case catch apply(Filter, extension, [NewOpts]) of + {'EXIT', _} -> + apply(Filter, extension, []); + Others -> + Others + end, + {ok, Out} = + file:open(docb_util:outfile(File, Extension, NewOpts), [write]), + put_chars(Out, Str), + file:close(Out). + +put_chars(Out, Str) -> put_chars(Out, Str, 0). + +put_chars(Out, [$\n|Cs], _Pos) -> + io:put_chars(Out, [$\n]), + put_chars(Out, Cs, 0); + +put_chars(Out, [$\011|Cs], Pos) -> % tab + TabbedPos = 8*((Pos div 8)+1), + Nblanks = TabbedPos - Pos, + io:put_chars(Out, lists:duplicate(Nblanks, $ )), + put_chars(Out, Cs, Pos+Nblanks); + +put_chars(Out, [C|Cs], Pos) when is_integer(C) -> + io:put_chars(Out, [C]), + put_chars(Out, Cs, Pos+1); + +put_chars(Out, [L|Cs], Pos) when is_list(L) -> + put_chars(Out, Cs, put_chars(Out, L, Pos)); + +put_chars(_Out, [], Pos) -> + Pos. + +pp({Tag, Optional, Args}, TagPath, Level, Filter, Opts) -> + TagPath1 = [Tag|TagPath], + Optional1 = reduce_optional(Optional), + + %% First try Filter:rule/3. It returns {Return, NewOpts} + %% where Return is as from rule/2: + Rule_3_result = + case catch Filter:rule(TagPath1, {Level,Optional1,Args},Opts) of + %% R5C + {'EXIT', {undef, [{_, rule, _}|_]}} -> % No rule/3 defined + failed; + + {'EXIT', {undef, {_, rule, _}}} -> % No rule/3 defined + failed; + %% R5C + {'EXIT', {function_clause, [{_, rule, _}|_]}} -> % No MATCHING rule/3 + failed; + + {'EXIT', {function_clause, {_, rule, _}}} -> % No MATCHING rule/3 + failed; + + {'EXIT', What} -> + docb_util:message(error, + "Serious Error: ~P", [What, 9]); + Others -> + Others + end, + handle_rule_call_result({r3, Rule_3_result}, Filter, TagPath1, Tag, + Level, Optional1, Args, Opts). + +handle_rule_call_result({r3, failed}, Filter, TagPath1, Tag, Level, Optional1, + Args, Opts) -> + %% Hmmm, try Filter:rule/2 + Rule_2_result = (catch Filter:rule(TagPath1, {Level, Optional1, Args})), + handle_rule_call_result({r2, Rule_2_result}, Filter, TagPath1, Tag, + Level, Optional1, Args, Opts); +handle_rule_call_result({r3, {Result, NewOpts}}, Filter, TagPath1, Tag, Level, + Optional1, Args, _Opts) -> + handle_rule_call_result({r2, Result}, Filter, TagPath1, Tag, Level, + Optional1, Args, NewOpts); +handle_rule_call_result({_, {func, F}}, _Filter, _TagPath1, _Tag, _Level, + _Optional1, Args, Opts) -> + {F(Args), Opts}; +handle_rule_call_result({_, {'EXIT', Why}}, _Filter, TagPath1, _Tag, Level, + Optional1, Args, Opts) -> + report_error(TagPath1, Why, {Level, Optional1, Args}), + {[], Opts}; +handle_rule_call_result({_, {drop, Str}}, _Filter, _TagPath1, _Tag, _Level, + _Optional1, _Args, Opts) -> + {[Str], Opts}; +handle_rule_call_result({_, {newargs, NewArgs}}, Filter, TagPath1, _Tag, _Level, + _Optional1, _Args, Opts) -> + {List, NewOpts} = pp_list(NewArgs, TagPath1, 1, Filter, Opts), + {[List], NewOpts}; +handle_rule_call_result({_, {newargs, Before, NewArgs, After}}, Filter, TagPath1, _Tag, _Level, + _Optional1, _Args, Opts) -> + {List, NewOpts} = pp_list(NewArgs, TagPath1, 1, Filter, Opts), + {[Before, List, After], NewOpts}; +handle_rule_call_result({_, {Before, After}}, Filter, TagPath1, _Tag, _Level, + _Optional1, Args, Opts) when is_list(Before) -> + {List, NewOpts} = pp_list(Args, TagPath1, 1, Filter, Opts), + {[Before, List, After], NewOpts}. + +pp_list([H|T], TagPath, Level, Rules, Opts) -> + {Hpp, Hopts} = pp(H, TagPath, Level, Rules, Opts), + {Tpp, Tops} = pp_list(T, TagPath, Level + 1, Rules, Hopts), + {[Hpp|Tpp], Tops}; +pp_list([], _, _, _, Opts) -> + {[], Opts}. + +reduce_optional([{_, _, H}|T]) -> [H|reduce_optional(T)]; +reduce_optional([]) -> []. + +report_error(Arg1, Cause, Arg2) -> + [Tag|_] = Arg1, + docb_util:message(error, + "Formatting trouble in ~p: ~p", [Tag, Cause]), + docb_util:message(error, "Failure in rule(~p, ~p)", [Arg1, Arg2]). + +%%---------------------------------------------------------------------- + +%% include_file(File, Tag) -> {ok, String} | error +include_file(File, Tag) -> + include(File, "%S" ++ Tag, "%E" ++ Tag). + +%% include(File, StartTag, StopTag) -> {ok, String} | error +include(File, "", "") -> + case file:open(File, [read]) of + {ok, Fd} -> + String = include_all(Fd), + file:close(Fd), + {ok, String}; + _ -> + docb_util:message(error, + "Include file ~s not found", [File]), + error + end; +include(File, StartTag, StopTag) -> + case file:open(File, [read]) of + {ok, Fd} -> + String = extract(File, Fd, StartTag, StopTag, searching), + file:close(Fd), + {ok, lists:flatten(String)}; + _ -> + docb_util:message(error, + "Include file ~s not found", [File]), + error + end. + +include_all(Fd) -> + case io:get_line(Fd, '') of + eof -> + []; + ListOfChars -> + lists:append(ListOfChars, include_all(Fd)) + end. + +extract(File, Fd, StartTag, StopTag, State) -> + Line=io:get_line(Fd, ''), + extract(File, Fd, StartTag, StopTag, State, Line). + +extract(File, _, _, _, _, eof) -> + docb_util:message(error, + "Premature end of file in include file ~p", + [File]), + []; +extract(File, Fd, StartTag, StopTag, searching, Line) -> + case regexp:match(Line, "^" ++ StartTag) of + {match, _Start, _Length} -> + extract(File, Fd, StartTag, StopTag, copying); + nomatch -> + extract(File, Fd, StartTag, StopTag, searching); + {error, _Error} -> + docb_util:message(error, "Bad syntax in ~s", [File]), + [] + end; +extract(File, Fd, StartTag, StopTag, copying, Line) -> + case regexp:match(Line, "^" ++ StopTag) of + {match, _Start, _Length} -> + []; + nomatch -> + [Line|extract(File, Fd, StartTag, StopTag, copying)]; + {error, _Error} -> + docb_util:message(error, "Bad syntax in ~s", [File]), + [] + end. + +%%---------------------------------------------------------------------- + +eval_str(Str) -> + case lib:eval_str(Str) of + {error, Report} -> + docb_util:message(error, + "ErlEval failed: ~s (~s)", [Str, Report]); + {ok, S} -> + io_lib:format("~p~n", [S]) + end. diff --git a/lib/docbuilder/src/docb_pretty_format.erl b/lib/docbuilder/src/docb_pretty_format.erl new file mode 100644 index 0000000000..0c4fb0507b --- /dev/null +++ b/lib/docbuilder/src/docb_pretty_format.erl @@ -0,0 +1,177 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_pretty_format). + +-export([term/1]). + +%% pretty_format:term(Term) -> PNF list of characters +%% +%% Note: this is usually used in expressions like: +%% io:format('~s\n', [pretty_format:term(Term)]). +%% +%% Uses the following simple heuristics: +%% +%% 1) Simple tuples are printed across the page. +%% (Simple means *all* the elements are "flat") +%% 2) The complex tuple {Arg1, Arg2, Arg3,....} is printed thus: +%% {Arg1, +%% Arg2, +%% Arg3, +%% ...} +%% 3) Lists are treated as for tuples. +%% 4) Lists of printable characters are treated as strings. +%% +%% This method seems to work reasonable well for {Tag, ...} type +%% data structures. +term(Term) -> + element(2, term(Term, 0)). + +%% pretty_format:term(Term, Indent} -> {Indent', Chars} +%% Format <Term> -- use <Indent> to indent the *next* line. +%% Note: Indent' is a new indentaion level (sometimes printing <Term> +%% the next line to need an "extra" indent!). +term([], Indent) -> + {Indent, [$[,$]]}; +term(L, Indent) when list(L) -> + case is_string(L) of + true -> + {Indent, io_lib:write_string(L)}; + false -> + case complex_list(L) of + true -> + write_complex_list(L, Indent); + false -> + write_simple_list(L, Indent) + end + end; +term(T, Indent) when tuple(T) -> + case complex_tuple(T) of + true -> + write_complex_tuple(T, Indent); + false -> + write_simple_tuple(T, Indent) + end; +term(A, Indent) -> + {Indent, io_lib:write(A)}. + +%% write_simple_list([H|T], Indent) -> {Indent', Chars} +write_simple_list([H|T], Indent) -> + {_, S1} = term(H, Indent), + {_, S2} = write_simple_list_tail(T, Indent), + {Indent, [$[,S1|S2]}. + +write_simple_list_tail([H|T], Indent) -> + {_, S1} = term(H, Indent), + {_, S2} = write_simple_list_tail(T, Indent), + {Indent, [$,,S1| S2]}; +write_simple_list_tail([], Indent) -> + {Indent, "]"}; +write_simple_list_tail(Other, Indent) -> + {_, S} = term(Other, Indent), + {Indent, [$|,S,$]]}. + +%% write_complex_list([H|T], Indent) -> {Indent', Chars} +write_complex_list([H|T], Indent) -> + {I1, S1} = term(H, Indent+1), + {_, S2} = write_complex_list_tail(T, I1), + {Indent, [$[,S1|S2]}. + +write_complex_list_tail([H|T], Indent) -> + {I1, S1} = term(H, Indent), + {_, S2} = write_complex_list_tail(T, I1), + {Indent, [$,,nl_indent(Indent),S1,S2]}; +write_complex_list_tail([], Indent) -> + {Indent, "]"}; +write_complex_list_tail(Other, Indent) -> + {_, S} = term(Other, Indent), + {Indent, [$|,S,$]]}. + +%% complex_list(List) -> true | false +%% Returns true if the list is complex otherwise false. +complex_list([]) -> + false; +complex_list([H|T]) when is_list(H) -> + case is_string(H) of + true -> + complex_list(T); + false -> + true + end; +complex_list([H|_]) when is_tuple(H) -> true; +complex_list(_) -> false. + +%% complex_tuple(Tuple) -> true | false +%% Returns true if the tuple is complex otherwise false. +complex_tuple(T) -> + complex_list(tuple_to_list(T)). + +%% write_simple_tuple(Tuple, Indent} -> {Indent', Chars} +write_simple_tuple({}, Indent) -> + {Indent, "{}"}; +write_simple_tuple(Tuple, Indent) -> + {_, S} = write_simple_tuple_args(tuple_to_list(Tuple), Indent), + {Indent, [${, S, $}]}. + +write_simple_tuple_args([X], Indent) -> + term(X, Indent); +write_simple_tuple_args([H|T], Indent) -> + {_, SH} = term(H, Indent), + {_, ST} = write_simple_tuple_args(T, Indent), + {Indent, [SH, $,, ST]}. + +%% write_complex_tuple(Tuple, Indent} -> {Indent', Chars} +write_complex_tuple(Tuple, Indent) -> + [H|T] = tuple_to_list(Tuple), + {I1, SH} = term(H, Indent+2), + {_, ST} = write_complex_tuple_args(T, I1), + {Indent, [${, SH, ST, $}]}. + +write_complex_tuple_args([X], Indent) -> + {_, S} = term(X, Indent), + {Indent, [$,, nl_indent(Indent), S]}; +write_complex_tuple_args([H|T], Indent) -> + {I1, SH} = term(H, Indent), + {_, ST} = write_complex_tuple_args(T, I1), + {Indent, [$,, nl_indent(Indent) , SH, ST]}; +write_complex_tuple_args([], Indent) -> + {Indent, []}. + +%% utilities + +nl_indent(I) when I >= 0 -> + ["\n"|indent(I)]; +nl_indent(_I) -> + [$ ]. + +indent(I) when I >= 8 -> + [$\t|indent(I-8)]; +indent(I) when I > 0 -> + [$ |indent(I-1)]; +indent(_) -> + []. + +is_string([9|T]) -> + is_string(T); +is_string([10|T]) -> + is_string(T); +is_string([H|T]) when H >31, H < 127 -> + is_string(T); +is_string([]) -> + true; +is_string(_) -> + false. diff --git a/lib/docbuilder/src/docb_tr_application2html.erl b/lib/docbuilder/src/docb_tr_application2html.erl new file mode 100644 index 0000000000..4084cfe6ba --- /dev/null +++ b/lib/docbuilder/src/docb_tr_application2html.erl @@ -0,0 +1,288 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_application2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(File, {application, _Attrs, [Header|Rest]}, Opts0) -> + + %% Extract header data + Title = docb_html_util:extract_header_data(title, Header), + + case docb_util:an_option(kwicindex_only, Opts0) of + false -> + + %% Create the framing HTML document + OutFile = docb_util:outfile(File++"_frame", ".html", Opts0), + case file:open(OutFile, [write]) of + {ok, Fd} -> + io:format(Fd, +"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" +\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"> +<!-- This document was generated using DocBuilder-" ++ docb_util:version() ++ " --> +<html> +<head> + <title>~s</title> + " ++ docb_util:html_snippet(head, Opts0) ++ " +</head> +<frameset cols=\"150, *\"> + <frame src=\"~s\" name=\"toc\"> + <frame src=\"~s\" name=\"document\"> + <noframes> + <body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" + vlink=\"#FF00FF\" alink=\"#FF0000\"> + <p>This documentation requires a browser that can handle frames</p> + </body> + </noframes> +</frameset> +</html> +", + [Title, + File++".html", File++"_first.html"]), + file:close(Fd) + end, + + %% Create the front HTML document + docb_main:transform(first, html, Opts0, File ++ "_first", + {first, [], [Header|Rest]}); + + true -> + ok + end, + + %% Extract files to include + Files = case Rest of + [{description, _, _}|NewRest] -> + lists:map(fun({include, [{_, _, F}], _}) ->filename:rootname(F) end, + NewRest); + [{include, _, _}|_NewRest] -> + lists:map(fun({include, [{_, _, F}], _}) -> filename:rootname(F) end, + Rest) + end, + + %% Concat all reference manuals into a *big* parse tree + ConcatTree = concat_files(Files, Opts0), + + %% Create the kwic index src file to be put in outdir + docb_main:transform(refs, kwic, Opts0, File, {refs,[],ConcatTree}), + + case docb_util:an_option(kwicindex_only, Opts0) of + false -> + + %% Create an index + docb_main:transform(index, html, Opts0, File ++ "_index", + {index, [], [Header|ConcatTree]}), + %% Create a cite dictionary + docb_main:transform(cite, html, Opts0, File ++ "_cite", + {cite, [], [Header|ConcatTree]}), + + %% Create a term dictionary + docb_main:transform(term, html, Opts0, File ++ "_term", + {term, [], [Header|ConcatTree]}), + + %% Transform each reference page + case docb_util:an_option(framework_only, Opts0) of + true -> + ok; + false -> + transform_refs(Files, + [dict,{part_application,File}|Opts0]) + end; + true -> + ok + end, + + %% Find all fascicules to be put in the top menu of the table of + %% contents + Ext = docb_util:lookup_option(src_type, Opts0), + Opts2 = + case filelib:is_regular("fascicules"++Ext) of + true -> + case docb_main:parse1("fascicules", Opts0) of + {ok, Parse} -> + FascData = get_fasc_data(Parse), + case lists:keysearch(File, 1, FascData) of + {value, {_, _, "YES", _}} -> + OrigFile = + docb_util:outfile(File++"_frame", + ".html", Opts0), + EntryFile = + docb_util:outfile("index", + ".html",Opts0), + docb_util:message(info, + "Copying ~s to ~s", + [OrigFile,EntryFile]), + file:copy(OrigFile, EntryFile); + _ -> + ok + end, + [{fascdata, FascData}| Opts0]; + errors -> + %% Do not bother + docb_util:message( + warning, + "fascicules~s could not be parsed," + " no index.html created", + [Ext]), + Opts0 + end; + false -> + %% do not bother + docb_util:message(warning, + "fascicules~s not found, " + "no index.html created", + [Ext]), + Opts0 + end, + + %% Create ToC parse tree + {{toc, [{"FILE", "CDATA", File}], [Header|make_toc(ConcatTree)]}, + Opts2}. + +concat_files(Files, Opts) -> + concat_files(Files, [], Opts). + +concat_files([File|Rest], Body, Opts) -> + case docb_main:parse1(File, Opts) of + {ok, Parse} -> + NewParse=expand([Parse], File), + %% Remove the reference manual header + [{Ref, [], [_Hdr| NewBody]}] = NewParse, + RefParse = [{Ref, [], NewBody}], + lists:append(Body, concat_files(Rest, RefParse, Opts)); + errors -> + errors + end; +concat_files([], Body, _Opts) -> + Body. + +expand([], _) -> + []; +expand([{pcdata, Attrs, More}|Rest], File) -> + [{pcdata, Attrs, More}|expand(Rest, File)]; +expand([{name, Attrs, More}|Rest], File) -> + [{name, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest, File)]; +expand([{module, Attrs, More}|Rest], File) -> + [{module, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest,File)]; +expand([{file, Attrs, More}|Rest], File) -> + [{file, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest, File)]; +expand([{app, Attrs, More}|Rest], File) -> + [{app, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest, File)]; +expand([{lib, Attrs, More}|Rest], File) -> + [{lib, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest, File)]; +expand([{com, Attrs, More}|Rest], File) -> + [{com, [{"FILE", "CDATA", File}|Attrs], More}|expand(Rest, File)]; +expand([{Tag, Attrs, More}|Rest], File) -> + [{Tag, Attrs, expand(More, File)}|expand(Rest, File)]. + +transform_refs([], _) -> + ok; +transform_refs([File|Rest], Opts) -> + Ext = docb_util:lookup_option(src_type, Opts), + docb_util:message(info, "Processing \"~s~s\"", [File, Ext]), + docb_main:process(File, Opts), + transform_refs(Rest, Opts). + +make_toc([]) -> + []; +make_toc([{pcdata, _Attrs, _More}|Rest]) -> + make_toc(Rest); +make_toc([{module, Attrs, More}|Rest]) -> + [{module, Attrs, More}|make_toc(Rest)]; +make_toc([{file, Attrs, More}|Rest]) -> + [{file, Attrs, More}|make_toc(Rest)]; +make_toc([{app, Attrs, More}|Rest]) -> + [{app, Attrs, More}|make_toc(Rest)]; +make_toc([{lib, Attrs, More}|Rest]) -> + [{lib, Attrs, More}|make_toc(Rest)]; +make_toc([{com, Attrs, More}|Rest]) -> + [{com, Attrs, More}|make_toc(Rest)]; +make_toc([{_Tag, _Attrs, More}|Rest]) -> + lists:append(make_toc(More), make_toc(Rest)). + +rule([module|_], {_, [File], _}) -> + {"<small><a target=\"document\" href=\"" ++ + docb_html_util:make_anchor_href(File) ++ "\">", + "</a></small><br/>\n"}; + +rule([file|_], {_, [File], _}) -> + {"<small><a target=\"document\" href=\"" ++ + docb_html_util:make_anchor_href(File) ++ "\">", + "</a></small><br/>\n"}; + +rule([app|_], {_, [File], _}) -> + {"<small><a target=\"document\" href=\"" ++ + docb_html_util:make_anchor_href(File) ++ "\">", + "</a></small><br/>\n"}; + +rule([lib|_], {_, [File], _}) -> + {"<small><a target=\"document\" href=\"" ++ + docb_html_util:make_anchor_href(File) ++ "\">", + "</a></small><br/>\n"}; + +rule([com|_], {_, [File], _}) -> + {"<small><a target=\"document\" href=\"" ++ + docb_html_util:make_anchor_href(File) ++ "\">", + "</a></small><br/>\n"}; + +rule([pcdata|_], {_, _, Data}) -> + {drop, docb_html_util:pcdata_to_html(Data)}; + +rule(_, _) -> + {drop, ""}. + +rule([toc|_], {_Depth, [File], [Header|_]}, Opts) -> + case docb_util:lookup_option(fascdata, Opts) of + false -> + {{docb_html_layout:application_toc_top( + docb_html_util:all_header_data(Header), + File, Opts), + docb_html_layout:part_toc_bot()}, Opts}; + FascData -> + HRefTexts = + lists:map( + fun({_File, HRef, _Entry, PCText}) -> + {HRef, docb_html_util:pcdata_to_html(PCText)} + end, + FascData), + {{docb_html_layout:application_toc_top( + docb_html_util:all_header_data(Header), + File, Opts, HRefTexts) ++ "\n", + docb_html_layout:part_toc_bot()}, Opts} + end. + +%% Returns: [{File, HRef, Entry, Text}]. +get_fasc_data({fascicules, _, Fascs}) -> + lists:map( + fun({fascicule, Atts, Trees}) -> + AVals = get_avals(Atts), + PCText = get_pc_text(Trees), + list_to_tuple(lists:append([AVals, [PCText]])) + end, + Fascs). + +get_avals(Atts) -> + lists:map(fun(Tuple) -> + element(3, Tuple) end, + Atts). + +get_pc_text([{pcdata, _, Text}]) -> + Text. diff --git a/lib/docbuilder/src/docb_tr_appref2html.erl b/lib/docbuilder/src/docb_tr_appref2html.erl new file mode 100644 index 0000000000..6b4cc0f815 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_appref2html.erl @@ -0,0 +1,48 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_appref2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +%% Transform the parse tree. Header data is stored in an extra +%% argument to make life easier later on. +transform(_File, {appref,_,[Header|Rest]}, _Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + {appref, Data, [{header,[],[]}|Rest]}. + +rule([header|_],_) -> + {drop, ""}; + +rule([app|_],_) -> + {"\n<h3>APPLICATION</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([appsummary|_],_) -> + {"\n<h3>APPLICATION SUMMARY</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule(TagHistory, TagBody) -> + docb_html_ref:rule(TagHistory,TagBody). + +rule([appref|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:ref_top(Data, Opts), + docb_html_layout:ref_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html_ref:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_chapter2html.erl b/lib/docbuilder/src/docb_tr_chapter2html.erl new file mode 100644 index 0000000000..185cdc7cc3 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_chapter2html.erl @@ -0,0 +1,59 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_chapter2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(File, {chapter,_,[Header|Rest]}, Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + Tree = {chapter, Data, [{header,[],[]}|Rest]}, + ChapterLevel = + case docb_util:lookup_option(number, Opts) of + false -> none; + Value -> Value + end, + docb_html_util:number(Tree, ChapterLevel, File). + +rule([header|_], _) -> + {drop, ""}; + +rule([toc|_], {_,_,ToC}) -> + {drop, + "\n<h3>Table of Contents</h3>\n" ++ + docb_html_util:format_toc(ToC) ++ "\n"}; + +rule([section|_], _) -> + {"", ""}; + +rule([title|Rest], {_,[Number,_File], [{pcdata,_,Title}]}) -> + N = integer_to_list(docb_html_util:count_sections(Rest)+1), + {drop,"\n<h" ++ N ++ ">" ++ Number ++ " " ++ + docb_html_util:pcdata_to_html(Title) ++ "</h" ++ N ++ ">\n"}; + +rule(TagHistory, TagBody) -> + docb_html:rule(TagHistory, TagBody). + +rule([chapter|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:chapter_top(Data, Opts), + docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_cite2html.erl b/lib/docbuilder/src/docb_tr_cite2html.erl new file mode 100644 index 0000000000..4ecbfa4e91 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_cite2html.erl @@ -0,0 +1,136 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_cite2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, Tree, Opts) -> + purge(Tree, Opts). + +purge({Tag, Attrs, [Header|Body]}, Opts) -> + CiteList = case docb_util:lookup_option({defs,cite}, Opts) of + false -> []; + Value -> Value + end, + B1 = purge_body(Body, CiteList), + B2 = lists:ukeysort(2, B1), + {Tag, Attrs, [Header|B2]}. + +purge_body([], _) -> + []; +purge_body([{pcdata,_Attrs,_More}|Rest], CiteList) -> + purge_body(Rest, CiteList); +purge_body([{cite,[{"ID","CDATA",ID}],More}|Rest], CiteList) -> + case lists:keysearch(ID, 1, CiteList) of + false -> + [{cite, [{"NAME","CDATA",ID}, {"ID","CDATA",ID}], More}| + purge_body(Rest, CiteList)]; + {value, {ID, Name, _Description, _Responsible}} -> + [{cite, [{"NAME","CDATA",Name}, {"ID","CDATA",ID}], More}| + purge_body(Rest, CiteList)]; + {value, {ID, Name, _Description}} -> + [{cite, [{"NAME","CDATA",Name}, {"ID","CDATA",ID}], More}| + purge_body(Rest, CiteList)] + end; +purge_body([{_Tag,_Attrs,More}|Rest], CiteList) -> + lists:append(purge_body(More, CiteList), + purge_body(Rest, CiteList)). + +rule([header|_], _) -> + {drop, ""}; + +rule(_, _) -> + {drop, ""}. + +rule([cite|_], {_,[],[Header]}, Opts) -> + HeaderData = docb_html_util:all_header_data(Header), + {{docb_html_layout:chapter_top(HeaderData, Opts) ++ + "\n<center><h1>Bibliography</h1></center>\n", + docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([cite|_], {_,[],[Header|_]}, Opts) -> + HeaderData = docb_html_util:all_header_data(Header), + {{docb_html_layout:chapter_top(HeaderData, Opts) ++ + "\n<center><h1>Bibliography</h1></center>\n<dl>\n", + "\n</dl>\n" ++ docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([cite|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:chapter_top(Data, Opts) ++ + "\n<center><h1>Bibliography</h1></center>\n<dl>\n", + "\n</dl>\n" ++ docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([cite|T], {A, B, [{citedef,C, + [{ctitle, [], [{pcdata,[],CTitle}]}, + {cauthor, [], [{pcdata,[],CAuthor}]}, + {chowpublished, [], + [{pcdata,[],Chowpublished}]}]}]}, Opts) -> + CiteDef = CTitle ++ " " ++ CAuthor ++ " " ++ Chowpublished, + rule([cite|T], {A,B,[{citedef,C,[{pcdata,[],CiteDef}]}]}, Opts); + +rule([cite|_], {_,[Name,ID], [{citedef,[],[{pcdata,[],Def}]}]}, Opts) -> + CiteList = + case docb_util:lookup_option({defs,cite}, Opts) of + false -> []; + Value -> Value + end, + case lists:keysearch(ID, 1, CiteList) of + false -> + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Def) ++ "\n</dd>\n"}, Opts}; + {value, {ID, Name, Description, _Responsible}} -> + docb_util:message(warning, + "Global cite ~s overriding local", [ID]), + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, + Opts}; + {value, {ID, Name, Description}} -> + docb_util:message(warning, + "Global cite ~s overriding local", [ID]), + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} + end; + +rule([cite|_], {_,[Name,ID],_}, Opts) -> + CiteList = + case docb_util:lookup_option({defs,cite}, Opts) of + false -> []; + Value -> Value + end, + case lists:keysearch(ID, 1, CiteList) of + false -> + docb_util:message(error, + "The cite ~s has no definition", [ID]), + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ + "??" ++ "\n</dd>\n"}, Opts}; + {value, {ID, Name, Description, _Responsible}} -> + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, + Opts}; + {value, {ID, Name, Description}} -> + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} + end. diff --git a/lib/docbuilder/src/docb_tr_comref2html.erl b/lib/docbuilder/src/docb_tr_comref2html.erl new file mode 100644 index 0000000000..25207dccb4 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_comref2html.erl @@ -0,0 +1,46 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_comref2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, {comref,_,[Header|Rest]}, _Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + {comref, Data, [{header,[],[]}|Rest]}. + +rule([header|_],_) -> + {drop,""}; + +rule([com|_],_) -> + {"\n<h3>COMMAND</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([comsummary|_],_) -> + {"\n<h3>COMMAND SUMMARY</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule(TagHistory, TagBody) -> + docb_html_ref:rule(TagHistory, TagBody). + +rule([comref|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:ref_top(Data, Opts), + docb_html_layout:ref_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html_ref:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_cref2html.erl b/lib/docbuilder/src/docb_tr_cref2html.erl new file mode 100644 index 0000000000..06748b8c57 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_cref2html.erl @@ -0,0 +1,61 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_cref2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, {cref,_,[Header|Rest]}, _Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + {cref, Data, [{header,[],[]}|Rest]}. + +rule([header|_],_) -> + {drop, ""}; + +rule([ret|_],_) -> + {"",""}; + +rule([nametext|_],_) -> + {" ",""}; + +rule([name|_], {_,_,[_Ret,{nametext,[],[{pcdata,[],Name}]}]}) -> + FName = lists:flatten(docb_html_util:pcdata_to_html(Name)), + TName = docb_util:trim(FName), + CAnchor = docb_util:fknidx(TName, "/"), + {"<A NAME=\"" ++ CAnchor ++ "\"><STRONG><CODE>", + "</CODE></STRONG></A><BR>\n"}; +rule([name|T], {I,As,[Ret,{pcdata,[],Name}]}) -> % For SGML DTD + rule([name|T], {I,As,[Ret,{nametext,[],[{pcdata,[],Name}]}]}); + +rule([lib|_],_) -> + {"\n<H3>C LIBRARY</H3>\n<DIV CLASS=REFBODY>\n","\n</DIV>\n"}; + +rule([libsummary|_],_) -> + {"\n<H3>C LIBRARY SUMMARY</H3>\n<DIV CLASS=REFBODY>\n","\n</DIV>\n"}; + +rule(TagHistory, TagBody) -> + docb_html_ref:rule(TagHistory, TagBody). + +rule([cref|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:ref_top(Data, Opts), + docb_html_layout:ref_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html_ref:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_erlref2html.erl b/lib/docbuilder/src/docb_tr_erlref2html.erl new file mode 100644 index 0000000000..b264c46bce --- /dev/null +++ b/lib/docbuilder/src/docb_tr_erlref2html.erl @@ -0,0 +1,46 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_erlref2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, {erlref,_,[Header|Rest]}, _Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + {erlref, Data, [{header,[],[]}|Rest]}. + +rule([header|_],_) -> + {drop, ""}; + +rule([module|_],_) -> + {"\n<h3>MODULE</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([modulesummary|_],_) -> + {"\n<h3>MODULE SUMMARY</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule(TagHistory, TagBody) -> + docb_html_ref:rule(TagHistory, TagBody). + +rule([erlref|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:ref_top(Data, Opts), + docb_html_layout:ref_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html_ref:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_fileref2html.erl b/lib/docbuilder/src/docb_tr_fileref2html.erl new file mode 100644 index 0000000000..60280543a8 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_fileref2html.erl @@ -0,0 +1,46 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_fileref2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, {fileref,_,[Header|Rest]}, _Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + {fileref, Data, [{header,[],[]}|Rest]}. + +rule([header|_],_) -> + {drop, ""}; + +rule([file|_],_) -> + {"\n<h3>FILE</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule([filesummary|_],_) -> + {"\n<h3>FILE SUMMARY</h3>\n<div class=\"REFBODY\">\n","\n</div>\n"}; + +rule(TagHistory, TagBody) -> + docb_html_ref:rule(TagHistory, TagBody). + +rule([fileref|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:ref_top(Data, Opts), + docb_html_layout:ref_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html_ref:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_first2html.erl b/lib/docbuilder/src/docb_tr_first2html.erl new file mode 100644 index 0000000000..e9ecbe73cb --- /dev/null +++ b/lib/docbuilder/src/docb_tr_first2html.erl @@ -0,0 +1,46 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_first2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, Tree, _Opts) -> + Tree. + +rule([header|_], _) -> + {drop, ""}; + +rule([description|_], _) -> + {"", ""}; + +rule([include|_], _) -> + {drop, ""}; + +rule(TagHistory, TagBody) -> + docb_html:rule(TagHistory, TagBody). + +rule([first|_], {_,[],[Header|_]}, Opts) -> + HeaderData = docb_html_util:all_header_data(Header), + {{docb_html_layout:first_top(HeaderData, Opts), + docb_html_layout:first_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_index2html.erl b/lib/docbuilder/src/docb_tr_index2html.erl new file mode 100644 index 0000000000..bbf419f3ef --- /dev/null +++ b/lib/docbuilder/src/docb_tr_index2html.erl @@ -0,0 +1,197 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_index2html). + +-export([extension/0, transform/3, rule/2]). + +extension() -> + ".html". + +transform(_File0, {index, Attrs, [Header| Trees0]}, _Opts) -> + Trees1 = prune_flat(Trees0, false), + %% + %% Now each element of Trees1 is a tree with tag `name' and + %% attribute `File', and with one `pcdata' subtree containing the + %% name `Func' of the function. We extract `File' and `Func', and + %% create new trees. + %% + %% `File' is attribute CDATA (from an <include file=...>), and + %% `Func' is PCDATA. + %% + FileFuncs = + [{File, RefType, Func} || + {name, [{_, _, File}, {_, _, RefType}|_], + [{pcdata, [], Func}]} + <- Trees1], + Trees2 = new_trees(FileFuncs), + {index, Attrs, [Header| Trees2]}. + +%% Remove all elements except those with tag equal to `name'. +%% Within `name' remove all elements except those equal to `pcdata'. +%% Add attribute `filetype' to `name'. +%% +%% Refs: appref, comref, cref, erlref, fileref +prune_flat([{appref, _Attrs, More}| Rest], _) -> + RefType = appref, + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([{comref, _Attrs, More}| Rest], _) -> + RefType = comref, + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([{cref, _Attrs, More}| Rest], _) -> + RefType = cref, + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([{erlref, _Attrs, More}| Rest], _) -> + RefType = erlref, + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([{fileref, _Attrs, More}| Rest], _) -> + RefType = fileref, + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([{name, [Attr0|Attrs0], More}| Rest], RefType) -> + Attrs = [Attr0, {"FILETYPE", "CDATA", RefType} | + Attrs0], + [{name, Attrs, keep_pcdata(More)}| prune_flat(Rest, RefType)]; +prune_flat([{pcdata, _, _}| Rest], RefType) -> % special case + prune_flat(Rest, RefType); +prune_flat([{_Tag, _Attrs, More}| Rest], RefType) -> + lists:append(prune_flat(More, RefType), prune_flat(Rest, RefType)); +prune_flat([], _) -> + []. + +keep_pcdata(Trees) -> + lists:filter(fun({pcdata, _, _}) -> true; + (_) -> false + end, Trees). + +new_trees(FileFuncs) -> + Files0 = [{File, RefType} || {File, RefType, _} <- FileFuncs], + Files1 = lists:usort(Files0), + FileEntries = [{reffile, File, RefType, + [Fu || {Fi, _, Fu} <- FileFuncs, Fi == File]} + || {File, RefType} <- Files1], + FuncEntries = [{func, Func, RefType, [File]} + || {File, RefType, Func} <- FileFuncs], + Entries = FileEntries ++ FuncEntries, + SortedEntries = sort_entries(Entries), + %% + %% We create a tree according to the following "dtd": + %% + %% element index (reffile | funcdef)* + %% element reffile (funcdef2)* + %% attribute reffile filename CDATA + %% attribute reffile filetype CDATA + %% element funcdef2 PCDATA + %% attribute funcdef2 filename CDATA + %% attribute funcdef2 filetype CDATA + %% element funcdef PCDATA + %% attribute funcdef filename CDATA + %% attribute funcdef filetype CDATA + %% + %% For example: + %% <index> + %% <reffile filename="mymod" filetype="erlref"> + %% <funcdef2 filename="mymod" filetype="erlref">myfunca(A)</> + %% <funcdef2 filename="mymod" filetype="erlref">myfuncb(A, B)</> + %% </> + %% <funcdef filename="mymod" filetype="erlref">myfunca(A)</> + %% <funcdef filename="mymod" filetype="erlref">myfuncb(A, B)</> + %% </> + lists:flatmap( + fun({reffile, File, RefType, Funcs}) -> + %% A reffile tree + [{reffile, [{"FILENAME", "CDATA", File}, + {"FILETYPE", "CDATA", RefType}], + [{funcdef2, [{"FILENAME", "CDATA", File}, + {"FILETYPE", "CDATA", RefType}], + [{pcdata, [], Func}]} || Func <- Funcs]}]; + ({func, Func, RefType, [File]}) -> + %% A func tree + [{funcdef, [{"FILENAME", "CDATA", File}, + {"FILETYPE", "CDATA", RefType}], + [{pcdata, [], Func}]}] + end, SortedEntries). + +%% Sorting of entries +%% +%% The sorting is based on how names of files and functions are +%% presented (in a browser). +%% Requires conversion to "function/2" etc. +%% +sort_entries(Entries) -> + ExpEntries = + lists:map( + fun({reffile, File, RefType, Funcs}) -> + HFile = filename_sort_order(File), + HFuncs = [{funcdef_sort_order(Fu, RefType), Fu} || Fu <- Funcs], + {reffile, HFile, File, RefType, lists:sort(HFuncs)}; + ({func, Func, RefType, [File]}) -> + HFunc = funcdef_sort_order(Func, RefType), + HFile = filename_sort_order(File), + {func, HFunc, Func, RefType, [{HFile, File}]} + end, Entries), + SortedExpEntries = lists:keysort(2, ExpEntries), + lists:map( + fun({Tag, _HName, Name, RefType, Vals}) -> + NVals = lists:map(fun({_HVal, Val}) -> Val end, Vals), + {Tag, Name, RefType, NVals} + end, SortedExpEntries). + +rule([index| _], _) -> + {docb_html_layout:index_top("") ++ + "<dl>\n", + "</dl>\n" ++ docb_html_layout:index_bot()}; + +rule([header| _], _) -> + {drop, ""}; + +rule([reffile| _], {_, [File, _RefType|_], _}) -> + CFile = docb_html_util:attribute_cdata_to_html(File), + {"<dt><em>" ++ CFile ++ "</em></dt>\n", ""}; + +rule([funcdef2| _], {_, [File, RefType|_], [{pcdata, [], FuncDef}]}) -> + FFuncDef = lists:flatten(docb_html_util:pcdata_to_html(FuncDef)), + TFuncDef = docb_util:trim(FFuncDef), + ShortFuncDef = docb_html_util:make_funcdef_short(TFuncDef, RefType), + HRef = + docb_html_util:make_anchor_href_short(File, TFuncDef, RefType), + {drop, + "<dd><a href=\"" ++ HRef ++ "\"><code>" ++ + ShortFuncDef ++ "</code></a></dd>\n"}; + +rule([funcdef| _], {_, [File, RefType|_], [{pcdata, [], FuncDef}]}) -> + FFuncDef = lists:flatten(docb_html_util:pcdata_to_html(FuncDef)), + TFuncDef = docb_util:trim(FFuncDef), + ShortFuncDef = docb_html_util:make_funcdef_short(TFuncDef, RefType), + HRef = + docb_html_util:make_anchor_href_short(File, TFuncDef, RefType), + CFile = docb_html_util:attribute_cdata_to_html(File), + {drop, + "<dt><code>" ++ ShortFuncDef ++ "</code></dt>\n" + "<dd><a href=\"" ++ HRef ++ "\"><em>" ++ + CFile ++ "</em></a></dd>\n"}; + +rule(_, _) -> + {drop, ""}. + +filename_sort_order(File) -> + docb_html_util:html_latin1_sort_order( + lists:flatten( + docb_html_util:attribute_cdata_to_html(string:strip(File)))). + +funcdef_sort_order(FuncDef, RefType) -> + docb_html_util:html_latin1_sort_order( + docb_html_util:make_anchor_name_short(FuncDef, RefType)). diff --git a/lib/docbuilder/src/docb_tr_part2html.erl b/lib/docbuilder/src/docb_tr_part2html.erl new file mode 100644 index 0000000000..dd44c4a8df --- /dev/null +++ b/lib/docbuilder/src/docb_tr_part2html.erl @@ -0,0 +1,240 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_part2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(File, {part, _Attrs, [Header| Rest]}, Opts0) -> + + %% Extract header data + Title = docb_html_util:extract_header_data(title, Header), + + %% Create the framing HTML document + OutFile = docb_util:outfile(File ++ "_frame", ".html", Opts0), + case file:open(OutFile, [write]) of + {ok, Frame} -> + io:format(Frame, +"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"> +<!-- This document was generated using DocBuilder-" ++ docb_util:version() ++ " --> +<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> +<head> + <title>~s</title> + " ++ docb_util:html_snippet(head, Opts0) ++ " +</head> +<frameset cols=\"200, *\"> + <frame src=\"~s\" name=\"toc\"/> + <frame src=\"~s\" name=\"document\"/> + <noframes> + <body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" + vlink=\"#FF00FF\" alink=\"#FF0000\"> + <p>This documentation requires a browser that can handle frames</p> + </body> + </noframes> +</frameset> +</html> +", + [Title, File ++ ".html", File ++ "_first.html"]), + file:close(Frame) + end, + + %% Create the front HTML document + docb_main:transform(first, html, Opts0, File ++ "_first", + {first, [], [Header| Rest]}), + + %% Extract files to include + Files = + case Rest of + [{description, _, _}| NewRest] -> + lists:map(fun({include, [{_, _, F}], _}) -> filename:rootname(F) end, + NewRest); + [{include, _, _}| _NewRest] -> + lists:map(fun({include, [{_, _, F}], _}) -> filename:rootname(F) end, Rest) + end, + + %% Concat all chapters into a *big* parse tree + %% Also transform them to HTML + TransformP = not docb_util:an_option(framework_only, Opts0), + TOpts = [dict, {part_application,File}], + ConcatTree = concat_files(Files, Opts0, TransformP, TOpts), + + %% Create a cites dictionary + docb_main:transform(cite, html, Opts0, File ++ "_cite", + {cite, [], [Header| ConcatTree]}), + + %% Create a terms dictionary + docb_main:transform(term, html, Opts0, File ++ "_term", + {term, [], [Header| ConcatTree]}), + + %% Find all fascicules to be put in the top menu of the table of + %% contents + Ext = docb_util:lookup_option(src_type, Opts0), + Opts2 = + case filelib:is_regular("fascicules"++Ext) of + true -> + case docb_main:parse1("fascicules", Opts0) of + {ok, Parse} -> + FascData = get_fasc_data(Parse), + case lists:keysearch(File, 1, FascData) of + {value, {_, _, "YES", _}} -> + OrigFile = + docb_util:outfile(File++"_frame", + ".html", Opts0), + EntryFile = + docb_util:outfile("index", + ".html", Opts0), + docb_util:message(info, + "Copying ~s to ~s", + [OrigFile,EntryFile]), + file:copy(OrigFile, EntryFile); + _ -> + ok + end, + [{fascdata, FascData}| Opts0]; + errors -> + %% do not bother + docb_util:message( + warning, + "fascicules~s could not be parsed," + " no index.html created~n", [Ext]), + Opts0 + end; + _ -> + %% do not bother + docb_util:message(warning, + "fascicules~s not found, " + "no index.html created~n", + [Ext]), + Opts0 + end, + + %% Create ToC parse tree + {{toc, [{"FILE", "CDATA", File}], [Header| ConcatTree]}, Opts2}. + +concat_files(Files, Opts, TransformP, TOpts) -> + Ext = docb_util:lookup_option(src_type, Opts), + concat_files(Files, [], 1, Opts, TransformP, TOpts, Ext). + +concat_files([File | Rest], Body, ChLevel, Opts, TP, TOpts, Ext) -> + case docb_main:parse1(File, Opts) of + {ok, Parse} -> + {TopTag, Attrs, [Header = {header, _, HeaderContents} | More]} = Parse, + {value,{title,_,Title}} = lists:keysearch(title,1,HeaderContents), + NewMore = [{section, [], [{title, [], Title}| More]}], + NewParse = {TopTag, Attrs, [Header| NewMore]}, + if + TP -> + docb_util:message(info, + "Processing \"~s~s\"", + [File, Ext]), + Opts2 = + [html, {number,integer_to_list(ChLevel)}] ++ + TOpts ++ Opts, + docb_main:transform(TopTag, html, Opts2, File, + NewParse); + true -> ignore + end, + NumberTree = + docb_html_util:number(NewParse, + integer_to_list(ChLevel), File), + {_, [], [_| NewBody]} = NumberTree, + lists:append(Body, + concat_files(Rest, NewBody, ChLevel+1, Opts, + TP, TOpts, Ext)); + errors -> + throw({error,"Parse error when building chapter "++File}) + end; +concat_files([], Body, _ChLevel, _Opts, _TP, _TOpts, _Ext) -> + Body. + +rule([section| _], _) -> + {"", ""}; + +rule(_, _) -> + {drop, ""}. + +rule([toc| _], {_Depth, [File], [Header| _]}, Opts) -> + case docb_util:lookup_option(fascdata, Opts) of + false -> + {{docb_html_layout:part_toc_top( + docb_html_util:all_header_data(Header), File, Opts), + docb_html_layout:part_toc_bot()}, Opts}; + FascData -> + HRefTexts = + lists:map( + fun({_File, HRef, _Entry, PCText}) -> + {HRef, docb_html_util:pcdata_to_html(PCText)} + end, + FascData), + {{docb_html_layout:part_toc_top( + docb_html_util:all_header_data(Header), + File, Opts, HRefTexts), + docb_html_layout:part_toc_bot()}, Opts} + end; + +rule([title| Rest], {_, [Number, File], [{pcdata, _, Title}]}, Opts) -> + N = docb_html_util:count_sections(Rest), + OutFile = docb_html_util:make_anchor_href(File), + if + N == 1 -> + {{drop, + "<hr/>\n<small>" ++ + Number ++ + " <a target=\"document\" href=\"" ++ OutFile ++ "#" ++ + Number ++ "\">" ++ + docb_html_util:pcdata_to_html(Title) ++ + "</a></small><br/>\n"}, + Opts}; + N < 3 -> + {{drop, + "<small>" ++ + Number ++ + " <a target=\"document\" href=\"" ++ OutFile ++ "#" ++ + Number ++ "\">" ++ + docb_html_util:pcdata_to_html(Title) ++ + "</a></small><br/>\n"}, + Opts}; + true -> + {{drop, ""}, Opts} + end. + +%% Parsed fascicules: +%% {fascicules,[], +%% [{fascicule, [{"FILE","CDATA","refman"}, +%% {"HREF","CDATA","refman_frame.html"}, +%% {"ENTRY","TOKEN","YES"}], +%% [{pcdata, [], "" Reference Manual\\n \n"}]}, +%% Returns: [{File, HRef, Entry, Text}]. +get_fasc_data({fascicules, _, Fascs}) -> + lists:map( + fun({fascicule, Atts, Trees}) -> + AVals = get_avals(Atts), + PCText = get_pc_text(Trees), + list_to_tuple(lists:append([AVals, [PCText]])) end, + Fascs). + +get_avals(Atts) -> + lists:map(fun(Tuple) -> + element(3, Tuple) end, + Atts). + +get_pc_text([{pcdata, _, Text}]) -> + Text. diff --git a/lib/docbuilder/src/docb_tr_refs2kwic.erl b/lib/docbuilder/src/docb_tr_refs2kwic.erl new file mode 100644 index 0000000000..dc60c329fc --- /dev/null +++ b/lib/docbuilder/src/docb_tr_refs2kwic.erl @@ -0,0 +1,156 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_refs2kwic). + +-export([extension/0, transform/3, rule/2]). + +%% Output parts of a parsetree that contains a series of reference +%% manual pages. The tags considered are: module, file, app, com and lib +%% (and their corresponding *summary tags), and name, fsummary, c, em, +%% ret and pcdata. + +extension() -> + ".kwc". + +transform(File, Tree, Opts) -> + {refs, [], Trees} = Tree, + FileTree = {srcfile, [], [{pcdata, [], File}]}, + AppName = docb_util:lookup_option(name, Opts, "unknown"), + AppTree = {appname, [], [{pcdata, [], AppName}]}, + Vsn = docb_util:lookup_option(vsn, Opts, "unknown"), + VsnTree = {appvsn, [], [{pcdata, [], Vsn}]}, + NewTree = {refs, [], [FileTree, AppTree, VsnTree| Trees]}, + {NewTree, Opts}. + +rule([refs|_],_) -> + {"%% Automatically generated. Do not edit.\n", ""}; + +rule([srcfile| _], _) -> + {"{srcfile, \"", "\"}.\n"}; + +rule([appname| _], _) -> + {"{appname, \"", "\"}.\n"}; + +rule([appvsn| _], _) -> + {"{appvsn, \"", "\"}.\n"}; + +rule([erlref|_ ], _) -> + {"", ""}; + +rule([fileref|_ ], _) -> + {"", ""}; + +rule([appref|_ ], _) -> + {"", ""}; + +rule([comref|_ ], _) -> + {"", ""}; + +rule([cref|_ ], _) -> + {"", ""}; + +rule([module| _], {_, [File], _}) -> + {drop, "{module, \"" ++ File ++ "\"}.\n"}; + +rule([file|_], {_, [File], _}) -> + {drop, "{file, \"" ++ File ++ "\"}.\n"}; + +rule([app|_], {_, [File], _}) -> + {drop, "{app, \"" ++ File ++ "\"}.\n"}; + +rule([com|_], {_, [File], _}) -> + {drop, "{com, \"" ++ File ++ "\"}.\n"}; + +rule([lib|_], {_, [File], _}) -> + {drop, "{lib, \"" ++ File ++ "\"}.\n"}; + +rule([modulesummary|_], _) -> + {"{modulesummary, \"", "\"}.\n"}; + +rule([filesummary|_], _) -> + {"{filesummary, \"", "\"}.\n"}; + +rule([appsummary|_], _) -> + {"{appsummary, \"", "\"}.\n"}; + +rule([comsummary|_], _) -> + {"{comsummary, \"", "\"}.\n"}; + +rule([libsummary|_], _) -> + {"{libsummary, \"", "\"}.\n"}; + +rule([funcs|_ ], _) -> + {"", ""}; + +rule([func|_ ], _) -> + {"", ""}; + +rule([name,func,funcs,cref|_], {_,[_File], [_Ret,{pcdata,[],Name}]}) -> + FName = lists:flatten(docb_html_util:pcdata_to_html(Name)), + TName = docb_util:trim(FName), + case catch docb_util:fknidx(TName, "/") of + {'EXIT',_} -> + {drop, ["{name, \"", escq(TName), "\"}.\n"]}; + FuncName -> + {drop, ["{name, \"", escq(FuncName), "\"}.\n"]} + end; + +rule([name,func,funcs,erlref|_], {_,[_File], [{pcdata,[],Name}]}) -> + FName = lists:flatten(docb_html_util:pcdata_to_html(Name)), + TName = docb_util:trim(FName), + case catch docb_util:fknidx(TName, "/") of + {'EXIT',_} -> + {drop, ["{name, \"", escq(TName), "\"}.\n"]}; + FuncName -> + {drop, ["{name, \"", escq(FuncName), "\"}.\n"]} + end; + +rule([name, func| _], {_, [_File], [{pcdata, [], Name}]}) -> + FName = lists:flatten(docb_html_util:pcdata_to_html(Name)), + TName = docb_util:trim(FName), + Cmd = case string:tokens(TName, " ") of + [Cmd0| _] -> + Cmd0; + _ -> + TName + end, + {drop, ["{name, \"", escq(Cmd), "\"}.\n"]}; + +rule([fsummary| _], _) -> + {"{fsummary, \"", "\"}.\n"}; + +rule([c, fsummary|_], _) -> + {"", ""}; + +rule([em, fsummary|_], _) -> + {"", ""}; + +rule([pcdata| _], {_, _, Data}) -> + FData = lists:flatten(docb_html_util:pcdata_to_html(Data)), + Out = lists:map(fun($\n) -> $ ; (C) -> C end, FData), + {drop, escq(Out)}; + +rule(_, _) -> + {drop, ""}. + +escq(Cs) -> + lists:flatmap(fun($") -> + "\\\""; + (C) -> [C] + end, + Cs). diff --git a/lib/docbuilder/src/docb_tr_report2html.erl b/lib/docbuilder/src/docb_tr_report2html.erl new file mode 100644 index 0000000000..3386ed972a --- /dev/null +++ b/lib/docbuilder/src/docb_tr_report2html.erl @@ -0,0 +1,70 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_report2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +%% +%% File extension +%% + +extension() -> + ".html". + +transform(File, {report,_,[Header|Rest]}, Opts) -> + Data = [{[], [], docb_html_util:all_header_data(Header)}], + Tree = {report, Data, [{header,[],[]}|Rest]}, + ChapterLevel = case docb_util:lookup_option(number, Opts) of + false -> none; + Value -> Value + end, + NumberTree = docb_html_util:number(Tree, ChapterLevel, File), + options(NumberTree, Opts). + +options(Tree, []) -> + Tree; +options(Tree, [_|Rest]) -> + options(Tree, Rest). + +rule([header|_], _) -> + {drop, ""}; + +rule([toc|_], {_,_,ToC}) -> + {drop, "\n<h3>Table of Contents</h3>\n" ++ + docb_html_util:format_toc(ToC) ++ "\n"}; + +rule([section|_], _) -> + {"", ""}; + +rule([title|Rest], {_,[Number,_File], [{pcdata,_,Title}]}) -> + N = integer_to_list(docb_html_util:count_sections(Rest)+1), + {drop, "\n<h" ++ N ++ ">" ++ Number ++ " " ++ + docb_html_util:pcdata_to_html(Title) ++ "</h" ++ N ++ ">\n"}; + +rule([erlinclude|_], {_,[File,Tag],_}) -> + docb_html_util:erl_include(File, Tag); + +rule(TagHistory, TagBody) -> + docb_html:rule(TagHistory, TagBody). + +rule([report|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:report_top(Data, Opts), + docb_html_layout:report_bot(Opts)}, Opts}; + +rule(TagHistory, TagBody, Opts) -> + docb_html:rule(TagHistory, TagBody, Opts). diff --git a/lib/docbuilder/src/docb_tr_term2html.erl b/lib/docbuilder/src/docb_tr_term2html.erl new file mode 100644 index 0000000000..0a993cebb1 --- /dev/null +++ b/lib/docbuilder/src/docb_tr_term2html.erl @@ -0,0 +1,126 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_tr_term2html). + +-export([extension/0, transform/3, rule/2, rule/3]). + +extension() -> + ".html". + +transform(_File, Tree, Opts) -> + purge(Tree, Opts). + +purge({Tag, Attrs, [Header|Body]}, Opts) -> + TermList = case docb_util:lookup_option({defs,term}, Opts) of + false -> []; + Value -> Value + end, + B1 = purge_body(Body, TermList), + B2 = lists:ukeysort(2, B1), + {Tag, Attrs, [Header|B2]}. + +purge_body([], _) -> + []; +purge_body([{pcdata,_Attrs,_More}|Rest], TermList) -> + purge_body(Rest, TermList); +purge_body([{term,[{"ID","CDATA",ID}],More}|Rest], TermList) -> + case lists:keysearch(ID, 1, TermList) of + false -> + [{term,[{"NAME","CDATA",ID},{"ID","CDATA",ID}],More}| + purge_body(Rest, TermList)]; + {value, {ID, Name, _Description, _Responsible}} -> + [{term,[{"NAME","CDATA",Name},{"ID","CDATA",ID}],More}| + purge_body(Rest, TermList)]; + {value, {ID, Name, _Description}} -> + [{term,[{"NAME","CDATA",Name},{"ID","CDATA",ID}],More}| + purge_body(Rest, TermList)] + end; +purge_body([{_Tag,_Attrs,More}|Rest], TermList) -> + lists:append(purge_body(More, TermList), + purge_body(Rest, TermList)). + +rule([header|_], _) -> + {drop, ""}; + +rule(_, _) -> + {drop, ""}. + +rule([term|_], {_,[],[Header]}, Opts) -> + {{docb_html_layout:chapter_top( + docb_html_util:all_header_data(Header), Opts) ++ + "\n<center><h1>Glossary</h1></center>\n", + docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([term|_], {_,[],[Header|_]},Opts) -> + {{docb_html_layout:chapter_top( + docb_html_util:all_header_data(Header), Opts) ++ + "\n<center><h1>Glossary</h1></center>\n<dl>\n", + "\n</dl>\n" ++ docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([term|_], {_,[Data],_}, Opts) -> + {{docb_html_layout:chapter_top(Data, Opts) ++ + "\n<center><h1>Bibliography</h1></center>\n<dl>\n", + "\n</dl>\n" ++ docb_html_layout:chapter_bot(Opts)}, Opts}; + +rule([term|_], {_,[Name,ID],[{termdef,[],[{pcdata,[],Def}]}]}, Opts) -> + TermList = case docb_util:lookup_option({defs,term}, Opts) of + false -> []; + Value -> Value + end, + case lists:keysearch(ID, 1, TermList) of + false -> + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ ID ++ "</strong></a>\n</dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Def) ++ "\n</dd>\n"}, Opts}; + {value, {ID, Name, Description, _Responsible}} -> + docb_util:message(warning, + "Global term ~s overriding local", [ID]), + {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, + Opts}; + {value, {ID, Name, Description}} -> + docb_util:message(warning, + "Global term ~s overriding local", [ID]), + {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} + end; + +rule([term|_], {_,[Name,ID],_}, Opts) -> + TermList = case docb_util:lookup_option({defs,term}, Opts) of + false -> []; + Value -> Value + end, + case lists:keysearch(ID, 1, TermList) of + false -> + docb_util:message(error, + "The term ~s has no definition", [ID]), + {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ + "??" ++ "\n</dd>\n"}, Opts}; + {value, {ID, Name, Description, _Responsible}} -> + {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, + Opts}; + {value, {ID, Name, Description}} -> + {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ + "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ + docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} + end. diff --git a/lib/docbuilder/src/docb_transform.erl b/lib/docbuilder/src/docb_transform.erl new file mode 100644 index 0000000000..a432038adf --- /dev/null +++ b/lib/docbuilder/src/docb_transform.erl @@ -0,0 +1,161 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_transform). + +-export([file/1, file/2]). + +%% file(File) -> ok | {error, Reason} +%% file(File, Opts) -> ok | {error, Reason} +%% File = string(), file name with or without ".xml" extension +%% Opts = [Opt] +%% Reason = badfile | {badopt, Term} +file(File0) -> + file(File0, []). +file(File0, RawOpts) -> + File = filename:rootname(File0), % without extension + Ext = case filename:extension(File0) of + ".xml" -> ".xml"; + ".sgml" -> ".sgml"; + "" -> + %% If the file is given without extension, we try to + %% infer if the source file is XML or SGML. + %% SGML is supported *internally within OTP* for + %% backwards compatibility reasons. + case filelib:is_regular(File++".xml") of + true -> ".xml"; + false -> ".sgml" + end; + _Ext0 -> % this is probably an error... + ".xml" + end, + case filelib:is_regular(File++Ext) of + true -> + case parse(RawOpts) of + {ok, Opts0} -> + {ok, Cwd} = file:get_cwd(), + Opts = [{src_type,Ext}, + {src_dir,Cwd}, + {src_file,File}, + {{local_defs,term},[]}, + {{local_defs,cite},[]} | Opts0], + case docb_main:process(File, Opts) of + errors -> error; + ok -> ok + end; + Error -> % {error, {badopt,Term}} + Error + end; + false -> + {error, badfile} + end. + +parse(RawOpts) -> + parse(RawOpts, []). + +%% Officially supported options + +parse([{html_mod,Module} | RawOpts], Opts) when is_atom(Module) -> + parse(RawOpts, [{html_mod,Module} | Opts]); +parse([{outdir,Dir} | RawOpts], Opts) when is_list(Dir) -> + parse(RawOpts, [{outdir,Dir} | Opts]); +parse([{number,N} | RawOpts], Opts) when is_integer(N) -> + parse(RawOpts, [{number,integer_to_list(N)} | Opts]); +parse([{number,Nstr} | RawOpts], Opts) -> % list when called from script + parse(RawOpts, [{number,Nstr} | Opts]); +parse([{ptype,Type} | RawOpts], Opts) when Type==unix; + Type==windows -> + parse(RawOpts, [{ptype,atom_to_list(Type)} | Opts]); +parse([{ptype,Type} | RawOpts], Opts) -> % list when called from script + parse(RawOpts, [{ptype,Type} | Opts]); +parse([silent | RawOpts], Opts) -> + put(option_silent, true), + parse(RawOpts, [silent | Opts]); +parse([{top,Index} | RawOpts], Opts) when is_list(Index) -> + parse(RawOpts, [{top,Index} | Opts]); +parse([{vsn,Vsn} | RawOpts], Opts) when is_list(Vsn) -> + parse(RawOpts, [{vsn,Vsn} | Opts]); + +parse([{term_defs,File} | RawOpts], Opts) when is_list(File) -> + Opts2 = get_defs(term, File, Opts), + parse(RawOpts, Opts2); +parse([{cite_defs,File} | RawOpts], Opts) when is_list(File) -> + Opts2 = get_defs(cite, File, Opts), + parse(RawOpts, Opts2); + +%% OTP internal options (SGML and PDF support etc.) + +parse([html | RawOpts], Opts) -> + parse(RawOpts, [html | Opts]); +parse([latex | RawOpts], Opts) -> + parse(RawOpts, [latex | Opts]); +parse([{man,Level} | RawOpts], Opts) -> % Level = 1..9 + parse(RawOpts, [{man,Level} | Opts]); + +parse([{booksty,StyFile} | RawOpts], Opts) -> % "otpA4" | "otpBOOK" + parse(RawOpts, [{booksty,StyFile} | Opts]); +parse([{includepath,Dir} | RawOpts], Opts) -> + parse(RawOpts, [{includepath,Dir} | Opts]); +parse([showpaths | RawOpts], Opts) -> + parse(RawOpts, [showpaths | Opts]); +parse([straight | RawOpts], Opts) -> + parse(RawOpts, [straight | Opts]); +parse([{ent,Ent} | RawOpts], Opts) -> + parse(RawOpts, [{ent,Ent} | Opts]); + +%% Undocumented options + +parse([{name, Name} | RawOpts], Opts) -> + parse(RawOpts, [{name, Name} | Opts]); +parse([framework_only | RawOpts], Opts) -> + parse(RawOpts, [framework_only | Opts]); +parse([kwicindex_only | RawOpts], Opts) -> + parse(RawOpts, [kwicindex_only | Opts]); + +parse([], Opts) -> + {ok, Opts}; +parse([Opt | _RawOpts], _Opts) -> + {error, {badopt, Opt}}. + +%% Type = term | cite +get_defs(Type, File, Opts) -> + Key = {defs,Type}, + {PrevDefs, Opts2} = + case lists:keysearch(Key, 1, Opts) of + {value, {_, Defs0}} -> + {Defs0, lists:keydelete(Key, 1, Opts)}; + false -> + {[], Opts} + end, + NewDefs = case file:consult(File) of + {ok, [DefL]} when is_list(DefL) -> + DefL; + {ok, _Terms} -> + docb_util:message(error, + "Skipping defs file ~s, does " + "not contain one list", [File]), + []; + {error, Error} -> + Expl = lists:flatten(file:format_error(Error)), + docb_util:message(error, + "Skipping defs file ~s, ~s", + [File, Expl]), + [] + end, + [{Key,PrevDefs++NewDefs} | Opts2]. + + diff --git a/lib/docbuilder/src/docb_util.erl b/lib/docbuilder/src/docb_util.erl new file mode 100644 index 0000000000..59673ef3a4 --- /dev/null +++ b/lib/docbuilder/src/docb_util.erl @@ -0,0 +1,237 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_util). + +-export([version/0, old_docb_dir/0, dtd_dir/0]). +-export([html_snippet/2, html_snippet/3]). +-export([lookup_option/2, lookup_option/3, lookup_options/2, + an_option/2]). +-export([outfile/3, full_file_name/4]). +-export([message/2, message/3]). +-export([ltrim/1, rtrim/1, trim/1]). +-export([join/2]). +-export([fknidx/2]). + +-include("docb_util.hrl"). + +%%--DocBuilder info----------------------------------------------------- + +%% version() -> string() +%% Returns the DocBuilder application version. +version() -> + DocbDir = code:lib_dir(docbuilder), + case string:tokens(filename:basename(DocbDir), "-") of + [_, Vsn] -> Vsn; + _ -> "unknown" + end. + +%% old_docb_dir() -> string() +%% Returns the root directory of Old_DocBuilder (OTP internal). +old_docb_dir() -> + "/home/otp/sgml/docb". + +%% dtd_dir() -> string() +%% Returns the directory where the XML DTDs are located. +dtd_dir() -> + DocbDir = code:lib_dir(docbuilder), + filename:join(DocbDir, "dtd"). + +%%--User defined HTML snippets------------------------------------------ + +%% html_snippet(What, Opts) -> HTML +%% html_snippet(What, Arg, Opts) -> HTML +%% What = head | seealso +%% HTML = string() +html_snippet(What, Opts) -> + case lookup_option(html_mod, Opts) of + false -> ""; + Module -> + case catch apply(Module, What, []) of + HTML when is_list(HTML) -> + HTML; + {'EXIT', {undef, _}} -> + ""; + {'EXIT', Reason} -> + message(warning, + "Callback function ~p:~p() => ~p", + [Module, What, Reason]), + ""; + Other -> + message(warning, + "Callback function ~p:~p() => ~p", + [Module, What, Other]), + "" + end + end. +html_snippet(What, Arg, Opts) -> + case lookup_option(html_mod, Opts) of + false -> ""; + Module -> + case catch apply(Module, What, [Arg]) of + HTML when is_list(HTML) -> + HTML; + {'EXIT', {undef, _}} -> + ""; + {'EXIT', Reason} -> + message(warning, + "Callback function ~p:~p(~p) => ~p", + [Module, What, Arg, Reason]), + ""; + Other -> + message(warning, + "Callback function ~p:~p(~p) => ~p", + [Module, What, Arg, Other]), + "" + end + end. + +%%--Option utilities---------------------------------------------------- + +%% Opts = [{Opt,Value} | Opt] + +%% lookup_option(Opt, Opts) -> Value | false +lookup_option(Opt, Opts) -> + case lists:keysearch(Opt, 1, Opts) of + {value, {Opt,Value}} -> Value; + false -> false + end. + +%% lookup_option(Opt, Opts, DefaultValue) -> Value | DefaultValue +lookup_option(Opt, Opts, DefaultValue) -> + case lookup_option(Opt,Opts) of + false -> DefaultValue; + Value -> Value + end. + +%% lookup_options(Opt, Opts) -> [Value] +%% Used when the same option can be defined several times and returns +%% the (possibly empty) list of values. +lookup_options(Opt, Opts) -> + [V || {O, V} <- Opts, O == Opt]. + +%% an_option(Opt, Opts) -> bool() +an_option(Opt, Opts) -> + lists:member(Opt, Opts). + +%%--File handling------------------------------------------------------- + +%% outfile(File0, Extension, Opts) -> File +%% Build the full filename for where to place a resulting file. +outfile(File0, Extension, Opts) -> + File = + case regexp:match(File0, "[^/]*\$") of + {match,Start,Length} -> + string:substr(File0, Start, Length); + _ -> + File0 + end, + full_file_name(File, Extension, outdir, Opts). + +%% full_file_name(File, Extension, What, Opts) -> File' +%% File = string() +%% What = outdir | includepath +%% Prepend the full path name. +full_file_name(File, Extension, What, Opts) -> + Path = lookup_option(What, Opts, ""), + full_file_name(File, Extension, Path). + +full_file_name(File0, Extension, Path) -> + File = case filename:extension(File0) of + Extension -> File0; + _ -> File0++Extension + end, + + case File of + [$/|_] -> File; + [$~|_] -> File; + _ when Path=/="" -> filename:join(Path, File); + _ -> File + end. + +%%--Messages to the user------------------------------------------------ + +%% message(Class, Format) +%% message(Class, Format, Values) -> ok +%% Class = info | warning | error +%% Format, Values -- as in io:format/2 +%% Prints a warning or error message. +%% Call as util:message(warning, "~w is undefined", [foo]). +message(Class, Format) -> + message(Class, Format, []). +message(Class, Format, Values) -> + Prefix = case Class of + info -> ""; + warning -> "*** Warning: "; + error -> "*** Error: " + end, + case get(option_silent) of + true when Class==warning -> + ok; + _ -> + io:format(Prefix, []), + io:format(Format, Values), + io:nl() + end. + +%%--String handling----------------------------------------------------- + +%% ltrim(Str) -> Str' +%% rtrim(Str) -> Str' +%% trim(Str) -> Str' +%% Strips whitespace from left, right or both. +ltrim(Str) -> + lists:dropwhile(fun white_space/1, Str). +rtrim(Str) -> + lists:reverse(ltrim(lists:reverse(Str))). +trim(Str) -> + rtrim(ltrim(Str)). + +white_space($ ) -> true; +white_space(C) when C<$ -> true; +white_space($\n) -> true; +white_space($\t) -> true; +white_space(_) -> false. + +%% join(Strings, With) -> string() +join([H1, H2| T], S) -> + H1 ++ S ++ join([H2| T], S); +join([H], _) -> + H; +join([], _) -> + []. + +%%--Other--------------------------------------------------------------- + +%% fknidx(FNdef0, Fn_arity_sep) -> string() +%% Get me the function name and arity. +fknidx(FNdef0, Fn_arity_sep) -> + FNdef = string:strip(FNdef0), + case string:tokens(FNdef,"(") of + [FNdef] -> + %% No parentheses, assume variable: remove nl:s at end, + %% and strip blanks. + string:strip(string:strip(FNdef, right, $\n)); + [Name0|Args0] -> + [Args1|_] = string:tokens(string:strip(hd(Args0)), "-"), + Arity = case Args1 of + [$)|_] -> 0; + _ -> + length(string:tokens(Args1, ",")) + end, + string:strip(Name0)++Fn_arity_sep++integer_to_list(Arity) + end. diff --git a/lib/docbuilder/src/docb_util.hrl b/lib/docbuilder/src/docb_util.hrl new file mode 100644 index 0000000000..01ef3f7fca --- /dev/null +++ b/lib/docbuilder/src/docb_util.hrl @@ -0,0 +1,34 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% + +%%% For character conversion + +-record(in_opts, {expand_entities=false, + encode_filter = fun(X) -> X end}). +-record(out_opts, {escape_chars=false, + remove_nl=false, + delete_trailing_whitespace=false, + delete_trailing_nl=false, + compress_white_space=false, + escape_filter = fun(X) -> X end}). + + +-define(pcdata_IN, #in_opts{expand_entities=true}). +-define(rcdata_IN, #in_opts{expand_entities=true}). +-define(cdata_IN, #in_opts{}). + diff --git a/lib/docbuilder/src/docb_xmerl_tree_cb.erl b/lib/docbuilder/src/docb_xmerl_tree_cb.erl new file mode 100644 index 0000000000..d57f55bff8 --- /dev/null +++ b/lib/docbuilder/src/docb_xmerl_tree_cb.erl @@ -0,0 +1,343 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the Licence for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson AB. +%% Portions created by Ericsson are Copyright 1999-2006, Ericsson AB. +%% All Rights Reserved.�� +%% +%% $Id$ +%% +-module(docb_xmerl_tree_cb). + +%% This is the XMerL callback module for exporting XML to the internal +%% tree format used by DocBuilder. +%% {Doc, _Misc} = xmerl_scan:file("file.xml", [{validation,true}]) +%% Tree = xmerl:export([Doc], docb_xmerl_tree_cb) + +-export(['#xml-inheritance#'/0]). + +-export(['#root#'/4, + '#text#'/1, + '#element#'/5]). +-include("xmerl.hrl"). + +%%--Functions used by xmerl--------------------------------------------- + +'#xml-inheritance#'() -> + []. + +'#root#'(Data, _Attrs, [], _E) -> + Data. + +'#text#'(Text) -> + Text2 = strip_leading_blanks(Text), +%% before +%% case Text2 of +%% [$\n|T] -> +%% case is_empty(T) of +%% true -> []; +%% false -> {pcdata, [], nl(Text2)} +%% end; +%% +%% _ -> +%% {pcdata, [], nl(Text2)} +%% end. +%% after + {pcdata, [], nl(Text2)}. + +'#element#'(Tag, Data, Attrs, Parents, _E) when Tag==pre; Tag==code -> + [H|T] = reinsert_nl(Data), + NewData = [strip_nl(H)|T], + NewData2 = case Tag of + code -> + fix_single_pcdata(NewData); + pre -> + NewData + end, + {Tag, attrs(get_dtd(Parents), Tag, Attrs), NewData2}; +'#element#'(Tag, Data, Attrs, Parents, _E) -> + NewData = case tag_content(Tag) of + no_pcdata -> % remove all pcdata + [Dat|| + Dat <- Data, + begin + Fun = fun({pcdata,_,_}) -> false; + (_) -> true end, + Fun(Dat) + end]; + single_pcdata when length(Data)>1 -> + %% merge several pcdata's into one single pcdata + fix_single_pcdata(Data); + _ -> + lists:flatten(Data) + end, + {Tag, attrs(get_dtd(Parents), Tag, Attrs), NewData}. + +%%--Internal functions-------------------------------------------------- + +%% is_empty(Str) -> bool() +%% Returns true if the string Str only contains blanks, tabs and +%% newlines, false otherwise. +%% is_empty("\n" ++ Text) -> +%% is_empty(Text); +%% is_empty("\t" ++ Text) -> +%% is_empty(Text); +%% is_empty(" " ++ Text) -> +%% is_empty(Text); +%% is_empty("") -> +%% true; +%% is_empty(_) -> +%% false. + +%% reinsert_nl(L1) -> L2 +%% Workaround for <pre>: Normally empty lines are ignored. However, +%% Xmerl splits lines whenever it encounters an entity. In the case of +%% <pre>, this may lead to that we ignores what we think is an empty +%% line but is actually a line break that should be kept, for example +%% in this case: +%% <pre> +%% <input>some command</input> <-- this line break is lost! +%% <some result> +%% </pre> +%% This function reinserts line breaks where necessary. +reinsert_nl([[]|T]) -> + [{pcdata,[],"\\n"} | reinsert_nl(T)]; +reinsert_nl([H|T]) -> + [H | reinsert_nl(T)]; +reinsert_nl([]) -> + []. + +%% sgmls treats line breaks in a way that DocBuilder relies on and +%% which must be imitated here. Replace all "\n" with "\\n" and add +%% "\n" to the end of each text element. +nl("") -> + "\n"; +nl("\n"++Text) -> + "\\n"++nl(Text); +nl([Ch|Text]) -> + [Ch|nl(Text)]. + + +%% strip_leading_blanks(Str) -> Str +%% Leading spaces and tabs before a newline are always redundant +%% and are therefore stripped of here +%% If no newline is found the original string is returned unchanged + +strip_leading_blanks(Str) -> + strip_leading_blanks(Str,Str). + +strip_leading_blanks([],Str) -> + Str; +strip_leading_blanks([$\s|T],Str) -> + strip_leading_blanks(T,Str); +strip_leading_blanks([$\t|T],Str) -> + strip_leading_blanks(T,Str); +strip_leading_blanks(Rest=[$\n|_],_) -> + Rest; +strip_leading_blanks(_,Str) -> + Str. + +%% strip_nl(Str) -> Str +%% The XMerL scan will often result in the contents of <pre> or <code> +%% starting with a newline, as the format is normally: +%% <pre> +%% ..contents.. +%% </pre> +%% However, this newline must be removed, or the resulting HTML will be +%% <pre> +%% +%% ..content.. +%% </pre> +strip_nl({pcdata,[],"\\n"++Str}) -> {pcdata,[],Str}; +strip_nl(E) -> E. + +get_dtd([]) -> + none; +get_dtd(Parents) -> + {DTD, _} = lists:last(Parents), + DTD. + +%% attrs(DTD, Tag, GivenAttrs) -> AllAttrs +%% DTD = Tag = atom() DTD and tag name +%% GivenAttrs = [#xmlAttribute{}] +%% AllAttrs = [{Name, Type, Val}] +%% Name = string() (uppercase) Example: "VALIGN" +%% Type = "CDATA" | "TOKEN" +%% Val = string() (uppercase if type is "TOKEN", as-is otherwise) +%% The XMerL scanning of <file>.xml renders only the given attributes. +%% However, DocBuilder needs also the optional attributes (which not +%% necessarily have been given), so we add them here, using the default +%% values according to the DTDs. +%% NOTE: Uses the information from the DTDs. That is, if some change is +%% done to the DTDs, also this file must be updated. Ideally, the DTDs +%% should be parsed automatically in some way. +%% It can also be noted that this check is superfluous in the case where +%% all attributes are required (except that the attributes are sorted +%% in the same order as in the DTD) and where an optional attribute has +%% type "CDATA" as no sensible default value can be specified in this +%% case. +attrs(DTD, Tag, GivenAttrs) -> + merge_attrs(Tag, default_attrs(DTD, Tag), GivenAttrs). + +merge_attrs(Tag, [{NameA, Type, DefVal}|Default], GivenAttrs) -> + Val = case lists:keysearch(NameA, #xmlAttribute.name, GivenAttrs) of + {value, #xmlAttribute{value=Val0}} -> Val0; + false -> DefVal + end, + Attr = {attr_name(NameA), Type, attr_val(Type, Val)}, + [Attr | merge_attrs(Tag, Default, GivenAttrs)]; +merge_attrs(_Tag, [], _GivenAttrs) -> + []. + +attr_name(Atom) -> + string:to_upper(atom_to_list(Atom)). + +attr_val("CDATA", Val) -> Val; +attr_val("TOKEN", Val) -> string:to_upper(Val). + +%% Given the DTD and element tag, return a list [{Name, Value}] where +%% Name (atom) is the name of each possible attribute and +%% Value (lowercase string) its default value. +default_attrs(_, cell) -> + [{align, "TOKEN", "left"}, + {valign, "TOKEN", "middle"}]; +default_attrs(_, cite) -> + [{id, "CDATA", ""}]; % required +default_attrs(_, code) -> + [{type, "TOKEN", "none"}]; +default_attrs(_, codeinclude) -> + [{file, "CDATA", ""}, % required + {tag, "CDATA", ""}, + {type, "TOKEN", "none"}]; +default_attrs(book, contents) -> + [{level, "TOKEN", "2"}]; +default_attrs(_, erleval) -> + [{expr, "CDATA", ""}]; % required +default_attrs(report, erlinclude) -> + [{file, "CDATA", ""}, % required + {tag, "CDATA", ""}]; % required +default_attrs(_, fascicule) -> + [{file, "CDATA", ""}, % required + {href, "CDATA", ""}, % required + {entry, "TOKEN", "no"}]; +default_attrs(book, header) -> + [{titlestyle, "TOKEN", "normal"}]; +default_attrs(_, image) -> + [{file, "CDATA", ""}]; % required +default_attrs(_, include) -> + [{file, "CDATA", ""}]; % required +default_attrs(report, index) -> + [{txt, "CDATA", ""}]; % required +default_attrs(_, list) -> + [{type, "TOKEN", "bulleted"}]; +default_attrs(_, marker) -> + [{id, "CDATA", ""}]; % required +default_attrs(book, onepart) -> + [{lift, "TOKEN", "no"}]; +default_attrs(book, parts) -> + [{lift, "TOKEN", "no"}]; +default_attrs(_, path) -> + [{unix, "CDATA", ""}, + {windows, "CDATA", ""}]; +default_attrs(_, seealso) -> + [{marker, "CDATA", ""}]; % required +default_attrs(report, table) -> + [{width, "CDATA", "0"}, + {colspec, "CDATA", ""}]; +default_attrs(_, table) -> + [{align, "TOKEN", "center"}]; +default_attrs(_, term) -> + [{id, "CDATA", ""}]; % required +default_attrs(book, theheader) -> + [{tag, "TOKEN", "none"}]; +default_attrs(bookinsidecover, theheader) -> + [{tag, "TOKEN", "none"}]; +default_attrs(_, url) -> + [{href, "CDATA", ""}]; % required +default_attrs(_, _) -> []. + +%%--Single PCDATA broken into several fix------------------------------- + +%% When text contains an entity, then XMERL splits it into two +%% PCDATA elements, the second starting with the entity. +%% +%% Example: +%% Magnus Fr�berg => [{pcdata,[],"Magnus Fr\n"},{pcdata,[],"�berg\n"}] +%% +%% This is not handled by DocBuilder which expects many tags, for +%% example title and aname, to contain a single PCDATA element. (That +%% is also what nsgmls returned.) + +fix_single_pcdata([{pcdata,[],Str1}, {pcdata,[],Str2}|T]) -> + fix_single_pcdata([{pcdata,[],Str1++Str2}|T]); +fix_single_pcdata(FixedData) -> + FixedData. + +tag_content(aname) -> single_pcdata; +tag_content(app) -> single_pcdata; +tag_content(approved) -> single_pcdata; +tag_content(appsummary) -> single_pcdata; +tag_content(b) -> single_pcdata; +tag_content(c) -> single_pcdata; +tag_content(cauthor) -> single_pcdata; +tag_content(cell) -> mixed_content; +tag_content(checked) -> single_pcdata; +tag_content(chowpublished) -> single_pcdata; +tag_content(code) -> single_pcdata; % mixed? +tag_content(com) -> single_pcdata; +tag_content(comsummary) -> single_pcdata; +tag_content(copyright) -> mixed_content; +tag_content(ctitle) -> single_pcdata; +tag_content(d) -> mixed_content; +tag_content(date) -> single_pcdata; +tag_content(docno) -> single_pcdata; +tag_content(em) -> mixed_content; +tag_content(email) -> single_pcdata; +tag_content(fascicule) -> single_pcdata; +tag_content(file) -> single_pcdata; +tag_content(filesummary) -> single_pcdata; +tag_content(fsummary) -> mixed_content; +tag_content(headline) -> single_pcdata; +tag_content(holder) -> single_pcdata; +tag_content(i) -> single_pcdata; +tag_content(icaption) -> single_pcdata; +tag_content(id) -> single_pcdata; +tag_content(input) -> mixed_content; +tag_content(item) -> mixed_content; +tag_content(legalnotice) -> single_pcdata; +tag_content(lib) -> single_pcdata; +tag_content(libsummary) -> single_pcdata; +tag_content(module) -> single_pcdata; +tag_content(modulesummary) -> single_pcdata; +tag_content(name) -> single_pcdata; +tag_content(nametext) -> single_pcdata; +tag_content(p) -> mixed_content; +tag_content(pagetext) -> single_pcdata; +tag_content(path) -> single_pcdata; % mixed? +tag_content(pre) -> mixed_content; +tag_content(prepared) -> single_pcdata; +tag_content(resp) -> single_pcdata; +tag_content(responsible) -> single_pcdata; +tag_content(ret) -> single_pcdata; +tag_content(rev) -> single_pcdata; +tag_content(seealso) -> single_pcdata; % mixed? +tag_content(shortdef) -> single_pcdata; +tag_content(shorttitle) -> single_pcdata; +tag_content(tag) -> mixed_content; +tag_content(tcaption) -> single_pcdata; +tag_content(termdef) -> single_pcdata; +tag_content(title) -> single_pcdata; +tag_content(url) -> single_pcdata; % mixed +tag_content(v) -> single_pcdata; +tag_content(year) -> single_pcdata; +tag_content(_) -> no_pcdata. + + diff --git a/lib/docbuilder/src/docb_xmerl_xml_cb.erl b/lib/docbuilder/src/docb_xmerl_xml_cb.erl new file mode 100644 index 0000000000..089b8f0c7d --- /dev/null +++ b/lib/docbuilder/src/docb_xmerl_xml_cb.erl @@ -0,0 +1,88 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the Licence for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson AB. +%% Portions created by Ericsson are Copyright 1999-2006, Ericsson AB. +%% All Rights Reserved.�� +%% +%% $Id$ +%% +-module(docb_xmerl_xml_cb). + +%% This is the callback module for exporting XHTML to a DocBuilder +%% erlref or chapter document in XML format. +%% See docb_edoc_xml_cb.erl for further information. +%% +%% The origin of this file is the xmerl module xmerl_otpsgml.erl +%% written by Ulf Wiger and Richard Carlsson. + +-export(['#xml-inheritance#'/0]). + +-export(['#root#'/4, + '#element#'/5, + '#text#'/1]). + +-include("xmerl.hrl"). + +'#xml-inheritance#'() -> + [xmerl_xml]. + +'#root#'(Data, _Attrs, [], _E) -> + ["<",DTD,">"] = hd(hd(Data)), + ["<?xml version=\"1.0\" encoding=\"latin1\" ?>\n", + "<!DOCTYPE "++DTD++" SYSTEM \""++DTD++".dtd\">\n", + Data]. + +'#element#'(Tag, Data, Attrs, _Parents, _E) -> + {NewTag, NewAttrs} = convert_tag(Tag, Attrs), + xmerl_lib:markup(NewTag, NewAttrs, Data). + +'#text#'(Text) -> + xmerl_lib:export_text(Text). + +%% Utility functions + +convert_tag(a, [Attr]) -> + case Attr#xmlAttribute.name of + href -> + Val = Attr#xmlAttribute.value, + case is_url(Val) of + true -> + {url, [Attr]}; + false -> + {seealso, [Attr#xmlAttribute{name=marker}]} + end; + name -> + {marker, [Attr#xmlAttribute{name=id}]} + end; +convert_tag(b, Attrs) -> {em, Attrs}; +convert_tag(blockquote, Attrs) -> {quote, Attrs}; +convert_tag(code, Attrs) -> {c, Attrs}; +convert_tag(dd, Attrs) -> {item, Attrs}; +convert_tag(dl, Attrs) -> {taglist, Attrs}; +convert_tag(dt, Attrs) -> {tag, Attrs}; +convert_tag(li, Attrs) -> {item, Attrs}; +convert_tag(ol, Attrs) -> {list, Attrs}; +convert_tag(strong, Attrs) -> {em, Attrs}; +convert_tag(td, Attrs) -> {cell, Attrs}; +convert_tag(tr, Attrs) -> {row, Attrs}; +convert_tag(tt, Attrs) -> {c, Attrs}; +convert_tag(ul, Attrs) -> {list, Attrs}; +convert_tag(underline, Attrs) -> {em, Attrs}; +convert_tag(Tag, Attrs) -> {Tag, Attrs}. + +is_url("http:"++_) -> true; +is_url("../"++_) -> true; +is_url(FileRef) -> + case filename:extension(FileRef) of + "" -> false; % no extension = xml file, DocBuilder resolves + _Ext -> true % extension, DocBuilder must not resolve + end. diff --git a/lib/docbuilder/src/docb_xml_check.erl b/lib/docbuilder/src/docb_xml_check.erl new file mode 100644 index 0000000000..8ae5cd2eac --- /dev/null +++ b/lib/docbuilder/src/docb_xml_check.erl @@ -0,0 +1,44 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999-2000, Ericsson +%% Utvecklings AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_xml_check). + +-export([validate/1]). + +%% validate(File) -> ok | error | {error, badfile} +%% File = string(), file name with or without ".xml" extension +%% If XML validation fails for a file, the error information from +%% Xmerl is printed to terminal and the function returns error. +validate(File0) -> + File = case filename:extension(File0) of + ".xml" -> File0; + _ -> File0++".xml" + end, + case filelib:is_regular(File) of + true -> + DtdDir = docb_util:dtd_dir(), + case catch xmerl_scan:file(File, [{validation,true}, + {fetch_path,[DtdDir]}]) of + {'EXIT', Error} -> + io:format("~p~n", [Error]), + error; + {_Doc, _Misc} -> + ok + end; + false -> + {error, badfile} + end. diff --git a/lib/docbuilder/src/docbuilder.app.src b/lib/docbuilder/src/docbuilder.app.src new file mode 100644 index 0000000000..64c4770964 --- /dev/null +++ b/lib/docbuilder/src/docbuilder.app.src @@ -0,0 +1,37 @@ +{application, docbuilder, + [{description, "Tool for building HTML documentation"}, + {vsn, "%VSN%"}, + {modules, [docb_edoc_xml_cb, + docb_gen, + docb_html, + docb_html_layout, + docb_html_ref, + docb_html_util, + docb_html_util_iso, + docb_main, + docb_pretty_format, + docb_tr_application2html, + docb_tr_appref2html, + docb_tr_chapter2html, + docb_tr_cite2html, + docb_tr_comref2html, + docb_tr_cref2html, + docb_tr_erlref2html, + docb_tr_fileref2html, + docb_tr_first2html, + docb_tr_index2html, + docb_tr_part2html, + docb_tr_refs2kwic, + docb_tr_report2html, + docb_tr_term2html, + docb_transform, + docb_util, + docb_xmerl_tree_cb, + docb_xmerl_xml_cb, + docb_xml_check + ]}, + {registered, []}, + {applications, [kernel, stdlib]}, + {env, []}]}. + + diff --git a/lib/docbuilder/src/docbuilder.appup.src b/lib/docbuilder/src/docbuilder.appup.src new file mode 100644 index 0000000000..54a63833e6 --- /dev/null +++ b/lib/docbuilder/src/docbuilder.appup.src @@ -0,0 +1 @@ +{"%VSN%",[],[]}. diff --git a/lib/docbuilder/test/Makefile b/lib/docbuilder/test/Makefile new file mode 100644 index 0000000000..080479ee71 --- /dev/null +++ b/lib/docbuilder/test/Makefile @@ -0,0 +1,80 @@ +# ``The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved via the world wide web at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# The Initial Developer of the Original Code is Ericsson Utvecklings AB. +# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +# AB. All Rights Reserved.'' +# +# $Id$ +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +MODULES = \ + docb_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile + +SPEC_FILES= + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/docb_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +ERL_MAKE_FLAGS += +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +.PHONY: make_emakefile + +make_emakefile: + $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES)\ + > $(EMAKEFILE) + +tests debug opt: make_emakefile + erl $(ERL_MAKE_FLAGS) -make + +clean: + rm -f $(EMAKEFILE) + rm -f $(TARGET_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: make_emakefile + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) + chmod -f -R u+w $(RELSYSDIR) + @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) + +release_docs_spec: + + diff --git a/lib/docbuilder/test/docb_SUITE.erl b/lib/docbuilder/test/docb_SUITE.erl new file mode 100644 index 0000000000..c871130521 --- /dev/null +++ b/lib/docbuilder/test/docb_SUITE.erl @@ -0,0 +1,31 @@ +%% ``The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved via the world wide web at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +%% $Id$ +%% +-module(docb_SUITE). + +-export([all/1,html/1]). + +-include("test_server.hrl"). + +-include_lib("kernel/include/file.hrl"). + +all(suite) -> [html]. + +html(suite) -> []; +html(Config) when is_list(Config) -> + ok. + diff --git a/lib/docbuilder/test/docb_SUITE_data/cdata_problem.xml b/lib/docbuilder/test/docb_SUITE_data/cdata_problem.xml new file mode 100755 index 0000000000..b7f6f5376e --- /dev/null +++ b/lib/docbuilder/test/docb_SUITE_data/cdata_problem.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> +<chapter> + <header> + <title>�Docbookö bug</title> + <prepared>Matthias Lang</prepared> +<docno></docno> +<date>2008-03-31</date> + <rev>1.0</rev> + </header> + +<section><title>This is a title</title> + <code><![CDATA[ + This works + ]]></code> + + <code><![CDATA[ + This does not + ]]> </code> +</section> +</chapter> + diff --git a/lib/docbuilder/vsn.mk b/lib/docbuilder/vsn.mk new file mode 100644 index 0000000000..4c782f7481 --- /dev/null +++ b/lib/docbuilder/vsn.mk @@ -0,0 +1,12 @@ +DOCB_VSN = 0.9.8.6 + +TICKETS = OTP-8201 + +TICKETS_0.9.8.5 = OTP-7851 + +TICKETS_0.9.8.4 = OTP-7236 + +TICKETS_0.9.8.1 = OTP-7236 + + + diff --git a/lib/docbuilder/xsd/application.xsd b/lib/docbuilder/xsd/application.xsd new file mode 100755 index 0000000000..eb666cb6c7 --- /dev/null +++ b/lib/docbuilder/xsd/application.xsd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.xsd"/>
+ <xs:include schemaLocation="common.header.xsd"/>
+ <xs:element name="application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element minOccurs="0" ref="description"/>
+ <xs:element maxOccurs="unbounded" ref="include"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="description">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="include">
+ <xs:complexType>
+ <xs:attribute name="file" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/appref.xsd b/lib/docbuilder/xsd/appref.xsd new file mode 100755 index 0000000000..b63839e494 --- /dev/null +++ b/lib/docbuilder/xsd/appref.xsd @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.refs.xsd"/>
+ <!-- Structure -->
+ <xs:element name="appref">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element ref="app"/>
+ <xs:element ref="appsummary"/>
+ <xs:element ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="section"/>
+ <xs:element ref="funcs"/>
+ </xs:choice>
+ <xs:element ref="authors"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="app" type="xs:string"/>
+ <xs:element name="appsummary" type="xs:string"/>
+ <!--
+ `name' is used in common.refs.dtd and must therefore
+ be defined in each *ref. dtd
+ -->
+ <xs:element name="name" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/book.xsd b/lib/docbuilder/xsd/book.xsd new file mode 100755 index 0000000000..b47962263a --- /dev/null +++ b/lib/docbuilder/xsd/book.xsd @@ -0,0 +1,292 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.xsd"/>
+ <xs:include schemaLocation="common.table.xsd"/>
+ <xs:element name="book">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element minOccurs="0" ref="insidecover"/>
+ <xs:element ref="pagetext"/>
+ <xs:element ref="preamble"/>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="applications"/>
+ <xs:element ref="parts"/>
+ <xs:element ref="headline"/>
+ <xs:element ref="pagetext"/>
+ </xs:choice>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="listoffigures"/>
+ <xs:element minOccurs="0" ref="listoftables"/>
+ <xs:element minOccurs="0" ref="listofterms"/>
+ <xs:element minOccurs="0" ref="bibliography"/>
+ <xs:element minOccurs="0" ref="index"/>
+ </xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="title"/>
+ <xs:element ref="prepared"/>
+ <xs:element minOccurs="0" ref="responsible"/>
+ <xs:element ref="docno"/>
+ <xs:element minOccurs="0" ref="approved"/>
+ <xs:element minOccurs="0" ref="checked"/>
+ <xs:element ref="date"/>
+ <xs:element ref="rev"/>
+ <xs:element minOccurs="0" ref="file"/>
+ <xs:element minOccurs="0" ref="abbreviation"/>
+ </xs:sequence>
+ <xs:attribute name="titlestyle" default="normal">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="special"/>
+ <xs:enumeration value="normal"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="title">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="prepared">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="responsible">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="docno">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="approved">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="checked">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="date">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="rev">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="file">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="abbreviation">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="br"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="pagetext" type="xs:string"/>
+ <xs:element name="preamble">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="preface"/>
+ <xs:element minOccurs="0" ref="contents"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="preface">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="title"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ <xs:element ref="table"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="insidecover">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="br"/>
+ <xs:element ref="theheader"/>
+ <xs:element ref="vfill"/>
+ <xs:element ref="tt"/>
+ <xs:element ref="bold"/>
+ <xs:element ref="include"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tt">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="br"/>
+ <xs:element ref="theheader"/>
+ <xs:element ref="vfill"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="bold">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="br"/>
+ <xs:element ref="theheader"/>
+ <xs:element ref="vfill"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="vfill">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="theheader">
+ <xs:complexType>
+ <xs:attribute name="tag" default="none">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="title"/>
+ <xs:enumeration value="prepared"/>
+ <xs:enumeration value="responsible"/>
+ <xs:enumeration value="docno"/>
+ <xs:enumeration value="approved"/>
+ <xs:enumeration value="checked"/>
+ <xs:enumeration value="date"/>
+ <xs:enumeration value="rev"/>
+ <xs:enumeration value="file"/>
+ <xs:enumeration value="abbreviation"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="applications">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="include"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="parts">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="title"/>
+ <xs:element minOccurs="0" ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="include"/>
+ <xs:element ref="onepart"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="lift" default="no">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes"/>
+ <xs:enumeration value="no"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="headline" type="xs:string"/>
+ <xs:element name="index">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="listoffigures">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="listoftables">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="listofterms">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="bibliography">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="contents">
+ <xs:complexType>
+ <xs:attribute name="level" default="2">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="0"/>
+ <xs:enumeration value="1"/>
+ <xs:enumeration value="2"/>
+ <xs:enumeration value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="onepart">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="title"/>
+ <xs:element minOccurs="0" ref="description"/>
+ <xs:element maxOccurs="unbounded" ref="include"/>
+ </xs:sequence>
+ <xs:attribute name="lift" default="no">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes"/>
+ <xs:enumeration value="no"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="description">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="include">
+ <xs:complexType>
+ <xs:attribute name="file" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/chapter.xsd b/lib/docbuilder/xsd/chapter.xsd new file mode 100755 index 0000000000..4d89baa988 --- /dev/null +++ b/lib/docbuilder/xsd/chapter.xsd @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.xsd"/>
+ <xs:include schemaLocation="common.header.xsd"/>
+ <xs:include schemaLocation="common.table.xsd"/>
+ <xs:include schemaLocation="common.image.xsd"/>
+ <!-- Structure -->
+ <xs:element name="chapter">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ <xs:element ref="br"/>
+ <xs:element ref="image"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="table"/>
+ </xs:choice>
+ <xs:element maxOccurs="unbounded" ref="section"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="section">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="marker"/>
+ <xs:element ref="title"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ <xs:element ref="br"/>
+ <xs:element ref="image"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="table"/>
+ <xs:element ref="section"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/common.entities.xsd b/lib/docbuilder/xsd/common.entities.xsd new file mode 100755 index 0000000000..52a5d35179 --- /dev/null +++ b/lib/docbuilder/xsd/common.entities.xsd @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"/>
diff --git a/lib/docbuilder/xsd/common.header.xsd b/lib/docbuilder/xsd/common.header.xsd new file mode 100755 index 0000000000..bfee4b8bb4 --- /dev/null +++ b/lib/docbuilder/xsd/common.header.xsd @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="title"/>
+ <xs:element minOccurs="0" ref="shorttitle"/>
+ <xs:element ref="prepared"/>
+ <xs:element minOccurs="0" ref="responsible"/>
+ <xs:element ref="docno"/>
+ <xs:element minOccurs="0" ref="approved"/>
+ <xs:element minOccurs="0" ref="checked"/>
+ <xs:element ref="date"/>
+ <xs:element ref="rev"/>
+ <xs:element minOccurs="0" ref="file"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="title" type="xs:string"/>
+ <xs:element name="shorttitle" type="xs:string"/>
+ <xs:element name="prepared" type="xs:string"/>
+ <xs:element name="responsible" type="xs:string"/>
+ <xs:element name="docno" type="xs:string"/>
+ <xs:element name="approved" type="xs:string"/>
+ <xs:element name="checked" type="xs:string"/>
+ <xs:element name="date" type="xs:string"/>
+ <xs:element name="rev" type="xs:string"/>
+ <xs:element name="file" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/common.image.xsd b/lib/docbuilder/xsd/common.image.xsd new file mode 100755 index 0000000000..17054eb23c --- /dev/null +++ b/lib/docbuilder/xsd/common.image.xsd @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="image">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="icaption">
+ <xs:attribute name="file" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="icaption">
+ <xs:sequence>
+ <xs:element ref="icaption"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="icaption" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/common.refs.xsd b/lib/docbuilder/xsd/common.refs.xsd new file mode 100755 index 0000000000..58b450669d --- /dev/null +++ b/lib/docbuilder/xsd/common.refs.xsd @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file contains common stuff for the *ref.dtd files.
+ Note that `name' is defined in each *ref.dtd.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.xsd"/>
+ <xs:include schemaLocation="common.header.xsd"/>
+ <xs:element name="description">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="funcs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="func"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="func">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="name"/>
+ <xs:element ref="fsummary"/>
+ <xs:element minOccurs="0" ref="type"/>
+ <xs:element minOccurs="0" ref="desc"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- ELEMENT name is defined in each ref dtd -->
+ <xs:element name="fsummary">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="c"/>
+ <xs:element ref="em"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="type">
+ <xs:complexType>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element ref="v"/>
+ <xs:element minOccurs="0" ref="d"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="v" type="xs:string"/>
+ <xs:element name="d">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="c"/>
+ <xs:element ref="em"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="desc">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="authors">
+ <xs:complexType>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element ref="aname"/>
+ <xs:element ref="email"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="aname" type="xs:string"/>
+ <xs:element name="email" type="xs:string"/>
+ <xs:element name="section">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="marker"/>
+ <xs:element ref="title"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/common.table.xsd b/lib/docbuilder/xsd/common.table.xsd new file mode 100755 index 0000000000..cf63df4317 --- /dev/null +++ b/lib/docbuilder/xsd/common.table.xsd @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="table">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="row"/>
+ <xs:element ref="tcaption"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="row">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="cell"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cell">
+ <xs:complexType mixed="true">
+ <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/>
+ <xs:attribute name="align" default="left">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="left"/>
+ <xs:enumeration value="center"/>
+ <xs:enumeration value="right"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="valign" default="middle">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="top"/>
+ <xs:enumeration value="middle"/>
+ <xs:enumeration value="bottom"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tcaption" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/common.xsd b/lib/docbuilder/xsd/common.xsd new file mode 100755 index 0000000000..3d43390bd8 --- /dev/null +++ b/lib/docbuilder/xsd/common.xsd @@ -0,0 +1,212 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file contains common stuff for all dtds. -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="block" abstract="true"/>
+ <xs:group name="inline">
+ <xs:sequence>
+ <xs:choice minOccurs="0">
+ <xs:element ref="c"/>
+ <xs:element ref="em"/>
+ <xs:element ref="term"/>
+ <xs:element ref="cite"/>
+ <xs:element ref="br"/>
+ <xs:element ref="path"/>
+ <xs:element ref="seealso"/>
+ <xs:element ref="url"/>
+ <xs:element ref="marker"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:group>
+ <!-- XXX -->
+ <xs:element name="p" substitutionGroup="block">
+ <xs:complexType mixed="true">
+ <xs:group minOccurs="0" maxOccurs="unbounded" ref="inline"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="pre" substitutionGroup="block">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="seealso"/>
+ <xs:element ref="url"/>
+ <xs:element ref="input"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="input">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="seealso"/>
+ <xs:element ref="url"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="code" substitutionGroup="block">
+ <xs:complexType mixed="true">
+ <xs:attribute name="type" default="none">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="erl"/>
+ <xs:enumeration value="c"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="quote">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="p"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="warning">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="note">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="c" type="xs:string"/>
+ <xs:element name="em">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="c"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- XXX -->
+ <xs:element name="term">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="termdef"/>
+ </xs:sequence>
+ <xs:attribute name="id" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="termdef" type="xs:string"/>
+ <xs:element name="cite">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="citedef"/>
+ </xs:sequence>
+ <xs:attribute name="id" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="citedef">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ctitle"/>
+ <xs:element ref="cauthor"/>
+ <xs:element ref="chowpublished"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ctitle" type="xs:string"/>
+ <xs:element name="cauthor" type="xs:string"/>
+ <xs:element name="chowpublished" type="xs:string"/>
+ <!-- XXX -->
+ <xs:element name="br">
+ <xs:complexType/>
+ </xs:element>
+ <!-- Path -->
+ <xs:element name="path">
+ <xs:complexType mixed="true">
+ <xs:attribute name="unix" default=""/>
+ <xs:attribute name="windows" default=""/>
+ </xs:complexType>
+ </xs:element>
+ <!-- List -->
+ <xs:element name="list" substitutionGroup="block">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="item"/>
+ </xs:sequence>
+ <xs:attribute name="type" default="bulleted">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="ordered"/>
+ <xs:enumeration value="bulleted"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="taglist" substitutionGroup="block">
+ <xs:complexType>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:element ref="tag"/>
+ <xs:element ref="item"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tag">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="c"/>
+ <xs:element ref="em"/>
+ <xs:element ref="seealso"/>
+ <xs:element ref="url"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="item">
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="inline"/>
+ <xs:element ref="block"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <!-- References -->
+ <xs:element name="seealso">
+ <xs:complexType mixed="true">
+ <xs:attribute name="marker" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="url">
+ <xs:complexType mixed="true">
+ <xs:attribute name="href" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="marker">
+ <xs:complexType>
+ <xs:attribute name="id" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- CodeInclude -->
+ <xs:element name="codeinclude" substitutionGroup="block">
+ <xs:complexType>
+ <xs:attribute name="file" use="required"/>
+ <xs:attribute name="tag" default=""/>
+ <xs:attribute name="type" default="none">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="erl"/>
+ <xs:enumeration value="c"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <!-- ErlEval -->
+ <xs:element name="erleval" substitutionGroup="block">
+ <xs:complexType>
+ <xs:attribute name="expr" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/comref.xsd b/lib/docbuilder/xsd/comref.xsd new file mode 100755 index 0000000000..61df4dd848 --- /dev/null +++ b/lib/docbuilder/xsd/comref.xsd @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.refs.xsd"/>
+ <xs:element name="comref">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element ref="com"/>
+ <xs:element ref="comsummary"/>
+ <xs:element ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="section"/>
+ <xs:element ref="funcs"/>
+ </xs:choice>
+ <xs:element ref="authors"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="com" type="xs:string"/>
+ <xs:element name="comsummary" type="xs:string"/>
+ <!--
+ `name' is used in common.refs.dtd and must therefore
+ be defined in each *ref. dtd
+ -->
+ <xs:element name="name" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/cref.xsd b/lib/docbuilder/xsd/cref.xsd new file mode 100755 index 0000000000..f1cbeddfff --- /dev/null +++ b/lib/docbuilder/xsd/cref.xsd @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.refs.xsd"/>
+ <xs:element name="cref">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element ref="lib"/>
+ <xs:element ref="libsummary"/>
+ <xs:element ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="section"/>
+ <xs:element ref="funcs"/>
+ </xs:choice>
+ <xs:element ref="authors"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="lib" type="xs:string"/>
+ <xs:element name="libsummary" type="xs:string"/>
+ <!--
+ `name' is used in common.refs.dtd and must therefore
+ be defined in each *ref. dtd
+ -->
+ <xs:element name="name">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ret"/>
+ <xs:element ref="nametext"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ret" type="xs:string"/>
+ <xs:element name="nametext" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/erlref.xsd b/lib/docbuilder/xsd/erlref.xsd new file mode 100755 index 0000000000..f6011b7bea --- /dev/null +++ b/lib/docbuilder/xsd/erlref.xsd @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.refs.xsd"/>
+ <xs:element name="erlref">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element ref="module"/>
+ <xs:element ref="modulesummary"/>
+ <xs:element ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="section"/>
+ <xs:element ref="funcs"/>
+ </xs:choice>
+ <xs:element ref="authors"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="module" type="xs:string"/>
+ <xs:element name="modulesummary" type="xs:string"/>
+ <!--
+ `name' is used in common.refs.dtd and must therefore
+ be defined in each *ref. dtd
+ -->
+ <xs:element name="name" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/fascicules.xsd b/lib/docbuilder/xsd/fascicules.xsd new file mode 100755 index 0000000000..bfdb5bd604 --- /dev/null +++ b/lib/docbuilder/xsd/fascicules.xsd @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Structure -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="fascicules">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="fascicule"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="fascicule">
+ <xs:complexType mixed="true">
+ <xs:attribute name="file" use="required"/>
+ <xs:attribute name="href" use="required"/>
+ <xs:attribute name="entry" default="no">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes"/>
+ <xs:enumeration value="no"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/fileref.xsd b/lib/docbuilder/xsd/fileref.xsd new file mode 100755 index 0000000000..8038f2115f --- /dev/null +++ b/lib/docbuilder/xsd/fileref.xsd @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.refs.xsd"/>
+ <xs:element name="fileref">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element ref="file"/>
+ <xs:element ref="filesummary"/>
+ <xs:element ref="description"/>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="section"/>
+ <xs:element ref="funcs"/>
+ </xs:choice>
+ <xs:element ref="authors"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <!-- Note: ELEMENT file is already defined -->
+ <xs:element name="filesummary" type="xs:string"/>
+ <!--
+ `name' is used in common.refs.dtd and must therefore
+ be defined in each *ref. dtd
+ -->
+ <xs:element name="name" type="xs:string"/>
+</xs:schema>
diff --git a/lib/docbuilder/xsd/part.xsd b/lib/docbuilder/xsd/part.xsd new file mode 100755 index 0000000000..30d6ec0120 --- /dev/null +++ b/lib/docbuilder/xsd/part.xsd @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:include schemaLocation="common.xsd"/>
+ <xs:include schemaLocation="common.header.xsd"/>
+ <xs:element name="part">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="header"/>
+ <xs:element minOccurs="0" ref="description"/>
+ <xs:element maxOccurs="unbounded" ref="include"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="description">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="block"/>
+ <xs:element ref="quote"/>
+ <xs:element ref="br"/>
+ <xs:element ref="marker"/>
+ <xs:element ref="warning"/>
+ <xs:element ref="note"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="include">
+ <xs:complexType>
+ <xs:attribute name="file" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
|