forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <d...@brondsema.net>
Subject Re: text2document
Date Thu, 17 Jul 2003 20:28:22 GMT
Quoting Dave Brondsema <dave@brondsema.net>:

> 
> I would like to put some .txt files in the xdocs directory and have them
> generate documents where the content is all the text within a <source> tag. 
> This seems like it would be easy to implement, but I'm not very familiar with
> forrest's pipelines.  Anyone up for it?
> 
> TIA,
> 

Well.. I did it myself.  It's not pretty how it takes care of line endings, but
it works.  If someone knows how to fix it that'd be great.

To implement this, use the attached files and add the following to forrest.xmap
in the source formats section:
          <map:when test="content/xdocs/{1}.txt">
            <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
              <map:generate type="text2xml" src="content/xdocs/{1}{2}.txt" />
              <map:transform type="lexer"   src="resources/grammars/text.xlex"/>
              <map:transform type="parser"  src="resources/grammars/text.xgrm"/>
              <map:transform src="resources/stylesheets/text2document.xsl">
                <map:parameter name="name" value="{2}" />
              </map:transform>
              <map:transform type="idgen" />
              <map:serialize type="xml"/>
            </map:match>
          </map:when>

Mime
View raw message