NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use
trunk.foswiki.org to view this page for some minimal testing.
Use
Item11383 for general documentation changes for release 1.1.5. Use
Item9693 for docu changes for release 2.0.
Item8425: MailerContrib creates bad links for TOC
| Priority: |
CurrentState: |
AppliesTo: |
Component: |
WaitingFor: |
| Normal |
New |
Extension |
MailerContrib |
|
I'm using
MailerContrib for sending topics as newsletter (complete content).
It is working fine with one exception:
If there is a Table-of-contents (%TOC%) in a topic the links created by
MailerContrib representing its items are broken:
<a href="http://some.server.com/foswiki/bin#Topic1"> Topic1</a>
But it should be:
1)
<a href="http://some.server.com/foswiki/bin/view/MYWEB/TestPage#Topic1" Topic1</a>
or perhaps even better:
2)
<a href="#Topic1"> Topic1 </a>
#1 could be done with the following change in
MailerContrib.pm:
# Rewrite absolute URLs
#my $base = $Foswiki::cfg{DefaultUrlHost} . $Foswiki::cfg{ScriptUrlPath};
my $base = $Foswiki::cfg{DefaultUrlHost} . $Foswiki::cfg{ScriptUrlPath} . "/view/" . $web . "/" . $topic; # cz
$tmpl =~ s/(href=\")([^"]+)/$1.relativeURL($base,$2)/goei;
At least that works for me ...
Christian
--
ChristianZiemski - 26 Jan 2010
Now I found a way to make #2 work as well.
I added an if() in
MailerContrib.pm here:
sub relativeURL {
my ( $base, $link ) = @_;
if ( ! $link =~ "^#" ) {
return URI->new_abs( $link, URI->new($base) )->as_string;
} else {
return $link
}
}
--
ChristianZiemski - 27 Jan 2010