create new tag
, view all tags

ExternalLinkPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on ExternalLinkPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

ExternalLinkPlugin development discussion

First release.

-- AntonioTerceiro - 03 Nov 2005

Thank you very much AurelioAHeckert, NelsonFerraz and AntonioTerceiro for contributing this Plugin!

I changed the SHORTDESCRIPTION and added a signature to the Plugin topic. Feel free to take this into the next release.

-- PeterThoeny - 03 Nov 2005

When using ExternalLinkPlugin v.1001 with small icons (like Mediawiki) and including a site with external links into another one (here between different webs), the icon apears twice. Don't know, if this is because the different webs or the way I defined the icon.

My Icon definition looks as follows:

      * Set MARK = <img src="%PUBURL%/TWiki/ExternalLinkPlugin/external.png" />

-- TobiasRoeser - 05 Feb 2006

Should the functionality of ExitPlugin be rolled into this (better named) plugin?

-- MartinCleaver - 05 Feb 2006

The double'd link icon isn't a problem of different webs only, it apears always twice if you include a page that contains links to external sites. (TWiki 4.0.1 Release used)

-- TobiasRoeser - 23 Feb 2006

This Plugin uses the CommonTagsHandler which will be executed when (all) Includes are done. But this can't be correct, because when including a page into another, this Plugin gets executed twice resulting in two "external" mark.

Could someone help please with better knowledge of the CommonTagsHandler?

-- TobiasRoeser - 28 Feb 2006

A quick (and very dirty) fix can be found in the attached .diff-file. It assumes that you don't use "&nbsp;" in your external links. It simply expands the line matching external links to not match if such a nbsp-mark is present (which gets appended by the plugin). So once the plugin has appended an icon, it won't do so again. However, to do this properly, one really ought to match on a (properly escaped!!) externalLinkMark-variable. Maybe i'll do this one day and upload a better fix - but for now this works smile

-- MarcLangheinrich - 11 Mar 2006

Today, I looked myself to the problem, as I was not aware, that you already provided a patch. I had the same patch-idea as you. Thanks for your patch. I made some changes to your patch, to match the trailing &nbsp; in a more precise manner, to avoid the exclusion of links, that contain the /nbsp/ pattern. The patch: ExternalLinkPlugin.pm.diff

Sorry, as I uploaded with the same filename, my patch now hides your version, this was not intended. I apologize.

-- TobiasRoeser - 13 Mar 2006

Very useful plugin. I would prefer though if the icon/sign would not be default prepended with &nbsp;. The » sign is quite far from the link now.

-- ArthurClemens - 21 Mar 2006

ExitPlugin now does something very similar to this.

-- IanBygrave - 22 Mar 2006

Arthur, I like the "extra" space, it it quite natural. But I use an icon similar to MediaWiki. The sign (french quote) look indeed better without a space, maybe the space should be configurable separately.

Ian, the Exit Plugin has more functionality. For those, who don't need or don't wont it, it may be just overhead. Are there some (speed) comparisons between ExitPlugin and ExternalLinkPlugin available? In general, both tasks, displaying an extra sign for external links and providing a You-Leave-TWiki-Now page should be kept separated. But in terms of speed, one has to be willing to compromise between clean and modularized design or speedier browsing feeling (and server load of course).

-- TobiasRoeser - 30 Mar 2006

It would be nice if the plugin also marks:

  • mailto links - this should be a different icon
  • interwiki links

-- ArthurClemens - 03 Apr 2006

Each interwiki could get an own icon, so you can omit the interwiki prefix. This requires a full set of self speaking icons, of course. But may be, this should be implemented in the InterwikiPlugin. The Icons can be set within a new row in the interwiki definition table.

-- TobiasRoeser - 03 Apr 2006

Bug: an icon is added with each nested include. So with a news article with external links that is included in News, shows 2 icons, and when the news home section "latest" is included on the homepage the external links get 3 icons.

-- ArthurClemens - 14 Apr 2006

Arthur, this bug is known, but the original author of this plugin seems to be absent for a long time. You can use my patch from 13 Mar 2006, attached to this topic. It is just a hack but works flawless for me. smile

-- TobiasRoeser - 22 Apr 2006

Thanks for the patch, Tobias. I applied it to SVN and uploaded a new version.

-- SteffenPoulsen - 23 Apr 2006

The external link mark has to be specified explicit like:

   * Set MARK = <img src="%PUBURLPATH%/%TWIKIWEB%/ExternalLinkPlugin/external.gif" />

The use of %TOPIC% will give wrong results (mostly image will not be found) for all pages other than ExternalLinkPlugin.

As this wrong mark definition is also part of the last plugin release, a version bump would be recommended. Could you please use version numbers again instead of release dates for the version indicator?

Thanks for the incorporated patch and for the fixes a thanks in advance.

-- TobiasRoeser - 24 Apr 2006

Better now - thanks for the suggestions smile

-- SteffenPoulsen - 24 Apr 2006

As external link symbol you can use %ICON{external}% (TWiki 4.0.2).

-- ArthurClemens - 24 Apr 2006

Please consider adding the use strict; pragma to this plugin. Its use is important to ensuring the quality of TWiki plugins and avoiding unpleasant surprises. See UseStrict for more.

-- MeredithLesly - 02 Jul 2006

It would be very nice if the symbol can be disabled per section, for example STARTDISABLEEXTERNALLINK and STOPDISABLEEXTERNALLINK.

Why? I am trying to make topic components in my site that use parametrized includes. One of the components is a blog feed (HeadlinesPlugin). Which is a nice setup, because I can keep the HeadlinesPlugin code in one topic, and create a blog feed on any page with any feed url.

But when I use INCLUDE in another topic, all blog entry links are seen as external (which they are, of course) and given the external link icon. But in a list this makes it all very crowded and it looses all sense since the blog url itself has a external link icon already. Disabling it for this list is a must-have if I want to have this as a parametrized include.

-- ArthurClemens - 06 Jul 2006

Sounds sensible.

I.e. FindElsewherePlugin respects <noautolink> sections and lifts them out. Basically cutting & pasting a few lines from it's startRenderingHandler would make this plugin do the same (using a <noexternallink> tag instead, perhaps).

Would love to do it, but other priorities take my time atm.

-- SteffenPoulsen - 06 Jul 2006

Hi Steffen, I have attached a patch which changes the Handler as preRenderingHandler and which also we use expandVars to check for links. Also it checks a little bit better for a link, to recognize also links like local.

Maybe you will include this in the current relase of plugin.


-- ThomasFreudenberg - 22 Aug 2006

Maybe Thomas should ask for SVN access. wink

-- FranzJosefSilli - 23 Aug 2006

I noticed that there is a problem with the default definition of MARK when this Plugin is used in conjunction with the MAKEINDEX example found on the FilterPlugin page. The problem is related to the way options (in this case, the format option of MAKEINDEX) are parsed. As double quotes are used as delimiters, this clashes with the forementioned default definition of MARK to modifiy external links, which also uses double quotes for the <img> tag. Once you substitute the latter with single quotes, it works flawlessly. In other words, both plugins work as they should; in order to ged rid of this kind of "side effect" for sure, we'd either need some kind of unique delimiter for options or be able to delay the modification of option values, though both of this would obviously not be plugin-specific.

-- MarkusUeberall - 31 Jan 2008

As mentioned above, this plugin doesn't modify TWiki:Plugins.InterwikiPlugin links. But since those are also external links, I changed the format of those to look like external links by changing INTERLINKFORMAT from the default value of <a href="$url" title="$tooltip" class="interwikiLink">$label</a> to <a href="$url" title="$tooltip" class="interwikiLink">$label</a> <img border=0 src=/pub/TWiki/ExternalLinkPlugin/external.gif>

Also, to keep the TWiki site "sticky" I like to force external links to open in a new window. This had to be done in the global handler of external links because the plugin only adds an icon, and the link itself is rendered afterwards: changed target="_top" to target="_blank" in "sub _externalLink" of <\TWiki\lib\TWiki\Render.pm>.

-- SeanCMorgan - 25 Mar 2008

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff ExternalLinkPlugin.pm.diff r3 r2 r1 manage 1.4 K 2006-08-22 - 23:07 ThomasFreudenberg ExternalLinkPlugin patch, please see my comment from 2006-08-22
Edit | Attach | Watch | Print version | History: r27 < r26 < r25 < r24 < r23 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r27 - 2008-03-25 - SeanCMorgan
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.