Author: ben
Date: 2007-12-20 13:18:24 -0800 (Thu, 20 Dec 2007)
New Revision: 7645

Modified:
   openlaszlo/trunk/docs/src/build.xml
   openlaszlo/trunk/docs/src/xsl/common-html.xsl
Log:
Change 20071220-ben-8 by [EMAIL PROTECTED] on 2007-12-20 12:42:09 PST
    in /Users/ben/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make example canvases get their height from the example code

New Features:

Bugs Fixed: LPP-5207 (really, this time) change height of example code window 
from 200 to 400 pixels

Technical Reviewer: iorio (pending)
QA Reviewer: brynn (pending)

Documentation:

Two crucial changes here! First, our build file was set up wrong when it
generated the intermediate developers/index.dbk. It has to put this file into
docs/src/build/developers/index.dbk; it used to put it into
docs/developers/index.dbk -- effectively losing all the delicious processing 
that
had been done to it by the dbkpreprocessexamles.xsl worksheet. That delicious
processing includes a step that determines the canvas width and height from the
program listing itself.

Second! The part of common-html.xsl that actually sends canvas parameters to
Lz.swfEmbed(...) was only sending the first canvas parameter it found! This
code... 

<xsl:variable name="canvas-parameters"> 
   <xsl:if
test="[EMAIL PROTECTED]'canvas']"> 
        <xsl:value-of select="[EMAIL PROTECTED]'canvas']"/> 
    </xsl:if> ... 
</xsl:variable>

..actually only puts the first answer to the xpath query
[EMAIL PROTECTED]'canvas'] into the variable $canvas-parameters. This is an xsl
subtlety that I don't understand, but it has something to do with how node-sets
are coerced into strings when their value is taken. To fix this, I have added a
for-each which explicitly concatenates the value of each canvas parameter, with 
a
comma between them. This (thank goodness) inserts the correct canvas width and
height parameters into the call to Lz.swfEmbed.

Tests:
Note the canvas height for example 34.1, basecomponent, is 260 pixels,
as specified in the program listing: 
http://localhost:8080/trunk/docs/developers/custom-components.html

Note that the canvas height of the first two examples is 30 pixels,
as specified in the program listing:
http://localhost:8080/trunk/docs/reference/lz.button.html



Modified: openlaszlo/trunk/docs/src/build.xml
===================================================================
--- openlaszlo/trunk/docs/src/build.xml 2007-12-20 21:00:10 UTC (rev 7644)
+++ openlaszlo/trunk/docs/src/build.xml 2007-12-20 21:18:24 UTC (rev 7645)
@@ -279,12 +279,15 @@
 
   </target> <!-- book.html.generate -->
 
-  <target name="book.resources.generate" depends="init">
-    <!--- @param local.input.dir
-          @param local.build.dir
-          @param local.output.dir
+  <!-- Copy resources (programs, images, data, resources) from the source 
directory to the output directory.
+    Note that this doesn't actively "generate" anything, it just copies stuff 
around. -->
+  <target name="book.resources.generate" depends="init"
+    description="Copy resources (programs, images, data, resources) from the 
source directory to the output directory.">
+    <!--- @param local.input.dir path to the source files on disk
+          @param local.build.dir where to put build intermediates
+          @param local.output.dir where to put the final product
        -->
-    <!-- Extract the lzx (and other) files from the *.in files. -->
+    <!-- Extract the lzx (and other) files from the input files. -->
     <mkdir dir="${local.output.dir}/programs"/>
     <copy todir="${local.output.dir}/programs">
       <fileset dir="${local.build.dir}/programs" includes="*.lzx"/>
@@ -1148,7 +1151,7 @@
     <antcall target="dbk.examples.preprocess" inheritAll="true">
       <param name="local.input.dir" value="${docs.build.dir}"/> <!-- 
$LPS_HOME/docs/src/build --> 
       <param name="local.input.index" 
value="developers/${developers.input.index}"/>
-      <param name="local.output.dir" value="${developers.output.dir}"/> <!-- 
$LPS_HOME/docs/developers -->
+      <param name="local.output.dir" value="${developers.build.dir}"/> 
       <param name="local.output.index" value="${developers.dbk.index}"/>
       <param name="local.worksheet" value="xsl/dbkpreprocessexamples.xsl"/>
     </antcall>

Modified: openlaszlo/trunk/docs/src/xsl/common-html.xsl
===================================================================
--- openlaszlo/trunk/docs/src/xsl/common-html.xsl       2007-12-20 21:00:10 UTC 
(rev 7644)
+++ openlaszlo/trunk/docs/src/xsl/common-html.xsl       2007-12-20 21:18:24 UTC 
(rev 7645)
@@ -43,9 +43,7 @@
   <xsl:param name="show.fixmes" select="1"/>
 
   <xsl:param name="textdata.default.encoding"/>
-  
-  <xsl:param name="warn.no.programlisting.canvas.width" select="false()"/>
-  
+    
   <xsl:param name="show.examples.debuginfo" select="false()" />
   
   <xsl:template name="base.book.name">
@@ -209,10 +207,22 @@
       [bshine 12.16.2007]
     -->         
     <xsl:variable name="canvas-parameters">
-      <xsl:if test="[EMAIL PROTECTED]'canvas']"><xsl:value-of select="[EMAIL 
PROTECTED]'canvas']"/></xsl:if>
-      <xsl:if test="count([EMAIL PROTECTED]'canvas']) = 0">height: 400, width: 
500, bgcolor: '#FFFFFF'</xsl:if>      
-    </xsl:variable> 
-   
+      <!-- The problem here! is that! if we do select="[EMAIL 
PROTECTED]'canvas']" and there is
+        more than one parameter with role='canvas' then the value of the 
$canvas-parameters 
+        variable is *only* the text contents of the *first* result of the 
xpath query. 
+        We want to have a comma-separated list of the canvas parameters! The
+        bug LPP-5207 results from almost always discarding the canvas height, 
which is 
+        almost always the second canvas parameter listed. To demonstrate that 
this is
+        indeed the problem, in dbkpreprocessexamples.xsl switch the order of 
emitting
+        the canvas parameters. Notice that we now have nice canvas heights, 
but bad
+        canvas widths. 
+        The solution! Iterate over the result node set! -->
+      <xsl:for-each select="[EMAIL PROTECTED]'canvas']">
+        <xsl:value-of select="."/>, 
+      </xsl:for-each>
+     </xsl:variable>
+      
+     
     <!-- format live example -->
     <xsl:variable name="live" select="ancestor::[EMAIL 
PROTECTED]'live-example'] or ancestor::[EMAIL PROTECTED]'live-example']"/>
     <xsl:if test="$live">


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to