[Laszlo-checkins] r10641 - in openlaszlo/trunk/docs: includes src/developers/tutorials src/developers/tutorials/programs src/xsl
dda@openlaszlo.org
dda at openlaszlo.org
Fri Aug 8 06:00:13 PDT 2008
Author: dda
Date: 2008-08-08 06:00:09 -0700 (Fri, 08 Aug 2008)
New Revision: 10641
Modified:
openlaszlo/trunk/docs/includes/docbook.css
openlaszlo/trunk/docs/src/developers/tutorials/laszlo_basics.dbk
openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$1.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$2.lzx
openlaszlo/trunk/docs/src/xsl/common-html.xsl
Log:
Change 20080807-dda-O by dda at lester.local on 2008-08-07 10:05:13 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-doc5
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Allow DHTML versions of tutorial examples to build and (start to) run
New Features:
Bugs Fixed: LPP-3887 (compiling dguide for both runtimes crashes firefox)
Technical Reviewer: max (pending)
QA Reviewer: (pending)
Doc Reviewer: liorio (pending)
Documentation:
Release Notes:
Details:
After enabling DHTML as indicated in LPP-3887, discovered that some of the code was stale and needed
some fixes. After fixing, the 'basics' page runs correctly in DHTML
without crashing Firefox either on MacOSX/Firefox or Windows (parallels)/Firefox
or MacOSX/Safari. Other pages probably need some debugging for DHTML,
for example, docs/developers/tutorials/calculator.html doesn't show much at all
in the examples for DHTML (tried in MacOSX/Firefox) but doesn't crash firefox
either. Presumably other pages may produce mixed results, but at least
DHTML is now possible, and examples can be tried/debugged/fixed by directly
editting the example code.
Nature of the fixes:
some canvas parameters - height and width are being passed
as unquoted: height: 100 vs. height: '100'
The quoted representation seems to be required for DHTML, but
the unquoted args are pervasive, rather than change them all,
I fixed the XSL 'rewrite' of the programs to add quotes when necessary.
There was an extra stray comma in the embed parameter list that is now removed.
For the first two examples on the basics page, the implementation did not
match what was shown as source (height was 150 rather than 100 in the source).
Standardized these on 100, and in doing so, discovered a lot of duplication in
laszlo_basics.dbk - the code for each example is listed 3 times (!),
though two of these are commented, and most of the actual code used is in a different
file entirely (e.g. docs/src/developers/tutorials/programs/laszlo_basics-$1.lzx).
Left the commented code, it is possible it is/was used to help generate the
actual code files? Canvas args are handled specially it seems.
The parts that need to be commented/uncommented for DHTML to work are now consistently
marked with <?ignore (one spot was //commented in Javascript before).
A couple errors in docbook.css have been corrected.
In this work, I never saw a crash of Firefox (problem originally reported),
so that error seems to be due to older DHTML code or older versions of Firefox.
Tests:
Examined:
http://localhost:8080/trunk/docs/developers/tutorials/laszlo_basics.html
Regression: smokecheck SWF8, DHTML + hello SWF9
Modified: openlaszlo/trunk/docs/includes/docbook.css
===================================================================
--- openlaszlo/trunk/docs/includes/docbook.css 2008-08-08 08:30:08 UTC (rev 10640)
+++ openlaszlo/trunk/docs/includes/docbook.css 2008-08-08 13:00:09 UTC (rev 10641)
@@ -122,7 +122,7 @@
/* This is used in the ECMAScript chapter to mark unsupported APIs */
.strikeout {
- font-variant: italic;
+ font-style: italic;
color: red;
}
@@ -234,7 +234,7 @@
/* Synopsis */
.methodclass, .methodstaticclass, .methodname {
- font-size: 1.08em
+ font-size: 1.08em;
color: #333333;
}
Modified: openlaszlo/trunk/docs/src/developers/tutorials/laszlo_basics.dbk
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/laszlo_basics.dbk 2008-08-08 08:30:08 UTC (rev 10640)
+++ openlaszlo/trunk/docs/src/developers/tutorials/laszlo_basics.dbk 2008-08-08 13:00:09 UTC (rev 10641)
@@ -49,10 +49,10 @@
</example>
<?example role="live-example"><title>Empty Canvas</title><programlisting role="lzx-embednew"><filename>laszlo_basics-$1.lzx</filename><parameter/><code>
-<canvas width="500" height="150" bgcolor="green">
+<canvas width="500" height="100" bgcolor="green">
</canvas>
</code></programlisting><programlisting>
-<canvas width="500" height="150" bgcolor="green">
+<canvas width="500" height="100" bgcolor="green">
</canvas>
</programlisting><?lzx-edit programs/laszlo_basics-$1.lzx></example?>
@@ -70,11 +70,11 @@
</example>
<?example role="live-example"><title>Simple window</title><programlisting role="lzx-embednew"><filename>laszlo_basics-$2.lzx</filename><parameter/><code>
-<canvas width="500" height="150">
+<canvas width="500" height="100">
<window/>
</canvas>
</code></programlisting><programlisting>
-<canvas width="500" height="150">
+<canvas width="500" height="100">
<window/>
</canvas>
</programlisting><?lzx-edit programs/laszlo_basics-$2.lzx></example?>
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$1.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$1.lzx 2008-08-08 08:30:08 UTC (rev 10640)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$1.lzx 2008-08-08 13:00:09 UTC (rev 10641)
@@ -1,7 +1,7 @@
-<canvas width="500" height="150" bgcolor="green">
+<canvas width="500" height="100" bgcolor="green">
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$2.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$2.lzx 2008-08-08 08:30:08 UTC (rev 10640)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/laszlo_basics-$2.lzx 2008-08-08 13:00:09 UTC (rev 10641)
@@ -1,8 +1,8 @@
-<canvas width="500" height="150">
+<canvas width="500" height="100">
<window/>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/xsl/common-html.xsl
===================================================================
--- openlaszlo/trunk/docs/src/xsl/common-html.xsl 2008-08-08 08:30:08 UTC (rev 10640)
+++ openlaszlo/trunk/docs/src/xsl/common-html.xsl 2008-08-08 13:00:09 UTC (rev 10641)
@@ -126,7 +126,9 @@
<link rel="stylesheet" href="{$rootpath}includes/lzx-pretty-print.css" type="text/css"/>
<script type="text/javascript" language="JavaScript" src="{$rootpath}{$root.relative.lps.includes}embed-compressed.js"/>
<script type="text/javascript" language="JavaScript" src="{$rootpath}includes/docs.js"/>
- <script type="text/javascript"><xsl:text>//lz.embed.lfc('</xsl:text><xsl:value-of select="$rootpath"/><xsl:value-of select="$root.relative.lps.includes"/><xsl:text>lfc/LFCdhtml.js', '</xsl:text><xsl:value-of select="$rootpath"/><xsl:text>../');</xsl:text></script>
+<?ignore
+ <script type="text/javascript" language="JavaScript"><xsl:text>lz.embed.lfc('</xsl:text><xsl:value-of select="$rootpath"/><xsl:value-of select="$root.relative.lps.includes"/><xsl:text>lfc/LFCdhtml.js', '</xsl:text><xsl:value-of select="$rootpath"/><xsl:text>../');</xsl:text></script>
+?>
</xsl:template>
<xsl:template name="body.attributes">
@@ -210,12 +212,42 @@
<xsl:apply-templates select="programlisting"/>
</xsl:template>
+ <!-- make sure parameters are quoted strings -->
+ <xsl:template name="quote-canvas-parameter">
+ <xsl:param name="text"/>
+ <xsl:variable name="single-quote">'</xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($text, $single-quote)">
+ <xsl:value-of select="$text"/>
+ </xsl:when>
+ <xsl:when test="contains($text, ',')">
+ <xsl:call-template name="quote-canvas-parameter">
+ <xsl:with-param name="text" select="substring-before($text,',')"/>
+ </xsl:call-template>,
+ <xsl:call-template name="quote-canvas-parameter">
+ <xsl:with-param name="text" select="substring-after($text,',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($text, ': ')">
+ <xsl:value-of select="substring-before($text,': ')"/>
+ : '<xsl:value-of select="substring-after($text,': ')"/>'
+ </xsl:when>
+ <xsl:when test="contains($text, ':')">
+ <xsl:value-of select="substring-before($text,':')"/>
+ :'<xsl:value-of select="substring-after($text,':')"/>'
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message><xsl:value-of select="concat('Unknown parameter syntax in quote-canvas-paramter: ', $text)"/></xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<xsl:template match="programlisting[@language='lzx' and textobject/textdata/@fileref]">
<!-- extract necessary information from context -->
<xsl:variable name="fname" select="textobject/textdata/@fileref"/>
<xsl:variable name="query-parameters" select="parameter[@role='query']"/>
-
+
<!--If no canvas parameters are specified, set height to 400px and width to 500.
This fixes LPP-5207 change height of example code window from 200 to 400 pixels
[bshine 12.16.2007]
@@ -232,7 +264,10 @@
canvas widths.
The solution! Iterate over the result node set! -->
<xsl:for-each select="parameter[@role='canvas']">
- , <xsl:value-of select="."/> <!-- do a leading comma so that we don't have a stray comma at the end -->
+ <!-- leading comma for each param -->
+ , <xsl:call-template name="quote-canvas-parameter">
+ <xsl:with-param name="text" select="."/>
+ </xsl:call-template>
</xsl:for-each>
</xsl:variable>
@@ -246,7 +281,7 @@
</xsl:variable>
<xsl:variable name="canvas-id" select="generate-id(.)"/>
<xsl:variable name="swf-embed-params">{url: '<xsl:value-of select="concat($fname, '?lzt=swf', $query-param)"/>', id: '<xsl:value-of select="concat($canvas-id,'SWF')"/>', history: false, cancelmousewheel: true <xsl:value-of select="$canvas-parameters"/>}</xsl:variable>
- <xsl:variable name="dhtml-embed-params">{url: '<xsl:value-of select="concat($fname, '?lzt=html&lzr=dhtml', $query-param)"/>', id: '<xsl:value-of select="concat($canvas-id,'DHTML')"/>', cancelkeyboardcontrol: true, <xsl:value-of select="$canvas-parameters"/>}</xsl:variable>
+ <xsl:variable name="dhtml-embed-params">{url: '<xsl:value-of select="concat($fname, '?lzt=html&lzr=dhtml', $query-param)"/>', id: '<xsl:value-of select="concat($canvas-id,'DHTML')"/>', cancelkeyboardcontrol: true <xsl:value-of select="$canvas-parameters"/>}</xsl:variable>
<!-- To test examples in DHTML, uncomment the second script block below
and the call to lz.embed.lfc() above.
If you don't want to see the SWF version as well, comment out the
@@ -398,7 +433,6 @@
Lz.dhtmlEmbed(<xsl:value-of select="$dhtml-embed-params"/>);
</script>
?>
-
</div>
</xsl:template>
More information about the Laszlo-checkins
mailing list