forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <>
Subject Removed xdoc copying (Re: cvs commit: ...)
Date Sun, 12 Oct 2003 13:29:17 GMT
On Sun, Oct 12, 2003 at 12:51:32PM -0000, wrote:
> jefft       2003/10/12 05:51:32
>   Modified:    src/resources/conf cocoon.xconf faq.xmap forrest.xmap
>                         linkmap.xmap menu.xmap resources.xmap
>                         revisions.xmap sitemap.xmap
>                src/resources/forrest-shbat
>   Log:
>   Remove the need to copy xdocs to a temporary webapp. xdocs can now be edited in
>   their original directory and updates seen live, eg. when using 'forrest run'.

As you can see, I've made a start on in-place editing of content.  After
typing 'forrest run', XML can be edited in
src/documentation/content/xdocs/ and changes will appear on

This is done very simply with a 'project' DefaultsMetaModule, and every
occurrence of 'content/xdocs/' replaced with '{project:content.xdocs}'.



Lurking on lenya-dev, I saw a neat solution for how we can handle static
things like stylesheets, which exist in
$FORREST_HOME/resources/stylesheets, but may be overridden by the user in
src/documentation/resources/stylesheets/.  Namely, in the sitemap we use
(for example) '{stylesheet:changes2document.xsl}', and let an inputmodule
decide which path to use - either the overridden file, or the default.

To make this work, I wrote a ResourceExistsModule which interprets its
input as a path, and returns null if that path doesn't exist.  By putting
two of these in a ChainMetaModule, we achieve 'fallback' behaviour.  Here
is how the 'stylesheets' module is defined:

  <!-- Declare our components -->
    logger="core.modules.mapper" name="exists"/>
    logger="core.modules.mapper" name="mapper"/>
  <component-instance logger="core.modules.input" name="stylesheets"    class="org.apache.cocoon.components.modules.input.ChainMetaModule">
     <!-- Overridden stylesheet, if any -->
     <input-module name="mapper">       <!-- Add a prefix (the path) to the key (eg
'changes2document.xsl') -->
      <input-module name="exists"/>     <!-- If the full path exists, return it,
otherwise return null -->
     <!-- Default stylesheet.  Only used if overridden stylesheet doesn't exist -->
     <input-module name="mapper">
      <input-module name="exists"/>

The Lenya equivalent is a FallbackModule which hardcodes the paths - this
is just a generic equivalent.  I'll see about adding this
ResourceExistsModule to Cocoon CVS, so we can potentially use the same

Unfortunately this solution doesn't generalize to other possibly
overridden files like images, because we don't know the image name
beforehand, and we can't have {images:{1}} because the sitemap doesn't
allow nested variable interpolation.  Need to ping cocoon-dev and find
out if nested variables can be supported..

Hope everyone had a similarly fun weekend. ;P


View raw message