FootNotes

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Provide support for footnotes and intra-page cross-references.

Solution

Attach:footnotes.php - PHP code

Attach:footnotes.zip - PHP code fixed for PmWiki 0.6.9

Adds the following markup to PmWiki/PmWiki:

  [^this is the text of a footnote^] gets replaced by a numeric superscript

  [^#^] inserts the footnote texts, numbered sequentially

  [^#anchor^] looks for [[#anchor]] on the current page and copies the text
  from there to the end of the paragraph into the [^...^] position

Discussion

Add the line include_once("local/footnotes.php"); in the local.php file.

For example[^here is a footnote^].

The intra-page cross-reference variant is useful on FAQ pages. Use it as follows:

  • write Q:[[#q1]]text of question 1, and so on
  • write [[ThisPage#q1]] [^#q1^] at the top of the page
    • this will display as [1] text of question 1
  • if the questions contain no wiki markup, write
    # [[#q1 [^#q1^]]]
    • this will display text of question 1 as a link

To see an example of intra-page links, visit http://wiki.lianza.org.nz/index.php/Main/WikiFAQ. It uses an experimental version of the footnotes script to generate a page table of contents.

There are no footnotes in this example

Bugs

It does not work if you use base <href='[(approve links) edit diff]'> in the HEAD section of the page. The Links are all broken.

I had to change the line

  $HTMLHeaderFmt .= "<style type = 'text/css'>

to

  $HTMLHeaderFmt[] = "<style type = 'text/css'>

to get it to work with PmWiki 0.6.9 (and sanitised all the double backslashes) - Phil Randal, March 17, 2004

Revision History

  • Released 19 August 2003
  • Fixed for PmWiki 0.6.9 17 March 2004

See Also

  • IncludePara

Contributors

  • John Rankin
  • Phil Randal

[^#^] here becomes:
--------

  1. here is a footnote

pmwiki-2.3.38 -- Last modified by {{jr}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons