Subject: | encoded chars in href |
When I run the following markup through wikiformat
[[https://foo.com/bar]]
I expect to get the following html:
<p><a href="https://foo.com/bar">https://foo.com/bar</a></p>
but what I get is:
<p><a href='https%3A%2F%2Ffoo.com%2Fbar'>bar</a></p>
The encoding confuses the browser into thinking its a relative link and
prepends my web servers doc home url. (webkit and mozilla based browsers)
I've tried setting the extended and absolute_links flags and they
produce the following:
extended => 0, absolute_links => 0
<p>[[https://foo.com/bar]]</p>
extended =>0, absolute_links => 1
<p>[[<a href='https://foo.com/bar]'>https://foo.com/bar]</a>]</p>
extended =>1, absolute_links => 0
<p><a href='https%3A%2F%2Ffoo.com%2Fbar'>https://foo.com/bar</a></p>
extended =>1, absolute_links => 1
<p><a href='https%3A%2F%2Ffoo.com%2Fbar'>https://foo.com/bar</a></p>
Sample script to test:
use Text::MediawikiFormat 'wikiformat';
my $text = "[[https://foo.com/bar]]";
for (my $e=0; $e<=1; $e++) {
for (my $a=0; $a<=1; $a++) {
printf "e->%d a->%d txt=%s\n", $e, $a, wikiformat($text, {},
{extended=>$e, absolute_links=>$a});
}
}
Am I doing something wrong? On a MediaWiki base wiki I control, when I
enter [[https://foo.com]] the markup renders as
<a rel="nofollow" title="https://foo.com/bar" class="external
autonumber" href="https://foo.com/bar">[2]</a>
Setup details:
perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Text::MediawikiFormat v.1.0
uname -a
Linux xzy.foo.com 2.6.18-164.11.1.el5PAE #1 SMP Wed Jan 6 13:43:57 EST
2010 i686 i686 i386 GNU/Linux
I appreciate any help you can provide...
Todd