Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 12 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Showing with 359 additions and 152 deletions.
  1. +8 −0 doc/widlproc.html
  2. +74 −10 src/comment.c
  3. +11 −1 src/parse.c
  4. +266 −141 src/widlprocxmltohtml.xsl
View
8 doc/widlproc.html
@@ -232,6 +232,14 @@ <h4 id="api-feature">\api-feature</h4>
is used.
</p>
+<h4>\name</h4>
+
+<p>
+Declares a name for the document node associated with the current referral
+point. This is useful for the root document node that otherwise does not have
+a WebIDL identifier.
+</p>
+
<h4>\author</h4>
<p>
View
84 src/comment.c
@@ -29,6 +29,7 @@ struct cnode {
struct cnode *children;
struct cnode *parent;
const struct cnodefuncs *funcs;
+ const char *attrtext;
const char *filename;
unsigned int linenum;
};
@@ -466,6 +467,31 @@ static const struct cnodefuncs return_funcs = {
};
/***********************************************************************
+ * author_output : output name cnode
+ *
+ * Enter: cnode for root
+ * indent = indent (nesting) level
+ */
+static void
+name_output(struct cnode *cnode, unsigned int indent)
+{
+ printf("%*s<name>\n", indent, "");
+ outputchildren(cnode, indent, 1);
+ printf("%*s</name>\n", indent, "");
+}
+
+/***********************************************************************
+ * cnode type name
+ */
+static const struct cnodefuncs name_funcs = {
+ 0, /* !indesc */
+ 0, /* !needpara */
+ &default_askend,
+ 0, /* end */
+ &name_output,
+};
+
+/***********************************************************************
* author_output : output author cnode
*
* Enter: cnode for root
@@ -543,7 +569,10 @@ static void
code_output(struct cnode *cnode, unsigned int indent)
{
/* Note capitalization to differentiate it from HTML code element. */
- printf("%*s<Code>", indent, "");
+ if(cnode->attrtext)
+ printf("%*s<Code %s>", indent, "", cnode->attrtext);
+ else
+ printf("%*s<Code>", indent, "");
outputchildren(cnode, indent, 1);
printf("</Code>\n");
}
@@ -1150,7 +1179,7 @@ parseword(const char **pp)
*/
static const char *
dox_b(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
struct cnode *cnode = *pcnode;
const char *word = parseword(&p);
@@ -1172,7 +1201,7 @@ dox_b(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_n(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
struct cnode *cnode = *pcnode;
cnode = starthtmlcnode(cnode, HTMLELDESC_BR, 0, 0, filename, linenum);
@@ -1186,7 +1215,7 @@ dox_n(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_code(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
*pcnode = startpara(*pcnode, &code_funcs);
(*pcnode)->filename = filename;
@@ -1200,7 +1229,7 @@ dox_code(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_endcode(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
incode = 0;
*pcnode = endspecificcnode(*pcnode, &code_funcs, filename, linenum);
@@ -1212,7 +1241,7 @@ dox_endcode(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_param(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
struct cnode *cnode = *pcnode;
unsigned int inout = 0;
@@ -1256,7 +1285,7 @@ dox_param(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_para(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
*pcnode = startpara(*pcnode, type);
return p;
@@ -1267,7 +1296,7 @@ dox_para(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
*/
static const char *
dox_throw(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
- const char *filename, unsigned int linenum)
+ const char *filename, unsigned int linenum, const char *cmdname)
{
struct cnode *cnode = *pcnode;
const char *word;
@@ -1287,10 +1316,43 @@ dox_throw(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
}
/***********************************************************************
+ * Doxygen command handler : \lang
+ */
+static const char *
+dox_attr(const char *p, struct cnode **pcnode, const struct cnodefuncs *type,
+ const char *filename, unsigned int linenum, const char *cmdname)
+{
+ struct cnode *cnode = *pcnode;
+ const char *word;
+ int len, wordlen, offset = 0;
+ /* Get the next word as the attribute value. */
+ word = parseword(&p);
+ if (!word)
+ locerrorexit(filename, linenum, "expected word after \\%s", cmdname);
+
+ len = strlen(cmdname) + (wordlen = p-word) + 4; /* p="word"\0 */
+ if(cnode->attrtext)
+ len += (offset = strlen(cnode->attrtext)) + 1; /* add space for space */
+ char *attrtext = memalloc(len);
+ if(offset) {
+ memcpy(attrtext, cnode->attrtext, offset);
+ attrtext[offset++] = ' ';
+ memfree(((void*)cnode->attrtext));
+ }
+ offset += sprintf(&attrtext[offset], "%s=\"", cmdname);
+ memcpy(&attrtext[offset], word, wordlen);
+ strcpy(&attrtext[offset + wordlen], "\"");
+ cnode->attrtext = attrtext;
+ /* skip delimiter because it won't be done otherwise */
+ if(incode && iswhitespace(*p)) ++p;
+ return p;
+}
+
+/***********************************************************************
* commands : table of Doxygen commands
*/
struct command {
- const char *(*func)(const char *p, struct cnode **pcnode, const struct cnodefuncs *type, const char *filename, unsigned int linenum);
+ const char *(*func)(const char *p, struct cnode **pcnode, const struct cnodefuncs *type, const char *filename, unsigned int linenum, const char *cmdname);
const struct cnodefuncs *type;
unsigned int namelen;
const char *name;
@@ -1299,11 +1361,13 @@ static const struct command commands[] = {
{ &dox_throw, &def_api_feature_funcs, 15, "def-api-feature" },
{ &dox_throw, &def_api_feature_set_funcs, 19, "def-api-feature-set" },
{ &dox_para, &def_instantiated_funcs, 16, "def-instantiated" },
+ { &dox_para, &name_funcs, 4, "name" },
{ &dox_para, &author_funcs, 6, "author" },
{ &dox_b, 0, 1, "b" },
{ &dox_para, &brief_funcs, 5, "brief" },
{ &dox_code, 0, 4, "code" },
{ &dox_throw, &def_device_cap_funcs, 14, "def-device-cap" },
+ { &dox_attr, 0, 4, "lang" },
{ &dox_endcode, 0, 7, "endcode" },
{ &dox_n, 0, 1, "n" },
{ &dox_param, &param_funcs, 5, "param" },
@@ -1599,7 +1663,7 @@ parsecomment(struct comment *comment)
command++;
}
p = (*command->func)(p, &cnode, command->type,
- comment->filename, linenum);
+ comment->filename, linenum, command->name);
ch = *p;
starttext = p;
}
View
12 src/parse.c
@@ -507,7 +507,14 @@ static struct node *
parseextendedattribute(struct tok *tok)
{
struct node *node = newelement("ExtendedAttribute");
- addnode(node, newattr("name", setidentifier(tok)));
+ char *attrname = setidentifier(tok);
+ addnode(node, newattr("name", attrname));
+ const char *start = tok->prestart;
+ node->wsstart = start;
+ node->end = tok->start + tok->len;
+ if(!strcmp(attrname, "Constructor") || !strcmp(attrname, "NamedConstructor")) {
+ setcommentnode(node);
+ }
lexnocomment();
if (tok->type == '=') {
lexnocomment();
@@ -516,6 +523,7 @@ parseextendedattribute(struct tok *tok)
if (tok->type == '(') {
lexnocomment();
addnode(node, parseargumentlist(tok));
+ node->end = tok->start + tok->len;
eat(tok, ')');
}
return node;
@@ -1082,6 +1090,7 @@ parseenum(struct tok *tok, struct node *eal)
if (tok->type == TOK_STRING) {
const char *start = tok->prestart;
struct node *node2 = newelement("EnumValue");
+ setcommentnode(node2);
char *s;
s = memalloc(tok->len + 1);
memcpy(s, tok->start, tok->len);
@@ -1172,6 +1181,7 @@ struct node *
parse(void)
{
struct node *root = newelement("Definitions");
+ setcommentnode(root);
struct tok *tok = lexnocomment();
parsedefinitions(tok, root);
if (tok->type != TOK_EOF)
View
407 src/widlprocxmltohtml.xsl
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--====================================================================
-$Id$
+$Id: widlprocxmltohtml.xsl 407 2009-10-26 13:48:48Z tpr $
Copyright 2009 Aplix Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,18 +18,8 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="html"/>
<xsl:param name="date" select="'error: missing date'"/>
-<xsl:param name="requiredescriptive" select="1"/>
-
-<xsl:variable name="title" select="concat('The Bondi ',/Definitions/*[1]/@name,' Module - Version ',/Definitions/Module/descriptive/version)"/>
-
-<!-- section number of the Interfaces section. If there are typedefs, this is 3, otherwise 2 -->
-<xsl:variable name="interfaces-section-number">
- <xsl:choose>
- <xsl:when test="/Definitions/Module/Typedef">3</xsl:when>
- <xsl:otherwise>2</xsl:otherwise>
- </xsl:choose>
-</xsl:variable>
+<xsl:variable name="title" select="concat('The ',/Definitions/descriptive/name,' Module - Version ',/Definitions/descriptive/version)"/>
<!--Root of document.-->
<xsl:template match="/">
@@ -46,8 +36,8 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</html>
</xsl:template>
-<!--Module: a whole API.-->
-<xsl:template match="Module">
+<!--Root of Definitions.-->
+<xsl:template match="Definitions">
<div class="api" id="{@id}">
<a href="http://bondi.omtp.org"><img src="http://www.omtp.org/images/BondiSmall.jpg" alt="Bondi logo"/></a>
<h1><xsl:value-of select="$title"/></h1>
@@ -58,45 +48,76 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<xsl:apply-templates select="descriptive/author"/>
</ul>
- <p class="copyright"><small2009 OMTP Ltd. All rights reserved. OMTP and OMTP BONDI are registered trademarks of OMTP Ltd.</small></p>
+ <p class="copyright"><smallThe authors, 2012. All rights reserved.</small></p>
<hr/>
<h2>Abstract</h2>
<xsl:apply-templates select="descriptive/brief"/>
+ <xsl:apply-templates select="descriptive/description"/>
+ <xsl:apply-templates select="descriptive/Code"/>
<h2>Table of Contents</h2>
<ul class="toc">
- <li>1. <a href="#intro">Introduction</a>
+ <li><a href="#intro">Introduction</a>
<ul>
<xsl:if test="descriptive/def-api-feature-set">
- <li>1.1. <a href="#def-api-feature-sets">Feature set</a></li>
+ <li><a href="#def-api-feature-sets">Feature set</a></li>
</xsl:if>
<xsl:if test="descriptive/def-api-feature">
- <li>1.2. <a href="#def-api-features">Features</a></li>
+ <li><a href="#def-api-features">Features</a></li>
</xsl:if>
<xsl:if test="descriptive/def-device-cap">
- <li>1.3. <a href="#def-device-caps">Device Capabilities</a></li>
+ <li><a href="#def-device-caps">Device Capabilities</a></li>
</xsl:if>
</ul>
</li>
<xsl:if test="Typedef">
- <li>2. <a href="#typedefs">Type Definitions</a>
+ <li><a href="#typedefs">Type Definitions</a>
<ul class="toc">
- <xsl:for-each select="Typedef[descriptive or not($requiredescriptive)]">
- <li>2.<xsl:number value="position()"/>. <a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
+ <xsl:for-each select="Typedef[descriptive]">
+ <li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
- <li><xsl:number value="$interfaces-section-number"/>. <a href="#interfaces">Interfaces</a>
- <ul class="toc">
- <xsl:for-each select="Interface[descriptive or not($requiredescriptive)]">
- <li><xsl:number value="$interfaces-section-number"/>.<xsl:number value="position()"/>. <a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
- </xsl:for-each>
- </ul>
- </li>
+ <xsl:if test="Interface">
+ <li><a href="#interfaces">Interfaces</a>
+ <ul class="toc">
+ <xsl:for-each select="Interface[descriptive]">
+ <li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </xsl:if>
+ <xsl:if test="Dictionary">
+ <li><a href="#dictionaries">Dictionary types</a>
+ <ul class="toc">
+ <xsl:for-each select="Dictionary[descriptive]">
+ <li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </xsl:if>
+ <xsl:if test="Callback">
+ <li><a href="#callbacks">Callbacks</a>
+ <ul class="toc">
+ <xsl:for-each select="Callback[descriptive]">
+ <li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </xsl:if>
+ <xsl:if test="Enum">
+ <li><a href="#enums">Enums</a>
+ <ul class="toc">
+ <xsl:for-each select="Enum[descriptive]">
+ <li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </xsl:if>
</ul>
<hr/>
@@ -104,21 +125,21 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<h2>Summary of Methods</h2>
<xsl:call-template name="summary"/>
- <h2 id="intro">1. Introduction</h2>
- <xsl:apply-templates select="descriptive/description"/>
+ <h2 id="intro">Introduction</h2>
+ <xsl:apply-templates select="descriptive/description"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:if test="descriptive/def-api-feature-set">
<div id="def-api-feature-sets" class="def-api-feature-sets">
- <h3 id="features">1.1. Feature set</h3>
+ <h3 id="features">Feature set</h3>
<p>This is the URI used to declare this API's feature set, for use in bondi.requestFeature. For the URL, the list of features included by the feature set is provided.</p>
<xsl:apply-templates select="descriptive/def-api-feature-set"/>
</div>
</xsl:if>
<xsl:if test="descriptive/def-api-feature">
<div id="def-api-features" class="def-api-features">
- <h3 id="features">1.2. Features</h3>
+ <h3 id="features">Features</h3>
<p>This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions covered is provided.</p>
<xsl:apply-templates select="Interface/descriptive/def-instantiated"/>
<xsl:apply-templates select="descriptive/def-api-feature"/>
@@ -126,7 +147,7 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</xsl:if>
<xsl:if test="descriptive/def-device-cap">
<div class="def-device-caps" id="def-device-caps">
- <h3>1.3. Device capabilities</h3>
+ <h3>Device capabilities</h3>
<dl>
<xsl:apply-templates select="descriptive/def-device-cap"/>
</dl>
@@ -134,12 +155,34 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</xsl:if>
<xsl:if test="Typedef">
<div class="typedefs" id="typedefs">
- <h2>2. Type Definitions</h2>
- <xsl:apply-templates select="Typedef[descriptive or not($requiredescriptive)]"/>
+ <h2>Type Definitions</h2>
+ <xsl:apply-templates select="Typedef[descriptive]"/>
+ </div>
+ </xsl:if>
+ <xsl:if test="Interface">
+ <div class="interfaces" id="interfaces">
+ <h2>Interfaces</h2>
+ <xsl:apply-templates select="Interface"/>
+ </div>
+ </xsl:if>
+ <xsl:if test="Dictionary">
+ <div class="dictionaries" id="dictionaries">
+ <h2>Dictionary types</h2>
+ <xsl:apply-templates select="Dictionary"/>
+ </div>
+ </xsl:if>
+ <xsl:if test="Callback">
+ <div class="callbacks" id="callbacks">
+ <h2>Callbacks</h2>
+ <xsl:apply-templates select="Callback"/>
+ </div>
+ </xsl:if>
+ <xsl:if test="Enum">
+ <div class="enums" id="enums">
+ <h2>Enums</h2>
+ <xsl:apply-templates select="Enum"/>
</div>
</xsl:if>
- <h2><xsl:value-of select="$interfaces-section-number"/>. Interfaces</h2>
- <xsl:apply-templates select="Interface"/>
</div>
</xsl:template>
@@ -218,8 +261,7 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</xsl:template>
<!--Typedef.-->
-<xsl:template match="Typedef">
- <xsl:if test="descriptive or not($requiredescriptive)">
+<xsl:template match="Typedef[descriptive]">
<div class="typedef" id="{@id}">
<h3>2.<xsl:number value="position()"/>. <code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
@@ -227,38 +269,44 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
</div>
- </xsl:if>
</xsl:template>
<!--Interface.-->
-<xsl:template match="Interface">
- <xsl:if test="descriptive or not($requiredescriptive)">
+<xsl:template match="Interface[descriptive]">
<xsl:variable name="name" select="@name"/>
<div class="interface" id="{@id}">
- <h3><xsl:value-of select="concat($interfaces-section-number,'.',1+count(preceding::Interface|preceding::Dictionary))"/>. <code><xsl:value-of select="@name"/></code></h3>
+ <h3><code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="../Implements[@name2=$name]/webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:apply-templates select="InterfaceInheritance"/>
- <xsl:if test="Const[descriptive or not($requiredescriptive)]">
+ <xsl:if test="Const/descriptive">
<div class="consts">
<h4>Constants</h4>
<dl>
- <xsl:apply-templates select="Const[descriptive or not($requiredescriptive)]"/>
+ <xsl:apply-templates select="Const"/>
</dl>
</div>
</xsl:if>
- <xsl:if test="Attribute[descriptive or not($requiredescriptive)]">
+ <xsl:if test="ExtendedAttributeList/ExtendedAttribute/descriptive">
+ <div class="constructors">
+ <h4>Constructors</h4>
+ <dl>
+ <xsl:apply-templates select="ExtendedAttributeList/ExtendedAttribute"/>
+ </dl>
+ </div>
+ </xsl:if>
+ <xsl:if test="Attribute/descriptive">
<div class="attributes">
<h4>Attributes</h4>
<dl>
- <xsl:apply-templates select="Attribute[descriptive or not($requiredescriptive)]"/>
+ <xsl:apply-templates select="Attribute"/>
</dl>
</div>
</xsl:if>
- <xsl:if test="Operation[descriptive or not($requiredescriptive)]">
+ <xsl:if test="Operation/descriptive">
<div class="methods">
<h4>Methods</h4>
<dl>
@@ -267,46 +315,44 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</div>
</xsl:if>
</div>
- </xsl:if>
+</xsl:template>
+<xsl:template match="Interface[not(descriptive)]">
</xsl:template>
<!--Dictionary.-->
-<xsl:template match="Dictionary">
- <xsl:if test="descriptive or not($requiredescriptive)">
+<xsl:template match="Dictionary[descriptive]">
<xsl:variable name="name" select="@name"/>
<div class="dictionary" id="{@id}">
- <h3><xsl:value-of select="concat($interfaces-section-number,'.',1+count(preceding::Interface|preceding::Dictionary))"/>. <code><xsl:value-of select="@name"/></code></h3>
+ <h3><code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
- <xsl:apply-templates select="DictionaryInheritance"/>
- <xsl:if test="DictionaryMember[descriptive or not($requiredescriptive)]">
+ <xsl:apply-templates select="InterfaceInheritance"/>
+ <xsl:if test="Const/descriptive">
+ <div class="consts">
+ <h4>Constants</h4>
+ <dl>
+ <xsl:apply-templates select="Const"/>
+ </dl>
+ </div>
+ </xsl:if>
+ <xsl:if test="Attribute/descriptive">
<div class="attributes">
- <h4>Dictionary members</h4>
+ <h4>Attributes</h4>
<dl>
- <xsl:apply-templates select="DictionaryMember[descriptive or not($requiredescriptive)]"/>
+ <xsl:apply-templates select="Attribute"/>
</dl>
</div>
</xsl:if>
</div>
- </xsl:if>
</xsl:template>
-
-
-<xsl:template match="InterfaceInheritance">
- <p>
- <xsl:text>This interface inherits from: </xsl:text>
- <xsl:for-each select="Name">
- <code><xsl:value-of select="@name"/></code>
- <xsl:if test="position!=last()">, </xsl:if>
- </xsl:for-each>
- </p>
+<xsl:template match="Dictionary[not(descriptive)]">
</xsl:template>
-<xsl:template match="DictionaryInheritance">
+<xsl:template match="InterfaceInheritance/ScopedNameList">
<p>
- <xsl:text>This dictionary inherits from: </xsl:text>
+ <xsl:text>This interface inherits from: </xsl:text>
<xsl:for-each select="Name">
<code><xsl:value-of select="@name"/></code>
<xsl:if test="position!=last()">, </xsl:if>
@@ -314,7 +360,6 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</p>
</xsl:template>
-
<!--Attribute-->
<xsl:template match="Attribute">
<dt class="attribute" id="{@name}">
@@ -338,21 +383,6 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</dd>
</xsl:template>
-<!--DictionaryMember-->
-<xsl:template match="DictionaryMember">
- <dt class="member" id="{@name}">
- <code>
- <xsl:apply-templates select="Type"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
- </code></dt>
- <dd>
- <xsl:apply-templates select="descriptive/brief"/>
- <xsl:apply-templates select="descriptive"/>
- <xsl:apply-templates select="descriptive/Code"/>
- </dd>
-</xsl:template>
-
<!--Const-->
<xsl:template match="Const">
<dt class="const" id="{@id}">
@@ -369,53 +399,81 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</dd>
</xsl:template>
+<!--ExtendedAttribute name==Constructor || name==NamedConstructor-->
+<xsl:template match="ExtendedAttributeList/ExtendedAttribute">
+ <dt class="constructor" id="{concat(@name,generate-id(.))}">
+ <code>
+ <xsl:value-of select="../../@name"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="ArgumentList">
+ <xsl:with-param name="nodesc" select="1"/>
+ </xsl:apply-templates>
+ <xsl:text>);</xsl:text>
+ </code>
+ </dt>
+ <dd>
+ <xsl:apply-templates select="descriptive/brief"/>
+ <xsl:apply-templates select="descriptive"/>
+ <xsl:apply-templates select="ArgumentList"/>
+ <xsl:apply-templates select="Raises"/>
+ <xsl:if test="descriptive/api-feature">
+ <div class="api-features">
+ <h6>API features</h6>
+ <dl>
+ <xsl:apply-templates select="descriptive/api-feature"/>
+ </dl>
+ </div>
+ </xsl:if>
+ <xsl:apply-templates select="webidl"/>
+ <xsl:apply-templates select="descriptive/Code"/>
+ </dd>
+</xsl:template>
+
<!--Operation-->
<xsl:template match="Operation">
<dt class="method" id="{concat(@name,generate-id(.))}">
- <code><xsl:value-of select="@name"/></code>
+ <code>
+ <xsl:if test="@stringifier">
+ <xsl:value-of select="concat(@stringifier, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@omittable">
+ <xsl:value-of select="concat(@omittable, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@getter">
+ <xsl:value-of select="concat(@getter, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@setter">
+ <xsl:value-of select="concat(@setter, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@creator">
+ <xsl:value-of select="concat(@creator, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@deleter">
+ <xsl:value-of select="concat(@deleter, ' ')"/>
+ </xsl:if>
+ <xsl:if test="@caller">
+ <xsl:value-of select="concat(@caller, ' ')"/>
+ </xsl:if>
+ <xsl:apply-templates select="Type"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="ArgumentList">
+ <xsl:with-param name="nodesc" select="1"/>
+ </xsl:apply-templates>
+ <xsl:text>);</xsl:text>
+ </code>
</dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
- <div class="synopsis">
- <h6>Signature</h6>
- <pre>
- <xsl:if test="@static">
- <xsl:value-of select="concat(@static, ' ')"/>
- </xsl:if>
- <xsl:if test="@stringifier">
- <xsl:value-of select="concat(@stringifier, ' ')"/>
- </xsl:if>
- <xsl:if test="@getter">
- <xsl:value-of select="concat(@getter, ' ')"/>
- </xsl:if>
- <xsl:if test="@setter">
- <xsl:value-of select="concat(@setter, ' ')"/>
- </xsl:if>
- <xsl:if test="@creator">
- <xsl:value-of select="concat(@creator, ' ')"/>
- </xsl:if>
- <xsl:if test="@deleter">
- <xsl:value-of select="concat(@deleter, ' ')"/>
- </xsl:if>
- <xsl:if test="@caller">
- <xsl:value-of select="concat(@caller, ' ')"/>
- </xsl:if>
- <xsl:apply-templates select="Type"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
- <xsl:text>(</xsl:text>
- <xsl:apply-templates select="ArgumentList">
- <xsl:with-param name="nodesc" select="1"/>
- </xsl:apply-templates>
- <xsl:text>);
-</xsl:text></pre>
- </div>
+ <xsl:apply-templates select="webidl"/>
+ <xsl:apply-templates select="descriptive/Code"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="ArgumentList"/>
- <xsl:if test="Type[descriptive or not($requiredescriptive)]">
+ <xsl:if test="Type/descriptive">
<div class="returntype">
<h5>Return value</h5>
- <xsl:apply-templates select="Type[descriptive or not($requiredescriptive)]"/>
+ <xsl:apply-templates select="Type/descriptive"/>
</div>
</xsl:if>
<xsl:apply-templates select="Raises"/>
@@ -431,6 +489,42 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</dd>
</xsl:template>
+<!--Callback-->
+<xsl:template match="Callback">
+ <xsl:variable name="name" select="@name"/>
+ <div class="callback" id="{@id}">
+ <h3><code><xsl:value-of select="@name"/></code></h3>
+
+ <dd>
+ <xsl:apply-templates select="descriptive/brief"/>
+ <xsl:apply-templates select="webidl"/>
+ <xsl:apply-templates select="descriptive"/>
+ <div class="synopsis">
+ <h6>Signature</h6>
+ <pre>
+ <xsl:apply-templates select="Type"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="ArgumentList">
+ <xsl:with-param name="nodesc" select="1"/>
+ </xsl:apply-templates>
+ <xsl:text>);
+</xsl:text></pre>
+ </div>
+ <xsl:apply-templates select="descriptive"/>
+ <xsl:apply-templates select="ArgumentList"/>
+ <xsl:if test="Type/descriptive">
+ <div class="returntype">
+ <h5>Return value</h5>
+ <xsl:apply-templates select="Type/descriptive"/>
+ </div>
+ </xsl:if>
+ <xsl:apply-templates select="descriptive/Code"/>
+ </dd>
+ </div>
+</xsl:template>
+
<!--ArgumentList. This is passed $nodesc=true to output just the argument
types and names, and not any documentation for them.-->
<xsl:template match="ArgumentList">
@@ -509,20 +603,9 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<xsl:template match="Type">
<xsl:choose>
<xsl:when test="Type">
- <xsl:choose>
- <xsl:when test="@type='sequence'">
- <xsl:text>sequence &lt;</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>></xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- <xsl:text>[]</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="@nullable">
- <xsl:text>?</xsl:text>
- </xsl:if>
+ <xsl:text>sequence &lt;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>></xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
@@ -534,6 +617,40 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</xsl:choose>
</xsl:template>
+<!--Enum.-->
+<xsl:template match="Enum[descriptive]">
+ <xsl:variable name="name" select="@name"/>
+ <div class="enum" id="{@id}">
+ <h3><code><xsl:value-of select="@name"/></code></h3>
+ <xsl:apply-templates select="descriptive/brief"/>
+ <xsl:apply-templates select="webidl"/>
+ <xsl:apply-templates select="descriptive"/>
+ <xsl:apply-templates select="descriptive/Code"/>
+ <div class="enumvalues">
+ <h4>Values</h4>
+ <dl>
+ <xsl:apply-templates select="EnumValue"/>
+ </dl>
+ </div>
+ </div>
+</xsl:template>
+<xsl:template match="Enum[not(descriptive)]">
+</xsl:template>
+
+<!--EnumValue-->
+<xsl:template match="EnumValue">
+ <dt class="enumvalue" id="{@id}">
+ <code>
+ <xsl:value-of select="@stringvalue"/>
+ </code>
+ </dt>
+ <dd>
+ <xsl:apply-templates select="descriptive/brief"/>
+ <xsl:apply-templates select="descriptive"/>
+ <xsl:apply-templates select="descriptive/Code"/>
+ </dd>
+</xsl:template>
+
<xsl:template match="descriptive[not(author)]">
<xsl:apply-templates select="version"/>
<xsl:if test="author">
@@ -576,13 +693,21 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<!--Code-->
<xsl:template match="Code">
<div class="example">
- <h5>Code example</h5>
+ <xsl:choose>
+ <xsl:when test="@lang">
+ <h5><xsl:value-of select="@lang"/></h5>
+ </xsl:when>
+ <xsl:otherwise>
+ <h5>Code example</h5>
+ </xsl:otherwise>
+ </xsl:choose>
<pre class="examplecode"><xsl:apply-templates/></pre>
</div>
</xsl:template>
<!--webidl : literal Web IDL from input-->
<xsl:template match="webidl">
+ <h5>WebIDL</h5>
<pre class="webidl"><xsl:apply-templates/></pre>
</xsl:template>
@@ -618,7 +743,7 @@ XSLT stylesheet to convert widlprocxml into html documentation.
</li>
</xsl:template>
-<!--def-instantiated (called from Module).
+<!--def-instantiated.
This assumes that only one interface in the module has a def-instantiated,
and that interface contains just one attribute.-->
<xsl:template match="def-instantiated">
@@ -652,7 +777,7 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<!--html elements-->
-<xsl:template match="a|b|br|dd|dl|dt|em|li|p|table|td|th|tr|ul|img">
+<xsl:template match="a|b|br|dd|dl|dt|em|li|p|table|td|th|tr|ul">
<xsl:element name="{name()}"><xsl:for-each select="@*"><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:for-each><xsl:apply-templates/></xsl:element>
</xsl:template>
@@ -662,7 +787,7 @@ XSLT stylesheet to convert widlprocxml into html documentation.
<tr><th>Interface</th><th>Method</th></tr>
</thead>
<tbody>
- <xsl:for-each select="Interface[descriptive or not($requiredescriptive)]">
+ <xsl:for-each select="Interface[descriptive]">
<tr><td><a href="#{@id}"><xsl:value-of select="@name"/></a></td>
<td>
<xsl:for-each select="Operation">

No commit comments for this range

Something went wrong with that request. Please try again.