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

Re: a few questions on using wml

On Wed, Jun 24, 1998, James A. Treacy wrote:

> The Debian web pages are in the process of being converted to using
> wml. 

Ohhh, great and really interesting News.  Nice to hear that WML was chosen as
the generation tool.  Please try to inform us from time to time about the
current states of your project.

> In the process I have come across a few things I haven't been
> able to figure out. Is it possible that there are things wml can't
> do? :)

<grin> Sure, WML is like Apache: Both usually provide anything and more Joe
Average will ever need, but the power users have special requirements which
always create new demands for which sometimes a solution is not already known.
But that doesn't mean that a solution doesn't exist ;-)

> Since I want the .html files in a different directory from the source
> a shebang path is used in the files, e.g. #!wml -o ../debian.org/%BASE.html.en
> What is actually desired is to use a variable to make it easier to move
> things around later, i.e. #!wml -o $(HTMLDIR)/%BASE.html.en where the
> variable is set in a .wmlrc file. Is this possible?

Currently not, because only %DIR and %BASE are expanded. But this is a really
good suggestion, so I'll try to add $(XXX) variables for WML 1.6.6 or 1.6.7.
In the meantime its no problem when I understand you correctly, its just for
feature flexibility, right?

> To keep the pages from being too static, I used some perl to grab the
> latest news entries and put their titles on the main page. It works
> perfectly, but 'wmk -a' does not catch the dependency (which is understandable).
> Is there a way to force a file to have a dependency on another?
> '#use <file>' is not appropriate in this case.

Hmmmm... WMk was designed to avoid the usual tivial Makefiles which have .html
<- .wml dependencies. I've never thought about making WMk a real "built
environment" tool.  But you can use a trick I use on the WML webarea, too.

Just use "-x xxx.dep" in a .wmkrc file at the same level your xxx.wml file
stays. When you now run "wmk" the "prolog program" "xxx.dep" is started before
WMk starts its actual processing. In "xxx.dep" you now do a mtime-comparison
of your external file and the xxx.html file. If the external file is newer
than the xxx.html file then simply "touch" the xxx.wml file (i.e. make it
newer then the xxx.html file). Now after the prolog program ran WMk compares
the mtimes between xxx.wml and xxx.html and finds that he has to run WML to
convert xxx.wml->xxx.html. BINGO!  Ok, for a single dependency its overkill,
but because xxx.dep can be any executable program you can do as complex
dependencies you want.

A first (untested) cut for xxx.dep could be:

   $ext_file = '/path/to/somewhere';
   $wml_file = 'xxx.wml'
   $out_file = 'xxx.wml'
   if (-f $ext_file) {
       $ext_mtime = -M _;
       if (-f $out_file) {
           $out_mtime = -M _;
           if ($ext_mime > $out_mtime) {
               $now = time;
               utime($now, $now, $wml_file);

If you have more such dependecies, I recommend you to write a generic .dep
file which reads a config file with depencies and does the above procedure for
each of the contained entries. 

> I tried 'wmk -a -F template/debian/*.wml' so all .wml files would
> be processed except for the template files. What's the proper way
> to do this?

Your templates have .wml extension, right? Hmmm.. then you have to use inside
a .wmkrc file "-F template.wml" options.  Or just name same .tmpl or .inc or

BTW: Always feel free to ask. Although my time is very limited I enjoy it when
people use my programs and create good things with it. And so I always try to
reserve some time for answering questions because support is one of the most
important decision points people have when using a software package ;-)

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