Ovidiu Gheorghies wrote:
Hi all.
How can one add custom JavaScript to the html pages?
If some JavaScript code is simply added to the page, the error is:
The content of element type "section" must match
"(title,(section|p|source|note|warning|fixme|table|ol|ul|dl|figure|anchor)*)"
>
> Still, is there a way to do it?
Not using XDoc. However you can do it by using HTML as your source file,
the problem with this is that HTML is not really structured enough in
its Syntax to allow forrest to process it correctly (it works but you
have to be careful how you write the HTML).
Another solution (and the one I use), is to place the javascript in
external files and then us <xi:include src="..."/> to include it in your
XDoc. This works because the inclusion is done after the validation of
the source file.
All this is messy, we need a better solution, which leads us to
forest:views. However this is a new feature being developed in 0.8-dev
and is not recomended for production environments yet.
Moreover, is it possible to add the
same JavaScript to all pages automatically?
Using 0.7 you need to create your own skin that will add the javascript
as you need it. If you look at the existing skins and the inclusion of
the last published time and the font sizing script you will see an
example of this.
Using 0.8-dev this becomes much easier in the aforementioned
forrest:views functionality. If you want to know more about that you
should join us on the dev list.
Ross