function MarkdownExtra_Parser::stripFootnotes in Markdown 6
Same name and namespace in other branches
- 5 markdown.php \MarkdownExtra_Parser::stripFootnotes()
File
- ./
markdown.php, line 3033
Class
Code
function stripFootnotes($text) {
#
# Strips link definitions from text, stores the URLs and titles in
# hash references.
#
$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 marker.
(?!\\n+[ ]{0,3}\\S)# ensure line is not blank and followed
# by non-indented content
)*
)
}xm', array(
&$this,
'_stripFootnotes_callback',
), $text);
return $text;
}