From: Arno H. <aho...@us...> - 2001-02-07 17:21:26
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv3958 Modified Files: stdlib.php transform.php Log Message: removed references, added footnotes Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** stdlib.php 2001/02/04 18:19:30 1.22 --- stdlib.php 2001/02/07 17:21:33 1.23 *************** *** 170,174 **** $link['link'] = "<a href=\"$ScriptUrl$match[1]\">$linkname</a>"; } elseif (preg_match("#^\d+$#", $URL)) { ! $link['type'] = "reference-$linktype"; $link['link'] = $URL; } else { --- 170,174 ---- $link['link'] = "<a href=\"$ScriptUrl$match[1]\">$linkname</a>"; } elseif (preg_match("#^\d+$#", $URL)) { ! $link['type'] = "footnote-$linktype"; $link['link'] = $URL; } else { Index: transform.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** transform.php 2001/02/07 16:38:33 1.10 --- transform.php 2001/02/07 17:21:33 1.11 *************** *** 266,269 **** --- 266,271 ---- function wtt_bracketlinks($line, &$trfrm) { + static $footnotes = array(); + // protecting [[ $n = $ntok = $trfrm->tokencounter; *************** *** 277,281 **** while ($n < $ntok) { $link = ParseAndLink($trfrm->replacements[$n]); ! $trfrm->replacements[$n++] = $link['link']; } --- 279,294 ---- while ($n < $ntok) { $link = ParseAndLink($trfrm->replacements[$n]); ! if (strpos($link['type'], 'footnote') === false) { ! $trfrm->replacements[$n] = $link['link']; ! } else { ! $ftnt = $link['link']; ! if (isset($footnotes[$ftnt])) { ! $trfrm->replacements[$n] = "<A NAME=\"footnote-$ftnt\"></A><A HREF=\"#footnote-rev-$ftnt\">[$ftnt]</A>"; ! } else { // first encounter of [x] ! $trfrm->replacements[$n] = "<A NAME=\"footnote-rev-$ftnt\"></A><SUP><A HREF=\"#footnote-$ftnt\">[$ftnt]</A></SUP>"; ! $footnotes[$ftnt] = 1; ! } ! } ! $n++; } |