[WM] Tidying up relative links on round substitution

Duncan Cameron dcameron.bcs.org.uk
Tue Feb 12 05:29:07 GMT 2002


I've just started using Webmake and found that relative links weren't being created
as I'd like.  My directory structure is

work
...raw
...site
.......images
.......styles

My .wmk file and template.htm are in the work directory. html gets generated into the
site directory.
I found that using references to images, etc., creates a relative link like
site/images/logo.gif, whereas I really want it one level further down.

What I'd like to happen is that when a round substitution is resolved, any matching
leading directories of the substituted value and the current output file are 
removed.
Looking at the code in main.pm for _round_subst() and canon_path(),I saw that this is
nearly being done already.

We need to pass the current output file's path to canon_path() as the relative dir.
Then canon_path() already tries to solve this problem but falls foul of mixing
forward and backward slashes as directory separators. A small fix to convert all to
'/' solves that.

Attached is a diff file for version 2.3.
I'm using Windows98, so, as a lot of the tests fail anyway, I can't verify whether
this change has any adverse effects, but "it works for me".

Thanks

Duncan Cameron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.pm.diff
Type: application/octet-stream
Size: 544 bytes
Desc: not available
Url : http://amgod.boxhost.net/pipermail/webmake-talk/attachments/20020212/bb474edd/main.pm.obj


More information about the Webmake-talk mailing list