updated readme, add comments to parse_apidoc.pl, make parse_devedge_doc.pl exit on startup, remove zpidoc.xml (it's in mozilla.org/projects/apidoc)

This commit is contained in:
rginda%netscape.com 2000-03-03 19:59:54 +00:00
Родитель a442830fd9
Коммит 3aadf08ddb
4 изменённых файлов: 69 добавлений и 545 удалений

Просмотреть файл

@ -1,17 +1,17 @@
DESCRIPTION:
APIDOC tool source.
Generates HTML API documentation from an xml source.
--
FILES:
===* parse_devedge_doc.pl
Requires:
nothing.
Description:
Parses the nasty devedge document (jsref.htm) into somewhat nicer xml.
Syntax:
perl parse_devedge_doc.pl < jsref.htm > jsref.xml
===* parse_apidoc.pl
Syntax:
perl parse_apidoc.pl jsref.xml [<output-directory>]
Requires:
XML::Parser (http://search.cpan.org/search?dist=XML-Parser)
@ -21,7 +21,24 @@ Description:
specified. Output pages with content will refer to api-content.css, table
of content pages will refer to api-toc.css.
See Also:
http://www.mozilla.org/projects/apidoc
===* parse_devedge_doc.pl
Syntax:
perl parse_apidoc.pl jsref.xml [<output-directory>]
perl parse_devedge_doc.pl < jsref.htm > jsref.xml
Requires:
nothing.
Description:
Parses the nasty devedge document (jsref.htm) into somewhat nicer xml.
The XML source, jsref.xml, located at
http://www.mozilla.org/js/apidoc/jsapi.xml is now the authoritative place to
make changes.
This file should be considered dead. Do not use it. It is here for emergency
use only.
REPEAT: DO NOT USE THIS SCRIPT!

Просмотреть файл

@ -1,530 +0,0 @@
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes'?>
<!DOCTYPE api>
<!--
- The contents of this file are subject to the Mozilla Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- 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 Original Code is the Netscape security libraries.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1994-2000 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Robert Ginda <rginda@netscape.com>
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU General Public License Version 2 or later (the
- "GPL"), in which case the provisions of the GPL are applicable
- instead of those above. If you wish to allow use of your
- version of this file only under the terms of the GPL and not to
- allow others to use your version of this file under the MPL,
- indicate your decision by deleting the provisions above and
- replace them with the notice and other provisions required by
- the GPL. If you do not delete the provisions above, a recipient
- may use your version of this file under either the MPL or the
- GPL.
-->
<API id='APIDOC Namespace'>
<ENTRY id=".Overview">
<SUMMARY>
The <S>APIDOC</S> namespace provides a way of describing an API
in XML.
</SUMMARY>
<DESCRIPTION>
<S>APIDOC</S> is an XML based API documentation system which allows the
document writer to create document content using a set
of logical tags in an XML file. A perl script, <S>parse_apidoc.pl</S>,
processes the source XML, and generates a collection of HTML files
suitable for web publishing.
<P/>
The set of tags available in <S>APIDOC</S> is very small compared to HTML,
and can be broken down into three groups. These are <S>Organizational</S>,
<S>Formatting</S>, and <S>Other</S>. <S>Organizational</S> tags are
logical sections of an API document, such as an <C>ENTRY</C>, a
<C>DESCRIPTION</C> or an <C>EXAMPLE</C>. <S>Formatting</S> tags provide
a set of basic format control tags, such as <B><C>B</C></B> and
<I><C>I</C></I>, as well as intelligent tags like <C>C</C> and
<C>S</C> which automatically create links to other <C>ENTRY</C>s or
external documents. The group of tags classified as <S>Other</S> don't
fit into either of the other two categories, but don't warrent a group
of their own.
<P/>
See the <S>README</S> for instructions on how to run APIDOC.
</DESCRIPTION>
<NOTE>
Tags and attributes <B>are</B> case sensitive. In <S>APIDOC</S>, all
tag names are in UPPERCASE, and all attribute names are
lowercase.
<P/>
The document you are reading was created with <S>APIDOC</S>, see
http://www.mozilla.org/projects/apidoc/<S>apidoc.xml</S> for the
source.
<P/>
<S>APIDOC</S> was originally written to allow engineers in the JavaScript
group at Netscape to maintain their own documentation on the JavaScript
Embedding API. That document is available from the
<S>JavaScript Page</S> on
<S>mozilla.org</S>
</NOTE>
</ENTRY>
<ENTRY id="API">
<TYPE value="Organizational"/>
<SUMMARY>
Container for all other tags.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;API id="..." version="..."&gt;]]>
. . .
<![CDATA[&lt;/API&gt;]]>
<PARAM name="id" type="string">
Identifier for the API.
</PARAM>
<PARAM name="version" type="number">
The <S>APIDOC</S> version expected by the contained tags. Currently
this attribute is ignored.
</PARAM>
</SYNTAX>
<DESCRIPTION>
The <C>API</C> tag is the top level container for all other tags. It is
analogous to the HTML tag in used in HTML documents. Unlike in HTML,
if tags appear outside of the <C>API</C> tag, the file will fail to
parse.
</DESCRIPTION>
</ENTRY>
<ENTRY id="ENTRY">
<TYPE value="Organizational"/>
<SUMMARY>
An entrypoint in the API.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;ENTRY id="..."&gt;]]>
. . .
<![CDATA[&lt;/ENTRY&gt;]]>
<PARAM name="id" type="string">
Identifier for the entrypoint.
</PARAM>
</SYNTAX>
<DESCRIPTION>
The <C>ENTRY</C> tag declares an API entrypoint you wish to document.
It serves as the container for most other <S>Organizational</S> tags.
Entries can be referenced in <C>SEEALSO</C> tags. If text appearing
in a <C>C</C> tag, is also an <C>ENTRY</C>, a link will be created.
</DESCRIPTION>
</ENTRY>
<ENTRY id="TYPE">
<TYPE value="Organizational"/>
<SUMMARY>
Indicates the type of an <C>ENTRY</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;TYPE value="..."/&gt;]]>
<PARAM name="value" type="string">
Type of the entry.
</PARAM>
</SYNTAX>
<DESCRIPTION>
The value attribute should be used to describe the <C>ENTRY</C>s
type. For example, documentation on a C based API may use 'Macro',
'Data Structure' and 'Function' as types, while this document
uses '<S>Organizational</S>', '<S>Formatting</S>', and '<S>Other</S>'
as type names.
<P/>
When a <C>TYPE</C> tag is encountered, a new <C>GROUP</C>
is created (if it doesn't already exist), and the <C>ENTRY</C> which
contains the <C>TYPE</C> tag is added to that group. In addition,
the new <C>GROUP</C> is automatically added to the 'Groups' portion of
'See Also' for that <C>ENTRY</C>.
</DESCRIPTION>
</ENTRY>
<ENTRY id="SUMMARY">
<TYPE value="Organizational"/>
<SUMMARY>
A brief summary for the <C>ENTRY</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;SUMMARY&gt;]]>
. . .
<![CDATA[&lt;/SUMMARY&gt;]]>
</SYNTAX>
<DESCRIPTION>
Gives the user a brief overview of the <C>ENTRY</C>'s purpose. See the
'Sumamry' of this entry for an example.
</DESCRIPTION>
</ENTRY>
<ENTRY id="SYNTAX">
<TYPE value="Organizational"/>
<SUMMARY>
Syntax for using the <C>ENTRY</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;SYNTAX&gt;]]>
. . .
<![CDATA[&lt;/SYNTAX&gt;]]>
</SYNTAX>
<DESCRIPTION>
Shows the user an abstract use of the <C>ENTRY</C>. <C>PARAM</C>
tags can be contained by the <C>SYNTAX</C> tag to further illustrate
parameters. Text inside <C>SYNTAX</C> tags will be rendered in a
monospace font using the PRE HTML tag. Leading spaces in the text
contained in a <C>SYNTAX</C> tag are converted to <![CDATA[&amp;nbsp;]]>
entities. Use the <C>EXAMPLE</C> tag for concrete examples.
</DESCRIPTION>
</ENTRY>
<ENTRY id="PARAM">
<TYPE value="Organizational"/>
<SUMMARY>
Description for a paramater used by the <C>ENTRY</C>
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;PARAM name="..." type="..."&gt;]]>
. . .
<![CDATA[&lt;/PARAM&gt;]]>
<PARAM name="name" type="string">
The name of the parameter.
</PARAM>
<PARAM name="type" type="string">
The data type of the parameter.
</PARAM>
</SYNTAX>
<DESCRIPTION>
Used to describe a parameter used by the <C>ENTRY</C>. <C>PARAM</C>
tags can only be contained inside <C>SYNTAX</C> tags. Multiple
<C>PARAM</C> tags can appear in a <C>SYNTAX</C> tag (typically one
for each parameter). <C>PARAM</C> tags will be displayed in the
order they appear.
</DESCRIPTION>
<EXAMPLE>
<![CDATA[&lt;PARAM name="name" type="string"&gt;
The name of the parameter.
&lt;/PARAM&gt;
&lt;PARAM name="type" type="string"&gt;
The data type of the parameter.
&lt;/PARAM&gt;]]>
</EXAMPLE>
</ENTRY>
<ENTRY id="RETVAL">
<TYPE value="Organizational"/>
<SUMMARY>
Description for the return value of the <C>ENTRY</C>
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;RETVAL [name="..."] type="..."&gt;]]>
. . .
<![CDATA[&lt;/RETVAL&gt;]]>
<PARAM name="name" type="string">
Optional. The name of the return value.
</PARAM>
<PARAM name="type" type="string">
The data type of the return value.
</PARAM>
</SYNTAX>
<DESCRIPTION>
<C>RETVAL</C> works exactly like the <C>PARAM</C> tag, with the
exception that the <C>name</C> attribute is optional. If
<C>name</C> is omitted, it defaults to the string "Return Value".
</DESCRIPTION>
</ENTRY>
<ENTRY id="DESCRIPTION">
<TYPE value="Organizational"/>
<SUMMARY>
Long description for the <C>ENTRY</C>
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;DESCRIPTION&gt;]]>
. . .
<![CDATA[&lt;/DESCRIPTION&gt;]]>
</SYNTAX>
<DESCRIPTION>
Contains a long description of the <C>ENTRY</C>. Literal HTML can
be included using a
<C><![CDATA[&lt;]]>![CDATA[ . . . ]]<![CDATA[&gt;]]></C> tag. The CDATA
'trick' can actually be used inside any <S>APIDOC</S> tag, but is most
useful for <C>DESCRIPTION</C>s.
</DESCRIPTION>
</ENTRY>
<ENTRY id="EXAMPLE">
<TYPE value="Organizational"/>
<SUMMARY>
An example usage the <C>ENTRY</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;EXAMPLE desc="..."&gt;]]>
. . .
<![CDATA[&lt;/EXAMPLE&gt;]]>
<PARAM name="desc" type="string">
Short description of what the example shows.
</PARAM>
</SYNTAX>
<DESCRIPTION>
Contains a "real world" example of the <C>ENTRY</C> being used.
As with the <C>SYNTAX</C> tag text inside <C>EXAMPLE</C> tags will
be rendered in a monospace font, and leading spaces are significant.
The desc attribute can be used to provide a short caption for the
example.
</DESCRIPTION>
</ENTRY>
<ENTRY id="NOTE">
<TYPE value="Organizational"/>
<SUMMARY>
Important notes about the <C>ENTRY</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;NOTE&gt;]]>
. . .
<![CDATA[&lt;/NOTE&gt;]]>
</SYNTAX>
<DESCRIPTION>
Contains notes about the entry that should stand out from the
description for one reason or another. If an entry is deprecated,
the <C>NOTES</C> section would be a good place to explain why.
</DESCRIPTION>
</ENTRY>
<ENTRY id="SEEALSO">
<TYPE value="Organizational"/>
<SUMMARY>
Associate one <C>ENTRY</C> with another.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;SEEALSO value="..."/&gt;]]>
<PARAM name="value" type="ENTRY id">
The <C>id</C> of a related <C>ENTRY</C>.
</PARAM>
</SYNTAX>
<DESCRIPTION>
Associates one entry with another. Multiple <C>SEEALSO</C> tags
can appear in an <C>ENTRY</C>. Using an entry in a <C>C</C> tag
creates a <C>SEEALSO</C> tag for it automatically. The
<C>EXTERNALREF</C> tag can be used to attach references to external
documents to entries.
</DESCRIPTION>
</ENTRY>
<ENTRY id="DEPRECATED">
<TYPE value="Organizational"/>
<SUMMARY>
Marks an <C>ENTRY</C> as deprecated.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;DEPRECATED/&gt;]]>
</SYNTAX>
<DESCRIPTION>
Marking an entry as <C>DEPRECATED</C> tells would-be users that
the use of that <C>ENTRY</C> is not advised. Further information
can be placed in the <C>DESCRIPTION</C> or <C>NOTE</C> tag. Marking
an entry as <C>DEPRECATED</C> automaticall makes it a member of the
'Deprecated' <C>GROUP</C>.
</DESCRIPTION>
</ENTRY>
<ENTRY id="EXTERNALREF">
<TYPE value="Other"/>
<SUMMARY>
An external source with more information about the API.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;EXTERNALREF name="..." value="..."/&gt;]]>
<PARAM name="name" type="string">
A text description of the reference.
</PARAM>
<PARAM name="value" type="URL">
The URL for the reference.
</PARAM>
</SYNTAX>
<DESCRIPTION>
<C>EXTERNALREF</C>s will be added to the 'See Also' portion of
an <C>ENTRY</C>. If an <C>EXTERNALREF</C> appears as a child of the
<C>API</C> tag, and the value of the URL contains the characters
'{e}', the reference will be attached to every entry, and the
<C>ENTRY</C>s <C>id</C> will be substitued in for '{e}'. If '{e}' does
not appear in the value attribute, <S>APIDOC</S> assumes that this
<C>EXTERNALREF</C> applies to the API as a whole, and only lists it in
the table of contents.
<P/>
If an <C>EXTERNALREF</C> appears as a child
of an <C>ENTRY</C> tag, it will only appear in that <C>ENTRY</C>s
'See Also' section.
<P/>
Multiple <C>EXTERNALREF</C> tags can appear as children of both
<C>API</C> and <C>ENTRY</C> tags.
</DESCRIPTION>
</ENTRY>
<ENTRY id="GROUP">
<TYPE value="Organizational"/>
<SUMMARY>
Includes an <C>ENTRY</C> in a group.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;GROUP name="..." [value="..."]/&gt;]]>
<PARAM name="name" type="string">
The name of the group.
</PARAM>
<PARAM name="value" type="ENTRY id">
The <C>id</C> of the <C>ENTRY</C> to add to the group. Optional
(and ignored) if the <C>GROUP</C> tag appears as a child of
an <C>ENTRY</C> tag, in which case the <C>id</C> of the containing
<C>ENTRY</C> is used.
</PARAM>
</SYNTAX>
<DESCRIPTION>
For each unique <C>GROUP</C> name appearing in the API, a subheading
will appear in the Table of Contents, listing each member of the
<C>GROUP</C>. Multiple <C>GROUP</C> tags can appear as children of
the <C>API</C> tag. The <C>GROUP</C> tag can appear as a child of
either the <C>API</C> tag, or an <C>ENTRY</C> tag. When a <C>GROUP</C>
is parented directly by the <C>API</C> tag, both <C>name</C> and
<C>value</C> attributes must be specified. When a <C>GROUP</C> tag
is parented by an <C>ENTRY</C> tag, the <C>id</C> of the containing
<C>ENTRY</C> is used in place of the <C>value</C> attribute.
<P/>
Marking an item as <C>DEPRECATED</C> automatically makes it a member
of the <C>group</C> named 'Deprecated'. Using the <C>TYPE</C> tag
in a n <C>ENTRY</C> automatically makes the <C>ENTRY</C> a member of
a group of the same name as given in the <C>value</C> attribute of
the <C>TYPE</C>
</DESCRIPTION>
</ENTRY>
<ENTRY id="C">
<TYPE value="Formatting"/>
<SUMMARY>
Marks text as code.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;C&gt;foo&lt;/C&gt;]]>
</SYNTAX>
<DESCRIPTION>
Any text contained in a <C>C</C> tag will appear in a monospace
font, rendered using the CODE HTML tag. In addition, if the text is a
<C>ENTRY</C> <C>id</C> (but not the current <C>ENTRY</C>), a link will
be created to the <C>ENTRY</C> in the text, and a <C>SEEALSO</C> tag
will be generated.
<P/>
For example, all of the links in this body of text
were generated by wrapping the plain text in a <C>C</C>
tag. <S>APIDOC</S>
checks to see of the contained text is a valid <C>ENTRY</C>, and if so,
assumes that's what you were talking about. If the contained text is
not a valid <C>ENTRY</C>, or it is the <B>current</B> entry, the text
is rendered in a HTML CODE container, and no links are generated.
</DESCRIPTION>
</ENTRY>
<ENTRY id="P">
<TYPE value="Formatting"/>
<SUMMARY>
Marks the beginning of a new paragraph.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;P/&gt;]]>. . .
</SYNTAX>
<DESCRIPTION>
Marks the start of a new paragraph. Unlike in HTML, <C>P</C> tags
are not containers. That is, the only valid <C>P</C> tag is the one
shown here.
</DESCRIPTION>
</ENTRY>
<ENTRY id="B">
<TYPE value="Formatting"/>
<SUMMARY>
Marks text as bold.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;B&gt;foo&lt;/B&gt;]]>
</SYNTAX>
<DESCRIPTION>
Any text contained in a <C>B</C> tag will appear bold. This tag
functions exactly like the B tag in HTML.
</DESCRIPTION>
</ENTRY>
<ENTRY id="I">
<TYPE value="Formatting"/>
<SUMMARY>
Marks text as italic.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;I&gt;foo&lt;/I&gt;]]>
</SYNTAX>
<DESCRIPTION>
Any text contained in a <C>I</C> tag will appear in italics. This tag
functions exactly like the I tag in HTML.
</DESCRIPTION>
</ENTRY>
<ENTRY id="S">
<TYPE value="Formatting"/>
<SUMMARY>
Creates an inline link to an <C>EXTERNALREF</C> or <C>GROUP</C>.
</SUMMARY>
<SYNTAX>
<![CDATA[&lt;S&gt;. . .&lt;/S&gt;]]>
</SYNTAX>
<DESCRIPTION>
If the text wrapped in an <C>S</C> tag is a valid <C>GROUP</C>
(including a <C>GROUP</C> implied by a <C>TYPE</C> or <C>DEPRECATED</C>
tag) a link to the referenced group will be created in addition to the
text. If instead, the text matches a valid <C>EXTERNALREF</C> tag, a
link to the external reference will be created.
<P/>
In both cases, an appropriate entry is added to the <C>ENTRY</C>s 'See
Also' section.
</DESCRIPTION>
<NOTE>
If the text contained by an <C>S</C> tag does not match any <C>GROUP</C>
or <C>EXTERNALREF</C>, the parse will fail.
</NOTE>
</ENTRY>
<!--
<ENTRY id='api-toc.css'>
<TYPE value="Files"/>
<SUMMARY>
CSS file referenced by generated Table of Contents pages
</SUMMARY>
<DESCRIPTION>
The following styles are referenced by generated Table of Contents pages:
<![CDATA[
<table><tr><th>className</th><th>Description</th></tr>
<tr><td>toc-title</td><td>"Alphabetical Listing" and "Grouped Listing" titles</td></tr>
<tr><td>toc-abc</td><td>Alphabetical listing table.</td></tr>
<tr><td>toc-group-even</td><td>Even groups</td></tr>
<tr><td>toc-group-odd</td><td>Odd groups</td></tr>
-->
<EXTERNALREF name="parse_apidoc.pl"
value="http://bonsai.mozilla.org/cvsquery.cgi?file=mozilla/webtools/apidoc/"/>
<EXTERNALREF name="APIDOC"
value="http://www.mozilla.org/projects/apidoc/"/>
<EXTERNALREF name="apidoc.xml"
value="http://www.mozilla.org/projects/apidoc/apidoc.xml"/>
<EXTERNALREF name="JavaScript Page" value="http://www.mozilla.org/js"/>
<EXTERNALREF name="mozilla.org" value="http://www.mozilla.org"/>
</API>

Просмотреть файл

@ -93,9 +93,17 @@ my @CODE_TAGS = ($TAGS[$SYNTAX], $TAGS[$EXAMPLE]);
my $URLVAR_ENTRY = "{e}";
my $footstr = "<center>This page was generated by " .
"<a href='www.mozilla.org/projects/apidoc'><b>APIDOC</b></a>" .
"<a href='http://www.mozilla.org/projects/apidoc' target='other_window'>" .
"<b>APIDOC</b></a>" .
"</center>\n</body></html>";
my $WARNING = "<!--\n" .
" -- HEADS UP! This page was *GENERATED* by APIDOC,\n".
" -- DO NOT EDIT THIS FILE BY HAND!\n" .
" -- See http://www.mozilla.org/projects/apidoc for information on APIDOC\n" .
" -- The original source file was " . $file . "\n" .
" -->\n";
my $JS_COMPLETE = ("\n<script>\n" .
"function navToEntry(entry) {\n" .
" window.document.location.hash=entry;\n" .
@ -271,6 +279,7 @@ sub p1_End {
}
sub StartTag {
# phase 2 open tag handler
my ($expat) = @_;
$_ =~ /<([^\s>]*)/;
my $lasttagname = $tagname;
@ -354,6 +363,7 @@ sub StartTag {
}
sub EndTag {
# phase 2 close tag handler
my ($expat) = @_;
my $iscontainer = 0;
$_ =~ /<\/([^\s>]*)/;
@ -516,6 +526,7 @@ sub EndDocument {
}
sub get_entry_html {
# get html for the current entry ($c)
my $html = "";
$c->{$TAGS[$ENTRY]} =~ /\.?(.*)/;
my $id = $1;
@ -607,6 +618,7 @@ sub get_entry_html {
}
sub get_seealso {
# get the see also section for the current entry ($c);
my @links;
my $k;
my $i;
@ -663,6 +675,7 @@ sub get_seealso {
sub add_entry_complete {
# add html for the current entry to the "complete" page
my ($html) = @_;
print COMPLETE "<a name='" . $c->{$TAGS[$ENTRY]} . "'></a>\n";
@ -671,6 +684,7 @@ sub add_entry_complete {
}
sub add_entry_sparse {
# add html for the current entry to a new "sparse" page
my ($html) = @_;
my $outfile = $outdir . "/api-" . $c->{$TAGS[$ENTRY]} . ".html";
@ -680,7 +694,7 @@ sub add_entry_sparse {
my $headstr = "<html><head><link rel=StyleSheet href='api-content.css' " .
"TYPE='text/css' MEDIA='screen'>" .
"<title>" . $c->{$TAGS[$ENTRY]} . "</title>" . $JS_SPARSE .
"</head><body bgcolor='white'>\n" .
"</head><body bgcolor='white'>\n$WARNING" .
"<h1 class='title'>$apiid Reference</h1>\n" . $user_head;
print SPARSE $headstr;
@ -693,6 +707,8 @@ sub add_entry_sparse {
}
sub write_toc_groups {
# Write the groups section of the toc to both the sparse and complete
# toc files
my @groups = sort(keys (%groups));
my $g;
my $even = 1;
@ -730,14 +746,19 @@ sub write_toc_groups {
}
sub add_toc_complete {
# add the current entry ($c) to the complete toc
print COMPLETE_TOC &add_toc(0);
}
sub add_toc_sparse {
# add the current entry ($c) to the sparse toc
print SPARSE_TOC &add_toc(1);
}
sub add_toc {
# add the current entry ($c) to the either the complete or sparse toc,
# based on the is_sparse parameter. Should only be called from
# add_toc_sparse or add_toc_complete.
my ($is_sparse) = @_;
my $html;
my $classsuffix = $c->{$TAGS[$DEPRECATED]} ? "-deprecated" : "";
@ -761,11 +782,14 @@ sub add_toc {
}
sub get_link {
# get a link for use in a content page. Works in both sparse and complete
# pages (because of the navToEntry call.)
my ($entry) = @_;
return ("<a href='javascript:navToEntry(\"$entry\");'>$entry</a>");
}
sub get_toc_link {
# get a link for use in a toc page.
my ($entry, $is_sparse, $class) = @_;
if ($is_sparse) {
@ -778,10 +802,10 @@ sub get_toc_link {
}
sub init_files {
# initialize the complete content and toc files.
my $headstr = "<html><head><link rel=StyleSheet href='api-content.css' " .
"TYPE='text/css' MEDIA='screen'><title>$apiid</title></head>" .
$JS_COMPLETE . "<body bgcolor='white'>\n" .
$JS_COMPLETE . "<body bgcolor='white'>\n$WARNING" .
"<h1 class='title'>$apiid Reference</h1>\n" . $user_head;
print COMPLETE $headstr;
@ -790,7 +814,7 @@ sub init_files {
("<html><head><link rel=StyleSheet href='api-toc.css' " .
"TYPE='text/css' MEDIA='screen'>" .
"<title>$apiid table of contents</title>" .
"</head>\n<body bgcolor='white'>\n" .
"</head>\n<body bgcolor='white'>\n$WARNING" .
"<h1 class='title'>$apiid Reference</h1><h4>Table of Contents</h4>\n" .
"<center><table class='toc-table' border='1' cellpadding='0' " .
"cellspacing='0' width='100%'>\n" .
@ -806,6 +830,7 @@ sub init_files {
}
sub close_files {
# finish up the complete content and toc files.
print COMPLETE $user_foot;
print COMPLETE $footstr;
@ -822,6 +847,8 @@ sub close_files {
}
sub add_leading_nbsp {
# replaces leading spaces with &nbsp; entities. Used for tags which
# contain code.
my ($str) = @_;
my $i;
my $pfx = "";

Просмотреть файл

@ -29,6 +29,14 @@
# file under either the NPL or the GPL.
#
# Parses the nasty devedge document (jsref.htm) into somewhat nicer xml.
# The XML source, jsref.xml, located at
# http://www.mozilla.org/js/apidoc/jsapi.xml is now the authoritative place to
# make changes.
# This file should be considered dead. Do not use it. It is here for emergency
# use only.
# REPEAT: DO NOT USE THIS SCRIPT!
my $API = 0;
my $ENTRY = 1;
my $TYPE = 2;
@ -57,6 +65,8 @@ my $NAMESPACE = ""; # "APIDOC";
my $TAB = " ";
my $indent_pfx = "";
die ("I said, dont use this script! Don't you read the comments?\n");
&parse_old_doc ();
sub parse_old_doc {