[pmwiki-users] Footnotes Extended external link

Daniel Roesler diafygi at gmail.com
Sun May 25 16:06:57 CDT 2008

Hey all,

So far, there isn't a way to include links (i.e.
[[http://www.example.com|Article1]] ) in footnotes. Footnotes,
FootnotesExtended, and MarkupExtensions don't allow the inclusion of
linking markup in their footnote text. I don't think it would be that
hard to add such a feature.

When I looked at the code for FootnotesExtended, the text is stored in
$FTNfootnoteTexts[$anchor] for each $anchor. Then, it is moved to the
local variable $text, where it is inserted into the html string (see
below for current code section...ha, wouldn't this be a good time for
a footnote?). When your $text contains something like
"[[http://ap.com/|AP article]]", it simply outputs
"[[http://ap.com/|AP article]]".

Logically, the easiest way to correct this is to translate the $text
from wiki formatting to html formatting before it's inserted into the
html string. Is there a way to do this? A simple function call? I'm
not a programmer, and I don't know the intricacies of pmwiki
functions, so I don't know if you can simply do a sort of $text =
WikiToHtml($text) function call. Of course, this brings up problems
with translating all wiki markup (i.e. line breaks, etc.), so maybe
there is a way to just translate wiki link formatting and no others? A
sort of $text = LinkToHtml($text) that takes "This is the
[[http://ap.com/|AP article]]" and outputs "This is the <a
href="http://ap.com">AP article</a>" (also, it would be able to do
internal linking, as well).

I just tried inputting the html code needed for a link directly into
the reference markup (i.e. [^This is the <a href="http://ap.com">AP
article</a>^] ), and all it displays is "This is the <a
href="http://ap.com">AP article</a>", and the html is not implemented,
just displayed. I guess that's a good security measure, but I bet it
will affect my proposal.

Can anyone with insight to translating links help point me in the
direction of a solution? I'm willing to play around with the code, but
I guess I don't have much of an idea where to start. Thanks a lot!

Daniel Roesler
diafygi at gmail.com

-------FOOTNOTES_EXTENDED.PHP - LINES 111-119-------
foreach($FTNrefAnchorCounterMapping as $anchor => $count) {
    if (!isset($FTNfootnoteTexts[$anchor])) {
      $text = "Warning: Footnote '$anchor' referenced but not defined.";
    } else {
      $text = $FTNfootnoteTexts[$anchor];
    $res[] = "<sup id='_note-$count'><a
href='#_ref-$count'>$count</a></sup> <small>$text</small> <p>";
    //$res[] = "<a id='_note-$count' href='#_ref-$count'>$count</a>. $text";

More information about the pmwiki-users mailing list