protected function MarkdownExtra::_appendFootnotes_callback in Markdown 7
* Callback for appending footnotes *
Parameters
array $matches: * @return string
File
- includes/
MarkdownExtra.php, line 1669
Class
- MarkdownExtra
- Markdown Extra Parser Class
Namespace
MichelfCode
protected function _appendFootnotes_callback($matches) {
$node_id = $this->fn_id_prefix . $matches[1];
// Create footnote marker only if it has a corresponding footnote *and*
// the footnote hasn't been used by another marker.
if (isset($this->footnotes[$node_id])) {
$num =& $this->footnotes_numbers[$node_id];
if (!isset($num)) {
// Transfer footnote content to the ordered list and give it its
// number
$this->footnotes_ordered[$node_id] = $this->footnotes[$node_id];
$this->footnotes_ref_count[$node_id] = 1;
$num = $this->footnote_counter++;
$ref_count_mark = '';
}
else {
$ref_count_mark = $this->footnotes_ref_count[$node_id] += 1;
}
$attr = "";
if ($this->fn_link_class != "") {
$class = $this->fn_link_class;
$class = $this
->encodeAttribute($class);
$attr .= " class=\"{$class}\"";
}
if ($this->fn_link_title != "") {
$title = $this->fn_link_title;
$title = $this
->encodeAttribute($title);
$attr .= " title=\"{$title}\"";
}
$attr = str_replace("%%", $num, $attr);
$node_id = $this
->encodeAttribute($node_id);
return "<sup id=\"fnref{$ref_count_mark}:{$node_id}\">" . "<a href=\"#fn:{$node_id}\"{$attr}>{$num}</a>" . "</sup>";
}
return "[^" . $matches[1] . "]";
}