[pmwiki-users] MarkupExtension - FootNotes problem

Patrick R. Michaud pmichaud at pobox.com
Fri Aug 26 11:54:26 CDT 2005

On Fri, Aug 26, 2005 at 06:31:21PM +0200, Peter Brink wrote:
> I'm making extensive use of footnotes on a FAQ page of mine (see for 
> example http://faq.rollspelshornan.se/FAQ/Immaterialr%e4tt#toc17), when 
> I began using footnotes (in May) I had no trouble, but today I noticed 
> that the footnotes are not linked to the correct note. 

John Rankin should be able to answer in more detail, but I'll
provide my observations.  

I'm not sure this recipe can work correctly when there are multiple 
footnote groups on a page.  Each footnote [^like this^] appears to 
get its own identifier (anchor) as #fn1, #fn2, #fn3, etc., 
and then the [^#^] generates the set of saved footnotes
and resets the footnote counter to zero.  

If there are then more footnotes and another footnote group rendered on
the same page, we end up with a situation of having multiple anchors
in a single page with the same identifier.  This is invalid HTML, but
more problematic is that the browser will tend to jump to only the first
such anchor in the entire page.  This makes it appear as though all of 
the (1) footnotes are tied together (in the first group), all of the (2) 
footnotes are tied together (in the first group containing two footnotes),

The solution is to make sure that each footnote identifier is unique.
This could be done by something like

   - Never resetting the footnote counter to zero
   - Adding a "footnote group" counter into the anchor, as in
     #fn_1_1, #fn_1_2, #fn_1_3, ...  and then after a [^#^] markup
     has been encountered increasing the group number to produce
     anchors like  #fn_2_1, #fn_2_2, #fn_2_3, etc.

I don't think the problem is tied to any particular version of PmWiki;
I think that the footnote capabilities in extendmarkup.php aren't 
(yet?) designed to support multiple instances of the [^#^] markup
in a single page.


More information about the pmwiki-users mailing list