Skip to content

Commit

Permalink
Now using setup and teardown in MarkdownExtra_Parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
michelf committed Apr 21, 2008
1 parent 48d9573 commit 2a10399
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions markdown.php
Expand Up @@ -1555,22 +1555,29 @@ function MarkdownExtra_Parser() {
var $footnote_counter = 1;


function transform($text) {
function setup() {
#
# Added clear to the new $html_hashes, reordered `hashHTMLBlocks` before
# blank line stripping and added extra parameter to `runBlockGamut`.
# Setting up Extra-specific variables.
#
# Clear the global hashes. If we don't clear these, you get conflicts
# from other articles when generating a page which contains more than
# one article (e.g. an index page that shows the N most recent
# articles):
$this->footnotes = array();
$this->footnotes_ordered = array();
$this->abbr_desciptions = array();
$this->abbr_matches = array();
$this->footnote_counter = 1;

return parent::transform($text);
return parent::setup();
}

function teardown($text) {
#
# Clearing Extra-specific variables.
#
return parent::teardown();

$this->footnotes = array();
$this->footnotes_ordered = array();
$this->abbr_desciptions = array();
$this->abbr_matches = array();
}


Expand Down

0 comments on commit 2a10399

Please sign in to comment.