forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r188757 - in /forrest/branches/locationmap_branch/main/fresh-site/src/documentation: WEB-INF/ WEB-INF/jtidy.properties content/locationmap.xml content/xdocs/samples/locationmap/index.xml sitemap.xmap
Date Tue, 07 Jun 2005 12:07:17 GMT
Author: rgardler
Date: Tue Jun  7 05:07:17 2005
New Revision: 188757

URL: http://svn.apache.org/viewcvs?rev=188757&view=rev
Log:
a simple demo of integrating content from Apache Lenya

Added:
    forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/
    forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties
  (with props)
Modified:
    forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml
    forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
    forrest/branches/locationmap_branch/main/fresh-site/src/documentation/sitemap.xmap

Added: forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties?rev=188757&view=auto
==============================================================================
--- forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties
(added)
+++ forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties
Tue Jun  7 05:07:17 2005
@@ -0,0 +1,30 @@
+# Copyright 2002-2004 The Apache Software Foundation or its licensors,
+# as applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+indent=yes
+indent-spaces=8
+wrap=72
+markup=no
+output-xml=no
+input-xml=no
+show-warnings=yes
+numeric-entities=yes
+quote-marks=yes
+quote-nbsp=yes
+quote-ampersand=yes
+break-before-br=yes
+uppercase-tags=no
+uppercase-attributes=no
+char-encoding=latin1

Propchange: forrest/branches/locationmap_branch/main/fresh-site/src/documentation/WEB-INF/jtidy.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml?rev=188757&r1=188756&r2=188757&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml
(original)
+++ forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/locationmap.xml
Tue Jun  7 05:07:17 2005
@@ -33,5 +33,8 @@
    <match pattern="remoteDemo/**.xml">
      <location src="http://svn.apache.org/viewcvs.cgi/*checkout*/forrest/trunk/site-author/content/xdocs/{1}.xml"
/>
    </match>
+   <match pattern="lenya/**.xml">
+     <location src="http://lenya.zones.apache.org:8888/default/live/{1}.html?raw=true"
/>
+   </match>
   </locator>
 </locationmap>

Modified: forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml?rev=188757&r1=188756&r2=188757&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
(original)
+++ forrest/branches/locationmap_branch/main/fresh-site/src/documentation/content/xdocs/samples/locationmap/index.xml
Tue Jun  7 05:07:17 2005
@@ -40,9 +40,11 @@
       the locationmap however the leaf does not identify a pipeline but instead identifies
       a location string.</p>
     </section>
-      
+    
+    <section id="examples">
+      <title>Locationmap Examples</title>
       <section>
-        <title>Generating from a Different Location</title>
+        <title>Retrieving an XDoc via HTTP</title>
         
         
         <p>Normally files are generated from <code>{project:content.xdocs}</code>.
@@ -69,7 +71,7 @@
         <code>/remoteDemo/PATH/TO/FILE/FILENAME.html</code>. In addition, we
         can request any other output format available via FOrrest plugins.</p>
         
-        <p>When including resources from remote repositories one hs to
+        <p>When including resources from remote repositories one has to
         be careful about things like <code>site</code> and <code>ext</code>
         linking. If the targets are not defined in the local 
         <code>site.xml</code> file then these links will be broken.</p>
@@ -78,9 +80,83 @@
         page generated from the above example are broken.</warning>
         
       </section>
+      
+      <section>
+        <title>Retrieving HTML from Lenya</title>
+        
+        <p><a href="http://lenya.apache.org">Apache Lenya</a> is a Java
Open-Source Content Management System based 
+        on open standards such as XML and XSLT and the Apache Software Stack, in particular
the XML publishing 
+        framework Apache Cocoon. Apache Forrest can retrieve an publish content from an Apache
Lenya CMS.</p>
+        
+        <p>For example, the following locationmap matcher will instruct Forrest to
retrieve content from
+        <code>http://lenya.zones.apache.org:8888/default/live/*.html?raw=true</code>,
whenever a local URL of
+        <code>lenya/**</code> is encountered.</p>
+        
+        <source>
+ &lt;match pattern="lenya/**.xml"&gt;
+   &lt;location src="http://lenya.zones.apache.org:8888/default/live/{1}.html?raw=true"
/&gt;
+ &lt;/match&gt;
+        </source>
+        
+        <p>However, since the source returned by this match is HTML and not XDoc we
also neet to convert this
+        to our internal XDoc format. We do this by adding the match below to our projects
<code>sitemap.xmap</code>
+        file.</p>
+        
+        <source>
+&lt;map:match pattern="lenya/**.xml"&gt;
+  &lt;map:generate type="html" src="{lm:{0}}" /&gt;
+  &lt;map:transform src="{forrest:stylesheets}/html2document.xsl" /&gt;
+  &lt;map:serialize type="xml"/&gt;
+&lt;/map:match&gt;
+        </source>
+        
+        <p>Since this snippet uses the HTML generator you must also ensure that your
sitemap has the HTML generator
+        component defined. That is, your sitemap must also include:</p>
+        
+        <source>
+&lt;map:components&gt;
+  &lt;map:generators default="file"&gt;
+    &lt;map:generator name="html"
+      src="org.apache.cocoon.generation.HTMLGenerator"&gt;
+      &lt;jtidy-config&gt;WEB-INF/jtidy.properties&lt;/jtidy-config&gt;
+    &lt;/map:generator&gt;
+  &lt;/map:generators&gt;
+&lt;/map:components&gt;
+        </source>
+        
+        <p>Since the HTML generator uses JTidy we need to make available a JTidy configuration
file.
+        This is placed in <code>PROJECT_HOME/src/documentation/WEB-INF/jtidy.properties</code>
(the
+        location can be changed in the above sitemap snippet). A sample config file is given
below:</p>
+        
+        <source>
+indent=yes
+indent-spaces=8
+wrap=72
+markup=no
+output-xml=no
+input-xml=no
+show-warnings=yes
+numeric-entities=yes
+quote-marks=yes
+quote-nbsp=yes
+quote-ampersand=yes
+break-before-br=yes
+uppercase-tags=no
+uppercase-attributes=no
+char-encoding=latin1
+        </source>
+                
+        <note>This requirement to add items to your project sitemap will be removed
in a future version either by Lenya
+        outputting XDoc or by Forrest switching to using XHTMl as its internal format (whichever
comes
+        first.</note>
+        
+        <p>Here is the <a href="/lenya/index.html">index page</a> from
that location.</p>
+        
+        <warning>This functionality is still under development. It does not work fully
yet. For exammple, absolute URLs
+        in the source document need to be rewritten to ensure that they are matched by the
locationmap.</warning>
+        
+      </section>
 
-    <section id="examples">
-      <title>Locationmap Examples</title>
       <section>
         <title>Link Rewriting</title>
         <p>The locationmap can be used to rewrite URLs when the page is generated.

Modified: forrest/branches/locationmap_branch/main/fresh-site/src/documentation/sitemap.xmap
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/main/fresh-site/src/documentation/sitemap.xmap?rev=188757&r1=188756&r2=188757&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/main/fresh-site/src/documentation/sitemap.xmap (original)
+++ forrest/branches/locationmap_branch/main/fresh-site/src/documentation/sitemap.xmap Tue
Jun  7 05:07:17 2005
@@ -16,6 +16,15 @@
   limitations under the License.
 -->
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:components>
+    <map:generators default="file">
+      <map:generator name="html"
+        src="org.apache.cocoon.generation.HTMLGenerator">
+        <jtidy-config>WEB-INF/jtidy.properties</jtidy-config>
+      </map:generator>
+    </map:generators>
+  </map:components>
+
  <map:pipelines>
   <map:pipeline>
    <map:match pattern="**custom.xml">
@@ -23,6 +32,12 @@
     <map:transform src="{project:resources.stylesheets}/hello2document.xsl" />
     <map:serialize type="xml"/>
    </map:match>
+   
+  <map:match pattern="lenya/**.xml">
+    <map:generate type="html" src="{lm:{0}}" />
+    <map:transform src="{forrest:stylesheets}/html2document.xsl" />
+    <map:serialize type="xml"/>
+  </map:match> 
    
   </map:pipeline>
  </map:pipelines>



Mime
View raw message