rfm@gnu.org
)Version: 1.0.3
Date: 6 Nov, 2006
This documents the GNUstep Documentation markup language.
Copyright: (C) Free Software Foundation, Inc.
The GNUstep documentation markup language (GSDoc) is an XML language designed specifically for writing documentation for the GNUstep project. In practice, that means that it is designed for writing about software, and in particular, for writing about Objective-C classes.
This document itself is an example, as well as a test case, of GSDoc itself.
There are several reasons for producing the new markup language -
So, with only one markup language available that supported Objective-C, and with XML software becoming available, the decision was to take GDML and update it to be an XML language, in the hope that this would -
The GSDoc markup language is defined by an SGML DTD, that specifies
the tags that may be used in marking up a GSDoc document, and how
and where those tags may be placed. The reader is encouraged to
consult the DTD directly on any points that the present document leaves
unclear. The DTD is stored under
GNUSTEP_SYSTEM_LIBRARY/DTDs
in a standard
GNUstep installation. .. where GNUSTEP_SYSTEM_LIBRARY is defined in
the GNUstep configuration file (GNUstep.conf).
The gsdoc DTD defines an XML language - that is, a markup language that conforms to a specific subset of SGML features defined as XML. The advantage of XML is that it provides most of the useful features of SGML while being much more light-weight (easy to use) because you can forget about the rest of SGML. As XML looks set to become increasingly popular, we can hope that documentation written with an XML language will be easily imported into XML software tools as they become available, so we will not (in the GNUstep project) need to devote a lot of time and effort to maintaining documentation tools.
A GSDoc document consists of a head and a body wrapped inside the overall document framework that looks like this -
<?xml version="1.0"?> <!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.2//EN" "http://www.gnustep.org/gsdoc-1_0_2.xml"> <gsdoc base="MyDoc" prev="First" next="Last" up="Overview"> <head> ... your document head here </head> <body> ... your document body here </body> </gsdoc>
The above example shows a GSDoc document framework. The first line specifies the XML version that the document conforms to. The second line specifies the version of GSDoc that the document conforms to. The third and final lines frame the main part of the document and supply all the (optional) attributes of the gsdoc element -
base
prev
next
up
The document head contains information about the document as a whole: its title, authors, version, modification date, copyright, and perhaps an abstract of its contents. The title is the only part of the document head that must be present, although at least one author is strongly encouraged.
<head> <title>GNUstep Documentation XML markup language (GSDoc)</title> <author name="Richard Frith-Macdonald"> <email address="rfm@gnu.org"/> <url url="http://www.gnustep.org/developers/whoiswho.html"/> <desc> A person who devotes far too much time to GNUstep development. </desc> </author> <version>0.1</version> <date>4 march, 2000</date> <abstract> This documents the GNUstep Documentation markup language and tools </abstract> <copy>Free Software Foundation, Inc.</copy> </head>
The above example shows all the elements possible in a document head. Only title is required (author is strongly encouraged), but if present they must occur in the order shown -
<title>
<author>
<version>
<date>
<abstract>
<copy>
The document body contains the main part of the document, it consists of an optional front part (for contents pages, overview etc), a sequence of any number of chapters, and an optional back part (for indexes, appendices etc). Normally, each of these three parts of the document would be expected to have their own separate page numbering schemes.
<body> <front> <contents/> <chapter> <heading>Preface</heading> <p> Here is an introductory chapter for a dummy document. </p> </chapter> </front> <chapter> <heading>Main text</heading> <p> Here is the main text of a chapter in the document. </p> </chapter> <back> <chapter> <heading>Afterword</heading> <p> And after the main part of the doucment we can have some other stuff. </p> </chapter> <index type="class"/> </back> </body>
The above example shows all the elements possible at the top level in a document body -
<front>
The <contents>
subelement is used as a marker
to specify that an automatically generated contents page (listing
the chapters in the document) is to be inserted.
<chapter>
<back>
The <index>
element is used as a marker to
specify that an automatically generated index is to be inserted.
See below
for details.
The allowable elements in GSDoc documents are described below, broken into sections by usage context.
Sectioning elements define hierarchical document structure.
<chapter>
<section>
chapter
. It contains
sub-sections
where a chapter would
contain sections.
<subsection>
section
.
<subsubsection>
subsection
.
<heading>
Block elements can occur at the top level of sections, as well is in certain other contexts. The block elements are -
<embed>
<example>
<index>
<index>
tag is special in that it is
dynamically expanded during output based on information that has
been collated from reading in various documentation and source
files. The type
attribute of the index specifies
what sort of item is to be in the index - the default type of
label
causes an index of all label and
entry elements to be generated. Currently the allowable
types are: class
, category
,
protocol
, method
,
ivariable
, function
, type
,
macro
, variable
, constant
,
label
, title
, EOModel
(associated with the Enterprise Objects Framework, for interacting
with databases), EOEntity
. The default is
"label
".
The <index>
element also takes three optional
attributes -
scope
file
" scope), or for the whole of the current
project ("project
" scope), or for everything the
software can find ("global
" scope). In certain
contexts the specified scope is automatically overridden ... if
the document is processed in a standalone manner, the scope is
always "file
". For method or ivariable indexing,
if the index is inside a class, protocol, or category, only
indexes for that unit are generated.
style
normal
" style) or in a minimalist style suitable
for, e.g., a navigation bar ("bare
" style).
target
target
" attribute to the <a>
href="..."
element generated for a link. In most cases
this can safely be left out.
Text elements can occur within blocks and typically within
other block elements such as
example
as well. They carry
out various presentation-related purposed.
The text elements are -
<p>
<br>
<example>
<footnote>
<code>
<em>
<strong>
<file>
<ivar>
<var>
<site>
(text)
List elements can occur within blocks and typically within
other block elements such as
example
as well. They support
presentation of various types of lists.
The list elements are -
<list>
<item>
tag.
<enum>
<item>
tags).
<deflist>
<term>
and <desc>
tags.
<dictionary>
<dictionaryItem>
tags each with
a required key
attribute and an optional
value
attribute. If this is excluded, the element
content, which may be any
block element
(including
another <dictionary>
tag) is the value.
<qalist>
<question>
s and
<answer>
s.
Cross-reference elements can occur within blocks and typically anywhere text elements can occur. They represent references to other entities inside or outside the project being documented. In output formats that support it, they are generally transformed into hyperlinks. The cross-reference elements are -
<ref>
type
class
,
category
, protocol
, method
,
ivariable
, function
, type
,
macro
, variable
, constant
,
label
, EOModel
, EOEntity
.
If type
is not specified, "label
" is
assumed.
id
label
references, this is the id
attribute of the label
being referenced.
class
method
is being referenced,
the class
attribute should be specified as well, and
should contain the name of the class the method occurs in, in one
of the following formats: "classname", "classname(categoryname)",
or "(protocolname)".
<prjref>
<prjref>
tag may contain text content,
which appears in the output.
<uref>
<A>
tag in HTML, except that the attribute
'url
' is used for the URL rather than
'href
'. Text contents are shown in the output to label
the hyperlink.
<url>
<uref>
except the URL itself is
automatically used as the hyperlink label (and so the tag itself does
not have text content).
<email>
mailto:
link.
<entry>
id
, which may be used to
refer to the entry. (If it is absent any text content is taken to
be the id.)
<label>
id
, which may be used to
refer to the label. (If it is absent any text content is taken to
be the id.)
Definition elements are specialized elements for software
documentation. They can occur in most places that block elements
can occur. They represent specific Objective-C elements, and are
formatted specially in output. In the majority of cases, you will
not need to write GSDoc using these elements, since they can be
autogenerated from Objective-C source files and special comments
within them. Most of the elements representing parts of the API
have optional attributes ovadd, ovdep and ovrem which may be used to
specify the OpenStep/OPENSTEP/MacOS-X versions at which the
documented element was added to, deprecated in, or removed from
the API, Similarly they have gvadd, gvdep and gvrem which may be
used to specify when an elment was added to or removed from
the API of the source code being documented
(eg a gnustep library).
The definition elements are -
<class>
name
attribute
is required for this element - it is the name of the class. The
super
attribute is normally necessary to provide the
name of the superclass.
The elements in a <class>
are - an optional
declared
element,
zero or more conform
elements,
an optional desc
,
zero or more ivariable
elements,
zero or more method
elements.
<category>
name
attribute providing the name of the category,
and a class
attribute naming the class the category
is associated with.
The elements in a <category>
are - an optional
declared
element,
zero or more conform
elements,
an optional desc
,
zero or more method
elements.
<protocol>
name
attribute providing the name of the protocol.
The elements in a <protocol>
are - an optional
declared
element,
zero or more conform
elements,
an optional desc
,
zero or more method
elements.
<function>
name
attribute providing the function's name and a
type
attribute providing the return type.
The elements in a <function>
are -
a series of zero or more arg
elements,
followed by an optional arg
element,
then an optional declared
element,
an optional desc
.
<macro>
name
attribute providing the macro's name.
The elements in a <macro>
are -
a series of zero or more arg
elements,
followed by an optional arg
element,
then an optional declared
element,
an optional desc
.
<type>
name
attribute providing the macro's name.
The elements in a <macro>
are -
an optional declared
element,
an optional desc
.
<constant>
name
and type
attributes and a
value
attribute is optional. In addition, an
Objective-C role for the constant may be specified using the
role
attribute. Acceptable values for this attribute
are: "except
", "defaults
",
"notify
", or "key
".
The elements in a <constant>
are -
an optional declared
element,
an optional desc
.
<variable>
name
and type
attributes and a
value
attribute is optional.
The elements in a <variable>
are -
an optional declared
element,
an optional desc
.
<ivariable>
name
and type
attributes and a
validity
attribute optionally specifies the access
level for the variable (may be "public
",
"protected
", or "private
", the default
is "public
").
The elements in a <variable>
are -
an optional desc
.
<desc>
<conform>
<declared>
<method>
type
attribute describes the return type; an optional
factory
attribute ("yes
" or
"no
", defaults to "no
") specifies whether
this is a class or instance method. (Class methods are typically
only used for construction purposes in Objective-C.) An optional
init
attribute (also taking
"yes
" / "no
") specifies whether this is
the designated constructor. An optional override
attribute specifies whether this method should be overridden.
If it must be overridden enter "subclass
",
if it must not be overridden enter never
",
if it is an empty/dummy implementation which is intended to be
overridden enter dummy
, otherwise (for most methods
which may be but are not particularly designed to be overridden)
leave this attribute unset.
The elements in a <method>
are -
the method's name (in a sel
element), the
method's arguments (a sequence of arg
then
sel
,arg
pairs, then an
optional vararg
element),
followed by an optional desc
,
zero or more ivariable
elements,
zero or more method
elements.
<sel>
<arg>
type
attribute giving the argument's type.
<vararg>