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

Re: VPATH (was: [ANNOUNCE] WML 2.0)



On Fri, 12 May 2000, Denis Barbier wrote:

DB>       - Better processing on files in other directories: the main goal
DB>         is to allow use of the VPATH feature of GNU make to build
DB>         webpages into a test area before compiling webpages.  This
DB>         does only apply to the wml binary, since there is no reason
DB>         to mix WMk and Makefiles.

With GNU Make this worked pretty fine with WML 1.7.4, when I
created two different Target environments out of common sources
(actually the only difference was a "comments" button for the
intranet-version which should not appear in the internet 
version, but I think one could realize entirely different
layouts or different languages in different target paths
through this).

The only problem I had was that BASENAME and DIRNAME were
determined in a way that didn't match my expectation.

user@host:~/targets $ wml ../sources/index.wml

would have set

WML_SRC_BASENAME=../sources/index
WML_SRC_DIRNAME=/home/user/target

instead of

WML_SRC_BASENAME=index
WML_SRC_DIRNAME=/home/user/source

As a quick and dirty workaround I included the following lines
in my templates:

-----8<-----
# Tweak for WML 1.7.4 being called from a directory
# other than the one where the source is.
#
# WML_SRC_BASENAME only does s/.wml$// but not s|(.*)/||
# WML_SRC_DIRNAME is set to `pwd` instead of $1 of prev. regex

<set-var WML_SRC_BUGGY_BASENAME=<get-var WML_SRC_BASENAME>>
<set-var WML_SRC_BUGGY_DIRNAME=<get-var WML_SRC_DIRNAME>>
<set-var WML_SRC_BASENAME=<substring
    <get-var WML_SRC_FILENAME>
    <match <get-var WML_SRC_FILENAME> "[^/]*$" action=startpos>
    <match <get-var WML_SRC_FILENAME> "\.wm.$" action=startpos>
>>
<set-var WML_SRC_DIRNAME=<substring
    <get-var WML_SRC_FILENAME>
    0
    <match <get-var WML_SRC_FILENAME> "[^/]*$" action=startpos>
>>
----->8-----

which delivers at least

WML_SRC_BASENAME=index
WML_SRC_DIRNAME=../source

where WML_SRC_DIRNAME could now be prepended to the
WML_SRC_BUGGY_DIRNAME and put through &canonpath() of
wml::sup::path to get the expected result.

But since this is really dirty and I don't know whether it
still works under WML 2.0 (which to be testing I'm still looking
forward to) I think If you really consider this senseful you
should implement it directly into wml.

Greets, Matthias


----------------------------------------------------------------
http://www.guxhagen.net/matthb/       mailto:matthb@guxhagen.net

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