Mailing List Archive

Embedding existing HTML pages from a location outside src/documentation/content/xdocs
Hello,

I'm trying to embed existing HTML pages into a site generated by Forrest.
Starting from a "forrest seed" everything works fine out of the box if
the pages are in a sub-directory of src/documentation/content/xdocs like
samples-b/embedded_html.html is.
However I would like to move them somewhere else, for instance let's say
in src/documentation/content/embedded/embedded_html.html, changing
site.xml like this :

@@ -43,6 +43,8 @@
<about label="About">
<index label="Index" href="index.html" description="Welcome to
MyProj"/>
<linkmap label="Documentation ToC" href="linkmap.html"
description="Table of Contents for this example site"/>
+ <sample-html label="Embedded HTML" href="embedded/embedded_html.html"
+ description="Test of Embedded HTML"/>
</about>
<samples tab="samples">
<overview label="Overview" href="samples-a/index.html"/>
@@ -60,8 +62,6 @@
<linking label="Linking" href="linking.html" description="Linking
explained and demonstrated"/>
<sample-howto label="How To" href="howto-howto.html"
description="Test of How To documents"/>
- <sample-html label="Embedded HTML" href="embedded_html.html"
- description="Test of Embedded HTML"/>
<sample-ascii-art label="ascii-art page" href="ascii-art.html"
description="Sample Ascii Art page"/>
<svg label="Using SVG" href="svg.html" description="Using
Scalable Vector Graphics (SVG)"/>


I cannot seem to come up with the proper modifications to sitemap.xmap
and/or locationmap.xml to make it work.

I thought adding something like this to locationmap.xml would be enough :
<match pattern="embedded/**">
<location src="{properties:content}/{0}"/>
</match>
But the file is still being looked for in .../xdocs/... :
X [0] embedded/embedded_html.html
BROKEN:
c:\Users\Mat\Desktop\dev\perso\cpp\forrest_seed\src\documentation\content\xdocs\embedded\embedded_html.xml
(The system cannot find the path specified)

Is there a solution involving only altering the locationmap ?

I also tried the "old_site" path, that is not touching locationmap.xml
but adding the following to the sitemap.xmap existing pipeline :
<map:pipelines>
<map:pipeline>
<map:match pattern="embedded/**.html">
<map:read src="{properties:content}{0}" mime-type="text/html"/>
</map:match>
...
This somewhat succeeds, as in "build successful", but the page is not
really embedded as it misses the skinning.
Then I tried this instead :
<map:pipelines>
<map:pipeline>
<map:match pattern="embedded/**.html">
<map:generate type="html" src="{properties:content}{0}"/>
<map:transform
src="{forrest:forrest.stylesheets}/html-to-document.xsl"/>
<map:serialize type="xml"/>
</map:match>
...
And got the following error :
X [0] embedded/embedded_html.html
BROKEN:
C:\Users\Mat\Desktop\dev\tools\forrest\main\webapp\.\c:\Users\Mat\Desktop\dev\perso\cpp\forrest_seed\src\WEB-INF\jtidy.properties
(The filename, directory name, or volume label syntax is incorrect)

I read https://issues.apache.org/jira/browse/FOR-679 and did what is
suggested but the same error remains.
I tried copying the jtidy.properties file to src/WEB-INF and still got
the same error.

Did I miss something obvious ?
Am I completely misunderstanding how Forrest/Cocoon work ?

Thanks !
MAT.
Re: Embedding existing HTML pages from a location outside src/documentation/content/xdocs [ In reply to ]
Mathieu Champlon wrote:
> Hello,
>
> I'm trying to embed existing HTML pages into a site generated by Forrest.

Ah sorry I forgot to say that I'm using Forrest 0.9-dev (just made a
fresh checkout a couple of days ago) and jdk1.6.0_03.

MAT.
RE: Embedding existing HTML pages from a location outside src/documentation/content/xdocs [ In reply to ]
> -----Original Message-----
> From: Mathieu Champlon [mailto:m.champlon@free.fr]
> Sent: Sunday, 15 February 2009 12:46 AM
> To: user@forrest.apache.org
> Subject: Embedding existing HTML pages from a location outside
> src/documentation/content/xdocs
>
> Hello,
>
> I'm trying to embed existing HTML pages into a site generated by Forrest.
> Starting from a "forrest seed" everything works fine out of the box if
> the pages are in a sub-directory of src/documentation/content/xdocs like
> samples-b/embedded_html.html is.
> However I would like to move them somewhere else, for instance let's say
> in src/documentation/content/embedded/embedded_html.html, changing
> site.xml like this :
>
> @@ -43,6 +43,8 @@
> <about label="About">
> <index label="Index" href="index.html" description="Welcome to
> MyProj"/>
> <linkmap label="Documentation ToC" href="linkmap.html"
> description="Table of Contents for this example site"/>
> + <sample-html label="Embedded HTML" href="embedded/embedded_html.html"
> + description="Test of Embedded HTML"/>
> </about>
> <samples tab="samples">
> <overview label="Overview" href="samples-a/index.html"/>
> @@ -60,8 +62,6 @@
> <linking label="Linking" href="linking.html" description="Linking
> explained and demonstrated"/>
> <sample-howto label="How To" href="howto-howto.html"
> description="Test of How To documents"/>
> - <sample-html label="Embedded HTML" href="embedded_html.html"
> - description="Test of Embedded HTML"/>
> <sample-ascii-art label="ascii-art page" href="ascii-art.html"
> description="Sample Ascii Art page"/>
> <svg label="Using SVG" href="svg.html" description="Using
> Scalable Vector Graphics (SVG)"/>
>
>
> I cannot seem to come up with the proper modifications to sitemap.xmap
> and/or locationmap.xml to make it work.
>
> I thought adding something like this to locationmap.xml would be enough :
> <match pattern="embedded/**">
> <location src="{properties:content}/{0}"/>
> </match>
> But the file is still being looked for in .../xdocs/... :
> X [0] embedded/embedded_html.html
> BROKEN:
> c:\Users\Mat\Desktop\dev\perso\cpp\forrest_seed\src\documentation\content\
> xdocs\embedded\embedded_html.xml
> (The system cannot find the path specified)

This is a very quick suggestion very late at night for me, but

{properties:content}/{0} would resolve to
/src/documentation/content/embedded_html.html as you've stripped out the
embedded directory included in the match.

Try <location src="{properties:content}/embedded/{0}"/>

It will still look for it in xdocs as fallback of it does not find it in the
match specified.

If that's wrong either myself or someone else can look at a better time of
day :)

Gav...

>
> Is there a solution involving only altering the locationmap ?
>
> I also tried the "old_site" path, that is not touching locationmap.xml
> but adding the following to the sitemap.xmap existing pipeline :
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="embedded/**.html">
> <map:read src="{properties:content}{0}" mime-type="text/html"/>
> </map:match>
> ...
> This somewhat succeeds, as in "build successful", but the page is not
> really embedded as it misses the skinning.
> Then I tried this instead :
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="embedded/**.html">
> <map:generate type="html" src="{properties:content}{0}"/>
> <map:transform
> src="{forrest:forrest.stylesheets}/html-to-document.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
> ...
> And got the following error :
> X [0] embedded/embedded_html.html
> BROKEN:
> C:\Users\Mat\Desktop\dev\tools\forrest\main\webapp\.\c:\Users\Mat\Desktop\
> dev\perso\cpp\forrest_seed\src\WEB-INF\jtidy.properties
> (The filename, directory name, or volume label syntax is incorrect)
>
> I read https://issues.apache.org/jira/browse/FOR-679 and did what is
> suggested but the same error remains.
> I tried copying the jtidy.properties file to src/WEB-INF and still got
> the same error.
>
> Did I miss something obvious ?
> Am I completely misunderstanding how Forrest/Cocoon work ?
>
> Thanks !
> MAT.
Re: Embedding existing HTML pages from a location outside src/documentation/content/xdocs [ In reply to ]
Hello Gavin and thanks for your help,

Gavin wrote:
>> I thought adding something like this to locationmap.xml would be enough :
>> <match pattern="embedded/**">
>> <location src="{properties:content}/{0}"/>
>> </match>
>
> {properties:content}/{0} would resolve to
> /src/documentation/content/embedded_html.html as you've stripped out the
> embedded directory included in the match.
>
>
Doesn't {0} contain the whole match ?
What is the difference with {1} then ?

In the seeded sitemap.xmap there is :
<map:match pattern="old_site/**.html">
<map:select type="exists">
<map:when test="{properties:content}{0}">
<map:read src="{properties:content}{0}" mime-type="text/html"/>
...
Is the syntax slightly different between sitemap.xmap and locationmap.xml ?

> Try <location src="{properties:content}/embedded/{0}"/>
>
>
Just to be sure I tried each of the following :

<location src="{properties:content}{0}"/>
<location src="{properties:content}/{0}"/>
<location src="{properties:content}{1}"/>
<location src="{properties:content}/{1}"/>
<location src="{properties:content}/embedded/{0}"/>
<location src="{properties:content}embedded/{0}"/>
<location src="{properties:content}/embedded/{1}"/>
<location src="{properties:content}embedded/{1}"/>

All of them yield :
X [0] embedded/embedded_html.html
BROKEN:
c:\Users\Mat\Desktop\dev\perso\cpp\forrest_seed\src\documentation\content\xdocs\embedded\embedded_html.xml
(The system cannot find the path specified)


MAT.
Re: Embedding existing HTML pages from a location outside src/documentation/content/xdocs [ In reply to ]
Just in case someone faces the same issue, here is how I ended up
working around it.

I used the following pipeline :

<map:pipelines>
<map:pipeline>
<map:match pattern="embedded/**.html">
<map:generate type="html" src="{properties:content}{0}"/>
<map:transform
src="{forrest:forrest.stylesheets}/html-to-document.xsl"/>
<map:serialize type="xml"/>
</map:match>
...

Along with the following generator (a bit adapted from
https://issues.apache.org/jira/browse/FOR-679) :

<map:components>
<map:generators default="file">
<map:generator name="html"
src="org.apache.cocoon.generation.HTMLGenerator">
<jtidy-config>context://WEB-INF/jtidy.properties</jtidy-config>
</map:generator>
</map:generators>
...

And this solves the error I had previously which was :
X [0] embedded/embedded_html.html
BROKEN:
C:\Users\Mat\Desktop\dev\tools\forrest\main\webapp\.\c:\Users\Mat\Desktop\dev\perso\cpp\forrest_seed\src\WEB-INF\jtidy.properties
(The filename, directory name, or volume label syntax is incorrect)


Afterwards I played a bit with the forrest sitemap configuration, and
changed main/webapp/resources/schema/entity/symbols-core-v10.ent like this :
@@ -25,7 +25,7 @@
<!ENTITY for-s "<strong>Apache Forrest</strong>">

<!-- Configure some sitemap components -->
-<!ENTITY generator-html-jtidy-properties "WEB-INF/jtidy.properties">
+<!ENTITY generator-html-jtidy-properties
"context://WEB-INF/jtidy.properties">
<!ENTITY dispatcher-output-serializer "xhtml">
<!ENTITY serializer-html-encoding "UTF-8">
<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01
Transitional//EN">

It seems to work quite well and I was able to remove the generator
definition from my project sitemap entirely.
The jtidy.properties file is then looked for in main/webapp/WEB-INF
which is fine when no project specific customization is required.

I'm not really sure but maybe this could also be used to fix
https://issues.apache.org/jira/browse/FOR-679 ?
Actually I never experienced the problem described in FOR-679 anyway so
maybe it became invalid at some point when moving from 0.8 to 0.9dev ?


MAT.