Commits

Anonymous committed a8a5c70

q

  • Participants
  • Parent commits 14bb86c

Comments (0)

Files changed (19)

File www/css/print.css

-* { margin:0; padding:0; }
-body, div, span, p, a, img, ul, ol, li, table, th, tr, td, form, fieldset, legend, dl, dt, dd, blockquote, applet, object { border:0; }
-ul, ol {list-style-type:none}
-body { padding: 0; font: normal 12px Arial,sans-serif; color: #000;}
-p {line-height: 1.9em;padding: 0 0 15px 0;}
-
-/* LINKS ---------------------------------------------------------------------------------------------------------- */
-a {color: #076fb0;text-decoration: underline;}
-a:link {color: #076fb0;}
-a:focus {color: #076fb0; outline: 0}
-a:visited {color: #063654}
-a:hover {color: #063654;text-decoration: none;}
-a.more {}
-
-
-/* H1 - H5 -------------------------------------------------------------------------------------------------------- */
-h1, h2, h3, h4, h5, h6 { margin:15px 0 15px 0; }
-h1 { font-size: 1.6em;  margin: 0; color: #000;}
-h2 { font-size: 1.45em; margin: 0 0 15px; color: #000;font-weight: normal;padding: 0;font-family: Georgia;}
-h3 { font-size:1.1em; margin: 0 0 15px; color: #000;  padding: 0 0 5px;}
-h4 { font-size:1.0em; color: #000 }
-h5 { font-size:1.0em; }
-
-/* LAYOUT --------------------------------------------------------------------------------------------------------- */
-
-    /* HEADER ----------------------------------------------------------------------------------------------------- */
-
-        /* logo */
-        h1 a { display: block; color: #000;text-decoration: none;}
-            h1 a span {display: none}
-
-        /* navigation */
-        ul#nav {display: none}
-
-        /* header box */
-        .box {background: #fff;border: 0;padding: 20px 0;margin: 20px 0;color: #000}
-            .box h2 {font-family: Arial; font-size: 1.2em;font-weight: bold; color: #000;margin: 0 0 5px;padding: 0; border: 0;}
-            .box p {margin: 0; padding: 0;}
-
-    .padding {padding: 0 0 20px;}
-
-    /* COLS ----------------------------------------------------------------------------------------------------------- */
-    ul.cols {margin: 15px 0;}
-        ul.cols li {}
-            ul.cols li.center {margin: 0;text-align: left;}
-                ul.cols li h3 {font-size: 1.2em;font-weight: bold;color: #000;padding: 10px 0 10px 0;color: #435b6a;border-bottom: 1px solid #d3dbdf}
-                ul.cols li p {padding: 0 0 10px 0}
-                ul.cols li a.more {padding-left: 0;}
-
-  	/* FOOTER ----------------------------------------------------------------------------------------------------- */
-    .footer {background: #fff;height: 50px; line-height: 50px;padding: 0;font-size: 0.9em; margin: 0;clear: both; overflow: hidden;}
-        .footer span {color: #7c7e7f;display: block; padding-top: 3px;}
-        .footer a {color: #7c7e7f;}
-        .footer a.pueblo-templates {display: inline-block;position: relative;width: 110px; height: 15px;line-height: 15px;margin-right: 20px;}
-            .footer a.pueblo-templates span {display: none}
-
-
-
-/* OTHER ----------------------------------------------------------------------------------------------------- */
-hr { display:block; height:1px; margin:10px 0; padding:0; border:0 solid #CCC; background:#CCC; color:#CCC;}
-.clear { clear:both; display: block; height:0;line-height:0;font-size:0; width: 100%;}
-.noscreen { display:none; }
-.flt-l {float: left;}
-.flt-r {float: right;}
-.bold {font-weight: bold;}
-.center {text-align: center;}
-.noborder {border: 0;}
-/* clearfix */
-.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden}
-.clearfix {display: inline-block;}
-/* hidden for ie mac \*/
-* html .clearfix {height: 1%;}
-.clearfix {display: block;}

File www/css/reset.css

-/* http://meyerweb.com/eric/tools/css/reset/ */
-/* v1.0 | 20080212 */
-
-html, body, div, span, applet, object, iframe,
-h1, h2, h3, h4, h5, h6, p, blockquote, pre,
-a, abbr, acronym, address, big, cite, code,
-del, dfn, em, font, img, ins, kbd, q, s, samp,
-small, strike, strong, sub, sup, tt, var,
-b, u, i, center,
-dl, dt, dd, ol, ul, li,
-fieldset, form, label, legend,
-table, caption, tbody, tfoot, thead, tr, th, td {
-	margin: 0;
-	padding: 0;
-	border: 0;
-	outline: 0;
-	font-size: 100%;
-	vertical-align: baseline;
-	background: transparent;
-}
-body {
-	line-height: 1;
-}
-ol, ul {
-	list-style: none;
-}
-blockquote, q {
-	quotes: none;
-}
-blockquote:before, blockquote:after,
-q:before, q:after {
-	content: '';
-	content: none;
-}
-
-/* remember to define focus styles! */
-:focus {
-	outline: 0;
-}
-
-/* remember to highlight inserts somehow! */
-ins {
-	text-decoration: none;
-}
-del {
-	text-decoration: line-through;
-}
-
-/* tables still need 'cellspacing="0"' in the markup */
-table {
-	border-collapse: collapse;
-	border-spacing: 0;
-}

File www/css/screen.css

-@IMPORT url('/css/reset.css');
-
-body {
-    width: 950px;
-    margin: 40px auto;
-}
-body, input, textarea, label {
-    font-family: verdana; font-size: 9pt;
-    line-height: 150%;
-}
-a {
-    color: #036;
-}
-
-.b-navigation {
-    padding: 10px 20px ;
-    background-color: #369;
-}
-.b-navigation, .b-navigation a {
-    color: #fff; font-weight: bold;
-}
-.b-navigation ul li {
-    display: inline;
-    padding-right: 15px;
-}
-
-.b-column {
-    padding: 0 1.5em;
-}
-
-.l-content {
-    float: left;
-    width: 656px;
-    border: 2px #eee solid;
-}
-.b-content h1, .b-content h2, .b-content h3 {
-    margin: 1.5em 0;
-}
-.b-content h1 {
-    font-size: 12pt;
-}
-.b-content h2 {
-    font-size: 11pt;
-}
-.b-content p {
-    margin: 0.8em 0;
-}
-
-.l-sidebar {
-    float: left;
-    width: 210px;
-}
-.l-copyright {
-    clear: both;
-}
-.b-copyright {
-    padding: 20px 0;
-}

File www/system/library/ZendY/Controller/Action.php

     protected $session = null;
 
     /**
-     * Enter description here...
-     *
-     * @var Zend_Navigation_Page
-     */
-    protected $currentPage = null;
-
-    /**
      *
      * @param object $user
      * @return Identity_User
         $this->flash(self::FLASH_ERROR, $message);
     }
 
-    protected function page($label, $page = array())
+    protected function page()
     {
-        if (is_array($label) && Zend_Registry::isRegistered('Zend_Translate')) {
-            $t = Zend_Registry::get('Zend_Translate');
-            $label[0] = $t->translate($label[0]);
-            $label = call_user_func_array('sprintf', $label);
-        }
+//        if (is_array($label) && Zend_Registry::isRegistered('Zend_Translate')) {
+//            $t = Zend_Registry::get('Zend_Translate');
+//            $label[0] = $t->translate($label[0]);
+//            $label = call_user_func_array('sprintf', $label);
+//        }
 
-        $page['label'] = $label;
 
-        if (isset($page['route'])) {
-            $defaults = Zend_Controller_Front::getInstance()->getRouter()->getRoute($page['route'])->getDefaults();
-        } else {
-            $defaults = array(
-                'action' => $this->getRequest()->getActionName(),
-                'controller' => $this->getRequest()->getControllerName(),
-                'module' => $this->getRequest()->getModuleName(),
-            );
-        }
-        foreach ($defaults as $key => $value) {
-            if (!isset($page[$key])) {
-                $page[$key] = $value;
-            }
-        }
-
-        $page = Zend_Navigation_Page::factory($page);
-        if ($this->currentPage) {
-            $this->view->navigation()->findOneBy('label', $this->currentPage->getLabel())->addPage($page);
-        } else {
-            $this->view->navigation()->addPage($page);
-        }
-        $this->currentPage = $page;
-
-        $this->view->headTitle($page->getLabel(), Zend_View_Helper_Placeholder_Container_Abstract::PREPEND);
     }
 }

File www/system/library/ZendY/View/Helper/Page.php

+<?php
+class ZendY_View_Helper_Page extends Zend_View_Helper_Abstract
+{
+    /**
+     *
+     * @var array
+     */
+    protected $defaults = array();
+
+    /**
+     * Enter description here...
+     *
+     * @var Zend_Navigation_Page
+     */
+    protected $currentPage = null;
+
+    public function page($label, $info = array())
+    {
+        $info['label'] = $label;
+
+        if (isset($info['route'])) {
+            $defaults = Zend_Controller_Front::getInstance()->getRouter()
+                    ->getRoute($info['route'])->getDefaults();
+        } else {
+            $request = Zend_Controller_Front::getInstance()->getRequest();
+            $defaults = array(
+                'action' => $request->getActionName(),
+                'controller' => $request->getControllerName(),
+                'module' => $request->getModuleName(),
+            );
+        }
+        foreach ($defaults as $key => $value) {
+            if (!isset($info[$key])) {
+                $info[$key] = $value;
+            }
+        }
+
+        $info = Zend_Navigation_Page::factory($info);
+        if ($this->currentPage) {
+            $this->view->navigation()->findOneBy('label',
+                    $this->currentPage->getLabel())
+                    ->addPage($info);
+        } else {
+            $this->view->navigation()->addPage($info);
+        }
+        $this->currentPage = $info;
+
+        $this->view->headTitle($info->getLabel(),
+                Zend_View_Helper_Placeholder_Container_Abstract::PREPEND);
+    }
+}

File www/system/modules/blog/configs/routes.yml

     action: delete
 
 blog_entry_show:
+  type: Zend_Controller_Router_Route_Regex
   route: entries/([^/]+)
   defaults:
     module: blog
     controller: entry
-    action: show
+    action: show
+  map: { 1: title_slug }
+  reverse: entries/%s

File www/system/modules/blog/configs/view.yml

 default:
   metas:
-    title: ForestOrange
-    description: ForestOrange
-    keywords: forest, orange
+    title: Zend Framework, Doctrine
+    description: Zend Framework, Doctrine
+    keywords: zend, framework, doctrine

File www/system/modules/blog/controllers/EntryController.php

 <?php
 class Blog_EntryController extends ZendY_Controller_Action
 {
+    public function init()
+    {
+        $this->view->page($this->view->metas['title'], array('route' => 'index'));
+    }
+
     public function listAction()
     {
         $service = new Blog_Service_Entry();
         $this->view->entry = $entry = $service->get($this->_getParam('title_slug'));
         $this->_helper->isEmpty->notFound($entry);
 
-        $this->page(__METHOD__);
+        $this->view->page($entry->getTitle());
     }
 
     public function newAction()

File www/system/modules/blog/library/Service/Entry.php

     public function get($title_slug)
     {
         return $this->createQuery('e')
-                ->addWhere('e.title_slug = ?')
+                ->addWhere('e.title_slug = ?', $title_slug)
                 ->fetchOne();
     }
 

File www/system/modules/blog/views/scripts/entry/list.phtml

 
 <?php foreach ($this->entries as $entry): ?>
     <h2>
-        <a
-                href="<?php echo $this->url(array(), 'blog_entry_show', true); ?>"
-                ><?php echo $entry->getTitle(); ?></a>
+        <a href="<?php echo $this->url(array('title_slug' => $entry->getTitleSlug()),
+                'blog_entry_show', true); ?>"><?php echo $entry->getTitle(); ?></a>
     </h2>
     <?php echo $entry->getTextHtml(); ?>
 <?php endforeach; ?>

File www/system/modules/blog/views/scripts/entry/show.phtml

+<h1><?= $this->pageTitle(); ?></h1>
+
+<?php echo $this->unescape($this->entry->getTextHtml()); ?>

File www/system/modules/blog/views/scripts/layout.phtml

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
 <head>
-<?php echo
-$this->headMeta()
-        ->appendName('description', $this->metas['description'])
-        ->appendName('keywords', $this->metas['keywords']);
+<?php
+    echo $this->headMeta()
+            ->appendName('description', $this->metas['description'])
+            ->appendName('keywords', $this->metas['keywords']);
 ?>
 <?php echo $this->headTitle()->setSeparator(' <- '); ?>
 <base href="<?php echo $this->serverUrl() . $this->baseUrl(); ?>/" />
 <?php
 $this->headLink()
-        ->prependStylesheet('css/screen.css')
-        ->appendStylesheet('css/print.css', 'print');
+        ->prependStylesheet('css/blog/screen.css');
 ?>
 <?php echo $this->bundleLink($this->headLink()); ?>
 <?php echo $this->headLink(); ?>
 
 <body>
 
+    <div class="b-breadcrumbs">
+        <ul>
+            <li>
+                <?php
+                    echo $this->navigation()->breadcrumbs()
+                            ->setSeparator('</li><li>&nbsp;/&nbsp;</li><li>')
+                            ->setMinDepth(0);
+                ?>
+            </li>
+        </ul>
+    </div>
+
     <div class="b-navigation">
         <ul>
             <li><a href="">One</a></li>

File www/system/modules/blog/web/css/reset.css

+/* http://meyerweb.com/eric/tools/css/reset/ */
+/* v1.0 | 20080212 */
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	outline: 0;
+	font-size: 100%;
+	vertical-align: baseline;
+	background: transparent;
+}
+body {
+	line-height: 1;
+}
+ol, ul {
+	list-style: none;
+}
+blockquote, q {
+	quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+	content: '';
+	content: none;
+}
+
+/* remember to define focus styles! */
+:focus {
+	outline: 0;
+}
+
+/* remember to highlight inserts somehow! */
+ins {
+	text-decoration: none;
+}
+del {
+	text-decoration: line-through;
+}
+
+/* tables still need 'cellspacing="0"' in the markup */
+table {
+	border-collapse: collapse;
+	border-spacing: 0;
+}

File www/system/modules/blog/web/css/screen.css

-@IMPORT url('/css/blog/src/reset.css');
-@IMPORT url('/css/blog/src/global.css');
-
-@IMPORT url('/css/blog/src/layouts/l-content.css');
-@IMPORT url('/css/blog/src/layouts/l-footer.css');
-@IMPORT url('/css/blog/src/layouts/l-navigation.css');
-@IMPORT url('/css/blog/src/layouts/l-page.css');
-@IMPORT url('/css/blog/src/layouts/l-sidebar.css');
-
-@IMPORT url('/css/blog/src/blocks/b-breadcrumbs.css');
-@IMPORT url('/css/blog/src/blocks/b-content.css');
-@IMPORT url('/css/blog/src/blocks/b-copyright.css');
-@IMPORT url('/css/blog/src/blocks/b-menu.css');
-@IMPORT url('/css/blog/src/blocks/b-navigation.css');
-@IMPORT url('/css/blog/src/blocks/b-table.css');
-
-@IMPORT url('/css/blog/src/system/b-table.css');
-@IMPORT url('/css/blog/src/system/b-orphus-dialog.css');
-
-@IMPORT url('/css/blog/src/zend/b-flash.css');
-@IMPORT url('/css/blog/src/zend/b-form.css');
-@IMPORT url('/css/blog/src/zend/b-log.css');
-@IMPORT url('/css/blog/src/zend/b-pager.css');
-@IMPORT url('/css/blog/src/zend/b-tagcloud.css');
+@IMPORT url('/css/reset.css');
+
+body {
+    width: 950px;
+    margin: 20px auto;
+}
+body, input, textarea, label {
+    font-family: verdana; font-size: 9pt;
+    line-height: 150%;
+}
+a {
+    color: #036;
+}
+
+.b-breadcrumbs {
+    padding: 20px 0;
+}
+.b-breadcrumbs ul li {
+    display: inline;
+}
+
+.b-navigation {
+    padding: 10px 20px ;
+    background-color: #369;
+}
+.b-navigation, .b-navigation a {
+    color: #fff; font-weight: bold;
+}
+.b-navigation ul li {
+    display: inline;
+    padding-right: 15px;
+}
+
+.b-column {
+    padding: 0 1.5em;
+}
+
+.l-content {
+    float: left;
+    width: 656px;
+    border: 2px #eee solid;
+}
+.b-content h1, .b-content h2, .b-content h3 {
+    margin: 1.5em 0;
+}
+.b-content h1 {
+    font-size: 12pt;
+}
+.b-content h2 {
+    font-size: 11pt;
+}
+.b-content p {
+    margin: 0.8em 0;
+}
+
+.l-sidebar {
+    float: left;
+    width: 210px;
+}
+.l-copyright {
+    clear: both;
+}
+.b-copyright {
+    padding: 20px 0;
+}

File www/system/modules/text/Bootstrap.php

     protected function _initText()
     {
         $baseDir = dirname(__FILE__);
-        Neno_Loader::getInstance()->registerPluginPrefixes(array(
-            'Text_' => $baseDir . '/library',
-        ));
-        set_include_path(get_include_path() . PATH_SEPARATOR . $baseDir . '/library');
+        set_include_path(get_include_path()
+                . PATH_SEPARATOR . $baseDir . '/library');
 
-        Zend_Filter::addDefaultNamespaces('Text_Filter_');
+        Zend_Filter::addDefaultNamespaces('Text_Filter');
     }
 }

File www/system/modules/text/library/Filter/Markdown.php

-<?php
-require_once dirname(__FILE__) . '/markdown/markdown.php';
-
-class Text_Filter_Markdown implements Zend_Filter_Interface
-{
-    public function filter($value)
-    {
-        return markdown($value);
-    }
-}

File www/system/modules/text/library/Filter/markdown/markdown.php

-<?php
-#
-# Markdown Extra  -  A text-to-HTML conversion tool for web writers
-#
-# PHP Markdown & Extra
-# Copyright (c) 2004-2009 Michel Fortin  
-# <http://michelf.com/projects/php-markdown/>
-#
-# Original Markdown
-# Copyright (c) 2004-2006 John Gruber  
-# <http://daringfireball.net/projects/markdown/>
-#
-
-
-define( 'MARKDOWN_VERSION',  "1.0.1n" ); # Sat 10 Oct 2009
-define( 'MARKDOWNEXTRA_VERSION',  "1.2.4" ); # Sat 10 Oct 2009
-
-
-#
-# Global default settings:
-#
-
-# Change to ">" for HTML output
-@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX',  " />");
-
-# Define the width of a tab for code blocks.
-@define( 'MARKDOWN_TAB_WIDTH',     4 );
-
-# Optional title attribute for footnote links and backlinks.
-@define( 'MARKDOWN_FN_LINK_TITLE',         "" );
-@define( 'MARKDOWN_FN_BACKLINK_TITLE',     "" );
-
-# Optional class attribute for footnote links and backlinks.
-@define( 'MARKDOWN_FN_LINK_CLASS',         "" );
-@define( 'MARKDOWN_FN_BACKLINK_CLASS',     "" );
-
-
-#
-# WordPress settings:
-#
-
-# Change to false to remove Markdown from posts and/or comments.
-@define( 'MARKDOWN_WP_POSTS',      true );
-@define( 'MARKDOWN_WP_COMMENTS',   true );
-
-
-
-### Standard Function Interface ###
-
-@define( 'MARKDOWN_PARSER_CLASS',  'MarkdownExtra_Parser' );
-
-function Markdown($text) {
-#
-# Initialize the parser and return the result of its transform method.
-#
-	# Setup static parser variable.
-	static $parser;
-	if (!isset($parser)) {
-		$parser_class = MARKDOWN_PARSER_CLASS;
-		$parser = new $parser_class;
-	}
-
-	# Transform text using parser.
-	return $parser->transform($text);
-}
-
-
-### WordPress Plugin Interface ###
-
-/*
-Plugin Name: Markdown Extra
-Plugin URI: http://michelf.com/projects/php-markdown/
-Description: <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://michelf.com/projects/php-markdown/">More...</a>
-Version: 1.2.4
-Author: Michel Fortin
-Author URI: http://michelf.com/
-*/
-
-if (isset($wp_version)) {
-	# More details about how it works here:
-	# <http://michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
-	
-	# Post content and excerpts
-	# - Remove WordPress paragraph generator.
-	# - Run Markdown on excerpt, then remove all tags.
-	# - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
-	if (MARKDOWN_WP_POSTS) {
-		remove_filter('the_content',     'wpautop');
-        remove_filter('the_content_rss', 'wpautop');
-		remove_filter('the_excerpt',     'wpautop');
-		add_filter('the_content',     'mdwp_MarkdownPost', 6);
-        add_filter('the_content_rss', 'mdwp_MarkdownPost', 6);
-		add_filter('get_the_excerpt', 'mdwp_MarkdownPost', 6);
-		add_filter('get_the_excerpt', 'trim', 7);
-		add_filter('the_excerpt',     'mdwp_add_p');
-		add_filter('the_excerpt_rss', 'mdwp_strip_p');
-		
-		remove_filter('content_save_pre',  'balanceTags', 50);
-		remove_filter('excerpt_save_pre',  'balanceTags', 50);
-		add_filter('the_content',  	  'balanceTags', 50);
-		add_filter('get_the_excerpt', 'balanceTags', 9);
-	}
-	
-	# Add a footnote id prefix to posts when inside a loop.
-	function mdwp_MarkdownPost($text) {
-		static $parser;
-		if (!$parser) {
-			$parser_class = MARKDOWN_PARSER_CLASS;
-			$parser = new $parser_class;
-		}
-		if (is_single() || is_page() || is_feed()) {
-			$parser->fn_id_prefix = "";
-		} else {
-			$parser->fn_id_prefix = get_the_ID() . ".";
-		}
-		return $parser->transform($text);
-	}
-	
-	# Comments
-	# - Remove WordPress paragraph generator.
-	# - Remove WordPress auto-link generator.
-	# - Scramble important tags before passing them to the kses filter.
-	# - Run Markdown on excerpt then remove paragraph tags.
-	if (MARKDOWN_WP_COMMENTS) {
-		remove_filter('comment_text', 'wpautop', 30);
-		remove_filter('comment_text', 'make_clickable');
-		add_filter('pre_comment_content', 'Markdown', 6);
-		add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
-		add_filter('pre_comment_content', 'mdwp_show_tags', 12);
-		add_filter('get_comment_text',    'Markdown', 6);
-		add_filter('get_comment_excerpt', 'Markdown', 6);
-		add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);
-	
-		global $mdwp_hidden_tags, $mdwp_placeholders;
-		$mdwp_hidden_tags = explode(' ',
-			'<p> </p> <pre> </pre> <ol> </ol> <ul> </ul> <li> </li>');
-		$mdwp_placeholders = explode(' ', str_rot13(
-			'pEj07ZbbBZ U1kqgh4w4p pre2zmeN6K QTi31t9pre ol0MP1jzJR '.
-			'ML5IjmbRol ulANi1NsGY J7zRLJqPul liA8ctl16T K9nhooUHli'));
-	}
-	
-	function mdwp_add_p($text) {
-		if (!preg_match('{^$|^<(p|ul|ol|dl|pre|blockquote)>}i', $text)) {
-			$text = '<p>'.$text.'</p>';
-			$text = preg_replace('{\n{2,}}', "</p>\n\n<p>", $text);
-		}
-		return $text;
-	}
-	
-	function mdwp_strip_p($t) { return preg_replace('{</?p>}i', '', $t); }
-
-	function mdwp_hide_tags($text) {
-		global $mdwp_hidden_tags, $mdwp_placeholders;
-		return str_replace($mdwp_hidden_tags, $mdwp_placeholders, $text);
-	}
-	function mdwp_show_tags($text) {
-		global $mdwp_hidden_tags, $mdwp_placeholders;
-		return str_replace($mdwp_placeholders, $mdwp_hidden_tags, $text);
-	}
-}
-
-
-### bBlog Plugin Info ###
-
-function identify_modifier_markdown() {
-	return array(
-		'name' => 'markdown',
-		'type' => 'modifier',
-		'nicename' => 'PHP Markdown Extra',
-		'description' => 'A text-to-HTML conversion tool for web writers',
-		'authors' => 'Michel Fortin and John Gruber',
-		'licence' => 'GPL',
-		'version' => MARKDOWNEXTRA_VERSION,
-		'help' => '<a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://michelf.com/projects/php-markdown/">More...</a>',
-		);
-}
-
-
-### Smarty Modifier Interface ###
-
-function smarty_modifier_markdown($text) {
-	return Markdown($text);
-}
-
-
-### Textile Compatibility Mode ###
-
-# Rename this file to "classTextile.php" and it can replace Textile everywhere.
-
-if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
-	# Try to include PHP SmartyPants. Should be in the same directory.
-	@include_once 'smartypants.php';
-	# Fake Textile class. It calls Markdown instead.
-	class Textile {
-		function TextileThis($text, $lite='', $encode='') {
-			if ($lite == '' && $encode == '')    $text = Markdown($text);
-			if (function_exists('SmartyPants'))  $text = SmartyPants($text);
-			return $text;
-		}
-		# Fake restricted version: restrictions are not supported for now.
-		function TextileRestricted($text, $lite='', $noimage='') {
-			return $this->TextileThis($text, $lite);
-		}
-		# Workaround to ensure compatibility with TextPattern 4.0.3.
-		function blockLite($text) { return $text; }
-	}
-}
-
-
-
-#
-# Markdown Parser Class
-#
-
-class Markdown_Parser {
-
-	# Regex to match balanced [brackets].
-	# Needed to insert a maximum bracked depth while converting to PHP.
-	var $nested_brackets_depth = 6;
-	var $nested_brackets_re;
-	
-	var $nested_url_parenthesis_depth = 4;
-	var $nested_url_parenthesis_re;
-
-	# Table of hash values for escaped characters:
-	var $escape_chars = '\`*_{}[]()>#+-.!';
-	var $escape_chars_re;
-
-	# Change to ">" for HTML output.
-	var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
-	var $tab_width = MARKDOWN_TAB_WIDTH;
-	
-	# Change to `true` to disallow markup or entities.
-	var $no_markup = false;
-	var $no_entities = false;
-	
-	# Predefined urls and titles for reference links and images.
-	var $predef_urls = array();
-	var $predef_titles = array();
-
-
-	function Markdown_Parser() {
-	#
-	# Constructor function. Initialize appropriate member variables.
-	#
-		$this->_initDetab();
-		$this->prepareItalicsAndBold();
-	
-		$this->nested_brackets_re = 
-			str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
-			str_repeat('\])*', $this->nested_brackets_depth);
-	
-		$this->nested_url_parenthesis_re = 
-			str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
-			str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
-		
-		$this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
-		
-		# Sort document, block, and span gamut in ascendent priority order.
-		asort($this->document_gamut);
-		asort($this->block_gamut);
-		asort($this->span_gamut);
-	}
-
-
-	# Internal hashes used during transformation.
-	var $urls = array();
-	var $titles = array();
-	var $html_hashes = array();
-	
-	# Status flag to avoid invalid nesting.
-	var $in_anchor = false;
-	
-	
-	function setup() {
-	#
-	# Called before the transformation process starts to setup parser 
-	# states.
-	#
-		# Clear global hashes.
-		$this->urls = $this->predef_urls;
-		$this->titles = $this->predef_titles;
-		$this->html_hashes = array();
-		
-		$in_anchor = false;
-	}
-	
-	function teardown() {
-	#
-	# Called after the transformation process to clear any variable 
-	# which may be taking up memory unnecessarly.
-	#
-		$this->urls = array();
-		$this->titles = array();
-		$this->html_hashes = array();
-	}
-
-
-	function transform($text) {
-	#
-	# Main function. Performs some preprocessing on the input text
-	# and pass it through the document gamut.
-	#
-		$this->setup();
-	
-		# Remove UTF-8 BOM and marker character in input, if present.
-		$text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
-
-		# Standardize line endings:
-		#   DOS to Unix and Mac to Unix
-		$text = preg_replace('{\r\n?}', "\n", $text);
-
-		# Make sure $text ends with a couple of newlines:
-		$text .= "\n\n";
-
-		# Convert all tabs to spaces.
-		$text = $this->detab($text);
-
-		# Turn block-level HTML blocks into hash entries
-		$text = $this->hashHTMLBlocks($text);
-
-		# Strip any lines consisting only of spaces and tabs.
-		# This makes subsequent regexen easier to write, because we can
-		# match consecutive blank lines with /\n+/ instead of something
-		# contorted like /[ ]*\n+/ .
-		$text = preg_replace('/^[ ]+$/m', '', $text);
-
-		# Run document gamut methods.
-		foreach ($this->document_gamut as $method => $priority) {
-			$text = $this->$method($text);
-		}
-		
-		$this->teardown();
-
-		return $text . "\n";
-	}
-	
-	var $document_gamut = array(
-		# Strip link definitions, store in hashes.
-		"stripLinkDefinitions" => 20,
-		
-		"runBasicBlockGamut"   => 30,
-		);
-
-
-	function stripLinkDefinitions($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.'}\[(.+)\][ ]?:	# id = $1
-							  [ ]*
-							  \n?				# maybe *one* newline
-							  [ ]*
-							(?:
-							  <(.+?)>			# url = $2
-							|
-							  (\S+?)			# url = $3
-							)
-							  [ ]*
-							  \n?				# maybe one newline
-							  [ ]*
-							(?:
-								(?<=\s)			# lookbehind for whitespace
-								["(]
-								(.*?)			# title = $4
-								[")]
-								[ ]*
-							)?	# title is optional
-							(?:\n+|\Z)
-			}xm',
-			array(&$this, '_stripLinkDefinitions_callback'),
-			$text);
-		return $text;
-	}
-	function _stripLinkDefinitions_callback($matches) {
-		$link_id = strtolower($matches[1]);
-		$url = $matches[2] == '' ? $matches[3] : $matches[2];
-		$this->urls[$link_id] = $url;
-		$this->titles[$link_id] =& $matches[4];
-		return ''; # String that will replace the block
-	}
-
-
-	function hashHTMLBlocks($text) {
-		if ($this->no_markup)  return $text;
-
-		$less_than_tab = $this->tab_width - 1;
-
-		# Hashify HTML blocks:
-		# We only want to do this for block-level HTML tags, such as headers,
-		# lists, and tables. That's because we still want to wrap <p>s around
-		# "paragraphs" that are wrapped in non-block-level tags, such as anchors,
-		# phrase emphasis, and spans. The list of tags we're looking for is
-		# hard-coded:
-		#
-		# *  List "a" is made of tags which can be both inline or block-level.
-		#    These will be treated block-level when the start tag is alone on 
-		#    its line, otherwise they're not matched here and will be taken as 
-		#    inline later.
-		# *  List "b" is made of tags which are always block-level;
-		#
-		$block_tags_a_re = 'ins|del';
-		$block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
-						   'script|noscript|form|fieldset|iframe|math';
-
-		# Regular expression for the content of a block tag.
-		$nested_tags_level = 4;
-		$attr = '
-			(?>				# optional tag attributes
-			  \s			# starts with whitespace
-			  (?>
-				[^>"/]+		# text outside quotes
-			  |
-				/+(?!>)		# slash not followed by ">"
-			  |
-				"[^"]*"		# text inside double quotes (tolerate ">")
-			  |
-				\'[^\']*\'	# text inside single quotes (tolerate ">")
-			  )*
-			)?	
-			';
-		$content =
-			str_repeat('
-				(?>
-				  [^<]+			# content without tag
-				|
-				  <\2			# nested opening tag
-					'.$attr.'	# attributes
-					(?>
-					  />
-					|
-					  >', $nested_tags_level).	# end of opening tag
-					  '.*?'.					# last level nested tag content
-			str_repeat('
-					  </\2\s*>	# closing nested tag
-					)
-				  |				
-					<(?!/\2\s*>	# other tags with a different name
-				  )
-				)*',
-				$nested_tags_level);
-		$content2 = str_replace('\2', '\3', $content);
-
-		# First, look for nested blocks, e.g.:
-		# 	<div>
-		# 		<div>
-		# 		tags for inner block must be indented.
-		# 		</div>
-		# 	</div>
-		#
-		# The outermost tags must start at the left margin for this to match, and
-		# the inner nested divs must be indented.
-		# We need to do this before the next, more liberal match, because the next
-		# match will start at the first `<div>` and stop at the first `</div>`.
-		$text = preg_replace_callback('{(?>
-			(?>
-				(?<=\n\n)		# Starting after a blank line
-				|				# or
-				\A\n?			# the beginning of the doc
-			)
-			(						# save in $1
-
-			  # Match from `\n<tag>` to `</tag>\n`, handling nested tags 
-			  # in between.
-					
-						[ ]{0,'.$less_than_tab.'}
-						<('.$block_tags_b_re.')# start tag = $2
-						'.$attr.'>			# attributes followed by > and \n
-						'.$content.'		# content, support nesting
-						</\2>				# the matching end tag
-						[ ]*				# trailing spaces/tabs
-						(?=\n+|\Z)	# followed by a newline or end of document
-
-			| # Special version for tags of group a.
-
-						[ ]{0,'.$less_than_tab.'}
-						<('.$block_tags_a_re.')# start tag = $3
-						'.$attr.'>[ ]*\n	# attributes followed by >
-						'.$content2.'		# content, support nesting
-						</\3>				# the matching end tag
-						[ ]*				# trailing spaces/tabs
-						(?=\n+|\Z)	# followed by a newline or end of document
-					
-			| # Special case just for <hr />. It was easier to make a special 
-			  # case than to make the other regex more complicated.
-			
-						[ ]{0,'.$less_than_tab.'}
-						<(hr)				# start tag = $2
-						'.$attr.'			# attributes
-						/?>					# the matching end tag
-						[ ]*
-						(?=\n{2,}|\Z)		# followed by a blank line or end of document
-			
-			| # Special case for standalone HTML comments:
-			
-					[ ]{0,'.$less_than_tab.'}
-					(?s:
-						<!-- .*? -->
-					)
-					[ ]*
-					(?=\n{2,}|\Z)		# followed by a blank line or end of document
-			
-			| # PHP and ASP-style processor instructions (<? and <%)
-			
-					[ ]{0,'.$less_than_tab.'}
-					(?s:
-						<([?%])			# $2
-						.*?
-						\2>
-					)
-					[ ]*
-					(?=\n{2,}|\Z)		# followed by a blank line or end of document
-					
-			)
-			)}Sxmi',
-			array(&$this, '_hashHTMLBlocks_callback'),
-			$text);
-
-		return $text;
-	}
-	function _hashHTMLBlocks_callback($matches) {
-		$text = $matches[1];
-		$key  = $this->hashBlock($text);
-		return "\n\n$key\n\n";
-	}
-	
-	
-	function hashPart($text, $boundary = 'X') {
-	#
-	# Called whenever a tag must be hashed when a function insert an atomic 
-	# element in the text stream. Passing $text to through this function gives
-	# a unique text-token which will be reverted back when calling unhash.
-	#
-	# The $boundary argument specify what character should be used to surround
-	# the token. By convension, "B" is used for block elements that needs not
-	# to be wrapped into paragraph tags at the end, ":" is used for elements
-	# that are word separators and "X" is used in the general case.
-	#
-		# Swap back any tag hash found in $text so we do not have to `unhash`
-		# multiple times at the end.
-		$text = $this->unhash($text);
-		
-		# Then hash the block.
-		static $i = 0;
-		$key = "$boundary\x1A" . ++$i . $boundary;
-		$this->html_hashes[$key] = $text;
-		return $key; # String that will replace the tag.
-	}
-
-
-	function hashBlock($text) {
-	#
-	# Shortcut function for hashPart with block-level boundaries.
-	#
-		return $this->hashPart($text, 'B');
-	}
-
-
-	var $block_gamut = array(
-	#
-	# These are all the transformations that form block-level
-	# tags like paragraphs, headers, and list items.
-	#
-		"doHeaders"         => 10,
-		"doHorizontalRules" => 20,
-		
-		"doLists"           => 40,
-		"doCodeBlocks"      => 50,
-		"doBlockQuotes"     => 60,
-		);
-
-	function runBlockGamut($text) {
-	#
-	# Run block gamut tranformations.
-	#
-		# We need to escape raw HTML in Markdown source before doing anything 
-		# else. This need to be done for each block, and not only at the 
-		# begining in the Markdown function since hashed blocks can be part of
-		# list items and could have been indented. Indented blocks would have 
-		# been seen as a code block in a previous pass of hashHTMLBlocks.
-		$text = $this->hashHTMLBlocks($text);
-		
-		return $this->runBasicBlockGamut($text);
-	}
-	
-	function runBasicBlockGamut($text) {
-	#
-	# Run block gamut tranformations, without hashing HTML blocks. This is 
-	# useful when HTML blocks are known to be already hashed, like in the first
-	# whole-document pass.
-	#
-		foreach ($this->block_gamut as $method => $priority) {
-			$text = $this->$method($text);
-		}
-		
-		# Finally form paragraph and restore hashed blocks.
-		$text = $this->formParagraphs($text);
-
-		return $text;
-	}
-	
-	
-	function doHorizontalRules($text) {
-		# Do Horizontal Rules:
-		return preg_replace(
-			'{
-				^[ ]{0,3}	# Leading space
-				([-*_])		# $1: First marker
-				(?>			# Repeated marker group
-					[ ]{0,2}	# Zero, one, or two spaces.
-					\1			# Marker character
-				){2,}		# Group repeated at least twice
-				[ ]*		# Tailing spaces
-				$			# End of line.
-			}mx',
-			"\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n", 
-			$text);
-	}
-
-
-	var $span_gamut = array(
-	#
-	# These are all the transformations that occur *within* block-level
-	# tags like paragraphs, headers, and list items.
-	#
-		# Process character escapes, code spans, and inline HTML
-		# in one shot.
-		"parseSpan"           => -30,
-
-		# Process anchor and image tags. Images must come first,
-		# because ![foo][f] looks like an anchor.
-		"doImages"            =>  10,
-		"doAnchors"           =>  20,
-		
-		# Make links out of things like `<http://example.com/>`
-		# Must come after doAnchors, because you can use < and >
-		# delimiters in inline links like [this](<url>).
-		"doAutoLinks"         =>  30,
-		"encodeAmpsAndAngles" =>  40,
-
-		"doItalicsAndBold"    =>  50,
-		"doHardBreaks"        =>  60,
-		);
-
-	function runSpanGamut($text) {
-	#
-	# Run span gamut tranformations.
-	#
-		foreach ($this->span_gamut as $method => $priority) {
-			$text = $this->$method($text);
-		}
-
-		return $text;
-	}
-	
-	
-	function doHardBreaks($text) {
-		# Do hard breaks:
-		return preg_replace_callback('/ {2,}\n/', 
-			array(&$this, '_doHardBreaks_callback'), $text);
-	}
-	function _doHardBreaks_callback($matches) {
-		return $this->hashPart("<br$this->empty_element_suffix\n");
-	}
-
-
-	function doAnchors($text) {
-	#
-	# Turn Markdown link shortcuts into XHTML <a> tags.
-	#
-		if ($this->in_anchor) return $text;
-		$this->in_anchor = true;
-		
-		#
-		# First, handle reference-style links: [link text] [id]
-		#
-		$text = preg_replace_callback('{
-			(					# wrap whole match in $1
-			  \[
-				('.$this->nested_brackets_re.')	# link text = $2
-			  \]
-
-			  [ ]?				# one optional space
-			  (?:\n[ ]*)?		# one optional newline followed by spaces
-
-			  \[
-				(.*?)		# id = $3
-			  \]
-			)
-			}xs',
-			array(&$this, '_doAnchors_reference_callback'), $text);
-
-		#
-		# Next, inline-style links: [link text](url "optional title")
-		#
-		$text = preg_replace_callback('{
-			(				# wrap whole match in $1
-			  \[
-				('.$this->nested_brackets_re.')	# link text = $2
-			  \]
-			  \(			# literal paren
-				[ \n]*
-				(?:
-					<(.+?)>	# href = $3
-				|
-					('.$this->nested_url_parenthesis_re.')	# href = $4
-				)
-				[ \n]*
-				(			# $5
-				  ([\'"])	# quote char = $6
-				  (.*?)		# Title = $7
-				  \6		# matching quote
-				  [ \n]*	# ignore any spaces/tabs between closing quote and )
-				)?			# title is optional
-			  \)
-			)
-			}xs',
-			array(&$this, '_doAnchors_inline_callback'), $text);
-
-		#
-		# Last, handle reference-style shortcuts: [link text]
-		# These must come last in case you've also got [link text][1]
-		# or [link text](/foo)
-		#
-		$text = preg_replace_callback('{
-			(					# wrap whole match in $1
-			  \[
-				([^\[\]]+)		# link text = $2; can\'t contain [ or ]
-			  \]
-			)
-			}xs',
-			array(&$this, '_doAnchors_reference_callback'), $text);
-
-		$this->in_anchor = false;
-		return $text;
-	}
-	function _doAnchors_reference_callback($matches) {
-		$whole_match =  $matches[1];
-		$link_text   =  $matches[2];
-		$link_id     =& $matches[3];
-
-		if ($link_id == "") {
-			# for shortcut links like [this][] or [this].
-			$link_id = $link_text;
-		}
-		
-		# lower-case and turn embedded newlines into spaces
-		$link_id = strtolower($link_id);
-		$link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
-
-		if (isset($this->urls[$link_id])) {
-			$url = $this->urls[$link_id];
-			$url = $this->encodeAttribute($url);
-			
-			$result = "<a href=\"$url\"";
-			if ( isset( $this->titles[$link_id] ) ) {
-				$title = $this->titles[$link_id];
-				$title = $this->encodeAttribute($title);
-				$result .=  " title=\"$title\"";
-			}
-		
-			$link_text = $this->runSpanGamut($link_text);
-			$result .= ">$link_text</a>";
-			$result = $this->hashPart($result);
-		}
-		else {
-			$result = $whole_match;
-		}
-		return $result;
-	}
-	function _doAnchors_inline_callback($matches) {
-		$whole_match	=  $matches[1];
-		$link_text		=  $this->runSpanGamut($matches[2]);
-		$url			=  $matches[3] == '' ? $matches[4] : $matches[3];
-		$title			=& $matches[7];
-
-		$url = $this->encodeAttribute($url);
-
-		$result = "<a href=\"$url\"";
-		if (isset($title)) {
-			$title = $this->encodeAttribute($title);
-			$result .=  " title=\"$title\"";
-		}
-		
-		$link_text = $this->runSpanGamut($link_text);
-		$result .= ">$link_text</a>";
-
-		return $this->hashPart($result);
-	}
-
-
-	function doImages($text) {
-	#
-	# Turn Markdown image shortcuts into <img> tags.
-	#
-		#
-		# First, handle reference-style labeled images: ![alt text][id]
-		#
-		$text = preg_replace_callback('{
-			(				# wrap whole match in $1
-			  !\[
-				('.$this->nested_brackets_re.')		# alt text = $2
-			  \]
-
-			  [ ]?				# one optional space
-			  (?:\n[ ]*)?		# one optional newline followed by spaces
-
-			  \[
-				(.*?)		# id = $3
-			  \]
-
-			)
-			}xs', 
-			array(&$this, '_doImages_reference_callback'), $text);
-
-		#
-		# Next, handle inline images:  ![alt text](url "optional title")
-		# Don't forget: encode * and _
-		#
-		$text = preg_replace_callback('{
-			(				# wrap whole match in $1
-			  !\[
-				('.$this->nested_brackets_re.')		# alt text = $2
-			  \]
-			  \s?			# One optional whitespace character
-			  \(			# literal paren
-				[ \n]*
-				(?:
-					<(\S*)>	# src url = $3
-				|
-					('.$this->nested_url_parenthesis_re.')	# src url = $4
-				)
-				[ \n]*
-				(			# $5
-				  ([\'"])	# quote char = $6
-				  (.*?)		# title = $7
-				  \6		# matching quote
-				  [ \n]*
-				)?			# title is optional
-			  \)
-			)
-			}xs',
-			array(&$this, '_doImages_inline_callback'), $text);
-
-		return $text;
-	}
-	function _doImages_reference_callback($matches) {
-		$whole_match = $matches[1];
-		$alt_text    = $matches[2];
-		$link_id     = strtolower($matches[3]);
-
-		if ($link_id == "") {
-			$link_id = strtolower($alt_text); # for shortcut links like ![this][].
-		}
-
-		$alt_text = $this->encodeAttribute($alt_text);
-		if (isset($this->urls[$link_id])) {
-			$url = $this->encodeAttribute($this->urls[$link_id]);
-			$result = "<img src=\"$url\" alt=\"$alt_text\"";
-			if (isset($this->titles[$link_id])) {
-				$title = $this->titles[$link_id];
-				$title = $this->encodeAttribute($title);
-				$result .=  " title=\"$title\"";
-			}
-			$result .= $this->empty_element_suffix;
-			$result = $this->hashPart($result);
-		}
-		else {
-			# If there's no such link ID, leave intact:
-			$result = $whole_match;
-		}
-
-		return $result;
-	}
-	function _doImages_inline_callback($matches) {
-		$whole_match	= $matches[1];
-		$alt_text		= $matches[2];
-		$url			= $matches[3] == '' ? $matches[4] : $matches[3];
-		$title			=& $matches[7];
-
-		$alt_text = $this->encodeAttribute($alt_text);
-		$url = $this->encodeAttribute($url);
-		$result = "<img src=\"$url\" alt=\"$alt_text\"";
-		if (isset($title)) {
-			$title = $this->encodeAttribute($title);
-			$result .=  " title=\"$title\""; # $title already quoted
-		}
-		$result .= $this->empty_element_suffix;
-
-		return $this->hashPart($result);
-	}
-
-
-	function doHeaders($text) {
-		# Setext-style headers:
-		#	  Header 1
-		#	  ========
-		#  
-		#	  Header 2
-		#	  --------
-		#
-		$text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
-			array(&$this, '_doHeaders_callback_setext'), $text);
-
-		# atx-style headers:
-		#	# Header 1
-		#	## Header 2
-		#	## Header 2 with closing hashes ##
-		#	...
-		#	###### Header 6
-		#
-		$text = preg_replace_callback('{
-				^(\#{1,6})	# $1 = string of #\'s
-				[ ]*
-				(.+?)		# $2 = Header text
-				[ ]*
-				\#*			# optional closing #\'s (not counted)
-				\n+
-			}xm',
-			array(&$this, '_doHeaders_callback_atx'), $text);
-
-		return $text;
-	}
-	function _doHeaders_callback_setext($matches) {
-		# Terrible hack to check we haven't found an empty list item.
-		if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
-			return $matches[0];
-		
-		$level = $matches[2]{0} == '=' ? 1 : 2;
-		$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
-		return "\n" . $this->hashBlock($block) . "\n\n";
-	}
-	function _doHeaders_callback_atx($matches) {
-		$level = strlen($matches[1]);
-		$block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
-		return "\n" . $this->hashBlock($block) . "\n\n";
-	}
-
-
-	function doLists($text) {
-	#
-	# Form HTML ordered (numbered) and unordered (bulleted) lists.
-	#
-		$less_than_tab = $this->tab_width - 1;
-
-		# Re-usable patterns to match list item bullets and number markers:
-		$marker_ul_re  = '[*+-]';
-		$marker_ol_re  = '\d+[.]';
-		$marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
-
-		$markers_relist = array(
-			$marker_ul_re => $marker_ol_re,
-			$marker_ol_re => $marker_ul_re,
-			);
-
-		foreach ($markers_relist as $marker_re => $other_marker_re) {
-			# Re-usable pattern to match any entirel ul or ol list:
-			$whole_list_re = '
-				(								# $1 = whole list
-				  (								# $2
-					([ ]{0,'.$less_than_tab.'})	# $3 = number of spaces
-					('.$marker_re.')			# $4 = first list item marker
-					[ ]+
-				  )
-				  (?s:.+?)
-				  (								# $5
-					  \z
-					|
-					  \n{2,}
-					  (?=\S)
-					  (?!						# Negative lookahead for another list item marker
-						[ ]*
-						'.$marker_re.'[ ]+
-					  )
-					|
-					  (?=						# Lookahead for another kind of list
-					    \n
-						\3						# Must have the same indentation
-						'.$other_marker_re.'[ ]+
-					  )
-				  )
-				)
-			'; // mx
-			
-			# We use a different prefix before nested lists than top-level lists.
-			# See extended comment in _ProcessListItems().
-		
-			if ($this->list_level) {
-				$text = preg_replace_callback('{
-						^
-						'.$whole_list_re.'
-					}mx',
-					array(&$this, '_doLists_callback'), $text);
-			}
-			else {
-				$text = preg_replace_callback('{
-						(?:(?<=\n)\n|\A\n?) # Must eat the newline
-						'.$whole_list_re.'
-					}mx',
-					array(&$this, '_doLists_callback'), $text);
-			}
-		}
-
-		return $text;
-	}
-	function _doLists_callback($matches) {
-		# Re-usable patterns to match list item bullets and number markers:
-		$marker_ul_re  = '[*+-]';
-		$marker_ol_re  = '\d+[.]';
-		$marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
-		
-		$list = $matches[1];
-		$list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol";
-		
-		$marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
-		
-		$list .= "\n";
-		$result = $this->processListItems($list, $marker_any_re);
-		
-		$result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
-		return "\n". $result ."\n\n";
-	}
-
-	var $list_level = 0;
-
-	function processListItems($list_str, $marker_any_re) {
-	#
-	#	Process the contents of a single ordered or unordered list, splitting it
-	#	into individual list items.
-	#
-		# The $this->list_level global keeps track of when we're inside a list.
-		# Each time we enter a list, we increment it; when we leave a list,
-		# we decrement. If it's zero, we're not in a list anymore.
-		#
-		# We do this because when we're not inside a list, we want to treat
-		# something like this:
-		#
-		#		I recommend upgrading to version
-		#		8. Oops, now this line is treated
-		#		as a sub-list.
-		#
-		# As a single paragraph, despite the fact that the second line starts
-		# with a digit-period-space sequence.
-		#
-		# Whereas when we're inside a list (or sub-list), that line will be
-		# treated as the start of a sub-list. What a kludge, huh? This is
-		# an aspect of Markdown's syntax that's hard to parse perfectly
-		# without resorting to mind-reading. Perhaps the solution is to
-		# change the syntax rules such that sub-lists must start with a
-		# starting cardinal number; e.g. "1." or "a.".
-		
-		$this->list_level++;
-
-		# trim trailing blank lines:
-		$list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
-
-		$list_str = preg_replace_callback('{
-			(\n)?							# leading line = $1
-			(^[ ]*)							# leading whitespace = $2
-			('.$marker_any_re.'				# list marker and space = $3
-				(?:[ ]+|(?=\n))	# space only required if item is not empty
-			)
-			((?s:.*?))						# list item text   = $4
-			(?:(\n+(?=\n))|\n)				# tailing blank line = $5
-			(?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
-			}xm',
-			array(&$this, '_processListItems_callback'), $list_str);
-
-		$this->list_level--;
-		return $list_str;
-	}
-	function _processListItems_callback($matches) {
-		$item = $matches[4];
-		$leading_line =& $matches[1];
-		$leading_space =& $matches[2];
-		$marker_space = $matches[3];
-		$tailing_blank_line =& $matches[5];
-
-		if ($leading_line || $tailing_blank_line || 
-			preg_match('/\n{2,}/', $item))
-		{
-			# Replace marker with the appropriate whitespace indentation
-			$item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
-			$item = $this->runBlockGamut($this->outdent($item)."\n");
-		}
-		else {
-			# Recursion for sub-lists:
-			$item = $this->doLists($this->outdent($item));
-			$item = preg_replace('/\n+$/', '', $item);
-			$item = $this->runSpanGamut($item);
-		}
-
-		return "<li>" . $item . "</li>\n";
-	}
-
-
-	function doCodeBlocks($text) {
-	#
-	#	Process Markdown `<pre><code>` blocks.
-	#
-		$text = preg_replace_callback('{
-				(?:\n\n|\A\n?)
-				(	            # $1 = the code block -- one or more lines, starting with a space/tab
-				  (?>
-					[ ]{'.$this->tab_width.'}  # Lines must start with a tab or a tab-width of spaces
-					.*\n+
-				  )+
-				)
-				((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z)	# Lookahead for non-space at line-start, or end of doc
-			}xm',
-			array(&$this, '_doCodeBlocks_callback'), $text);
-
-		return $text;
-	}
-	function _doCodeBlocks_callback($matches) {
-		$codeblock = $matches[1];
-
-		$codeblock = $this->outdent($codeblock);
-		$codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
-
-		# trim leading newlines and trailing newlines
-		$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
-
-		$codeblock = "<pre><code>$codeblock\n</code></pre>";
-		return "\n\n".$this->hashBlock($codeblock)."\n\n";
-	}
-
-
-	function makeCodeSpan($code) {
-	#
-	# Create a code span markup for $code. Called from handleSpanToken.
-	#
-		$code = htmlspecialchars(trim($code), ENT_NOQUOTES);
-		return $this->hashPart("<code>$code</code>");
-	}
-
-
-	var $em_relist = array(
-		''  => '(?:(?<!\*)\*(?!\*)|(?<!_)_(?!_))(?=\S|$)(?![.,:;]\s)',
-		'*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
-		'_' => '(?<=\S|^)(?<!_)_(?!_)',
-		);
-	var $strong_relist = array(
-		''   => '(?:(?<!\*)\*\*(?!\*)|(?<!_)__(?!_))(?=\S|$)(?![.,:;]\s)',
-		'**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
-		'__' => '(?<=\S|^)(?<!_)__(?!_)',
-		);
-	var $em_strong_relist = array(
-		''    => '(?:(?<!\*)\*\*\*(?!\*)|(?<!_)___(?!_))(?=\S|$)(?![.,:;]\s)',
-		'***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
-		'___' => '(?<=\S|^)(?<!_)___(?!_)',
-		);
-	var $em_strong_prepared_relist;
-	
-	function prepareItalicsAndBold() {
-	#
-	# Prepare regular expressions for searching emphasis tokens in any
-	# context.
-	#
-		foreach ($this->em_relist as $em => $em_re) {
-			foreach ($this->strong_relist as $strong => $strong_re) {
-				# Construct list of allowed token expressions.
-				$token_relist = array();
-				if (isset($this->em_strong_relist["$em$strong"])) {
-					$token_relist[] = $this->em_strong_relist["$em$strong"];
-				}
-				$token_relist[] = $em_re;
-				$token_relist[] = $strong_re;
-				
-				# Construct master expression from list.
-				$token_re = '{('. implode('|', $token_relist) .')}';
-				$this->em_strong_prepared_relist["$em$strong"] = $token_re;
-			}
-		}
-	}
-	
-	function doItalicsAndBold($text) {
-		$token_stack = array('');
-		$text_stack = array('');
-		$em = '';
-		$strong = '';
-		$tree_char_em = false;
-		
-		while (1) {
-			#
-			# Get prepared regular expression for seraching emphasis tokens
-			# in current context.
-			#
-			$token_re = $this->em_strong_prepared_relist["$em$strong"];
-			
-			#
-			# Each loop iteration search for the next emphasis token. 
-			# Each token is then passed to handleSpanToken.
-			#
-			$parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
-			$text_stack[0] .= $parts[0];
-			$token =& $parts[1];
-			$text =& $parts[2];
-			
-			if (empty($token)) {
-				# Reached end of text span: empty stack without emitting.
-				# any more emphasis.
-				while ($token_stack[0]) {
-					$text_stack[1] .= array_shift($token_stack);
-					$text_stack[0] .= array_shift($text_stack);
-				}
-				break;
-			}
-			
-			$token_len = strlen($token);
-			if ($tree_char_em) {
-				# Reached closing marker while inside a three-char emphasis.
-				if ($token_len == 3) {
-					# Three-char closing marker, close em and strong.
-					array_shift($token_stack);
-					$span = array_shift($text_stack);
-					$span = $this->runSpanGamut($span);
-					$span = "<strong><em>$span</em></strong>";
-					$text_stack[0] .= $this->hashPart($span);
-					$em = '';
-					$strong = '';
-				} else {
-					# Other closing marker: close one em or strong and
-					# change current token state to match the other
-					$token_stack[0] = str_repeat($token{0}, 3-$token_len);
-					$tag = $token_len == 2 ? "strong" : "em";
-					$span = $text_stack[0];
-					$span = $this->runSpanGamut($span);
-					$span = "<$tag>$span</$tag>";
-					$text_stack[0] = $this->hashPart($span);
-					$$tag = ''; # $$tag stands for $em or $strong
-				}
-				$tree_char_em = false;
-			} else if ($token_len == 3) {
-				if ($em) {
-					# Reached closing marker for both em and strong.
-					# Closing strong marker:
-					for ($i = 0; $i < 2; ++$i) {
-						$shifted_token = array_shift($token_stack);
-						$tag = strlen($shifted_token) == 2 ? "strong" : "em";
-						$span = array_shift($text_stack);
-						$span = $this->runSpanGamut($span);
-						$span = "<$tag>$span</$tag>";
-						$text_stack[0] .= $this->hashPart($span);
-						$$tag = ''; # $$tag stands for $em or $strong
-					}
-				} else {
-					# Reached opening three-char emphasis marker. Push on token 
-					# stack; will be handled by the special condition above.
-					$em = $token{0};
-					$strong = "$em$em";
-					array_unshift($token_stack, $token);
-					array_unshift($text_stack, '');
-					$tree_char_em = true;
-				}
-			} else if ($token_len == 2) {
-				if ($strong) {