Permalink
Browse files

Added support for predefined abbreviations.

  • Loading branch information...
1 parent 3035152 commit 834cd345a0c482c6ab13f1c838578924135a169b @michelf committed Apr 21, 2008
Showing with 13 additions and 5 deletions.
  1. +13 −5 markdown.php
View
18 markdown.php
@@ -1520,6 +1520,9 @@ class MarkdownExtra_Parser extends Markdown_Parser {
# Optional class attribute for footnote links and backlinks.
var $fn_link_class = MARKDOWN_FN_LINK_CLASS;
var $fn_backlink_class = MARKDOWN_FN_BACKLINK_CLASS;
+
+ # Predefined abbreviations.
+ var $predef_abbr = array();
function MarkdownExtra_Parser() {
@@ -1564,25 +1567,30 @@ function setup() {
#
# Setting up Extra-specific variables.
#
+ parent::setup();
+
$this->footnotes = array();
$this->footnotes_ordered = array();
$this->abbr_desciptions = array();
$this->abbr_matches = array();
$this->footnote_counter = 1;
-
- return parent::setup();
+
+ foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
+ $this->abbr_matches[] = preg_quote($abbr_word);
+ $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
+ }
}
- function teardown($text) {
+ function teardown() {
#
# Clearing Extra-specific variables.
#
- return parent::teardown();
-
$this->footnotes = array();
$this->footnotes_ordered = array();
$this->abbr_desciptions = array();
$this->abbr_matches = array();
+
+ parent::teardown();
}

0 comments on commit 834cd34

Please sign in to comment.