New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Item8425: MailerContrib creates bad links for TOC

Priority: Normal
Current State: New
Released In:
Target Release: n/a
Applies To: Extension
Component: MailerContrib
Reported By: ChristianZiemski
Waiting For:
Last Change By: ChristianZiemski
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=""> Topic1</a>

But it should be:

<a href="" Topic1</a>

or perhaps even better:

<a href="#Topic1"> Topic1 </a>

#1 could be done with the following change in
# 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 ...


-- ChristianZiemski - 26 Jan 2010

Now I found a way to make #2 work as well.

I added an if() in 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


ItemTemplate edit

Summary MailerContrib creates bad links for TOC
ReportedBy ChristianZiemski
Codebase 1.0.9
SVN Range
AppliesTo Extension
Component MailerContrib
Priority Normal
CurrentState New
TargetRelease n/a
Topic revision: r3 - 27 Jan 2010, ChristianZiemski - This page was cached on 21 Jun 2018 - 20:16.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy