[Laszlo-checkins] r9679 - in openlaszlo/trunk/docs/src: reference xsl
dda@openlaszlo.org
dda at openlaszlo.org
Mon Jun 16 10:06:54 PDT 2008
Author: dda
Date: 2008-06-16 10:06:48 -0700 (Mon, 16 Jun 2008)
New Revision: 9679
Modified:
openlaszlo/trunk/docs/src/reference/postprocess.rb
openlaszlo/trunk/docs/src/xsl/js2doc2dbk.xsl
Log:
Change 20080616-dda-g by dda at 33.sub-75-193-82.myvzw.com on 2008-06-16 12:15:15 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-doc5
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Show or don't show 'Attributes/Methods/Events' heading depending on inheritance.
New Features:
Bugs Fixed: LPP-6023
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: liorio (pending)
Documentation:
Release Notes:
Details:
We want to show the 'Attributes' (or 'Methods', 'Event') title if there
are any attributes, inherited or not, but not show it when there are none.
The difficulty is that the header appears first, before we visit
the inherited methods. Also the existence of inherited items that
are shown can be complicated - inherited methods can be private, for example.
This implementation requires us to 'generate' the inherited list
for attributes (or methods/events) in advance, diverting the output
into a local variable. The length of the variable reveals if there
will be any inherited attributes. This is more maintainable than
having a separate set of functions to determine if there will be
be inherited items.
One small change is of ordering: class attributes (which have
their own heading 'Class Attributes') now appear after instance
attributes and inherited attributes instead of between them.
Same with methods. Events had it coded correctly, although I don't
think there are any static events.
Also fixed some out-of-date comments in the postprocess ruby script.
Tests:
Rebuilt doc and looked at some particular cases:
LzEventable.html (no attributes - no title shown)
lz.list.html (no events but events inherited)
lz.base* various cases
Modified: openlaszlo/trunk/docs/src/reference/postprocess.rb
===================================================================
--- openlaszlo/trunk/docs/src/reference/postprocess.rb 2008-06-16 17:06:32 UTC (rev 9678)
+++ openlaszlo/trunk/docs/src/reference/postprocess.rb 2008-06-16 17:06:48 UTC (rev 9679)
@@ -7,11 +7,18 @@
# built on OSX 10.4 with ruby 1.8.6
# Copyright 2008 Laszlo Systems. Use according to license terms.
#
-# Some of the doc XSL processing leaves in undefined tags
-# of the form <postprocess-...>....</postprocess>. These
-# are converted to <font color="red"><postprocess-....
-# and this ruby script recognizes that and converts them.
-# Someday we'll pull this all back into the XSL world.
+# To handle difficult cases, some of the doc XSL processing
+# leaves in undefined tags of the form
+# <para role="postprocess-XXXX">....</para>.
+# These are converted to one of:
+# <p class="postprocess-XXXX"/>
+# <p class="postprocess-XXXX">....</p>.
+#
+# Each XXXX is an 'operation' telling this script what to do.
+# The script recognizes these and applies special ad hoc conversions.
+# These handle all the strange cases that can not be easily
+# handled within docbook XSL, although we have hopes to
+# someday pull this all back into the XSL world.
require 'getoptlong'
require 'rdoc/usage'
Modified: openlaszlo/trunk/docs/src/xsl/js2doc2dbk.xsl
===================================================================
--- openlaszlo/trunk/docs/src/xsl/js2doc2dbk.xsl 2008-06-16 17:06:32 UTC (rev 9678)
+++ openlaszlo/trunk/docs/src/xsl/js2doc2dbk.xsl 2008-06-16 17:06:48 UTC (rev 9679)
@@ -258,9 +258,6 @@
<xsl:variable name="events" select="&objectvalue;/property[@name='__ivars__' or @name='prototype']/object/property[doc/tag[@name='lzxtype']/text = 'event' and &isvisible;]" />
<xsl:variable name="initargs" select="class/initarg[not(contains(@access, 'private'))]" />
-
-
-
<!-- Initialization Arguments -->
<xsl:if test="$show.init.args">
<xsl:call-template name="describe-members">
@@ -279,6 +276,15 @@
</xsl:call-template>
</xsl:if>
+ <!-- Pregenerate inherited attributes -->
+ <xsl:variable name="inherited-attributes-output">
+ <xsl:if test="$show.inherited.attributes">
+ <xsl:call-template name="describe-inherited-attributes">
+ <xsl:with-param name="class" select="class"></xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+
<!-- Properties -->
<xsl:if test="$show.members.attributes">
<xsl:call-template name="describe-members">
@@ -287,9 +293,18 @@
<xsl:with-param name="initargs" select="$initargs" />
<xsl:with-param name="ivars" select="$ivars" />
<xsl:with-param name="setters" select="$svars" />
+ <xsl:with-param name="hasinherited" select="string-length($inherited-attributes-output) != 0" />
+
</xsl:call-template>
</xsl:if>
+ <!-- Inherited Attributes -->
+ <xsl:if test="$show.inherited.attributes">
+ <xsl:call-template name="describe-inherited-attributes">
+ <xsl:with-param name="class" select="class"></xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+
<!-- Static Properties -->
<xsl:if test="$show.properties.static">
<xsl:call-template name="describe-members">
@@ -302,13 +317,6 @@
</xsl:call-template>
</xsl:if>
- <!-- Inherited Attributes -->
- <xsl:if test="$show.inherited.attributes">
- <xsl:call-template name="describe-inherited-attributes">
- <xsl:with-param name="class" select="class"></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
<!-- Setters -->
<xsl:if test="$show.setters">
<xsl:call-template name="describe-members">
@@ -322,14 +330,27 @@
</xsl:call-template>
</xsl:if>
+ <!-- Pregenerate inherited methods -->
+ <xsl:variable name="inherited-methods-output">
+ <xsl:call-template name="describe-inherited-methods">
+ <xsl:with-param name="class" select="class"></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
<!-- (Prototype) Methods -->
<xsl:if test="$show.prototype.methods">
<xsl:call-template name="describe-members">
<xsl:with-param name="members" select="$pvars[child::function]"/>
<xsl:with-param name="title" select="'Methods'"/>
+ <xsl:with-param name="hasinherited" select="string-length($inherited-methods-output) != 0" />
</xsl:call-template>
</xsl:if>
+ <!-- Inherited Methods -->
+ <xsl:call-template name="describe-inherited-methods">
+ <xsl:with-param name="class" select="class"></xsl:with-param>
+ </xsl:call-template>
+
<!-- Static Methods -->
<xsl:if test="$show.methods.static">
<xsl:call-template name="describe-members">
@@ -339,16 +360,19 @@
</xsl:call-template>
</xsl:if>
- <!-- Inherited Methods -->
- <xsl:call-template name="describe-inherited-methods">
- <xsl:with-param name="class" select="class"></xsl:with-param>
- </xsl:call-template>
+ <!-- Pregenerate inherited events -->
+ <xsl:variable name="inherited-events-output">
+ <xsl:call-template name="describe-inherited-events">
+ <xsl:with-param name="class" select="class"></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
<!-- (Prototype) Events -->
<xsl:if test="$show.prototype.events">
<xsl:call-template name="describe-events">
<xsl:with-param name="members" select="$events"/>
<xsl:with-param name="title" select="'Events'"/>
+ <xsl:with-param name="hasinherited" select="string-length($inherited-events-output) != 0" />
</xsl:call-template>
</xsl:if>
@@ -427,6 +451,7 @@
<xsl:param name="setters" />
<xsl:param name="ivars" />
<xsl:param name="initargs"/>
+ <xsl:param name="hasinherited"/>
<xsl:choose>
<xsl:when test="contains($title, 'Attributes')">
<xsl:call-template name="describe-members-grid">
@@ -439,6 +464,7 @@
<xsl:with-param name="setters" select="$setters"/>
<xsl:with-param name="ivars" select="$ivars"/>
<xsl:with-param name="initargs" select="$initargs"/>
+ <xsl:with-param name="hasinherited" select="$hasinherited"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
@@ -449,6 +475,7 @@
<xsl:with-param name="subtitle" select="$subtitle"/>
<xsl:with-param name="describe-js" select="$describe-js" />
<xsl:with-param name="describe-lzx" select="$describe-lzx" />
+ <xsl:with-param name="hasinherited" select="$hasinherited"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@ -461,8 +488,9 @@
<xsl:param name="subtitle"/>
<xsl:param name="describe-js" select="boolean(@name)"/>
<xsl:param name="describe-lzx" select="boolean(&tagname;)"/>
+ <xsl:param name="hasinherited"/>
<xsl:variable name="visible-members" select="$members[contains($visibility.filter, at access)]"/>
- <xsl:if test="count($visible-members) > 0">
+ <xsl:if test="count($visible-members) > 0 or $hasinherited">
<variablelist>
<title><xsl:value-of select="$title"/></title>
<xsl:if test="$subtitle"><para><xsl:value-of select="$subtitle"/></para></xsl:if>
@@ -488,49 +516,53 @@
<xsl:param name="setters" />
<xsl:param name="ivars" />
<xsl:param name="initargs" />
+ <xsl:param name="hasinherited" />
<xsl:variable name="visible-members" select="$members[contains($visibility.filter, at access)]"/>
- <xsl:if test="count($visible-members) > 0">
+ <xsl:if test="count($visible-members) > 0 or $hasinherited">
<variablelist>
- <title><link linkend="info-attributes"><xsl:value-of select="$title"/></link></title>
- <informaltable frame="none" pgwide="1">
- <tgroup cols="5" colsep="0" rowsep="0">
- <colspec colname="Name" colwidth="1*" />
- <colspec colname="TypeTag" colwidth="1*" />
- <colspec colname="TypeJS" colwidth="1*" />
- <colspec colname="Default" colwidth="1*" />
- <colspec colname="Category" colwidth="1*" />
- <thead>
- <row>
- <entry align="left">Name</entry>
- <entry align="left">Type (tag)</entry>
- <entry align="left">Type (js)</entry>
- <entry align="left">Default</entry>
- <entry align="left">Category</entry>
- </row>
- </thead>
- <tbody>
- <xsl:for-each select="$visible-members">
- <xsl:sort select="translate(@name,'_$',' ')"/>
- <xsl:call-template name="member-data-row">
- <xsl:with-param name="setters" select="$setters"></xsl:with-param>
- <xsl:with-param name="ivars" select="$ivars"></xsl:with-param>
- <xsl:with-param name="initargs" select="$initargs"></xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </informaltable>
+ <title><xsl:value-of select="$title"/></title>
+ <xsl:if test="count($visible-members) > 0">
+ <informaltable frame="none" pgwide="1">
+ <tgroup cols="5" colsep="0" rowsep="0">
+ <colspec colname="Name" colwidth="1*" />
+ <colspec colname="TypeTag" colwidth="1*" />
+ <colspec colname="TypeJS" colwidth="1*" />
+ <colspec colname="Default" colwidth="1*" />
+ <colspec colname="Category" colwidth="1*" />
+ <thead>
+ <row>
+ <entry align="left">Name</entry>
+ <entry align="left">Type (tag)</entry>
+ <entry align="left">Type (js)</entry>
+ <entry align="left">Default</entry>
+ <entry align="left">Category</entry>
+ </row>
+ </thead>
+ <tbody>
+ <xsl:for-each select="$visible-members">
+ <xsl:sort select="translate(@name,'_$',' ')"/>
+ <xsl:call-template name="member-data-row">
+ <xsl:with-param name="setters" select="$setters"></xsl:with-param>
+ <xsl:with-param name="ivars" select="$ivars"></xsl:with-param>
+ <xsl:with-param name="initargs" select="$initargs"></xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </xsl:if>
</variablelist>
</xsl:if>
</xsl:template>
-
+
<xsl:template name="describe-events">
<xsl:param name="members"/>
<xsl:param name="title"/>
<xsl:param name="static" select="false()"/>
<xsl:param name="describe-js" select="true()"/>
<xsl:param name="describe-lzx" select="true()"/>
+ <xsl:param name="hasinherited" />
<xsl:variable name="visible-members" select="$members[contains($visibility.filter, at access)]"/>
<xsl:variable name="desc">
<xsl:apply-templates select="." mode="desc"/>
@@ -539,40 +571,42 @@
<xsl:apply-templates select="." mode="xref"/>
</xsl:variable>
- <xsl:if test="count($visible-members) > 0">
+ <xsl:if test="count($visible-members) > 0 or $hasinherited">
<variablelist>
<title>Events</title>
- <informaltable frame="none">
- <tgroup cols="2" colsep="0" rowsep="0">
- <colspec colname="Name" colwidth="1*" />
- <colspec colname="Description" colwidth="4*"/>
- <thead>
- <row>
- <entry align="left">Name</entry>
- <entry align="left">Description</entry>
- </row>
- </thead>
- <tbody>
- <xsl:for-each select="$visible-members">
- <xsl:sort select="translate(@name,'_$',' ')"/>
+ <xsl:if test="count($visible-members) > 0">
+ <informaltable frame="none">
+ <tgroup cols="2" colsep="0" rowsep="0">
+ <colspec colname="Name" colwidth="1*" />
+ <colspec colname="Description" colwidth="4*"/>
+ <thead>
<row>
- <entry>
- <indexterm zone="{@id}" id="{@id}">
- <primary>
+ <entry align="left">Name</entry>
+ <entry align="left">Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <xsl:for-each select="$visible-members">
+ <xsl:sort select="translate(@name,'_$',' ')"/>
+ <row>
+ <entry>
+ <indexterm zone="{@id}" id="{@id}">
+ <primary>
+ <xsl:value-of select="@name"/>
+ </primary>
+ </indexterm>
+ <literal>
<xsl:value-of select="@name"/>
- </primary>
- </indexterm>
- <literal>
- <xsl:value-of select="@name"/>
- </literal>
- </entry>
- <!-- Important this appears on one line see: http://www.docbook.org/tdg/en/html/entry.html -->
- <entry><xsl:apply-templates select="doc/text" mode="doc2dbk"/></entry>
- </row>
- </xsl:for-each>
- </tbody>
- </tgroup>
- </informaltable>
+ </literal>
+ </entry>
+ <!-- Important this appears on one line see: http://www.docbook.org/tdg/en/html/entry.html -->
+ <entry><xsl:apply-templates select="doc/text" mode="doc2dbk"/></entry>
+ </row>
+ </xsl:for-each>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </xsl:if>
</variablelist>
</xsl:if>
</xsl:template>
More information about the Laszlo-checkins
mailing list