[Kst] extragear/graphics/kst/kst/extensions/js

George Staikos staikos at kde.org
Tue May 24 07:26:29 CEST 2005


SVN commit 417644 by staikos:

Added recursive rule to allow closing brackets on
optional arguments


 M  +7 -0      Makefile.am  
 M  +30 -20    jsdocs-class.xsl  


--- trunk/extragear/graphics/kst/kst/extensions/js/Makefile.am #417643:417644
@@ -84,3 +84,10 @@
 
 rcdir=$(kde_datadir)/kst
 rc_DATA=kstextension_js.rc
+
+apidox:
+	xsltproc jsdocs-class.xsl bind_curve.xml >Curve.html
+	xsltproc jsdocs-class.xsl bind_equation.xml >Equation.html
+	xsltproc jsdocs-class.xsl bind_vector.xml >Vector.html
+	xsltproc jsdocs-collection.xsl bind_collection.xml >Collection.html
+
--- trunk/extragear/graphics/kst/kst/extensions/js/jsdocs-class.xsl #417643:417644
@@ -17,7 +17,7 @@
       <ul>
       <xsl:for-each select="constructor">
         <a href="#constructor_{string(position())}"><xsl:value-of select="$thisClass"/></a>
-        <xsl:text>( </xsl:text>
+        <xsl:text> ( </xsl:text>
         <xsl:call-template name="displayArgumentsInline">
           <xsl:with-param name="typed" select="0"/>
         </xsl:call-template>
@@ -32,7 +32,7 @@
     <ul>
     <xsl:for-each select="method">
       <a href="#method_{@name}"><xsl:value-of select="@name"/></a>
-      <xsl:text>( </xsl:text>
+      <xsl:text> ( </xsl:text>
       <xsl:call-template name="displayArgumentsInline">
         <xsl:with-param name="typed" select="0"/>
       </xsl:call-template>
@@ -57,7 +57,7 @@
     <!-- Display details of constructors -->
     <xsl:for-each select="constructor">
       <a name="constructor_{string(position())}"/>
-      <b><xsl:value-of select="$thisClass"/><xsl:text>( </xsl:text>
+      <b><xsl:value-of select="$thisClass"/><xsl:text> ( </xsl:text>
       <xsl:call-template name="displayArgumentsInline"/>
       <xsl:text> )</xsl:text>
       </b>
@@ -81,7 +81,7 @@
       <xsl:call-template name="displayReturnType"/>
 
       <xsl:value-of select="@name"/>
-      <xsl:text>( </xsl:text>
+      <xsl:text> ( </xsl:text>
       <xsl:call-template name="displayArgumentsInline"/>
       <xsl:text> )</xsl:text>
       </b>
@@ -141,22 +141,32 @@
 
   <xsl:template name="displayArgumentsInline">
     <xsl:param name="typed" select="1"/>
-    <xsl:for-each select="argument">
-      <xsl:if test="@optional = 'true'"> [</xsl:if>
-      <xsl:if test="position() &gt; 1">, </xsl:if>
-      <xsl:if test="$typed = 1">
-        <xsl:choose>
-          <xsl:when test="@type = 'Number' or @type = 'String' or @type = 'Boolean'">
-            <xsl:value-of select="@type"/>
-          </xsl:when>
-          <xsl:otherwise>
-            <a href="{@type}.html"><xsl:value-of select="@type"/></a>
-          </xsl:otherwise>
-        </xsl:choose>
-        <xsl:text> </xsl:text>
-      </xsl:if>
-      <xsl:value-of select="@name"/>
-    </xsl:for-each>
+    <xsl:param name="arg" select="1"/>
+    <xsl:if test="$arg &lt; count(argument) + 1">
+      <xsl:for-each select="argument[$arg]">
+        <xsl:if test="@optional = 'true'"> [</xsl:if>
+        <xsl:if test="$arg &gt; 1">, </xsl:if>
+        <xsl:if test="$typed = 1">
+          <xsl:choose>
+            <xsl:when test="@type = 'Number' or @type = 'String' or @type = 'Boolean'">
+              <xsl:value-of select="@type"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <a href="{@type}.html"><xsl:value-of select="@type"/></a>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:text> </xsl:text>
+        </xsl:if>
+        <xsl:value-of select="@name"/>
+	<xsl:for-each select="..">
+          <xsl:call-template name="displayArgumentsInline">
+            <xsl:with-param name="typed" select="$typed"/>
+            <xsl:with-param name="arg" select="$arg + 1"/>
+          </xsl:call-template>
+	</xsl:for-each>
+        <xsl:if test="@optional = 'true'">]</xsl:if>
+      </xsl:for-each>
+    </xsl:if>
   </xsl:template>
   
   <xsl:template name="displayArgumentsFull">


More information about the Kst mailing list