You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by cr...@apache.org on 2005/03/17 05:26:48 UTC

svn commit: r157889 - in forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org: ./ resources/stylesheets/ src/documentation/content/xdocs/ src/documentation/content/xdocs/samples/

Author: crossley
Date: Wed Mar 16 20:26:46 2005
New Revision: 157889

URL: http://svn.apache.org/viewcvs?view=rev&rev=157889
Log:
Support Forrest HowTo docs via OpenOffice.org Writer documents.
Contributed by: Ferdinand Soethe
Issue: FOR-464

Added:
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/openoffice-writer-howto.sxw   (with props)
Modified:
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-common2forrest.xsl
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-writer2forrest.xsl
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/index.xml
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/site.xml
    forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/status.xml

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-common2forrest.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-common2forrest.xsl?view=diff&r1=157888&r2=157889
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-common2forrest.xsl (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-common2forrest.xsl Wed Mar 16 20:26:46 2005
@@ -19,6 +19,9 @@
 <xsl:stylesheet version="1.0" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" xmlns:config="http://openoffice.org/2001/config" office:class="text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="office meta  table number dc fo xlink chart math script xsl draw svg dr3d form config text style">
   <xsl:param name="filename"/>
   <xsl:param name="extension"/>
+  
+  <xsl:variable name="OOtemplate" select="/office:document/office:meta/meta:template/@xlink:title"/>
+   
   <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
   <xsl:output method="xml" version="1.0" encoding="UTF-8" 
     doctype-public="-//APACHE//DTD Documentation V1.2//EN" 
@@ -46,6 +49,14 @@
             </xsl:otherwise>
           </xsl:choose>
         </title>
+        <!-- Abstract is required field in HowTos, so always create it and fill with description field  -->
+        <abstract>
+          <xsl:value-of select="/office:document/office:meta/dc:description"/>
+        </abstract>
+      
+        <!-- last modified date -->
+        <last-modified-content-date date="{substring-before(/office:document/office:meta/dc:date, 'T')}"/>
+
         <xsl:call-template name="style"/>
       </header>
       <xsl:apply-templates select="//office:body"/>
@@ -57,8 +68,31 @@
       +-->
   <xsl:template match="office:body">
     <body>
-      <xsl:apply-templates select="key('rootChildren', generate-id())"/>
-      <xsl:apply-templates select="text:h[@text:level='1']"/>      
+      <xsl:if test="$OOtemplate = 'OpenOffice.org Writer HowTo Template'">
+        <!-- Special processing for top of HowTos -->
+        <header>
+          <title>
+              <xsl:choose>
+                <xsl:when test="/office:document/office:meta/dc:title = '' or not(/office:document/office:meta/dc:title)">
+                  <xsl:value-of select="$filename"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="/office:document/office:meta/dc:title"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </title>
+            <section id="Overview">
+              <title>Overview</title>
+            <p>
+              <xsl:value-of select="/office:document/office:meta/dc:description"/>
+            </p>
+          </section>
+          </header>
+          
+        </xsl:if> 
+         <xsl:apply-templates select="key('rootChildren', generate-id())"/>
+        <xsl:apply-templates select="text:h[@text:level='1']"/>  
+      
     </body>
   </xsl:template>
   
@@ -71,6 +105,7 @@
       <xsl:with-param name="prevLevel" select="1"/>
     </xsl:call-template>
   </xsl:template>
+  
   <xsl:template match="text:h[@text:level='2'] | text:h[@text:level='3']| text:h[@text:level='4'] | text:h[@text:level='5']">
     <xsl:variable name="level" select="@text:level"/>
     <xsl:call-template name="createSection">
@@ -78,29 +113,26 @@
       <xsl:with-param name="prevLevel" select="preceding-sibling::text:h[@text:level &lt; $level][1]/@text:level "/>
     </xsl:call-template>
   </xsl:template>
+  
   <xsl:template name="createSection">
     <xsl:param name="currentLevel"/>
     <xsl:param name="prevLevel"/>
-    <xsl:choose>
-      <xsl:when test="$currentLevel &gt; $prevLevel+1">
-        <section>
-          <title>hugo</title>
-          <xsl:call-template name="createSection">
-            <xsl:with-param name="currentLevel" select="$currentLevel"/>
-            <xsl:with-param name="prevLevel" select="$prevLevel +1"/>
-          </xsl:call-template>
-        </section>
-      </xsl:when>
-      <xsl:otherwise>
-        <section>
-          <title>
-            <xsl:apply-templates/>
-          </title>
-          <xsl:apply-templates select="key('rootChildren', generate-id())"/>
-          <xsl:apply-templates select="key('chieldElements', generate-id())"/>
-        </section>
-      </xsl:otherwise>
-    </xsl:choose>
+          
+      
+    <section class="{.}">  
+      <title>
+        <xsl:apply-templates/>
+      </title>
+      <!-- Report structuring errors with a fixme -->
+      <xsl:if test="$currentLevel &gt; $prevLevel+1">
+        <fixme author="openoffice-common2forrest template">
+          The previous heading is more than one level below the heading before it. To remove this fixme, correct the structuring of your document.
+        </fixme>
+      </xsl:if>
+      <xsl:apply-templates select="key('rootChildren', generate-id())"/>
+      <xsl:apply-templates select="key('chieldElements', generate-id())"/>
+    </section>
+  
   </xsl:template>
   
   <!--+

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-writer2forrest.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-writer2forrest.xsl?view=diff&r1=157888&r2=157889
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-writer2forrest.xsl (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/resources/stylesheets/openoffice-writer2forrest.xsl Wed Mar 16 20:26:46 2005
@@ -20,7 +20,6 @@
   
   <xsl:import href="openoffice-common2forrest.xsl"/>
   
-  
   <!-- ================================================================== -->
   <!-- The templates below match special styles created in a special 
        Forrest template. However, there is no longer any need to use this
@@ -109,6 +108,18 @@
       <xsl:apply-templates/>
     </fixme>
   </xsl:template>
+  
+  <!--+
+      | Fixme2
+      | - translates the yellow stickers to fixmes
+      |   
+      +-->
+  <xsl:template match="office:annotation">
+    <fixme author="{@office:author}">
+      <xsl:apply-templates/>
+    </fixme>
+  </xsl:template>
+  
 
   <!--+
       | Note
@@ -117,5 +128,32 @@
     <note>
       <xsl:apply-templates/>
     </note>
-  </xsl:template>    
+  </xsl:template>
+   
+  <!--+
+      | special list format p2
+      |
+      | 0verwrites template in openoffice-common2forrest
+      | to allow for bulleted list item 'forrest: instructional step' in oo to 
+      | become a simple para with a class-attr in forrest (instruction)
+      | In order to do so, this template omits the <ul>-Element
+      | and bypasses the processing of the <li>-Element.
+      |        
+      +-->
+      
+  <xsl:template match="text:unordered-list[@text:style-name='L2']">
+      <xsl:apply-templates select="text:list-item/text:p"/>
+      <xsl:apply-templates select="text:list-item/text:unordered-list"/>
+      <xsl:apply-templates select="text:list-item/text:ordered-list"/> 
+  </xsl:template> 
+   
+  <!--+
+      | Instructional step
+      +-->
+  <xsl:template match="text:p[@text:style-name='P2']">
+    <p class="instruction">
+      <xsl:apply-templates/>
+    </p>
+  </xsl:template> 
+      
 </xsl:stylesheet>

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/index.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/index.xml?view=diff&r1=157888&r2=157889
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/index.xml (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/index.xml Wed Mar 16 20:26:46 2005
@@ -23,6 +23,7 @@
   <body> 
     <ul>
       <li><a href="openoffice-writer.html">OpenOffice Writer</a></li>
+      <li><a href="openoffice-writer-howto.html">Creating a Forrest HowTo with OpenOffice Writer</a></li>
       <li><a href="openoffice-impress.html">OpenOffice Impress</a> (Note this is very useful in conjunction with the 
       S5 slides plugin)</li>
     </ul>

Added: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/openoffice-writer-howto.sxw
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/openoffice-writer-howto.sxw?view=auto&rev=157889
==============================================================================
Binary file - no diff available.

Propchange: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/samples/openoffice-writer-howto.sxw
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/site.xml?view=diff&r1=157888&r2=157889
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/site.xml (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/src/documentation/content/xdocs/site.xml Wed Mar 16 20:26:46 2005
@@ -41,6 +41,7 @@
   <samples label="Samples" href="samples/">
     <index label="Index" href="index.html" description="Index of example files available"/>
     <openOfficeWriter label="SXW" href="openoffice-writer.html" description="OpenOffice.org Writer Example"/>
+    <openOfficeWriterhowto label="HowTo" href="openoffice-writer-howto.html" description="OpenOffice.org Writer HowTo Example"/>
     <openOfficeImpress label="SXI" href="openoffice-impress.html" description="OpenOffice.org Impress Example"/>
   </samples>
   

Modified: forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/status.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/status.xml?view=diff&r1=157888&r2=157889
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/status.xml (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.OpenOffice.org/status.xml Wed Mar 16 20:26:46 2005
@@ -24,6 +24,10 @@
 
   <changes>
     <release version="0.1" date="unreleased">
+      <action dev="DC" type="add" context="code"
+        due-to="Ferdinand Soethe" fixes-bug="FOR-464">
+        Support Forrest HowTo docs via OpenOffice.org Writer documents.
+      </action>
       <action dev="RDG" type="add" context="code">
         Support embedded images in documents.
       </action>