Question
I have a script I wish to dissuss/comment on. That includes a line:
$html =~ s/<\/head>/<base href="$baseurl"<\n<\/head</i;
In it's original format the start of the <base href tag breaks lots of stuff. Even now the above line in preview is wrong ("/cgi-bin/oops/Support/BaseHRefIssue?template=oops" vs "$baseurl").
If I change the <, > around base href to <, > I can't even save the page.
- TWiki version: ONLINE
- Web server: ONLINE
- Server OS: ONLINE
P.S., in 010315Beta it works "corretly", but behaviour varries between NS and IE
--
DrewCard - 14 Jun 2001
Answer
Have you tried putting the script text in <verbatim> tags, e.g.:
$html =~ s/<\/head>/<base href="$baseurl">\n<\/head>/i;
This avoids breaking the HTML. However, it does not fix the preview showing oops-type URLs, which IMO is a bug.
The <verbatim> tag requires the Dec 2000 TWiki build at least, before that you have <pre> which is not so good.
Since we are discussing this code ... this can be written avoiding the /-escapes etc as:
$html =~ s#</head>#<base href="$baseurl">\n$1#i;
--
RichardDonkin - 14 Jun 2001
It seems the <verbatim></verbatim> tags are just the trick...
--
DrewCard - 15 Jun 2001