adding some strings
[moodle-linuxchix.git] / mod / wiki / ewiki / plugins / markup / footnotes.php
blob8c853d04cd87d10ab22cc18f1619980821771f8a
1 <?php
3 /*
5 this plugin introduces markup for footnotes, use it like:
7 ...
8 some very scientific sentence {{this is a footnote explaination}}
9 ...
11 this may be useful in some rare cases; usually one should create
12 a WikiLink to explain a more complex task on another page;
13 your decision
15 */
19 $ewiki_plugins["format_source"][] = "ewiki_format_source_footnotes";
23 function ewiki_format_source_footnotes (&$source) {
25 $notenum = 0;
27 $l = 0;
28 while (
29 ($l = strpos($source, "{{", $l))
30 && ($r = strpos($source, "}}", $l))
33 $l += 2;
35 #-- skip "{{...\n...}}"
36 if (strpos($source, "\n", $l) < $r) {
37 continue;
40 $notenum++;
42 #-- extract "footnote"
43 $footnote = substr($source, $l, $r - $l);
45 #-- strip "{{footnote}}"
46 $source = substr($source, 0, $l - 2)
47 . "<a href=\"#fn$notenum\"$notenum</a>"
48 . substr($source, $r + 2);
50 #-- add "footnote" to the end of the wiki page source
51 if ($notenum==1) {
52 $source .= "\n----";
54 $source .= "\n" .
55 "<a name=\"fn$notenum\"$notenum</a> ". $footnote . "\n<br />";