[l2h] relative hyperlinks?
Ross Moore
ross@ics.mq.edu.au
Fri, 29 Mar 2002 09:27:09 +1100 (EST)
> Hi again,
>
> here is just another nice topic which I found
> when preparing my single-file html document.
> I created the html file with
>
> latex2html -split 0 -no_navigation xy.tex
>
> and I found, that all generated URLs in hyperlinks in
> "xy/xy.html" contain the _filename_ and are of the form
>
> HREF="xy.html#SECTION00030000000000000000"
>
> (i.e. "filename#anchor").
>
> This may be partially necessary for multi-document html trees,
> but makes it impossible to rename the single html file in
> my case, as all contained hyperlinks will fail afterwards.
> Removing "xy.html" from the hyperlinks, leaving them
> in a relative form as HREF="#SECTION00030000000000000000"
> (omitting the filename and leaving "#anchor" only)
> solves the problem.
This could be done at post-processing time,
by putting a regular-expression find/replace
into the &post_post_process subroutine.
If a subroutine with this name exists,
e.g. you can define it in the .latex2html-init file
then it will be called, at a point *after* all the
internal tagging has been resolved into correct HTML.
Something like the following should be enough:
sub post_post_process {
s/(HREF=")$CURRENT_FILE(\#)/$1$2/igs;
}
Please try this and report any difficulties.
If anyone else can see any not-so-obvious problems,
then please respond to this email list also.
Hope this helps,
Ross Moore
> I don't know what the real and pure html standard says
> about this relative form of a hyperlink, but according
> to my experience links of this form work fine on
> Netscape 4.x, Netscape 6, Opera 5 and InternetExplorer 5.
> Ommiting the filname in hyperlinks is also demonstrated in
> "HTML & XHTML" by Chuck Musciano & Bill Kennedy, 4th edition,
> O'Reilly 2000, so I think ommiting the filename from the URL,
> in cases where it is identical to the file in which the URL is
> used is at least worth a commandline option ;-)
>
> Best regards
> Ulrich
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Ulrich Gruenebaum (grueneba@zkom.de)
> Tel. +49/(0)231/9700-337
> FAX +49/(0)231/9700-474
>
> ZKOM GmbH
> State Diagnostic Systems and Computer Networks
> Joseph-von-Fraunhofer-Str. 20
> D-44227 Dortmund (Germany)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> _______________________________________________
> latex2html mailing list
> latex2html@tug.org
> http://tug.org/mailman/listinfo/latex2html