protected function MarkdownExtra::stripFootnotes in Markdown 7
* Footnotes - Strips link definitions from text, stores the URLs and * titles in hash references. *
Parameters
string $text: * @return string
File
- includes/
MarkdownExtra.php, line 1548
Class
- MarkdownExtra
- Markdown Extra Parser Class
Namespace
MichelfCode
protected function stripFootnotes($text) {
$less_than_tab = $this->tab_width - 1;
// Link defs are in the form: [^id]: url "optional title"
$text = preg_replace_callback('{
^[ ]{0,' . $less_than_tab . '}\\[\\^(.+?)\\][ ]?: # note_id = $1
[ ]*
\\n? # maybe *one* newline
( # text = $2 (no blank lines allowed)
(?:
.+ # actual text
|
\\n # newlines but
(?!\\[.+?\\][ ]?:\\s)# negative lookahead for footnote or link definition marker.
(?!\\n+[ ]{0,3}\\S)# ensure line is not blank and followed
# by non-indented content
)*
)
}xm', array(
$this,
'_stripFootnotes_callback',
), $text);
return $text;
}