83dae3433362f6a6e1f0f0765276904a74ca4135
5 * Parses for anchor targets.
11 * @author Manuel Holtgrewe <purestorm at ggnore dot net>
13 * @author Paul M. Jones <pmjones@php.net>
17 * @version $Id: Anchor.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
23 * This class implements a Text_Wiki_Parse to add an anchor target name
26 * @author Manuel Holtgrewe <purestorm at ggnore dot net>
28 * @author Paul M. Jones <pmjones at ciaweb dot net>
36 class Text_Wiki_Parse_Anchor
extends Text_Wiki_Parse
{
41 * The regular expression used to find source text matching this
42 * rule. Looks like a macro: [[# anchor_name]]
50 var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
55 * Generates a token entry for the matched text. Token options are:
57 * 'text' => The full matched text, not including the <code></code> tags.
61 * @param array &$matches The array of matches from parse().
63 * @return A delimited token number to be used as a placeholder in
68 function process(&$matches) {
73 $start = $this->wiki
->addToken(
75 array('type' => 'start', 'name' => $name)
78 $end = $this->wiki
->addToken(
80 array('type' => 'end', 'name' => $name)
83 // done, place the script output directly in the source
84 return $start . trim($text) . $end;