[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Using information in other documents



On Fri, 2 Mar 2001, Stephane Bortzmeyer wrote:
> A bit of ePerl code?
> 
> <define-tag href>
> <:
> # Open the file
> # Find the title (HTML::HeadParser)
> # Print it
> :>
> </define-tag>

That would take care of the HTML case, which is cool enough, not the most
important case to me.

On Fri, 2 Mar 2001, Axel Beckert wrote:
> All link descriptions are given as variable values in the source file.
> My WML template writes this data together with path and file name in
> some file named file-descriptions.psv (pipe separated values :-). When
> bulding the navigation bar, the template finds out the appropriate
> path and links to every level using the data from this file.
> 
> The disadvantage is known from the table of contents in LaTeX written
> documents: You have at least to compile all documents twice at the
> beginning, but after that usually one compilation is enough.

I agree that this is not an optimal solution: Building a web site should
be an exact science :-) But it is not necessary. Here is what I have
thought about (without looking at the source to WML, actually):

I define macros <title></title> <description></description> <body></body>
and similar macros to enclose content that may be referenced from
elsewhere.

These macros divert this content into seperate diversions.

Using a WML -o construct, I can extract the contents of e.g. the title and
description diversions. This I will execute in a macro
<get-title document="wmldocument">

(A generic macro <get-diversion document="" diversion=""> would form the
basis of this.)

Obviously, loops can be created: A title referring to the title of another
document referring to the title of the first document. But that's okay.

Another advantage of this is that if I define a tag
<related-links></related-links> to contain a collection of links that are
related to a certain document, then I can reuse this collection by doing
<get-diversion document="whatever" diversion="related-links">

As far as I can see, all this can be done with WML as it is, but it will
be slow, since for every <get-diversion...> tag, WML needs to be run once
on the target document.

But it should be possible to cache the results of the <get-diversion...>
tag by checking modification time of the target document. It could be
cached in a simple hashed database file with the key being the joined full
pathname of the document and the diversion.

(BTW, this caching could be extended to cover the HTML case too.)

So far so good. My problem is that I'm a lousy Perl programmer (a good
programmer, but not in Perl - I actually used to dislike Perl a lot, but
if it can make my life easier, then I can live with its obscurity).

Let me hear your input on this. Will someone help me with this project?

-- 
Anders Dinsen
anders@dinsen.net
http://dinsen.net/anders/





______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com