forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Bolger" <pbol...@gmail.com>
Subject Re: Modifying plugin
Date Wed, 08 Mar 2006 03:41:02 GMT
> Now, back to parameterisation.
>
> In 0.7 it is not easy to parameterise plugins. It is possible, but
> complex and requires modifications to core, which is obviously not a
> good thing for a plugin to do. In 0.8-dev though it is much easier.
>
> Basically, you create a default.plugin.properties.xml file in the root
> of the plugin directory and add any properties you need. In this case we
> want a property to define if we are to allow incorrect heading
> hierarchies. SO our default.properties.xml plugin would look like
> something like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <properties>
>     <!-- OpenOffice plugin properties -->
>
>     <!-- OpenOffice documents can be created with poorly structured
> heading hierarchies. This is bad practice and can result in unintended
> visual effects when rendering in other formats. Set this property to
> true if you would like the plugin to insert a warning in such documents. -->
>
>     <property name="OOo.headingsHierarchy.warning" value="true"/>
>
> </properties>
>
> Now we need to pass this parameter into the stylesheets so that they can
> be modified to behave as required. This requires a modification to the
> input.xmap, for example:
>
> add
>    <map:parameter name="warnHeadingHierarchies"
> value="{project:OOo.headingHierarchy.warning}" />
>
> to the sx* transformations, i.e.:
>
>          <map:when test="{lm:project.{uri}.sxw}">
>            <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
>              <!-- FIXME: use the OOo generator as seen in the resume
> plugin -->
>              <map:generate src="{lm:OOo.bootstrap}"/>
>              <map:transform
> src="{lm:OOo.transform.xsl.aggregates/openoffice-document}">
>                <map:parameter name="src" value="{lm:project.{1}{2}.sxw}"/>
>              </map:transform>
>              <map:transform type="cinclude"/>
>              <map:transform
> src="{lm:OOo.transform.openoffice-writer.forrest}">
>                <map:parameter name="filename" value="{2}" />
>                <map:parameter name="extension" value="sxw" />
>                <map:parameter name="warnHeadingHierarchies"
> value="{project:OOo.headingHierarchy.warning}" />
>              </map:transform>
>              <map:serialize type="xml-document"/>
>            </map:match>
>          </map:when>
>
> Finally we need to make the XSL behave differently according to this
> parameter:
>
> <xsl:param name="warnHeadingHierarchies"/>
>
> ...
>
> <xsl:if test="warnHeadingHierarchies='true'">
>    <!-- add the warning -->
> </xsl:if>
>
> Now, if the user wants to change this behaviour all they need to do is
> override the value of OOo.headingsHierarchy.warning in
> forrest.properties.xml in their project root.
>
> It is also possible for individual users to change the value of this
> using local.forrest.properties.xml.
>
> ---
>
> It would be great if you could provide a patch or this. The advantage is
> that you will not have to keep your OOo plugin in synch with the one we
> release and, of course, we all get the benefit of your work.


alright, I'm currently digesting this....

Mime
View raw message