Author: ben
Date: 2007-10-22 13:41:08 -0700 (Mon, 22 Oct 2007)
New Revision: 6952
Modified:
openlaszlo/branches/paperpie/docs/src/build.xml
openlaszlo/branches/paperpie/docs/src/xsl/common-html.xsl
openlaszlo/branches/paperpie/docs/src/xsl/simple-driver.xsl
Log:
Change 20071019-ben-b by [EMAIL PROTECTED] on 2007-10-19 21:30:38 PDT
in /Users/ben/src/svn/openlaszlo/branches/paperpie/docs
for http://svn.openlaszlo.org/openlaszlo/branches/paperpie/docs
Summary: Live examples links for developer's guide and reference
New Features:
Bugs Fixed:
LPP-4794 Editor for live code examples in dguide (Introduction to
Components chapter) isn't working
LPP-4696 Edit buttons missing from dguide code examples
LPP-4024 Clicking "edit" on doc example causes Firefox launch
inappropriate inquiry
LPP-4683 Parameterize path to source in live-editor for examples in dev
guide
Technical Reviewer: none
QA Reviewer: (pending)
Doc Reviewer: sundman (pending)
Documentation:
Live examples and links to edit live examples should all work, in reference,
developers guide, and tutorials.
Release Notes:
Details:
docs/src/build.xml - Rearranged paths for building the reference guide so that
the directory paths make sense. Everything goes from docs/src/developers to
docs/build to docs/developers. I think this is how it was *designed* to
work,
but it's not quite how it *was* working.
1) The code examples go from the developers.input.dir
to the developers.build.dir in the developers.preprocess target.
2) In the developers.examples.preprocess target, the examples come from the
docs.build.dir and are transcluded in the developer's guide
index.dbk.
3) In developers.html.generate target, the input comes from
developers.build.dir
and is written out to docs/
Also, don't build the contributor's guide. It takes a long time, and we're
not using it right now.
docs/src/xsl/common-html.xsl - Added templates and variables to keep track of
where the current output is relative to $LPS_HOME. Various things (like the
link
to the editor.jsp) need to refer to $LPS_HOME, and other things need to know
how far nested they are down from $LPS_HOME/docs. Rather than being
incredibly
clever and figuring it out by regexp analysis of the current path, we just
check which part of the book we're building now, and map that directly
to the relative path information we need.
Using this information, I rearranged the hrefs in the live examples button
and link so that it works for both the developers guide, the reference
guide,
and the tutorials.
For the purposes of development, I have inserted some debugging information
immediately after each live example. This will be removed before we ship.
docs/src/xsl/simple-driver.xsl - Changed to test out techniques for analyzing
local variables and directories.
Tests:
Modified: openlaszlo/branches/paperpie/docs/src/build.xml
===================================================================
--- openlaszlo/branches/paperpie/docs/src/build.xml 2007-10-22 20:40:00 UTC
(rev 6951)
+++ openlaszlo/branches/paperpie/docs/src/build.xml 2007-10-22 20:41:08 UTC
(rev 6952)
@@ -1053,35 +1053,39 @@
<target name="developers.resources" depends="developers.preprocess">
<foreach target="book.resources.generate" list="developers" param="dir"
inheritall="true">
- <param name="local.input.dir" value="${developers.build.dir}"/>
+ <param name="local.input.dir" value="${developers.input.dir}"/>
<param name="local.output.dir" value="${developers.output.dir}"/>
<param name="local.build.dir" value="${developers.build.dir}"/>
</foreach>
<foreach target="book.resources.generate" list="tutorials" param="dir"
inheritall="true">
- <param name="local.input.dir" value="${developers.build.dir}/tutorials"/>
+ <param name="local.input.dir" value="${developers.input.dir}/tutorials"/>
<param name="local.output.dir"
value="${developers.output.dir}/tutorials"/>
<param name="local.build.dir" value="${developers.build.dir}/tutorials"/>
</foreach>
</target>
+ <!-- This target seems to pull the example program's code into the docbook
file,
+ and format it for pretty printing. Earlier, in developers.preprocess,
+ we copied the example code files into $LPS_HOME/docs/developers/programs.
+ [bshine 10.19.2007] -->
<target name="developers.examples.preprocess"
depends="developers.preprocess">
<antcall target="dbk.examples.preprocess" inheritAll="true">
- <param name="local.input.dir" value="${docs.build.dir}"/>
+ <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="${docs.output.dir}"/>
- <param name="local.output.index"
value="developers/${developers.dbk.index}"/>
+ <param name="local.output.dir" value="${developers.output.dir}"/> <!--
$LPS_HOME/docs/developers -->
+ <param name="local.output.index" value="${developers.dbk.index}"/>
<param name="local.worksheet" value="xsl/dbkpreprocessexamples.xsl"/>
</antcall>
</target>
<target name="developers.html.generate"
depends="developers.examples.preprocess">
<antcall target="book.html.generate" inheritAll="true">
- <param name="local.input.dir" value="${docs.output.dir}"/>
- <param name="local.input.index"
value="developers/${developers.dbk.index}"/>
+ <param name="local.input.dir" value="${developers.build.dir}"/>
+ <param name="local.input.index" value="${developers.dbk.index}"/>
<param name="local.output.dir" value="${docs.output.dir}"/>
- <param name="local.output.index"
value="developers/${developers.html.index}"/>
- <param name="local.output.depends.dir" value="${developers.output.dir}"/>
+ <param name="local.output.index" value="${developers.html.index}"/>
+ <param name="local.output.depends.dir" value="${docs.output.dir}"/>
<param name="local.output.depends.set" value="*"/>
<param name="local.worksheet" value="xsl/dguide.xsl"/>
</antcall>
@@ -1314,8 +1318,9 @@
targets relating to both ref and tutorial docs:
-->
+ <!-- don't build the contributor's guide, because I don't want to and it
takes too long [bshine 10.17.2007] -->
<target name="build" description="Make the documentation"
- depends="users,contributors,reference.frameset.generate"
+ depends="users,reference.frameset.generate"
unless="skip.doc"/>
<target name="clean" description="clean up generated files"
Modified: openlaszlo/branches/paperpie/docs/src/xsl/common-html.xsl
===================================================================
--- openlaszlo/branches/paperpie/docs/src/xsl/common-html.xsl 2007-10-22
20:40:00 UTC (rev 6951)
+++ openlaszlo/branches/paperpie/docs/src/xsl/common-html.xsl 2007-10-22
20:41:08 UTC (rev 6952)
@@ -26,6 +26,7 @@
<!-- Path to base directory on local disk of output files -->
<xsl:param name="base.dir" />
+
<!-- Address of the servlet relative to the generated file -->
<xsl:param name="root.relative.lps.includes" select="'../lps/includes/'"/>
@@ -44,32 +45,59 @@
<xsl:param name="warn.no.programlisting.canvas.width" select="false()"/>
+ <xsl:template name="base.book.name">
+ <xsl:choose>
+ <xsl:when test="contains(ancestor::part/@id,
'developers.tutorials')">developers/tutorials</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id,
'.ref')">reference</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id,
'deployers')">deployers</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id,
'contributors')">contributors</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id,
'contribref')">contribref</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id, 'users')">users</xsl:when>
+ <xsl:when test="contains(ancestor::part/@id,
'developers')">developers</xsl:when>
+ <xsl:otherwise>unknownbook <!-- This is an error -->
+ <xsl:message>ERROR: could not identify book from part/@id, for
<xsl:value-of select="ancestor::part/@id"/></xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:variable name="root.relative">
+ <xsl:call-template name="dbhtml-dir"/>
+ </xsl:variable>
+
+ <xsl:variable name="depth.from.lpshome">
+ <xsl:value-of select="number(2)"/>
+ </xsl:variable>
+
+ <xsl:variable name="relative.path.to.lpshome">
+ <xsl:call-template name="copy-string">
+ <xsl:with-param name="string" select="'../'"/>
+ <xsl:with-param name="count" select="$depth.from.lpshome"/>
+ </xsl:call-template>
+ </xsl:variable>
+
<xsl:template name="local.lps.path">
-
- <xsl:variable name="root.relative">
- <xsl:call-template name="dbhtml-dir"/>
- </xsl:variable>
-
<xsl:variable name="depth">
- <xsl:call-template name="count.uri.path.depth">
- <xsl:with-param name="filename" select="$root.relative"/>
- </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="contains(ancestor-or-self::part/@id,
'developers.tutorials')">
+ <xsl:value-of select="number(3)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
-
- <xsl:variable name="href">
- <xsl:call-template name="copy-string">
- <xsl:with-param name="string" select="'../'"/>
- <xsl:with-param name="count" select="$depth"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:value-of select="$href"
- />
+ <xsl:value-of select="$root.relative" />
+ <xsl:call-template name="copy-string">
+ <xsl:with-param name="string" select="'../'"/>
+ <xsl:with-param name="count" select="$depth"/>
+ </xsl:call-template>
</xsl:template>
<xsl:template name="user.head.content">
<xsl:variable name="rootpath">
<xsl:call-template name="local.lps.path"/>
+ <xsl:text>docs/</xsl:text>
</xsl:variable>
<link rel="stylesheet" href="{$rootpath}includes/docbook.css"
type="text/css"/>
<link rel="stylesheet" href="{$rootpath}includes/lzx-pretty-print.css"
type="text/css"/>
@@ -161,6 +189,8 @@
</xsl:template>
<xsl:template match="[EMAIL PROTECTED]'lzx' and
textobject/textdata/@fileref]">
+
+
<!-- extract necessary information from context -->
<xsl:variable name="fname" select="textobject/textdata/@fileref"/>
<xsl:variable name="query-parameters" select="[EMAIL PROTECTED]'query']"/>
@@ -197,20 +227,36 @@
<!-- throw in the edit button -->
<xsl:if test="$live">
+
<xsl:variable name="edit-href">
- <xsl:text>../../../laszlo-explorer/editor.jsp?src=</xsl:text>
- <xsl:value-of select="$localdir"/>
- <xsl:text>developers/</xsl:text> <!-- TODO: BUG LPP-4683
- This should not be hardcoded to
developers. What about
- programs that are in contributors or
deployers? This needs to
- be parameterized per-book [bshine
2007.09.07] -->
+ <xsl:value-of select="$relative.path.to.lpshome"/>
+ <xsl:text>laszlo-explorer/editor.jsp?src=docs/</xsl:text>
+ <xsl:call-template name="base.book.name"/>
+ <xsl:text>/</xsl:text>
<xsl:value-of select="$fname"/>
</xsl:variable>
+ <xsl:variable name="editbuttonimg">
+ <!-- TODO [bshine 10.19.2007]
+ If we're in the top-level directory, we only need to go ../includes
to get to the edit button.
+ If we're in something/tutorial then we need to go up ../../includes
-->
+ <xsl:value-of select="$relative.path.to.lpshome"/>
+ <xsl:text>docs/includes/d_t_editbutton.gif</xsl:text>
+ </xsl:variable>
<xsl:text>
</xsl:text>
<div class="edit-button">
- <a href="{$edit-href}" target="lzview"><img border="0" alt=""
height="18" width="42" src="../../docs/includes/d_t_editbutton.gif"/></a>
+ <a href="{$edit-href}" target="lzview">
+ <img src="{$editbuttonimg}" border="0" alt="edit" />
+ </a>
</div>
<xsl:text>
</xsl:text>
+ <pre>
+ localdir: <xsl:value-of select="$localdir"/>
+ basedir: <xsl:value-of select="$base.dir"/>
+ fname: <xsl:value-of select="$fname"/>
+ base.book.name: <xsl:call-template name="base.book.name" />
+ root.relative: <xsl:value-of select="$root.relative"/>
+ relative.path.to.lpshome: <xsl:value-of
select="$relative.path.to.lpshome"/>
+ </pre>
</xsl:if>
</xsl:template>
@@ -295,10 +341,8 @@
<xsl:param name="href">
<xsl:text>../../laszlo-explorer/editor.jsp?src=</xsl:text>
<xsl:value-of select="$localdir"/>
- <xsl:text>developers/</xsl:text> <!-- TODO: BUG LPP-4683
- This should not be hardcoded to
developers. What about
- programs that are in contributors or
deployers? This needs to
- be parameterized per-book [bshine
2007.09.07] -->
+ <xsl:call-template name="base.book.name" />
+ <xsl:text>/</xsl:text>
<xsl:value-of select="."/>
</xsl:param>
<xsl:text>
</xsl:text>
Modified: openlaszlo/branches/paperpie/docs/src/xsl/simple-driver.xsl
===================================================================
--- openlaszlo/branches/paperpie/docs/src/xsl/simple-driver.xsl 2007-10-22
20:40:00 UTC (rev 6951)
+++ openlaszlo/branches/paperpie/docs/src/xsl/simple-driver.xsl 2007-10-22
20:41:08 UTC (rev 6952)
@@ -24,10 +24,12 @@
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:preserve-space elements="body"/>
+ <xsl:import href="common-html.xsl"/>
+
<xsl:output method="xml"/>
<!-- simple driver for testing paperpie doctools work -->
-
+
+
<xsl:param name="visibility.filter" select="'public'"/>
<xsl:key name="id" match="*" use="@id"/>
@@ -39,55 +41,12 @@
<xsl:key name="superclass" match="property[child::class]"
use="class/@extends"/>
<xsl:template match="/">
- <body>
- <!-- find all properties which have exactly one class child -->
- <xsl:apply-templates
select="descendant::function"></xsl:apply-templates>
- </body>
+ <xsl:for-each select="descendant::refsect1[1]">
+ $relative.path.to.lpshome: <xsl:value-of
select="$relative.path.to.lpshome"/>
+ local.lps.path:<xsl:call-template name="local.lps.path" />
+ base.book.name:<xsl:call-template name="base.book.name" />
+ dbhtml-dir <xsl:call-template
name="dbhtml-dir"></xsl:call-template>
+ </xsl:for-each>
</xsl:template>
-
- <xsl:template match="function">
- <function>
- <xsl:attribute name="name"><xsl:value-of select="../@name"
/></xsl:attribute>
- <class>
- <xsl:value-of select="ancestor::property/@name"/>
- </class>
- </function>
- </xsl:template>
-
- <xsl:template name="functionfun" >
- <!-- TO DO: special format for setters (properties with
../object/../[EMAIL PROTECTED]'setters'] structure) -->
- <xsl:param name="static"/>
- <xsl:param name="describe-js" select="true()"/>
- <xsl:param name="describe-lzx" select="true()"/>
- <xsl:variable name="property" select=".."></xsl:variable>
- <xsl:variable name="jsname" select="$property/@name"/>
- <xsl:variable name="lzxname" select="&tagname;"/>
- <xsl:variable name="name" select="&commonname;"/>
- <xsl:variable name="sortasname" select="translate($name,'_$',' ')"/>
- <xsl:variable name="id" select="$property/@id"/>
- <xsl:variable name="desc">
- <xsl:apply-templates select="$property" mode="desc"/>
- </xsl:variable>
- <xsl:variable name="xref">
- <xsl:apply-templates select="$property" mode="xref"/>
- </xsl:variable>
-
- <varlistentry>
- <term id="{$id}" xreflabel="{$xref}">
- <!-- how to get the indexterm to use a different name than
xreflabel? -->
- <indexterm zone="{$id}">
- <primary>
- <xsl:if test="$name != $sortasname">
- <xsl:attribute name="sortas"><xsl:value-of
select="$sortasname"/></xsl:attribute>
- </xsl:if>
- <xsl:value-of select="$name"/>
- </primary>
- </indexterm>
- <xsl:value-of select="$desc"/>
- </term>
- </varlistentry>
- </xsl:template>
-
-
</xsl:stylesheet>
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins