forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <>
Subject Re: Multiple file output formats and views (skinned-source-translation-etc)
Date Sun, 09 May 2004 10:31:46 GMT
Upayavira wrote:
> Nicola Ken Barozzi wrote:
>> Ok, so I hope I've explained the problem. We have multiple outputs and 
>> only one input.
>> Cocoon has a very neat concept of this called "views". We could have a 
>> default view and define the other ones as different views of the same 
>> source.
>>   index.html
>>   index.html?cocoon-view=source
>>   index.html?cocoon-view=docs
>>   index.html?cocoon-view=translated&language=fr
>> This is ok for live sites, but for static sites?
>> It's easy to see that the default output is the one that skins the 
>> file to make it published on the website.
>> The question is: how do we make the urls of the other views? Should we 
>> simply follow the Cocoon CLI convention on views to flatten the names 
>> or use another scheme?
> If you use the CLI to rewrite filenames, you need to have it rewrite 
> links within pages too, which really slows things down. So if you can do 
> it without using that CLI functionality, so much the better.

But as views are a special Ccooon feature, the CLI should be able to 
rewrite them without too much overhead.

> Of course, you could get the CLI to rewrite filenames and handle the 
> link rewriting yourself, but then your links wouldn't work in the live 
> site? (Unless you made a dynamic redirect from the rewritten view url to 
> the actual view, e.g. index_source.html->index.html?cocoon-view=source).

I think this is a good option!

> I'm open to the CLI having a more sophisticated way of rewriting 
> filenames. It has been asked for, but I just haven't been able to work 
> out for myself how to do it. 

More than this, I think that the issue is more about defining better how 
views are called on files. I don't really like the parameter thing very 
much, but of course don't have a better idea myself.

> There are three options that come to mind immediately:
> 1) Ignore the request parameters

We can't, as we need to output different files.

> 2) Just replace & and ?, etc: index.html_cocoon-view_source (but this is 
> static server unfriendly and ugly)


> 3) Place the request param stuff before the extension: 
> index.cocoon-view.source.html
> Thoughts?

Let's make it more difficult ;-)

Here is how maybe /ideally/ we could use views (with "ideally" I'm not 
talking about how they are requested but the fact that files use views 
instead of extensions).



1-  index.html
2-  index.pdf
3-  index.html (highlighted source code)
4-  index.pdf  (highlighted source code)
5-  index.html (highlighted docs)
6-  index.html (in french)
7-  index.pdf  (highlighted docs)
8-  index.pdf  (highlighted french docs)

But if you see the above, it becomes quite clear that something is wrong 
when looking the files statically. (1) and (3) have the same source, but 
are not the same file, ie result. Hence they should not have the same name.

This makes me think that maybe using views is not the best thing for 
this, especially when we are talking about making the files static.
IOW, probably we should simply make our own "views" in Forrest by 
defining a different naming convention for these views than the one used 
by Cocoon.

How does Apache HTTP deal with this? What standards are there that we 
can make of use?

Nicola Ken Barozzi         
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)

View raw message