<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[2501] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: W.org Plugins: Code reformatting.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/2501">2501</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2501","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-15 06:28:02 +0000 (Mon, 15 Feb 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>W.org Plugins: Code reformatting.

* Splitting out classes in their own files.
* Let the automated code formatter run over the plugin.

It should break too many things.

See <a href="http://meta.trac.wordpress.org/ticket/1584">#1584</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparserReadmeParserphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/ReadmeParser.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparsercompatphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/compat.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparsermarkdownphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/markdown.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytemplatephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytoolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytemplatephp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php                               (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php 2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,127 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @package WPorg_Plugin_Directory
+ */
+
+/**
+ * Various helpers to retrieve data not stored within WordPress.
+ */
+class WPorg_Plugin_Directory_Template {
+
+       /**
+        * @param string $plugin_slug
+        * @return int
+        */
+       static function get_active_installs_count( $plugin_slug ) {
+               if ( false === ( $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' ) ) ) {
+                       global $wpdb;
+
+                       $count = (int) $wpdb->get_var( $wpdb->prepare(
+                               "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1",
+                               $plugin_slug
+                       ) );
+                       wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 );
+               }
+
+               if ( $count < 10 ) {
+                       return 0;
+               }
+
+               if ( $count >= 1000000 ) {
+                       return 1000000;
+               }
+
+               return strval( $count )[0] * pow( 10, floor( log10( $count ) ) );
+       }
+
+       /**
+        * @return int
+        */
+       static function get_total_downloads() {
+               if ( false === ( $count = wp_cache_get( 'plugin_download_count', 'plugin_download_count' ) ) ) {
+                       global $wpdb;
+
+                       $count = $wpdb->get_var( "SELECT SUM(downloads) FROM `plugin_2_stats`" );
+                       wp_cache_add( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS );
+               }
+
+               return (int) $count;
+       }
+
+       /**
+        * @return array
+        */
+       static function get_plugin_sections() {
+               $plugin       = get_post();
+               $plugin_slug  = $plugin->post_name;
+               $raw_sections = get_post_meta( $plugin->ID, 'sections', true );
+               $raw_sections = array_unique( array_merge( $raw_sections, array(
+                       'description',
+                       'stats',
+                       'support',
+                       'reviews',
+                       'developers',
+               ) ) );
+
+               $sections = array();
+               $title    = '';
+               $url      = get_permalink();
+
+               foreach ( $raw_sections as $section_slug ) {
+                       switch ( $section_slug ) {
+
+                               case 'description':
+                                       $title = _x( 'Description', 'plugin tab title', 'wporg-plugins' );
+                                       break;
+
+                               case 'installation':
+                                       $title = _x( 'Installation', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'faq':
+                                       $title = _x( 'FAQ', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'screenshots':
+                                       $title = _x( 'Screenshots', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'changelog':
+                                       $title = _x( 'Changelog', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'stats':
+                                       $title = _x( 'Stats', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'support':
+                                       $title = _x( 'Support', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = 'https://wordpress.org/support/plugin/' . $plugin_slug;
+                                       break;
+
+                               case 'reviews':
+                                       $title = _x( 'Reviews', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = 'https://wordpress.org/support/view/plugin-reviews/' . $plugin_slug;
+                                       break;
+
+                               case 'developers':
+                                       $title = _x( 'Developers', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $url ) . '/' . $section_slug . '/';
+                                       break;
+                       }
+
+                       $sections[] = array(
+                               'slug'  => $section_slug,
+                               'url'   => $url,
+                               'title' => $title,
+                       );
+               }
+
+               return $sections;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytoolsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php                          (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php    2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,40 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @package WPorg_Plugin_Directory
+ */
+
+/**
+ * Various functions used by other processes, will make sense to move to specific classes.
+ */
+class WPorg_Plugin_Directory_Tools {
+
+       /**
+        * @param string $readme
+        * @return object
+        */
+       static function get_readme_data( $readme ) {
+
+               // Uses https://github.com/rmccue/WordPress-Readme-Parser (with modifications)
+               include_once __DIR__ . '/readme-parser/markdown.php';
+               include_once __DIR__ . '/readme-parser/compat.php';
+
+               $data = (object) WPorg_Readme::parse_readme( $readme );
+
+               unset( $data->sections['screenshots'] ); // Useless.
+
+               // Sanitize contributors.
+               var_dump($data);
+               foreach ( $data->contributors as $i => $name ) {
+                       if ( get_user_by( 'login', $name ) ) {
+                               continue;
+                       } elseif ( false !== ( $user = get_user_by( 'slug', $name ) ) ) {
+                               $data->contributors[] = $user->user_login;
+                               unset( $data->contributors[ $i ] );
+                       } else {
+                               unset( $data->contributors[ $i ] );
+                       }
+               }
+
+               return $data;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectoryphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php                                (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php  2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,252 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @package WPorg_Plugin_Directory
+ */
+
+/**
+ * Class WPorg_Plugin_Directory
+ */
+class WPorg_Plugin_Directory {
+
+       /**
+        * Constructor.
+        */
+       public function __construct() {
+               add_action( 'init', array( $this, 'init' ) );
+               add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
+               add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
+               add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
+               add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
+       }
+
+       /**
+        * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
+        */
+       public function activate() {
+               global $wp_rewrite;
+
+               // Setup the environment.
+               $this->init();
+
+               // %postname% is required.
+               $wp_rewrite->set_permalink_structure( '/%postname%/' );
+
+               // /tags/%slug% is required for tags.
+               $wp_rewrite->set_tag_base( '/tags' );
+
+               // We require the WordPress.org Ratings plugin also be active.
+               if ( ! is_plugin_active( 'wporg-ratings/wporg-ratings.php' ) ) {
+                       activate_plugin( 'wporg-ratings/wporg-ratings.php' );
+               }
+
+               // Enable the WordPress.org Plugin Repo Theme.
+               foreach ( wp_get_themes() as $theme ) {
+                       if ( $theme->get( 'Name' ) === 'WordPress.org Plugins' ) {
+                               switch_theme( $theme->get_stylesheet() );
+                               break;
+                       }
+               }
+
+               flush_rewrite_rules();
+
+               do_action( 'wporg_plugins_activation' );
+       }
+
+       /**
+        *
+        */
+       public function deactivate() {
+               flush_rewrite_rules();
+
+               do_action( 'wporg_plugins_deactivation' );
+       }
+
+       /**
+        * Set up the Plugin Directory.
+        */
+       public function init() {
+               load_plugin_textdomain( 'wporg-plugins' );
+
+               register_post_type( 'plugin', array(
+                       'labels'      => array(
+                               'name'               => __( 'Plugins',          'wporg-plugins' ),
+                               'singular_name'      => __( 'Plugin',           'wporg-plugins' ),
+                               'menu_name'          => __( 'My Plugins',       'wporg-plugins' ),
+                               'add_new'            => __( 'Add New',          'wporg-plugins' ),
+                               'add_new_item'       => __( 'Add New Plugin',   'wporg-plugins' ),
+                               'edit_item'          => __( 'Edit Plugin',      'wporg-plugins' ),
+                               'new_item'           => __( 'New Plugin',       'wporg-plugins' ),
+                               'view_item'          => __( 'View Plugin',      'wporg-plugins' ),
+                               'search_items'       => __( 'Search Plugins',   'wporg-plugins' ),
+                               'not_found'          => __( 'No plugins found', 'wporg-plugins' ),
+                               'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ),
+                       ),
+                       'description' => __( 'A Repo Plugin', 'wporg-plugins' ),
+                       'supports'    => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
+                       'taxonomies'  => array( 'post_tag', 'category' ),
+                       'public'      => true,
+                       'show_ui'     => true,
+                       'has_archive' => true,
+                       'rewrite'     => false,
+                       'menu_icon'   => 'dashicons-admin-plugins',
+               ) );
+
+               register_post_status( 'pending', array(
+                       'label'                     => _x( 'Pending', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+               register_post_status( 'disabled', array(
+                       'label'                     => _x( 'Disabled', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+               register_post_status( 'closed', array(
+                       'label'                     => _x( 'Closed', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+
+               // Add the browse/* views.
+               add_rewrite_tag( '%browse%', '(featured|popular|beta|new|favorites)' );
+               add_permastruct( 'browse', 'browse/%browse%' );
+
+               add_rewrite_endpoint( 'installation', EP_PERMALINK );
+               add_rewrite_endpoint( 'faq',          EP_PERMALINK );
+               add_rewrite_endpoint( 'screenshots',  EP_PERMALINK );
+               add_rewrite_endpoint( 'changelog',    EP_PERMALINK );
+               add_rewrite_endpoint( 'stats',        EP_PERMALINK );
+               add_rewrite_endpoint( 'developers',   EP_PERMALINK );
+               add_rewrite_endpoint( 'other_notes',  EP_PERMALINK );
+       }
+
+       /**
+        * Filter the permalink for the Packages to be /post_name/.
+        *
+        * @param string  $link The generated permalink.
+        * @param WP_Post $post The Plugin post object.
+        * @return string
+        */
+       public function package_link( $link, $post ) {
+               if ( 'plugin' !== $post->post_type ) {
+                       return $link;
+               }
+
+               return trailingslashit( home_url( $post->post_name ) );
+       }
+
+       /**
+        * Checks if the current users is a super admin before allowing terms to be added.
+        *
+        * @param string $term The term to add or update.
+        * @return string|WP_Error The term to add or update or WP_Error on failure.
+        */
+       public function pre_insert_term_prevent( $term ) {
+               if ( ! is_super_admin() ) {
+                       $term = new WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) );
+               }
+
+               return $term;
+       }
+
+       /**
+        * @param WP_Query $wp_query The WordPress Query object.
+        */
+       public function use_plugins_in_query( $wp_query ) {
+               if ( ! $wp_query->is_main_query() ) {
+                       return;
+               }
+
+               if ( empty( $wp_query->query_vars['pagename'] ) && ( empty( $wp_query->query_vars['post_type'] ) || 'posts' == $wp_query->query_vars['post_type'] ) ) {
+                       $wp_query->query_vars['post_type'] = array( 'plugin' );
+               }
+
+               if ( empty( $wp_query->query ) ) {
+                       $wp_query->query_vars['browse'] = 'featured';
+               }
+
+               switch ( get_query_var( 'browse' ) ) {
+                       case 'beta':
+                               $wp_query->query_vars['category_name'] = 'beta';
+                               break;
+
+                       case 'featured':
+                               $wp_query->query_vars['category_name'] = 'featured';
+                               break;
+
+                       case 'favorites':
+                               break;
+
+                       case 'popular':
+                               break;
+               }
+
+               // Re-route the Endpoints to the `content_page` query var.
+               if ( ! empty( $wp_query->query['name'] ) ) {
+                       $plugin_fields = array(
+                               'installation',
+                               'faq',
+                               'screenshots',
+                               'changelog',
+                               'stats',
+                               'developers',
+                               'other_notes'
+                       );
+
+                       foreach ( $plugin_fields as $plugin_field ) {
+                               if ( isset( $wp_query->query[ $plugin_field ] ) ) {
+                                       $wp_query->query['content_page'] = $wp_query->query_vars['content_page'] = $plugin_field;
+                                       unset( $wp_query->query[ $plugin_field ], $wp_query->query_vars[ $plugin_field ] );
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Returns the requested page's content.
+        *
+        * @param string $content
+        * @return string
+        */
+       public function filter_post_content_to_correct_page( $content ) {
+               if ( 'plugin' === get_post()->post_type ) {
+                       $page = get_query_var( 'content_page' );
+
+                       $content_pages = $this->split_post_content_into_pages( $content );
+                       if ( ! isset( $content_pages[ $page ] ) ) {
+                               $page = 'description';
+                       }
+
+                       $content = $content_pages[ $page ];
+               }
+
+               return $content;
+       }
+
+       /**
+        * Returns an array of pages based on section comments in the content.
+        *
+        * @param string $content
+        * @return array
+        */
+       public function split_post_content_into_pages( $content ) {
+               $_pages        = preg_split( "#<!--section=(.+?)-->#", $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+               $content_pages = array(
+                       'stats'      => '[wporg-plugins-stats]',
+                       'developers' => '[wporg-plugins-developer]',
+               );
+
+               for ( $i = 0; $i < count( $_pages ); $i += 2 ) {
+
+                       // Don't overwrite existing tabs.
+                       if ( ! isset( $content_pages[ $_pages[ $i ] ] ) ) {
+                               $content_pages[ $_pages[ $i ] ] = $_pages[ $i + 1 ];
+                       }
+               }
+
+               return $content_pages;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryplugindirectoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php    2016-02-13 17:28:48 UTC (rev 2500)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php      2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,348 +1,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/*
- * Plugin Name: Plugin Repository
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Plugin Name: Plugin Directory
</ins><span class="cx" style="display: block; padding: 0 10px">  * Plugin URI: http://wordpress.org/plugins/
</span><span class="cx" style="display: block; padding: 0 10px">  * Description: Transforms a WordPress site in The Official Plugin Directory.
</span><span class="cx" style="display: block; padding: 0 10px">  * Version: 0.1
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Author: wordpressdotorg
- * Author URI: http://wordpress.org/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Author: the WordPress team
+ * Author URI: https://wordpress.org/
</ins><span class="cx" style="display: block; padding: 0 10px">  * Text Domain: wporg-plugins
</span><span class="cx" style="display: block; padding: 0 10px">  * License: GPLv2
</span><span class="cx" style="display: block; padding: 0 10px">  * License URI: http://opensource.org/licenses/gpl-2.0.php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @package WPorg_Plugin_Directory
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Plugin_Directory {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+include_once( 'class-wporg-plugin-directory.php' );
+include_once( 'class-wporg-plugin-directory-template.php' );
+include_once( 'class-wporg-plugin-directory-tools.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function __construct() {
-               register_activation_hook( __FILE__, array( $this, 'activate' ) );
-               register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
-
-               add_action( 'init', array( $this, 'init' ) );
-               add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
-               add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
-               add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
-               add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
-       }
-
-       function activate() {
-               global $wp_rewrite;
-
-               // Setup the environment
-               $this->init();
-
-               // %postname% is required
-               $wp_rewrite->set_permalink_structure( '/%postname%/' );
-
-               // /tags/%slug% is required for tags
-               $wp_rewrite->set_tag_base( '/tags' );
-
-               // We require the WordPress.org Ratings plugin also be active
-               if ( ! is_plugin_active( 'wporg-ratings/wporg-ratings.php' ) ) {
-                       activate_plugin( 'wporg-ratings/wporg-ratings.php' );
-               }
-       
-               // Enable the WordPress.org Theme Repo Theme
-               foreach ( wp_get_themes() as $theme ) {
-                       if ( $theme->get( 'Name' ) === 'WordPress.org Plugins' ) {
-                               switch_theme( $theme->get_stylesheet() );
-                               break;
-                       }
-               }
-       
-               flush_rewrite_rules();
-       
-               do_action( 'wporg_plugins_activation' );
-       }
-
-       function deactivate() {
-               flush_rewrite_rules();
-       
-               do_action( 'wporg_plugins_deactivation' );
-       }
-
-
-       function init() {
-               load_plugin_textdomain( 'wporg-plugins' );
-
-               register_post_type( 'plugin', array(
-                       'labels'      => array(
-                               'name'               => __( 'Plugins', 'wporg-plugins' ),
-                               'singular_name'      => __( 'Plugin', 'wporg-plugins' ),
-                               'add_new'            => __( 'Add New', 'wporg-plugins' ),
-                               'add_new_item'       => __( 'Add New Plugin', 'wporg-plugins' ),
-                               'edit_item'          => __( 'Edit Plugin', 'wporg-plugins' ),
-                               'new_item'           => __( 'New Plugin', 'wporg-plugins' ),
-                               'view_item'          => __( 'View Plugin', 'wporg-plugins' ),
-                               'search_items'       => __( 'Search Plugins', 'wporg-plugins' ),
-                               'not_found'          => __( 'No plugins found', 'wporg-plugins' ),
-                               'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ),
-                               'menu_name'          => __( 'My Plugins', 'wporg-plugins' ),
-                       ),
-                       'description' => __( 'A package', 'wporg-plugins' ),
-                       'supports'    => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
-                       'taxonomies'  => array( 'post_tag', 'category' ),
-                       'public'      => true,
-                       'show_ui'     => true,
-                       'has_archive' => true,
-                       'rewrite'     => false,
-                       'menu_icon'   => 'dashicons-admin-plugins',
-               ) );
-
-               register_post_status( 'pending', array(
-                       'label' => _x( 'Pending', 'plugin status', 'wporg-plugins' ),
-                       'public' => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-               register_post_status( 'disabled', array(
-                       'label' => _x( 'Disabled', 'plugin status', 'wporg-plugins' ),
-                       'public' => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count' => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-               register_post_status( 'closed', array(
-                       'label' => _x( 'Closed', 'plugin status', 'wporg-plugins' ),
-                       'public' => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count' => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-       
-               // Add the browse/* views
-               add_rewrite_tag( '%browse%', '(featured|popular|beta|new|favorites)' );
-               add_permastruct( 'browse', 'browse/%browse%' );
-
-               add_rewrite_endpoint( 'installation', EP_PERMALINK );
-               add_rewrite_endpoint( 'faq',          EP_PERMALINK );
-               add_rewrite_endpoint( 'screenshots',  EP_PERMALINK );
-               add_rewrite_endpoint( 'changelog',    EP_PERMALINK );
-               add_rewrite_endpoint( 'stats',        EP_PERMALINK );
-               add_rewrite_endpoint( 'developers',   EP_PERMALINK );
-               add_rewrite_endpoint( 'other_notes',  EP_PERMALINK );
-       }
-
-       /**
-        * Filter the permalink for the Packages to be /post_name/
-        *
-        * @param string $link The generated permalink
-        * @param string $post The package object
-        * @return string
-        */
-       function package_link( $link, $post ) {
-               if ( 'plugin' != $post->post_type ) {
-                       return $link;
-               }
-       
-               return trailingslashit( home_url( $post->post_name ) );
-       }
-
-       /**
-        * Checks if ther current users is a super admin before allowing terms to be added.
-        *
-        * @param string           $term The term to add or update.
-        * @return string|WP_Error The term to add or update or WP_Error on failure.
-        */
-       function pre_insert_term_prevent( $term ) {
-               if ( ! is_super_admin() ) {
-                       $term = new WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) );
-               }
-       
-               return $term;
-       }
-
-       function use_plugins_in_query( $wp_query ) {
-               if ( ! $wp_query->is_main_query() ) {
-                       return;
-               }
-
-               if ( empty( $wp_query->query_vars['pagename'] ) &&
-                       ( empty( $wp_query->query_vars['post_type'] ) || 'posts' == $wp_query->query_vars['post_type'] ) ) {
-                       $wp_query->query_vars['post_type'] = array( 'plugin' );
-               }
-
-               if ( empty( $wp_query->query ) ) {
-                       $wp_query->query_vars['browse'] = 'featured';
-               }
-
-               switch ( get_query_var( 'browse' ) ) {
-                       case 'beta':
-                               $wp_query->query_vars['category_name'] = 'beta';
-                               break;
-       
-                       case 'featured':
-                               $wp_query->query_vars['category_name'] = 'featured';
-                               break;
-       
-                       case 'favorites':
-                               break;
-       
-                       case 'popular':
-                               break;
-               }
-
-               // Re-route the Endpoints to the `content_page` query var.
-               if ( !empty( $wp_query->query['name'] ) ) {
-                       foreach ( array( 'installation', 'faq', 'screenshots', 'changelog', 'stats', 'developers', 'other_notes' ) as $plugin_field ) {
-                               if ( isset( $wp_query->query[ $plugin_field ] ) ) {
-                                       $wp_query->query['content_page'] = $wp_query->query_vars['content_page'] = $plugin_field;
-                                       unset( $wp_query->query[ $plugin_field ], $wp_query->query_vars[ $plugin_field ] );
-                               }
-                       }
-               }
-       }
-
-       function filter_post_content_to_correct_page( $content ) {
-               global $content_pages;
-
-               $post = get_post();
-               if ( 'plugin' != $post->post_type ) {
-                       return $content;
-               }
-
-               $page = get_query_var( 'content_page' );
-               $content_pages = $this->split_post_content_into_pages( $content );
-
-               if ( ! isset( $content_pages[ $page ] ) ) {
-                       $page = 'description';
-               }
-
-               return $content_pages[ $page ];
-       }
-
-       function split_post_content_into_pages( $content ) {
-               $content_pages = array(
-                       'stats' => '[wporg-plugins-stats]',
-                       'developers' => '[wporg-plugins-developer]',
-               );
-               $_pages = preg_split( "#<!--section=(.+?)-->#", $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
-               for ( $i = 0; $i < count( $_pages ); $i += 2 ) {
-                       // Don't overwrite existing tabs.
-                       if ( ! isset( $content_pages[ $_pages[ $i ] ] ) ) {
-                               $content_pages[ $_pages[ $i ] ] = $_pages[ $i + 1 ];
-                       }
-               }
-
-               return $content_pages;
-       }
-
-}
-new Plugin_Directory();
-
-// Various functions used by other processes, will make sense to move to specific classses.
-class Plugin_Directory_Tools {
-       static function get_readme_data( $readme ) {
-               // Uses https://github.com/rmccue/WordPress-Readme-Parser (with modifications)
-               include_once __DIR__ . '/readme-parser/markdown.php';
-               include_once __DIR__ . '/readme-parser/compat.php';
-
-               $data = (object) _WordPress_org_Readme::parse_readme( $readme );
-
-               unset( $data->sections['screenshots'] ); // Useless
-
-               // sanitize contributors.
-               foreach ( $data->contributors as $i => $name ) {
-                       if ( get_user_by( 'login', $name ) ) {
-                               continue;
-                       } elseif ( false !== ( $user = get_user_by( 'slug', $name ) ) ) {
-                               $data->contributors[] = $user->user_login;
-                               unset( $data->contributors[ $i ] );
-                       } else {
-                               unset( $data->contributors[ $i ] );
-                       }
-               }
-
-               return $data;
-       }
-}
-
-// Various helpers to retrieve data not stored within WordPress
-class Plugin_Directory_Template_Helpers {
-       static function get_active_installs_count( $plugin_slug ) {
-               global $wpdb;
-       
-               $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' );
-               if ( false === $count ) {
-                       $count = (int) $wpdb->get_var( $wpdb->prepare(
-                               "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1",
-                               $plugin_slug
-                       ) );
-                       wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 );
-               }
-       
-               if ( $count < 10 ) {
-                       return 0;
-               }
-       
-               if ( $count >= 1000000 ) {
-                       return 1000000;
-               }
-       
-               return strval( $count )[0] * pow( 10, floor( log10( $count ) ) );
-       }
-
-       static function get_total_downloads() {
-               global $wpdb;
-
-               $count = wp_cache_get( 'plugin_download_count', 'plugin_download_count' );
-               if ( false === $count ) {
-                       $count = (int) $wpdb->get_var( "SELECT SUM(downloads) FROM `plugin_2_stats`" );
-                       wp_cache_add( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS );
-               }
-
-               return $count;
-       }
-
-       static function get_plugin_sections() {
-               $plugin_slug  = get_post()->post_name;
-               $raw_sections = get_post_meta( get_the_ID(), 'sections', true );
-               $raw_sections = array_unique( array_merge( $raw_sections, array( 'description', 'stats', 'support', 'reviews', 'developers' ) ) );
-       
-               $sections = array();
-               foreach ( $raw_sections as $section_slug ) {
-                       $url = get_permalink();
-                       switch ( $section_slug ) {
-                               case 'description':
-                                       $title = _x( 'Description', 'plugin tab title', 'wporg-plugins' );
-                                       break;
-                               case 'installation':
-                                       $title = _x( 'Installation', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                               case 'faq':
-                                       $title = _x( 'FAQ', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                               case 'screenshots':
-                                       $title = _x( 'Screenshots', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                               case 'changelog':
-                                       $title = _x( 'Changelog', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                               case 'stats':
-                                       $title = _x( 'Stats', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                               case 'support':
-                                       $title = _x( 'Support', 'plugin tab title', 'wporg-plugins' );
-                                       $url = 'https://wordpress.org/support/plugin/' . $plugin_slug;
-                                       break;
-                               case 'reviews':
-                                       $title = _x( 'Reviews', 'plugin tab title', 'wporg-plugins' );
-                                       $url = 'https://wordpress.org/support/view/plugin-reviews/' . $plugin_slug;
-                                       break;
-                               case 'developers':
-                                       $title = _x( 'Developers', 'plugin tab title', 'wporg-plugins' );
-                                       $url = trailingslashit( $url ) . '/' . $section_slug . '/';
-                                       break;
-                       }
-                       $sections[] = array(
-                               'slug'  => $section_slug,
-                               'url'   => $url,
-                               'title' => $title,
-                       );
-               }
-               return $sections;
-       }
-}
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$wporg_plugin_directory = new WPorg_Plugin_Directory();
+register_activation_hook( __FILE__, array( $wporg_plugin_directory, 'activate' ) );
+register_deactivation_hook( __FILE__, array( $wporg_plugin_directory, 'deactivate' ) );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparserReadmeParserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/ReadmeParser.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/ReadmeParser.php  2016-02-13 17:28:48 UTC (rev 2500)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/ReadmeParser.php    2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Custom readme parser
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Custom readme parser.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * Based on Automattic_Readme from http://code.google.com/p/wordpress-plugin-readme-parser/
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,152 +9,163 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @todo Handle screenshots section properly
</span><span class="cx" style="display: block; padding: 0 10px">  * @todo Create validator for this based on http://code.google.com/p/wordpress-plugin-readme-parser/source/browse/trunk/validator.php
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Class Baikonur_ReadmeParser
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> class Baikonur_ReadmeParser {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public static function parse_readme( $file ) {
+               $contents = file( $file );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function parse_readme($file) {
-               $contents = file($file);
-               return self::parse_readme_contents($contents);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return self::parse_readme_contents( $contents );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function parse_readme_contents($contents) {
-               if (is_string($contents)) {
-                       $contents = explode("\n", $contents);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function parse_readme_contents( $contents ) {
+               if ( is_string( $contents ) ) {
+                       $contents = explode( "\n", $contents );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this_class = __CLASS__;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (function_exists('get_called_class')) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( function_exists( 'get_called_class' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this_class = get_called_class();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $contents = array_map(array($this_class, 'strip_newlines'), $contents);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $contents = array_map( array( $this_class, 'strip_newlines' ), $contents );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Strip BOM
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (strpos($contents[0], "\xEF\xBB\xBF") === 0) {
-                       $contents[0] = substr($contents[0], 3);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( strpos( $contents[0], "\xEF\xBB\xBF" ) === 0 ) {
+                       $contents[0] = substr( $contents[0], 3 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $data = new stdClass;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Defaults
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->is_excerpt = false;
-               $data->is_truncated = false;
-               $data->tags = array();
-               $data->requires = '';
-               $data->tested = '';
-               $data->contributors = array();
-               $data->stable_tag = '';
-               $data->version = '';
-               $data->donate_link = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->is_excerpt        = false;
+               $data->is_truncated      = false;
+               $data->tags              = array();
+               $data->requires          = '';
+               $data->tested            = '';
+               $data->contributors      = array();
+               $data->stable_tag        = '';
+               $data->version           = '';
+               $data->donate_link       = '';
</ins><span class="cx" style="display: block; padding: 0 10px">                 $data->short_description = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->sections = array();
-               $data->changelog = array();
-               $data->upgrade_notice = array();
-               $data->screenshots = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->sections          = array();
+               $data->changelog         = array();
+               $data->upgrade_notice    = array();
+               $data->screenshots       = array();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $data->remaining_content = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $line = call_user_func_array(array($this_class, 'get_first_nonwhitespace'), array(&$contents));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $line       = call_user_func_array( array( $this_class, 'get_first_nonwhitespace' ), array( &$contents ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $data->name = $line;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->name = trim($data->name, "#= ");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->name = trim( $data->name, "#= " );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Parse headers
</span><span class="cx" style="display: block; padding: 0 10px">                $headers = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $line = call_user_func_array(array($this_class, 'get_first_nonwhitespace'), array(&$contents));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $line = call_user_func_array( array( $this_class, 'get_first_nonwhitespace' ), array( &$contents ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 do {
</span><span class="cx" style="display: block; padding: 0 10px">                        $key = $value = null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (strpos($line, ':') === false) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( strpos( $line, ':' ) === false ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $bits = explode(':', $line, 2);
-                       list($key, $value) = $bits;
-                       $key = strtolower(str_replace(array(' ', "\t"), '_', trim($key)));
-                       if ($key === 'tags' && isset($headers['tags'])) {
-                               $headers[$key] .= ',' . trim($value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $bits = explode( ':', $line, 2 );
+                       list( $key, $value ) = $bits;
+                       $key = strtolower( str_replace( array( ' ', "\t" ), '_', trim( $key ) ) );
+                       if ( $key === 'tags' && isset( $headers['tags'] ) ) {
+                               $headers[ $key ] .= ',' . trim( $value );
+                       } else {
+                               $headers[ $key ] = trim( $value );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else {
-                               $headers[$key] = trim($value);
-                       }
-               }
-               while (($line = array_shift($contents)) !== null && ($line = trim($line)) && !empty($line));
-               array_unshift($contents, $line);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } while ( ( $line = array_shift( $contents ) ) !== null && ( $line = trim( $line ) ) && ! empty( $line ) );
+               array_unshift( $contents, $line );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['tags'])) {
-                       $data->tags = explode(',', $headers['tags']);
-                       $data->tags = array_map('trim', $data->tags);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['tags'] ) ) {
+                       $data->tags = explode( ',', $headers['tags'] );
+                       $data->tags = array_map( 'trim', $data->tags );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['requires'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['requires'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->requires = $headers['requires'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['requires_at_least'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['requires_at_least'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->requires = $headers['requires_at_least'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['tested'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['tested'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->tested = $headers['tested'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['tested_up_to'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['tested_up_to'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->tested = $headers['tested_up_to'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['contributors'])) {
-                       $data->contributors = explode(',', $headers['contributors']);
-                       $data->contributors = array_map('trim', $data->contributors);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['contributors'] ) ) {
+                       $data->contributors = explode( ',', $headers['contributors'] );
+                       $data->contributors = array_map( 'trim', $data->contributors );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['stable_tag'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['stable_tag'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->stable_tag = $headers['stable_tag'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['donate_link'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['donate_link'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->donate_link = $headers['donate_link'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($headers['version'])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $headers['version'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->version = $headers['version'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                }
-               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data->version = $data->stable_tag;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Parse the short description
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                while (($line = array_shift($contents)) !== null) {
-                       $trimmed = trim($line);
-                       if (empty($trimmed)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         while ( ( $line = array_shift( $contents ) ) !== null ) {
+                       $trimmed = trim( $line );
+                       if ( empty( $trimmed ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $data->short_description .= "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                                continue;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($trimmed[0] === '=' && isset($trimmed[1]) && $trimmed[1] === '=') {
-                               array_unshift($contents, $line);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $trimmed[0] === '=' && isset( $trimmed[1] ) && $trimmed[1] === '=' ) {
+                               array_unshift( $contents, $line );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $data->short_description .= $line . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->short_description = trim($data->short_description);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->short_description = trim( $data->short_description );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->is_truncated = call_user_func_array(array($this_class, 'trim_short_desc'), array(&$data->short_description));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->is_truncated = call_user_func_array( array(
+                       $this_class,
+                       'trim_short_desc'
+               ), array( &$data->short_description ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Parse the rest of the body
</span><span class="cx" style="display: block; padding: 0 10px">                $current = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $special = array('description', 'installation', 'faq', 'frequently_asked_questions', 'screenshots', 'changelog', 'upgrade_notice');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $special = array(
+                       'description',
+                       'installation',
+                       'faq',
+                       'frequently_asked_questions',
+                       'screenshots',
+                       'changelog',
+                       'upgrade_notice'
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                while (($line = array_shift($contents)) !== null) {
-                       $trimmed = trim($line);
-                       if (empty($trimmed)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         while ( ( $line = array_shift( $contents ) ) !== null ) {
+                       $trimmed = trim( $line );
+                       if ( empty( $trimmed ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $current .= "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                                continue;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($trimmed[0] === '=' && isset($trimmed[1]) && $trimmed[1] === '=') {
-                               if (!empty($title)) {
-                                       $data->sections[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $trimmed[0] === '=' && isset( $trimmed[1] ) && $trimmed[1] === '=' ) {
+                               if ( ! empty( $title ) ) {
+                                       $data->sections[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $current = '';
-                               $real_title = trim($line, "#= \t");
-                               $title = strtolower(str_replace(' ', '_', $real_title));
-                               if ($title === 'faq') {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $current    = '';
+                               $real_title = trim( $line, "#= \t" );
+                               $title      = strtolower( str_replace( ' ', '_', $real_title ) );
+                               if ( $title === 'faq' ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $title = 'frequently_asked_questions';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                }
-                               elseif ($title === 'change_log') {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         } elseif ( $title === 'change_log' ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $title = 'changelog';
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if (!in_array($title, $special)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! in_array( $title, $special ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $current .= '<h3>' . $real_title . "</h3>";
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                                continue;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,104 +174,105 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $current .= $line . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($title)) {
-                       $data->sections[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $title ) ) {
+                       $data->sections[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $title = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $title   = null;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $current = null;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (empty($data->sections['description'])) {
-                       $data->sections['description'] = call_user_func(array($this_class, 'parse_markdown'), $data->short_description);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( empty( $data->sections['description'] ) ) {
+                       $data->sections['description'] = call_user_func( array(
+                               $this_class,
+                               'parse_markdown'
+                       ), $data->short_description );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Parse changelog
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($data->sections['changelog'])) {
-                       $lines = explode("\n", $data->sections['changelog']);
-                       while (($line = array_shift($lines)) !== null) {
-                               $trimmed = trim($line);
-                               if (empty($trimmed)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $data->sections['changelog'] ) ) {
+                       $lines = explode( "\n", $data->sections['changelog'] );
+                       while ( ( $line = array_shift( $lines ) ) !== null ) {
+                               $trimmed = trim( $line );
+                               if ( empty( $trimmed ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         continue;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($trimmed[0] === '=') {
-                                       if (!empty($current)) {
-                                               $data->changelog[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $trimmed[0] === '=' ) {
+                                       if ( ! empty( $current ) ) {
+                                               $data->changelog[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        $current = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $title = trim($line, "#= \t");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $title   = trim( $line, "#= \t" );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         continue;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $current .= $line . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $data->changelog[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $data->changelog[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $title = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $title   = null;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $current = null;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (isset($data->sections['upgrade_notice'])) {
-                       $lines = explode("\n", $data->sections['upgrade_notice']);
-                       while (($line = array_shift($lines)) !== null) {
-                               $trimmed = trim($line);
-                               if (empty($trimmed)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $data->sections['upgrade_notice'] ) ) {
+                       $lines = explode( "\n", $data->sections['upgrade_notice'] );
+                       while ( ( $line = array_shift( $lines ) ) !== null ) {
+                               $trimmed = trim( $line );
+                               if ( empty( $trimmed ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         continue;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($trimmed[0] === '=') {
-                                       if (!empty($current)) {
-                                               $data->upgrade_notice[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $trimmed[0] === '=' ) {
+                                       if ( ! empty( $current ) ) {
+                                               $data->upgrade_notice[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        $current = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $title = trim($line, "#= \t");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $title   = trim( $line, "#= \t" );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         continue;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                $current .= $line . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (!empty($title) && !empty($current)) {
-                               $data->upgrade_notice[$title] = trim($current);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( ! empty( $title ) && ! empty( $current ) ) {
+                               $data->upgrade_notice[ $title ] = trim( $current );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        unset($data->sections['upgrade_notice']);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 unset( $data->sections['upgrade_notice'] );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Markdownify!
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $data->sections       = array_map( array( $this_class, 'parse_markdown' ), $data->sections );
+               $data->changelog      = array_map( array( $this_class, 'parse_markdown' ), $data->changelog );
+               $data->upgrade_notice = array_map( array( $this_class, 'parse_markdown' ), $data->upgrade_notice );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->sections = array_map(array($this_class, 'parse_markdown'), $data->sections);
-               $data->changelog = array_map(array($this_class, 'parse_markdown'), $data->changelog);
-               $data->upgrade_notice = array_map(array($this_class, 'parse_markdown'), $data->upgrade_notice);
-
-               if (isset($data->sections['screenshots'])) {
-                       preg_match_all('#<li>(.*?)</li>#is', $data->sections['screenshots'], $screenshots, PREG_SET_ORDER);
-                       if ($screenshots) {
-                               foreach ((array) $screenshots as $ss) {
-                                       $data->screenshots[] = trim($ss[1]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $data->sections['screenshots'] ) ) {
+                       preg_match_all( '#<li>(.*?)</li>#is', $data->sections['screenshots'], $screenshots, PREG_SET_ORDER );
+                       if ( $screenshots ) {
+                               foreach ( (array) $screenshots as $ss ) {
+                                       $data->screenshots[] = trim( $ss[1] );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Rearrange stuff
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Rearrange stuff.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $data->remaining_content = $data->sections;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $data->sections = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data->sections          = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($special as $spec) {
-                       if (isset($data->remaining_content[$spec])) {
-                               $data->sections[$spec] = $data->remaining_content[$spec];
-                               unset($data->remaining_content[$spec]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $special as $spec ) {
+                       if ( isset( $data->remaining_content[ $spec ] ) ) {
+                               $data->sections[ $spec ] = $data->remaining_content[ $spec ];
+                               unset( $data->remaining_content[ $spec ] );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $data;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function get_first_nonwhitespace(&$contents) {
-               while (($line = array_shift($contents)) !== null) {
-                       $trimmed = trim($line);
-                       if (!empty($line)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function get_first_nonwhitespace( &$contents ) {
+               while ( ( $line = array_shift( $contents ) ) !== null ) {
+                       $trimmed = trim( $line );
+                       if ( ! empty( $line ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,22 +280,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $line;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function strip_newlines($line) {
-               return rtrim($line, "\r\n");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function strip_newlines( $line ) {
+               return rtrim( $line, "\r\n" );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function trim_short_desc(&$desc) {
-               if (function_exists('mb_strlen') && function_exists('mb_substr')) {
-                       if (mb_strlen($desc) > 150) {
-                               $desc = mb_substr($desc, 0, 150);
-                               $desc = trim($desc);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function trim_short_desc( &$desc ) {
+               if ( function_exists( 'mb_strlen' ) && function_exists( 'mb_substr' ) ) {
+                       if ( mb_strlen( $desc ) > 150 ) {
+                               $desc = mb_substr( $desc, 0, 150 );
+                               $desc = trim( $desc );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return true;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                }
-               else {
-                       if (strlen($desc) > 150) {
-                               $desc = substr($desc, 0, 150);
-                               $desc = trim($desc);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } else {
+                       if ( strlen( $desc ) > 150 ) {
+                               $desc = substr( $desc, 0, 150 );
+                               $desc = trim( $desc );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return true;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -291,39 +304,45 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function parse_markdown($text) {
-               $text = self::code_trick($text);
-               $text = preg_replace('/^[\s]*=[\s]+(.+?)[\s]+=/m', "\n" . '<h4>$1</h4>' . "\n", $text);
-               $text = Markdown(trim($text));
-               return trim($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function parse_markdown( $text ) {
+               $text = self::code_trick( $text );
+               $text = preg_replace( '/^[\s]*=[\s]+(.+?)[\s]+=/m', "\n" . '<h4>$1</h4>' . "\n", $text );
+               $text = Markdown( trim( $text ) );
+
+               return trim( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function code_trick($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function code_trick( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 // If doing markdown, first take any user formatted code blocks and turn them into backticks so that
</span><span class="cx" style="display: block; padding: 0 10px">                // markdown will preserve things like underscores in code blocks
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback("!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", array(__CLASS__, 'decodeit'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( "!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", array( __CLASS__, 'decodeit' ), $text );
+               $text = str_replace( array( "\r\n", "\r" ), "\n", $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = str_replace(array("\r\n", "\r"), "\n", $text);
</del><span class="cx" style="display: block; padding: 0 10px">                 // Markdown can do inline code, we convert bbPress style block level code to Markdown style
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback("!(^|\n)([ \t]*?)`(.*?)`!s", array(__CLASS__, 'indent'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( "!(^|\n)([ \t]*?)`(.*?)`!s", array( __CLASS__, 'indent' ), $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function indent($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function indent( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $text = $matches[3];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('|^|m', $matches[2] . '    ', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '|^|m', $matches[2] . '    ', $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $matches[1] . $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function decodeit($matches) {
-               $text = $matches[2];
-               $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
-               $text = strtr($text, $trans_table);
-               $text = str_replace('<br />', '', $text);
-               $text = str_replace('&#38;', '&', $text);
-               $text = str_replace('&#39;', "'", $text);
-               if ( '<pre><code>' == $matches[1] )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function decodeit( $matches ) {
+               $text        = $matches[2];
+               $trans_table = array_flip( get_html_translation_table( HTML_ENTITIES ) );
+               $text        = strtr( $text, $trans_table );
+               $text        = str_replace( '<br />', '', $text );
+               $text        = str_replace( '&#38;', '&', $text );
+               $text        = str_replace( '&#39;', "'", $text );
+
+                       if ( '<pre><code>' == $matches[1] ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text = "\n$text\n";
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return "`$text`";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparsercompatphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/compat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/compat.php        2016-02-13 17:28:48 UTC (rev 2500)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/compat.php  2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,95 +1,136 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress.org Plugin Readme Parser.
+ *
+ * @package WPorg_Plugin_Directory
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( !defined('WORDPRESS_README_MARKDOWN') ) {
-       define('WORDPRESS_README_MARKDOWN', dirname(__FILE__) . '/markdown.php');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( ! defined( 'WORDPRESS_README_MARKDOWN' ) ) {
+       define( 'WORDPRESS_README_MARKDOWN', dirname( __FILE__ ) . '/markdown.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-require_once(dirname(__FILE__) . '/ReadmeParser.php');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/ReadmeParser.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class _WordPress_org_Readme extends Baikonur_ReadmeParser {
-       public static function parse_readme($file) {
-               $contents = file($file);
-               return self::parse_readme_contents($contents);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Class WPorg_Readme
+ */
+class WPorg_Readme extends Baikonur_ReadmeParser {
+
+       /**
+        * @access public
+        *
+        * @param string $file File name.
+        * @return array
+        */
+       public static function parse_readme( $file ) {
+               $contents = file( $file );
+
+               return self::parse_readme_contents( $contents );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public static function parse_readme_contents($contents) {
-               if (empty($contents)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * @access public
+        *
+        * @param array $contents
+        * @return array
+        */
+       public static function parse_readme_contents( $contents ) {
+               if ( empty( $contents ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return array();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result = parent::parse_readme_contents($contents);
-               foreach ($result->sections as &$section) {
-                       $section = self::filter_text($section);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result = parent::parse_readme_contents( $contents );
+               $result->sections = array_map( array( 'WPorg_Readme', 'filter_text' ), $result->sections );
+
+               if ( ! empty( $result->upgrade_notice ) ) {
+                       $result->upgrade_notice = array_map( array( 'WPorg_Readme', 'sanitize_text' ), $result->upgrade_notice );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($result->upgrade_notice)) {
-                       foreach ($result->upgrade_notice as &$notice) {
-                               $notice = self::sanitize_text($notice);
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               if ( ! empty( $result->screenshots ) ) {
+                       $result->screenshots = array_map( array( 'WPorg_Readme', 'filter_text' ), $result->screenshots );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($result->screenshots)) {
-                       foreach ($result->screenshots as &$shot) {
-                               $shot = self::filter_text($shot);
-                       }
-               }
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!empty($result->remaining_content)) {
-                       $result->remaining_content = implode("\n", $result->remaining_content);
-                       $result->remaining_content = self::filter_text(str_replace("</h3>\n\n", "</h3>\n", $result->remaining_content));
-               }
-               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $result->remaining_content ) ) {
+                       $result->remaining_content = implode( "\n", $result->remaining_content );
+                       $result->remaining_content = self::filter_text( str_replace( "</h3>\n\n", "</h3>\n", $result->remaining_content ) );
+               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $result->remaining_content = '';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result->name = self::sanitize_text($result->name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result->name = self::sanitize_text( $result->name );
</ins><span class="cx" style="display: block; padding: 0 10px">                 //$result->short_description = self::sanitize_text($result->short_description);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result->donate_link = esc_url($result->donate_link);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result->donate_link = esc_url( $result->donate_link );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $result->requires_at_least = $result->requires;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result->tested_up_to = $result->tested;
-               unset($result->requires, $result->tested);
-               $result = ((array) $result);
-               return $result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result->tested_up_to      = $result->tested;
+
+               unset( $result->requires, $result->tested );
+
+               return (array) $result;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        protected static function trim_short_desc(&$desc) {
-               $desc = self::sanitize_text($desc);
-               return parent::trim_short_desc($desc);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+        * @access protected
+        *
+        * @param string $desc
+        * @return string
+        */
+       protected static function trim_short_desc( &$desc ) {
+               $desc = self::sanitize_text( $desc );
+               parent::trim_short_desc( $desc );
+
+               return $desc;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * @access protected
+        *
+        * @param string $text
+        * @return string
+        */
</ins><span class="cx" style="display: block; padding: 0 10px">         protected static function sanitize_text( $text ) { // not fancy
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = strip_tags($text);
-               $text = esc_html($text);
-               $text = trim($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = strip_tags( $text );
+               $text = esc_html( $text );
+               $text = trim( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * @access protected
+        *
+        * @param string $text
+        * @return string
+        */
</ins><span class="cx" style="display: block; padding: 0 10px">         protected static function filter_text( $text ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = trim($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = trim( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 //$text = self::code_trick($text); // A better parser than Markdown's for: backticks -> CODE
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $allowed = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'a' => array(
-                               'href' => array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'a'          => array(
+                               'href'  => array(),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'title' => array(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'rel' => array()),
-                       'blockquote' => array('cite' => array()),
-                       'br' => array(),
-                       'p' => array(),
-                       'code' => array(),
-                       'pre' => array(),
-                       'em' => array(),
-                       'strong' => array(),
-                       'ul' => array(),
-                       'ol' => array(),
-                       'li' => array(),
-                       'h3' => array(),
-                       'h4' => array()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'rel'   => array()
+                       ),
+                       'blockquote' => array( 'cite' => array() ),
+                       'br'         => array(),
+                       'p'          => array(),
+                       'code'       => array(),
+                       'pre'        => array(),
+                       'em'         => array(),
+                       'strong'     => array(),
+                       'ul'         => array(),
+                       'ol'         => array(),
+                       'li'         => array(),
+                       'h3'         => array(),
+                       'h4'         => array(),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = balanceTags($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = balanceTags( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $text = wp_kses( $text, $allowed );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = trim($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = trim( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryreadmeparsermarkdownphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/markdown.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/markdown.php      2016-02-13 17:28:48 UTC (rev 2500)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme-parser/markdown.php        2016-02-15 06:28:02 UTC (rev 2501)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,68 +3,62 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # Markdown Extra  -  A text-to-HTML conversion tool for web writers
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # PHP Markdown & Extra
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-# Copyright (c) 2004-2009 Michel Fortin  
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Copyright (c) 2004-2009 Michel Fortin
</ins><span class="cx" style="display: block; padding: 0 10px"> # <http://michelf.com/projects/php-markdown/>
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Original Markdown
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-# Copyright (c) 2004-2006 John Gruber  
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Copyright (c) 2004-2006 John Gruber
</ins><span class="cx" style="display: block; padding: 0 10px"> # <http://daringfireball.net/projects/markdown/>
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+define( 'MARKDOWN_VERSION', "1.0.1n" ); # Sat 10 Oct 2009
+define( 'MARKDOWNEXTRA_VERSION', "1.2.4" ); # Sat 10 Oct 2009
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define( 'MARKDOWN_VERSION',  "1.0.1n" ); # Sat 10 Oct 2009
-define( 'MARKDOWNEXTRA_VERSION',  "1.2.4" ); # Sat 10 Oct 2009
-
-
</del><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Global default settings:
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Change to ">" for HTML output
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX',  " />");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Define the width of a tab for code blocks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_TAB_WIDTH',     4 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_TAB_WIDTH', 4 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Optional title attribute for footnote links and backlinks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_FN_LINK_TITLE',         "" );
-@define( 'MARKDOWN_FN_BACKLINK_TITLE',     "" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_FN_LINK_TITLE', "" );
+@define( 'MARKDOWN_FN_BACKLINK_TITLE', "" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Optional class attribute for footnote links and backlinks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_FN_LINK_CLASS',         "" );
-@define( 'MARKDOWN_FN_BACKLINK_CLASS',     "" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_FN_LINK_CLASS', "" );
+@define( 'MARKDOWN_FN_BACKLINK_CLASS', "" );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # WordPress settings:
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Change to false to remove Markdown from posts and/or comments.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_WP_POSTS',      true );
-@define( 'MARKDOWN_WP_COMMENTS',   true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_WP_POSTS', true );
+@define( 'MARKDOWN_WP_COMMENTS', true );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
</del><span class="cx" style="display: block; padding: 0 10px"> ### Standard Function Interface ###
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-@define( 'MARKDOWN_PARSER_CLASS',  'MarkdownExtra_Parser' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@define( 'MARKDOWN_PARSER_CLASS', 'MarkdownExtra_Parser' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function Markdown($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function Markdown( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Initialize the parser and return the result of its transform method.
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px">        # Setup static parser variable.
</span><span class="cx" style="display: block; padding: 0 10px">        static $parser;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if (!isset($parser)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $parser ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $parser_class = MARKDOWN_PARSER_CLASS;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $parser = new $parser_class;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $parser       = new $parser_class;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        # Transform text using parser.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return $parser->transform($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $parser->transform( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> ### WordPress Plugin Interface ###
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,283 +70,282 @@
</span><span class="cx" style="display: block; padding: 0 10px"> Author URI: http://michelf.com/
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if (isset($wp_version)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( isset( $wp_version ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         # More details about how it works here:
</span><span class="cx" style="display: block; padding: 0 10px">        # <http://michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Post content and excerpts
</span><span class="cx" style="display: block; padding: 0 10px">        # - Remove WordPress paragraph generator.
</span><span class="cx" style="display: block; padding: 0 10px">        # - Run Markdown on excerpt, then remove all tags.
</span><span class="cx" style="display: block; padding: 0 10px">        # - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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 );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Add a footnote id prefix to posts when inside a loop.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function mdwp_MarkdownPost($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function mdwp_MarkdownPost( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 static $parser;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (!$parser) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! $parser ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $parser_class = MARKDOWN_PARSER_CLASS;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $parser = new $parser_class;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $parser       = new $parser_class;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (is_single() || is_page() || is_feed()) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( is_single() || is_page() || is_feed() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $parser->fn_id_prefix = "";
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        $parser->fn_id_prefix = get_the_ID() . ".";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $parser->transform($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return $parser->transform( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Comments
</span><span class="cx" style="display: block; padding: 0 10px">        # - Remove WordPress paragraph generator.
</span><span class="cx" style="display: block; padding: 0 10px">        # - Remove WordPress auto-link generator.
</span><span class="cx" style="display: block; padding: 0 10px">        # - Scramble important tags before passing them to the kses filter.
</span><span class="cx" style="display: block; padding: 0 10px">        # - Run Markdown on excerpt then remove paragraph tags.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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);
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 global $mdwp_hidden_tags, $mdwp_placeholders;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $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'));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $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' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       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);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       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 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function mdwp_strip_p($t) { return preg_replace('{</?p>}i', '', $t); }
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function mdwp_hide_tags($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function mdwp_strip_p( $t ) {
+               return preg_replace( '{</?p>}i', '', $t );
+       }
+
+       function mdwp_hide_tags( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 global $mdwp_hidden_tags, $mdwp_placeholders;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return str_replace($mdwp_hidden_tags, $mdwp_placeholders, $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return str_replace( $mdwp_hidden_tags, $mdwp_placeholders, $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function mdwp_show_tags($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function mdwp_show_tags( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 global $mdwp_hidden_tags, $mdwp_placeholders;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return str_replace($mdwp_placeholders, $mdwp_hidden_tags, $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return str_replace( $mdwp_placeholders, $mdwp_hidden_tags, $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> ### bBlog Plugin Info ###
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> function identify_modifier_markdown() {
</span><span class="cx" style="display: block; padding: 0 10px">        return array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'name' => 'markdown',
-               'type' => 'modifier',
-               'nicename' => 'PHP Markdown Extra',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'name'        => 'markdown',
+               'type'        => 'modifier',
+               'nicename'    => 'PHP Markdown Extra',
</ins><span class="cx" style="display: block; padding: 0 10px">                 'description' => 'A text-to-HTML conversion tool for web writers',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                '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>',
-               );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         '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>',
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> ### Smarty Modifier Interface ###
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function smarty_modifier_markdown($text) {
-       return Markdown($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function smarty_modifier_markdown( $text ) {
+       return Markdown( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> ### Textile Compatibility Mode ###
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> # Rename this file to "classTextile.php" and it can replace Textile everywhere.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( strcasecmp( substr( __FILE__, - 16 ), "classTextile.php" ) == 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">         # Try to include PHP SmartyPants. Should be in the same directory.
</span><span class="cx" style="display: block; padding: 0 10px">        @include_once 'smartypants.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Fake Textile class. It calls Markdown instead.
</span><span class="cx" style="display: block; padding: 0 10px">        class Textile {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                function TextileThis($text, $lite='', $encode='') {
-                       if ($lite == '' && $encode == '')    $text = Markdown($text);
-                       if (function_exists('SmartyPants'))  $text = SmartyPants($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         function TextileThis( $text, $lite = '', $encode = '' ) {
+                       if ( $lite == '' && $encode == '' ) {
+                               $text = Markdown( $text );
+                       }
+                       if ( function_exists( 'SmartyPants' ) ) {
+                               $text = SmartyPants( $text );
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $text;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Fake restricted version: restrictions are not supported for now.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                function TextileRestricted($text, $lite='', $noimage='') {
-                       return $this->TextileThis($text, $lite);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         function TextileRestricted( $text, $lite = '', $noimage = '' ) {
+                       return $this->TextileThis( $text, $lite );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Workaround to ensure compatibility with TextPattern 4.0.3.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                function blockLite($text) { return $text; }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         function blockLite( $text ) {
+                       return $text;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
</del><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Markdown Parser Class
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class Markdown_Parser {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         # Regex to match balanced [brackets].
</span><span class="cx" style="display: block; padding: 0 10px">        # Needed to insert a maximum bracked depth while converting to PHP.
</span><span class="cx" style="display: block; padding: 0 10px">        var $nested_brackets_depth = 6;
</span><span class="cx" style="display: block; padding: 0 10px">        var $nested_brackets_re;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         var $nested_url_parenthesis_depth = 4;
</span><span class="cx" style="display: block; padding: 0 10px">        var $nested_url_parenthesis_re;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         # Table of hash values for escaped characters:
</span><span class="cx" style="display: block; padding: 0 10px">        var $escape_chars = '\`*_{}[]()>#+-.!';
</span><span class="cx" style="display: block; padding: 0 10px">        var $escape_chars_re;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         # Change to ">" for HTML output.
</span><span class="cx" style="display: block; padding: 0 10px">        var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
</span><span class="cx" style="display: block; padding: 0 10px">        var $tab_width = MARKDOWN_TAB_WIDTH;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Change to `true` to disallow markup or entities.
</span><span class="cx" style="display: block; padding: 0 10px">        var $no_markup = false;
</span><span class="cx" style="display: block; padding: 0 10px">        var $no_entities = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Predefined urls and titles for reference links and images.
</span><span class="cx" style="display: block; padding: 0 10px">        var $predef_urls = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $predef_titles = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         function Markdown_Parser() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Constructor function. Initialize appropriate member variables.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Constructor function. Initialize appropriate member variables.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->_initDetab();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->prepareItalicsAndBold();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-               $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).']';
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $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 ) . ']';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Sort document, block, and span gamut in ascendent priority order.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                asort($this->document_gamut);
-               asort($this->block_gamut);
-               asort($this->span_gamut);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         asort( $this->document_gamut );
+               asort( $this->block_gamut );
+               asort( $this->span_gamut );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         # Internal hashes used during transformation.
</span><span class="cx" style="display: block; padding: 0 10px">        var $urls = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $titles = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $html_hashes = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Status flag to avoid invalid nesting.
</span><span class="cx" style="display: block; padding: 0 10px">        var $in_anchor = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function setup() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Called before the transformation process starts to setup parser 
-       # states.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Called before the transformation process starts to setup parser
+               # states.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Clear global hashes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->urls = $this->predef_urls;
-               $this->titles = $this->predef_titles;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->urls        = $this->predef_urls;
+               $this->titles      = $this->predef_titles;
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->html_hashes = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $in_anchor = false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function teardown() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Called after the transformation process to clear any variable 
-       # which may be taking up memory unnecessarly.
-       #
-               $this->urls = array();
-               $this->titles = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Called after the transformation process to clear any variable
+               # which may be taking up memory unnecessarly.
+               #
+               $this->urls        = array();
+               $this->titles      = array();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->html_hashes = array();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function transform( $text ) {
+               #
+               # Main function. Performs some preprocessing on the input text
+               # and pass it through the document gamut.
+               #
+               $this->setup();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function transform($text) {
-       #
-       # Main function. Performs some preprocessing on the input text
-       # and pass it through the document gamut.
-       #
-               $this->setup();
-       
</del><span class="cx" style="display: block; padding: 0 10px">                 # Remove UTF-8 BOM and marker character in input, if present.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '{^\xEF\xBB\xBF|\x1A}', '', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Standardize line endings:
</span><span class="cx" style="display: block; padding: 0 10px">                #   DOS to Unix and Mac to Unix
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('{\r\n?}', "\n", $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '{\r\n?}', "\n", $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Make sure $text ends with a couple of newlines:
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "\n\n";
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Convert all tabs to spaces.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->detab($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->detab( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Turn block-level HTML blocks into hash entries
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->hashHTMLBlocks($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->hashHTMLBlocks( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Strip any lines consisting only of spaces and tabs.
</span><span class="cx" style="display: block; padding: 0 10px">                # This makes subsequent regexen easier to write, because we can
</span><span class="cx" style="display: block; padding: 0 10px">                # match consecutive blank lines with /\n+/ instead of something
</span><span class="cx" style="display: block; padding: 0 10px">                # contorted like /[ ]*\n+/ .
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('/^[ ]+$/m', '', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '/^[ ]+$/m', '', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Run document gamut methods.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($this->document_gamut as $method => $priority) {
-                       $text = $this->$method($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $this->document_gamut as $method => $priority ) {
+                       $text = $this->$method( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->teardown();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         var $document_gamut = array(
</span><span class="cx" style="display: block; padding: 0 10px">                # Strip link definitions, store in hashes.
</span><span class="cx" style="display: block; padding: 0 10px">                "stripLinkDefinitions" => 20,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><span class="cx" style="display: block; padding: 0 10px">                 "runBasicBlockGamut"   => 30,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function stripLinkDefinitions($text) {
-       #
-       # Strips link definitions from text, stores the URLs and titles in
-       # hash references.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function stripLinkDefinitions( $text ) {
+               #
+               # Strips link definitions from text, stores the URLs and titles in
+               # hash references.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Link defs are in the form: ^[id]: url "optional title"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
-                                                       ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
+                                                       ^[ ]{0,' . $less_than_tab . '}\[(.+)\][ ]?:     # id = $1
</ins><span class="cx" style="display: block; padding: 0 10px">                                                           [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                                          \n?                           # maybe *one* newline
</span><span class="cx" style="display: block; padding: 0 10px">                                                          [ ]*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -373,22 +366,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                        )?      # title is optional
</span><span class="cx" style="display: block; padding: 0 10px">                                                        (?:\n+|\Z)
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_stripLinkDefinitions_callback'),
-                       $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_stripLinkDefinitions_callback' ),
+                       $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       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];
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return ''; # String that will replace the block
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function hashHTMLBlocks( $text ) {
+               if ( $this->no_markup ) {
+                       return $text;
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function hashHTMLBlocks($text) {
-               if ($this->no_markup)  return $text;
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Hashify HTML blocks:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -399,18 +396,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                # hard-coded:
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # *  List "a" is made of tags which can be both inline or block-level.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                #    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 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #    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
</ins><span class="cx" style="display: block; padding: 0 10px">                 #    inline later.
</span><span class="cx" style="display: block; padding: 0 10px">                # *  List "b" is made of tags which are always block-level;
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                $block_tags_a_re = 'ins|del';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
-                                                  'script|noscript|form|fieldset|iframe|math';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|' .
+                                  'script|noscript|form|fieldset|iframe|math';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Regular expression for the content of a block tag.
</span><span class="cx" style="display: block; padding: 0 10px">                $nested_tags_level = 4;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $attr = '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $attr              = '
</ins><span class="cx" style="display: block; padding: 0 10px">                         (?>                          # optional tag attributes
</span><span class="cx" style="display: block; padding: 0 10px">                          \s                    # starts with whitespace
</span><span class="cx" style="display: block; padding: 0 10px">                          (?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -422,29 +419,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">                          |
</span><span class="cx" style="display: block; padding: 0 10px">                                \'[^\']*\'      # text inside single quotes (tolerate ">")
</span><span class="cx" style="display: block; padding: 0 10px">                          )*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        )?      
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 )?
</ins><span class="cx" style="display: block; padding: 0 10px">                         ';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content =
-                       str_repeat('
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $content           =
+                       str_repeat( '
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                  [^<]+                      # content without tag
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><span class="cx" style="display: block; padding: 0 10px">                                  <\2                        # nested opening tag
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        '.$attr.'       # attributes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 ' . $attr . '   # attributes
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                          />
</span><span class="cx" style="display: block; padding: 0 10px">                                        |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                          >', $nested_tags_level).   # end of opening tag
-                                         '.*?'.                                        # last level nested tag content
-                       str_repeat('
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                   >', $nested_tags_level ) .    # end of opening tag
+                       '.*?' .                    # last level nested tag content
+                       str_repeat( '
</ins><span class="cx" style="display: block; padding: 0 10px">                                           </\2\s*>        # closing nested tag
</span><span class="cx" style="display: block; padding: 0 10px">                                        )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                  |                             
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                           |
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <(?!/\2\s*>       # other tags with a different name
</span><span class="cx" style="display: block; padding: 0 10px">                                  )
</span><span class="cx" style="display: block; padding: 0 10px">                                )*',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $nested_tags_level);
-               $content2 = str_replace('\2', '\3', $content);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $nested_tags_level );
+               $content2          = str_replace( '\2', '\3', $content );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # First, look for nested blocks, e.g.:
</span><span class="cx" style="display: block; padding: 0 10px">                #       <div>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -457,7 +454,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                # the inner nested divs must be indented.
</span><span class="cx" style="display: block; padding: 0 10px">                # We need to do this before the next, more liberal match, because the next
</span><span class="cx" style="display: block; padding: 0 10px">                # match will start at the first `<div>` and stop at the first `</div>`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{(?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{(?>
</ins><span class="cx" style="display: block; padding: 0 10px">                         (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                (?<=\n\n)            # Starting after a blank line
</span><span class="cx" style="display: block; padding: 0 10px">                                |                               # or
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -465,49 +462,49 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        (                                               # save in $1
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                          # Match from `\n<tag>` to `</tag>\n`, handling nested tags 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                   # Match from `\n<tag>` to `</tag>\n`, handling nested tags
</ins><span class="cx" style="display: block; padding: 0 10px">                           # in between.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
-                                               [ ]{0,'.$less_than_tab.'}
-                                               <('.$block_tags_b_re.')# start tag = $2
-                                               '.$attr.'>                   # attributes followed by > and \n
-                                               '.$content.'            # content, support nesting
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                               [ ]{0,' . $less_than_tab . '}
+                                               <(' . $block_tags_b_re . ')# start tag = $2
+                                               ' . $attr . '>                       # attributes followed by > and \n
+                                               ' . $content . '                # content, support nesting
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 </\2>                             # the matching end tag
</span><span class="cx" style="display: block; padding: 0 10px">                                                [ ]*                            # trailing spaces/tabs
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?=\n+|\Z)      # followed by a newline or end of document
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        | # Special version for tags of group a.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                [ ]{0,'.$less_than_tab.'}
-                                               <('.$block_tags_a_re.')# start tag = $3
-                                               '.$attr.'>[ ]*\n     # attributes followed by >
-                                               '.$content2.'           # content, support nesting
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         [ ]{0,' . $less_than_tab . '}
+                                               <(' . $block_tags_a_re . ')# start tag = $3
+                                               ' . $attr . '>[ ]*\n # attributes followed by >
+                                               ' . $content2 . '               # content, support nesting
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 </\3>                             # the matching end tag
</span><span class="cx" style="display: block; padding: 0 10px">                                                [ ]*                            # trailing spaces/tabs
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?=\n+|\Z)      # followed by a newline or end of document
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
-                       | # Special case just for <hr />. It was easier to make a special 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       | # Special case just for <hr />. It was easier to make a special
</ins><span class="cx" style="display: block; padding: 0 10px">                           # case than to make the other regex more complicated.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                                               [ ]{0,'.$less_than_tab.'}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                               [ ]{0,' . $less_than_tab . '}
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <(hr)                                # start tag = $2
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                '.$attr.'                       # attributes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         ' . $attr . '                   # attributes
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 /?>                                  # the matching end tag
</span><span class="cx" style="display: block; padding: 0 10px">                                                [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?=\n{2,}|\Z)           # followed by a blank line or end of document
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         | # Special case for standalone HTML comments:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                                       [ ]{0,'.$less_than_tab.'}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                       [ ]{0,' . $less_than_tab . '}
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?s:
</span><span class="cx" style="display: block; padding: 0 10px">                                                <!-- .*? -->
</span><span class="cx" style="display: block; padding: 0 10px">                                        )
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?=\n{2,}|\Z)           # followed by a blank line or end of document
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         | # PHP and ASP-style processor instructions (<? and <%)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                                       [ ]{0,'.$less_than_tab.'}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                                       [ ]{0,' . $less_than_tab . '}
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?s:
</span><span class="cx" style="display: block; padding: 0 10px">                                                <([?%])                      # $2
</span><span class="cx" style="display: block; padding: 0 10px">                                                .*?
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -515,97 +512,95 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        )
</span><span class="cx" style="display: block; padding: 0 10px">                                        [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?=\n{2,}|\Z)           # followed by a blank line or end of document
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         )
</span><span class="cx" style="display: block; padding: 0 10px">                        )}Sxmi',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_hashHTMLBlocks_callback'),
-                       $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_hashHTMLBlocks_callback' ),
+                       $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _hashHTMLBlocks_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _hashHTMLBlocks_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $text = $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $key  = $this->hashBlock($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $key  = $this->hashBlock( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return "\n\n$key\n\n";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       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.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       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.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Swap back any tag hash found in $text so we do not have to `unhash`
</span><span class="cx" style="display: block; padding: 0 10px">                # multiple times at the end.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->unhash($text);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->unhash( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Then hash the block.
</span><span class="cx" style="display: block; padding: 0 10px">                static $i = 0;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $key = "$boundary\x1A" . ++$i . $boundary;
-               $this->html_hashes[$key] = $text;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $key                       = "$boundary\x1A" . ++ $i . $boundary;
+               $this->html_hashes[ $key ] = $text;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $key; # String that will replace the tag.
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function hashBlock($text) {
-       #
-       # Shortcut function for hashPart with block-level boundaries.
-       #
-               return $this->hashPart($text, 'B');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function hashBlock( $text ) {
+               #
+               # Shortcut function for hashPart with block-level boundaries.
+               #
+               return $this->hashPart( $text, 'B' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         var $block_gamut = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # These are all the transformations that form block-level
-       # tags like paragraphs, headers, and list items.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # These are all the transformations that form block-level
+               # tags like paragraphs, headers, and list items.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 "doHeaders"         => 10,
</span><span class="cx" style="display: block; padding: 0 10px">                "doHorizontalRules" => 20,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><span class="cx" style="display: block; padding: 0 10px">                 "doLists"           => 40,
</span><span class="cx" style="display: block; padding: 0 10px">                "doCodeBlocks"      => 50,
</span><span class="cx" style="display: block; padding: 0 10px">                "doBlockQuotes"     => 60,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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
</ins><span class="cx" style="display: block; padding: 0 10px">                 # begining in the Markdown function since hashed blocks can be part of
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                # list items and could have been indented. Indented blocks would have 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         # list items and could have been indented. Indented blocks would have
</ins><span class="cx" style="display: block; padding: 0 10px">                 # been seen as a code block in a previous pass of hashHTMLBlocks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->hashHTMLBlocks($text);
-               
-               return $this->runBasicBlockGamut($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->hashHTMLBlocks( $text );
+
+               return $this->runBasicBlockGamut( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       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);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       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 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Finally form paragraph and restore hashed blocks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->formParagraphs($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->formParagraphs( $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       function doHorizontalRules($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function doHorizontalRules( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Do Horizontal Rules:
</span><span class="cx" style="display: block; padding: 0 10px">                return preg_replace(
</span><span class="cx" style="display: block; padding: 0 10px">                        '{
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -618,71 +613,68 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*            # Tailing spaces
</span><span class="cx" style="display: block; padding: 0 10px">                                $                       # End of line.
</span><span class="cx" style="display: block; padding: 0 10px">                        }mx',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n", 
-                       $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 "\n" . $this->hashBlock( "<hr$this->empty_element_suffix" ) . "\n",
+                       $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         var $span_gamut = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # These are all the transformations that occur *within* block-level
-       # tags like paragraphs, headers, and list items.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # These are all the transformations that occur *within* block-level
+               # tags like paragraphs, headers, and list items.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Process character escapes, code spans, and inline HTML
</span><span class="cx" style="display: block; padding: 0 10px">                # in one shot.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                "parseSpan"           => -30,
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         "parseSpan"           => - 30,
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Process anchor and image tags. Images must come first,
</span><span class="cx" style="display: block; padding: 0 10px">                # because ![foo][f] looks like an anchor.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                "doImages"            =>  10,
-               "doAnchors"           =>  20,
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         "doImages"            => 10,
+               "doAnchors"           => 20,
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Make links out of things like `<http://example.com/>`
</span><span class="cx" style="display: block; padding: 0 10px">                # Must come after doAnchors, because you can use < and >
</span><span class="cx" style="display: block; padding: 0 10px">                # delimiters in inline links like [this](<url>).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                "doAutoLinks"         =>  30,
-               "encodeAmpsAndAngles" =>  40,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         "doAutoLinks"         => 30,
+               "encodeAmpsAndAngles" => 40,
+               "doItalicsAndBold"    => 50,
+               "doHardBreaks"        => 60,
+       );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                "doItalicsAndBold"    =>  50,
-               "doHardBreaks"        =>  60,
-               );
-
-       function runSpanGamut($text) {
-       #
-       # Run span gamut tranformations.
-       #
-               foreach ($this->span_gamut as $method => $priority) {
-                       $text = $this->$method($text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function runSpanGamut( $text ) {
+               #
+               # Run span gamut tranformations.
+               #
+               foreach ( $this->span_gamut as $method => $priority ) {
+                       $text = $this->$method( $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       function doHardBreaks($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function doHardBreaks( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Do hard breaks:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return preg_replace_callback('/ {2,}\n/', 
-                       array(&$this, '_doHardBreaks_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return preg_replace_callback( '/ {2,}\n/',
+                       array( &$this, '_doHardBreaks_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doHardBreaks_callback($matches) {
-               return $this->hashPart("<br$this->empty_element_suffix\n");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doHardBreaks_callback( $matches ) {
+               return $this->hashPart( "<br$this->empty_element_suffix\n" );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function doAnchors( $text ) {
+               #
+               # Turn Markdown link shortcuts into XHTML <a> tags.
+               #
+               if ( $this->in_anchor ) {
+                       return $text;
+               }
+               $this->in_anchor = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function doAnchors($text) {
-       #
-       # Turn Markdown link shortcuts into XHTML <a> tags.
-       #
-               if ($this->in_anchor) return $text;
-               $this->in_anchor = true;
-               
</del><span class="cx" style="display: block; padding: 0 10px">                 #
</span><span class="cx" style="display: block; padding: 0 10px">                # First, handle reference-style links: [link text] [id]
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (                                       # wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                          \[
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                ('.$this->nested_brackets_re.')      # link text = $2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (' . $this->nested_brackets_re . ')  # link text = $2
</ins><span class="cx" style="display: block; padding: 0 10px">                           \]
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                          [ ]?                          # one optional space
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -693,22 +685,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">                          \]
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doAnchors_reference_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doAnchors_reference_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Next, inline-style links: [link text](url "optional title")
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (                               # wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                          \[
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                ('.$this->nested_brackets_re.')      # link text = $2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (' . $this->nested_brackets_re . ')  # link text = $2
</ins><span class="cx" style="display: block; padding: 0 10px">                           \]
</span><span class="cx" style="display: block; padding: 0 10px">                          \(                    # literal paren
</span><span class="cx" style="display: block; padding: 0 10px">                                [ \n]*
</span><span class="cx" style="display: block; padding: 0 10px">                                (?:
</span><span class="cx" style="display: block; padding: 0 10px">                                        <(.+?)>   # href = $3
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        ('.$this->nested_url_parenthesis_re.')       # href = $4
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 (' . $this->nested_url_parenthesis_re . ')   # href = $4
</ins><span class="cx" style="display: block; padding: 0 10px">                                 )
</span><span class="cx" style="display: block; padding: 0 10px">                                [ \n]*
</span><span class="cx" style="display: block; padding: 0 10px">                                (                       # $5
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -720,91 +712,93 @@
</span><span class="cx" style="display: block; padding: 0 10px">                          \)
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doAnchors_inline_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doAnchors_inline_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Last, handle reference-style shortcuts: [link text]
</span><span class="cx" style="display: block; padding: 0 10px">                # These must come last in case you've also got [link text][1]
</span><span class="cx" style="display: block; padding: 0 10px">                # or [link text](/foo)
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (                                       # wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                          \[
</span><span class="cx" style="display: block; padding: 0 10px">                                ([^\[\]]+)              # link text = $2; can\'t contain [ or ]
</span><span class="cx" style="display: block; padding: 0 10px">                          \]
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doAnchors_reference_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doAnchors_reference_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->in_anchor = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doAnchors_reference_callback($matches) {
-               $whole_match =  $matches[1];
-               $link_text   =  $matches[2];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doAnchors_reference_callback( $matches ) {
+               $whole_match = $matches[1];
+               $link_text   = $matches[2];
</ins><span class="cx" style="display: block; padding: 0 10px">                 $link_id     =& $matches[3];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($link_id == "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $link_id == "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # for shortcut links like [this][] or [this].
</span><span class="cx" style="display: block; padding: 0 10px">                        $link_id = $link_text;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # lower-case and turn embedded newlines into spaces
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $link_id = strtolower($link_id);
-               $link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $link_id = strtolower( $link_id );
+               $link_id = preg_replace( '{[ ]?\n}', ' ', $link_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (isset($this->urls[$link_id])) {
-                       $url = $this->urls[$link_id];
-                       $url = $this->encodeAttribute($url);
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $this->urls[ $link_id ] ) ) {
+                       $url = $this->urls[ $link_id ];
+                       $url = $this->encodeAttribute( $url );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $result = "<a href=\"$url\"";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( isset( $this->titles[$link_id] ) ) {
-                               $title = $this->titles[$link_id];
-                               $title = $this->encodeAttribute($title);
-                               $result .=  " title=\"$title\"";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( isset( $this->titles[ $link_id ] ) ) {
+                               $title = $this->titles[ $link_id ];
+                               $title = $this->encodeAttribute( $title );
+                               $result .= " title=\"$title\"";
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-                       $link_text = $this->runSpanGamut($link_text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       $link_text = $this->runSpanGamut( $link_text );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $result .= ">$link_text</a>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $result = $this->hashPart($result);
-               }
-               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $result = $this->hashPart( $result );
+               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $result = $whole_match;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $result;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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];
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $url = $this->encodeAttribute($url);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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];
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $url = $this->encodeAttribute( $url );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $result = "<a href=\"$url\"";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (isset($title)) {
-                       $title = $this->encodeAttribute($title);
-                       $result .=  " title=\"$title\"";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $title ) ) {
+                       $title = $this->encodeAttribute( $title );
+                       $result .= " title=\"$title\"";
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $link_text = $this->runSpanGamut($link_text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $link_text = $this->runSpanGamut( $link_text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $result .= ">$link_text</a>";
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->hashPart($result);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $this->hashPart( $result );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doImages($text) {
-       #
-       # Turn Markdown image shortcuts into <img> tags.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doImages( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                # Turn Markdown image shortcuts into <img> tags.
+               #
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # First, handle reference-style labeled images: ![alt text][id]
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (                               # wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                          !\[
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                ('.$this->nested_brackets_re.')              # alt text = $2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (' . $this->nested_brackets_re . ')          # alt text = $2
</ins><span class="cx" style="display: block; padding: 0 10px">                           \]
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                          [ ]?                          # one optional space
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -815,17 +809,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                          \]
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        }xs', 
-                       array(&$this, '_doImages_reference_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 }xs',
+                       array( &$this, '_doImages_reference_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Next, handle inline images:  ![alt text](url "optional title")
</span><span class="cx" style="display: block; padding: 0 10px">                # Don't forget: encode * and _
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (                               # wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                          !\[
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                ('.$this->nested_brackets_re.')              # alt text = $2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (' . $this->nested_brackets_re . ')          # alt text = $2
</ins><span class="cx" style="display: block; padding: 0 10px">                           \]
</span><span class="cx" style="display: block; padding: 0 10px">                          \s?                   # One optional whitespace character
</span><span class="cx" style="display: block; padding: 0 10px">                          \(                    # literal paren
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -833,7 +827,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                (?:
</span><span class="cx" style="display: block; padding: 0 10px">                                        <(\S*)>   # src url = $3
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        ('.$this->nested_url_parenthesis_re.')       # src url = $4
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 (' . $this->nested_url_parenthesis_re . ')   # src url = $4
</ins><span class="cx" style="display: block; padding: 0 10px">                                 )
</span><span class="cx" style="display: block; padding: 0 10px">                                [ \n]*
</span><span class="cx" style="display: block; padding: 0 10px">                                (                       # $5
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -845,67 +839,67 @@
</span><span class="cx" style="display: block; padding: 0 10px">                          \)
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doImages_inline_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doImages_inline_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doImages_reference_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doImages_reference_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $whole_match = $matches[1];
</span><span class="cx" style="display: block; padding: 0 10px">                $alt_text    = $matches[2];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $link_id     = strtolower($matches[3]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $link_id     = strtolower( $matches[3] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($link_id == "") {
-                       $link_id = strtolower($alt_text); # for shortcut links like ![this][].
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $link_id == "" ) {
+                       $link_id = strtolower( $alt_text ); # for shortcut links like ![this][].
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $alt_text = $this->encodeAttribute($alt_text);
-               if (isset($this->urls[$link_id])) {
-                       $url = $this->encodeAttribute($this->urls[$link_id]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $alt_text = $this->encodeAttribute( $alt_text );
+               if ( isset( $this->urls[ $link_id ] ) ) {
+                       $url    = $this->encodeAttribute( $this->urls[ $link_id ] );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $result = "<img src=\"$url\" alt=\"$alt_text\"";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (isset($this->titles[$link_id])) {
-                               $title = $this->titles[$link_id];
-                               $title = $this->encodeAttribute($title);
-                               $result .=  " title=\"$title\"";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( isset( $this->titles[ $link_id ] ) ) {
+                               $title = $this->titles[ $link_id ];
+                               $title = $this->encodeAttribute( $title );
+                               $result .= " title=\"$title\"";
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                        $result .= $this->empty_element_suffix;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $result = $this->hashPart($result);
-               }
-               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $result = $this->hashPart( $result );
+               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # If there's no such link ID, leave intact:
</span><span class="cx" style="display: block; padding: 0 10px">                        $result = $whole_match;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $result;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doImages_inline_callback($matches) {
-               $whole_match    = $matches[1];
-               $alt_text               = $matches[2];
-               $url                    = $matches[3] == '' ? $matches[4] : $matches[3];
-               $title                  =& $matches[7];
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $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
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">                $result .= $this->empty_element_suffix;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->hashPart($result);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $this->hashPart( $result );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doHeaders($text) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doHeaders( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Setext-style headers:
</span><span class="cx" style="display: block; padding: 0 10px">                #         Header 1
</span><span class="cx" style="display: block; padding: 0 10px">                #         ========
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                #  
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
</ins><span class="cx" style="display: block; padding: 0 10px">                 #         Header 2
</span><span class="cx" style="display: block; padding: 0 10px">                #         --------
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
-                       array(&$this, '_doHeaders_callback_setext'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
+                       array( &$this, '_doHeaders_callback_setext' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # atx-style headers:
</span><span class="cx" style="display: block; padding: 0 10px">                #       # Header 1
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -914,7 +908,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                #       ...
</span><span class="cx" style="display: block; padding: 0 10px">                #       ###### Header 6
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ^(\#{1,6})      # $1 = string of #\'s
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                (.+?)           # $2 = Header text
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -922,30 +916,34 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                \#*                     # optional closing #\'s (not counted)
</span><span class="cx" style="display: block; padding: 0 10px">                                \n+
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doHeaders_callback_atx'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doHeaders_callback_atx' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doHeaders_callback_setext($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doHeaders_callback_setext( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Terrible hack to check we haven't found an empty list item.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $matches[2] == '-' && preg_match( '{^-(?: |$)}', $matches[1] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $matches[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $level = $matches[2]{0} == '=' ? 1 : 2;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
-               return "\n" . $this->hashBlock($block) . "\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $block = "<h$level>" . $this->runSpanGamut( $matches[1] ) . "</h$level>";
+
+               return "\n" . $this->hashBlock( $block ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       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";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doLists($text) {
-       #
-       # Form HTML ordered (numbered) and unordered (bulleted) lists.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doLists( $text ) {
+               #
+               # Form HTML ordered (numbered) and unordered (bulleted) lists.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Re-usable patterns to match list item bullets and number markers:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -956,15 +954,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $markers_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        $marker_ul_re => $marker_ol_re,
</span><span class="cx" style="display: block; padding: 0 10px">                        $marker_ol_re => $marker_ul_re,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($markers_relist as $marker_re => $other_marker_re) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $markers_relist as $marker_re => $other_marker_re ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Re-usable pattern to match any entirel ul or ol list:
</span><span class="cx" style="display: block; padding: 0 10px">                        $whole_list_re = '
</span><span class="cx" style="display: block; padding: 0 10px">                                (                                                               # $1 = whole list
</span><span class="cx" style="display: block; padding: 0 10px">                                  (                                                             # $2
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        ([ ]{0,'.$less_than_tab.'})     # $3 = number of spaces
-                                       ('.$marker_re.')                        # $4 = first list item marker
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 ([ ]{0,' . $less_than_tab . '}) # $3 = number of spaces
+                                       (' . $marker_re . ')                    # $4 = first list item marker
</ins><span class="cx" style="display: block; padding: 0 10px">                                         [ ]+
</span><span class="cx" style="display: block; padding: 0 10px">                                  )
</span><span class="cx" style="display: block; padding: 0 10px">                                  (?s:.+?)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -975,64 +973,65 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                          (?=\S)
</span><span class="cx" style="display: block; padding: 0 10px">                                          (?!                                           # Negative lookahead for another list item marker
</span><span class="cx" style="display: block; padding: 0 10px">                                                [ ]*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                '.$marker_re.'[ ]+
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         ' . $marker_re . '[ ]+
</ins><span class="cx" style="display: block; padding: 0 10px">                                           )
</span><span class="cx" style="display: block; padding: 0 10px">                                        |
</span><span class="cx" style="display: block; padding: 0 10px">                                          (?=                                           # Lookahead for another kind of list
</span><span class="cx" style="display: block; padding: 0 10px">                                            \n
</span><span class="cx" style="display: block; padding: 0 10px">                                                \3                                              # Must have the same indentation
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                '.$other_marker_re.'[ ]+
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         ' . $other_marker_re . '[ ]+
</ins><span class="cx" style="display: block; padding: 0 10px">                                           )
</span><span class="cx" style="display: block; padding: 0 10px">                                  )
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                        '; // mx
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # We use a different prefix before nested lists than top-level lists.
</span><span class="cx" style="display: block; padding: 0 10px">                        # See extended comment in _ProcessListItems().
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-                       if ($this->list_level) {
-                               $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       if ( $this->list_level ) {
+                               $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 ^
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                '.$whole_list_re.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         ' . $whole_list_re . '
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }mx',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array(&$this, '_doLists_callback'), $text);
-                       }
-                       else {
-                               $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array( &$this, '_doLists_callback' ), $text );
+                       } else {
+                               $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 (?:(?<=\n)\n|\A\n?) # Must eat the newline
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                '.$whole_list_re.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         ' . $whole_list_re . '
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }mx',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array(&$this, '_doLists_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array( &$this, '_doLists_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doLists_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doLists_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Re-usable patterns to match list item bullets and number markers:
</span><span class="cx" style="display: block; padding: 0 10px">                $marker_ul_re  = '[*+-]';
</span><span class="cx" style="display: block; padding: 0 10px">                $marker_ol_re  = '\d+[.]';
</span><span class="cx" style="display: block; padding: 0 10px">                $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $list = $matches[1];
-               $list_type = preg_match("/$marker_ul_re/", $matches[4]) ? "ul" : "ol";
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $list      = $matches[1];
+               $list_type = preg_match( "/$marker_ul_re/", $matches[4] ) ? "ul" : "ol";
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $list .= "\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result = $this->processListItems($list, $marker_any_re);
-               
-               $result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
-               return "\n". $result ."\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result = $this->processListItems( $list, $marker_any_re );
+
+               $result = $this->hashBlock( "<$list_type>\n" . $result . "</$list_type>" );
+
+               return "\n" . $result . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        var $list_level = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function processListItems($list_str, $marker_any_re) {
-       #
-       #       Process the contents of a single ordered or unordered list, splitting it
-       #       into individual list items.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function processListItems( $list_str, $marker_any_re ) {
+               #
+               #       Process the contents of a single ordered or unordered list, splitting it
+               #       into individual list items.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # The $this->list_level global keeps track of when we're inside a list.
</span><span class="cx" style="display: block; padding: 0 10px">                # Each time we enter a list, we increment it; when we leave a list,
</span><span class="cx" style="display: block; padding: 0 10px">                # we decrement. If it's zero, we're not in a list anymore.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1053,257 +1052,258 @@
</span><span class="cx" style="display: block; padding: 0 10px">                # without resorting to mind-reading. Perhaps the solution is to
</span><span class="cx" style="display: block; padding: 0 10px">                # change the syntax rules such that sub-lists must start with a
</span><span class="cx" style="display: block; padding: 0 10px">                # starting cardinal number; e.g. "1." or "a.".
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $this->list_level++;
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->list_level ++;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # trim trailing blank lines:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $list_str = preg_replace( "/\n{2,}\\z/", "\n", $list_str );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $list_str = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $list_str = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (\n)?                                                   # leading line = $1
</span><span class="cx" style="display: block; padding: 0 10px">                        (^[ ]*)                                                 # leading whitespace = $2
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        ('.$marker_any_re.'                             # list marker and space = $3
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 (' . $marker_any_re . '                         # list marker and space = $3
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (?:[ ]+|(?=\n)) # space only required if item is not empty
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        ((?s:.*?))                                              # list item text   = $4
</span><span class="cx" style="display: block; padding: 0 10px">                        (?:(\n+(?=\n))|\n)                              # tailing blank line = $5
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        (?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 (?= \n* (\z | \2 (' . $marker_any_re . ') (?:[ ]+|(?=\n))))
</ins><span class="cx" style="display: block; padding: 0 10px">                         }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_processListItems_callback'), $list_str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_processListItems_callback' ), $list_str );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->list_level--;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->list_level --;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $list_str;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _processListItems_callback($matches) {
-               $item = $matches[4];
-               $leading_line =& $matches[1];
-               $leading_space =& $matches[2];
-               $marker_space = $matches[3];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _processListItems_callback( $matches ) {
+               $item               = $matches[4];
+               $leading_line       =& $matches[1];
+               $leading_space      =& $matches[2];
+               $marker_space       = $matches[3];
</ins><span class="cx" style="display: block; padding: 0 10px">                 $tailing_blank_line =& $matches[5];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($leading_line || $tailing_blank_line || 
-                       preg_match('/\n{2,}/', $item))
-               {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $leading_line || $tailing_blank_line ||
+                    preg_match( '/\n{2,}/', $item )
+               ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Replace marker with the appropriate whitespace indentation
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
-                       $item = $this->runBlockGamut($this->outdent($item)."\n");
-               }
-               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $item = $leading_space . str_repeat( ' ', strlen( $marker_space ) ) . $item;
+                       $item = $this->runBlockGamut( $this->outdent( $item ) . "\n" );
+               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Recursion for sub-lists:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $item = $this->doLists($this->outdent($item));
-                       $item = preg_replace('/\n+$/', '', $item);
-                       $item = $this->runSpanGamut($item);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $item = $this->doLists( $this->outdent( $item ) );
+                       $item = preg_replace( '/\n+$/', '', $item );
+                       $item = $this->runSpanGamut( $item );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return "<li>" . $item . "</li>\n";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doCodeBlocks($text) {
-       #
-       #       Process Markdown `<pre><code>` blocks.
-       #
-               $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doCodeBlocks( $text ) {
+               #
+               #       Process Markdown `<pre><code>` blocks.
+               #
+               $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (?:\n\n|\A\n?)
</span><span class="cx" style="display: block; padding: 0 10px">                                (                   # $1 = the code block -- one or more lines, starting with a space/tab
</span><span class="cx" style="display: block; padding: 0 10px">                                  (?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{'.$this->tab_width.'}  # Lines must start with a tab or a tab-width of spaces
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{' . $this->tab_width . '}  # Lines must start with a tab or a tab-width of spaces
</ins><span class="cx" style="display: block; padding: 0 10px">                                         .*\n+
</span><span class="cx" style="display: block; padding: 0 10px">                                  )+
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                ((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z)      # Lookahead for non-space at line-start, or end of doc
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         ((?=^[ ]{0,' . $this->tab_width . '}\S)|\Z)  # Lookahead for non-space at line-start, or end of doc
</ins><span class="cx" style="display: block; padding: 0 10px">                         }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doCodeBlocks_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doCodeBlocks_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doCodeBlocks_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doCodeBlocks_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $codeblock = $matches[1];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $codeblock = $this->outdent($codeblock);
-               $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $codeblock = $this->outdent( $codeblock );
+               $codeblock = htmlspecialchars( $codeblock, ENT_NOQUOTES );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # trim leading newlines and trailing newlines
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $codeblock = preg_replace( '/\A\n+|\n+\z/', '', $codeblock );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $codeblock = "<pre><code>$codeblock\n</code></pre>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return "\n\n".$this->hashBlock($codeblock)."\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return "\n\n" . $this->hashBlock( $codeblock ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function makeCodeSpan( $code ) {
+               #
+               # Create a code span markup for $code. Called from handleSpanToken.
+               #
+               $code = htmlspecialchars( trim( $code ), ENT_NOQUOTES );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        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>");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $this->hashPart( "<code>$code</code>" );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         var $em_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                ''  => '(?:(?<!\*)\*(?!\*)|(?<!_)_(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '_' => '(?<=\S|^)(?<!_)_(?!_)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">         var $strong_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                ''   => '(?:(?<!\*)\*\*(?!\*)|(?<!_)__(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '__' => '(?<=\S|^)(?<!_)__(?!_)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">         var $em_strong_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                ''    => '(?:(?<!\*)\*\*\*(?!\*)|(?<!_)___(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '___' => '(?<=\S|^)(?<!_)___(?!_)',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">         var $em_strong_prepared_relist;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function prepareItalicsAndBold() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # 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) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # 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 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Construct list of allowed token expressions.
</span><span class="cx" style="display: block; padding: 0 10px">                                $token_relist = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if (isset($this->em_strong_relist["$em$strong"])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( isset( $this->em_strong_relist["$em$strong"] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $token_relist[] = $this->em_strong_relist["$em$strong"];
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                                $token_relist[] = $em_re;
</span><span class="cx" style="display: block; padding: 0 10px">                                $token_relist[] = $strong_re;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Construct master expression from list.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $token_re = '{('. implode('|', $token_relist) .')}';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $token_re                                      = '{(' . implode( '|', $token_relist ) . ')}';
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $this->em_strong_prepared_relist["$em$strong"] = $token_re;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function doItalicsAndBold($text) {
-               $token_stack = array('');
-               $text_stack = array('');
-               $em = '';
-               $strong = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function doItalicsAndBold( $text ) {
+               $token_stack  = array( '' );
+               $text_stack   = array( '' );
+               $em           = '';
+               $strong       = '';
</ins><span class="cx" style="display: block; padding: 0 10px">                 $tree_char_em = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               while (1) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               while ( 1 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Get prepared regular expression for seraching emphasis tokens
</span><span class="cx" style="display: block; padding: 0 10px">                        # in current context.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        $token_re = $this->em_strong_prepared_relist["$em$strong"];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        # Each loop iteration search for the next emphasis token. 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 # Each loop iteration search for the next emphasis token.
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Each token is then passed to handleSpanToken.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $parts = preg_split( $token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text_stack[0] .= $parts[0];
</span><span class="cx" style="display: block; padding: 0 10px">                        $token =& $parts[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $text =& $parts[2];
-                       
-                       if (empty($token)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $text  =& $parts[2];
+
+                       if ( empty( $token ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Reached end of text span: empty stack without emitting.
</span><span class="cx" style="display: block; padding: 0 10px">                                # any more emphasis.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                while ($token_stack[0]) {
-                                       $text_stack[1] .= array_shift($token_stack);
-                                       $text_stack[0] .= array_shift($text_stack);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         while ( $token_stack[0] ) {
+                                       $text_stack[1] .= array_shift( $token_stack );
+                                       $text_stack[0] .= array_shift( $text_stack );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                       $token_len = strlen($token);
-                       if ($tree_char_em) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       $token_len = strlen( $token );
+                       if ( $tree_char_em ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Reached closing marker while inside a three-char emphasis.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($token_len == 3) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $token_len == 3 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Three-char closing marker, close em and strong.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array_shift($token_stack);
-                                       $span = array_shift($text_stack);
-                                       $span = $this->runSpanGamut($span);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array_shift( $token_stack );
+                                       $span = array_shift( $text_stack );
+                                       $span = $this->runSpanGamut( $span );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $span = "<strong><em>$span</em></strong>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $text_stack[0] .= $this->hashPart($span);
-                                       $em = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $text_stack[0] .= $this->hashPart( $span );
+                                       $em     = '';
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $strong = '';
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Other closing marker: close one em or strong and
</span><span class="cx" style="display: block; padding: 0 10px">                                        # change current token state to match the other
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $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
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $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
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                                $tree_char_em = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        } else if ($token_len == 3) {
-                               if ($em) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } else if ( $token_len == 3 ) {
+                               if ( $em ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Reached closing marker for both em and strong.
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Closing strong marker:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        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);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 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 );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $$tag = ''; # $$tag stands for $em or $strong
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        # Reached opening three-char emphasis marker. Push on token 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 # Reached opening three-char emphasis marker. Push on token
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # stack; will be handled by the special condition above.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $em = $token{0};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $em     = $token{0};
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $strong = "$em$em";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array_unshift($token_stack, $token);
-                                       array_unshift($text_stack, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array_unshift( $token_stack, $token );
+                                       array_unshift( $text_stack, '' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $tree_char_em = true;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        } else if ($token_len == 2) {
-                               if ($strong) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } else if ( $token_len == 2 ) {
+                               if ( $strong ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Unwind any dangling emphasis marker:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if (strlen($token_stack[0]) == 1) {
-                                               $text_stack[1] .= array_shift($token_stack);
-                                               $text_stack[0] .= array_shift($text_stack);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( strlen( $token_stack[0] ) == 1 ) {
+                                               $text_stack[1] .= array_shift( $token_stack );
+                                               $text_stack[0] .= array_shift( $text_stack );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Closing strong marker:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array_shift($token_stack);
-                                       $span = array_shift($text_stack);
-                                       $span = $this->runSpanGamut($span);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array_shift( $token_stack );
+                                       $span = array_shift( $text_stack );
+                                       $span = $this->runSpanGamut( $span );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $span = "<strong>$span</strong>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $text_stack[0] .= $this->hashPart($span);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $text_stack[0] .= $this->hashPart( $span );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $strong = '';
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array_unshift($token_stack, $token);
-                                       array_unshift($text_stack, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array_unshift( $token_stack, $token );
+                                       array_unshift( $text_stack, '' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $strong = $token;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                # Here $token_len == 1
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($em) {
-                                       if (strlen($token_stack[0]) == 1) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $em ) {
+                                       if ( strlen( $token_stack[0] ) == 1 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 # Closing emphasis marker:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                array_shift($token_stack);
-                                               $span = array_shift($text_stack);
-                                               $span = $this->runSpanGamut($span);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         array_shift( $token_stack );
+                                               $span = array_shift( $text_stack );
+                                               $span = $this->runSpanGamut( $span );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $span = "<em>$span</em>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $text_stack[0] .= $this->hashPart($span);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $text_stack[0] .= $this->hashPart( $span );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $em = '';
</span><span class="cx" style="display: block; padding: 0 10px">                                        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $text_stack[0] .= $token;
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="cx" style="display: block; padding: 0 10px">                                } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        array_unshift($token_stack, $token);
-                                       array_unshift($text_stack, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 array_unshift( $token_stack, $token );
+                                       array_unshift( $text_stack, '' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $em = $token;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text_stack[0];
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doBlockQuotes($text) {
-               $text = preg_replace_callback('/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doBlockQuotes( $text ) {
+               $text = preg_replace_callback( '/
</ins><span class="cx" style="display: block; padding: 0 10px">                           (                                                             # Wrap whole match in $1
</span><span class="cx" style="display: block; padding: 0 10px">                                (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                  ^[ ]*>[ ]?                 # ">" at the start of a line
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1313,58 +1313,59 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                )+
</span><span class="cx" style="display: block; padding: 0 10px">                          )
</span><span class="cx" style="display: block; padding: 0 10px">                        /xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doBlockQuotes_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doBlockQuotes_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doBlockQuotes_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doBlockQuotes_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $bq = $matches[1];
</span><span class="cx" style="display: block; padding: 0 10px">                # trim one level of quoting - trim whitespace-only lines
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
-               $bq = $this->runBlockGamut($bq);             # recurse
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $bq = preg_replace( '/^[ ]*>[ ]?|^[ ]+$/m', '', $bq );
+               $bq = $this->runBlockGamut( $bq );        # recurse
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $bq = preg_replace('/^/m', "  ", $bq);
-               # These leading spaces cause problem with <pre> content, 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $bq = preg_replace( '/^/m', "  ", $bq );
+               # These leading spaces cause problem with <pre> content,
</ins><span class="cx" style="display: block; padding: 0 10px">                 # so we need to fix that:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx', 
-                       array(&$this, '_doBlockQuotes_callback2'), $bq);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $bq = preg_replace_callback( '{(\s*<pre>.+?</pre>)}sx',
+                       array( &$this, '_doBlockQuotes_callback2' ), $bq );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return "\n". $this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return "\n" . $this->hashBlock( "<blockquote>\n$bq\n</blockquote>" ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doBlockQuotes_callback2($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doBlockQuotes_callback2( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $pre = $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $pre = preg_replace('/^  /m', '', $pre);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pre = preg_replace( '/^  /m', '', $pre );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $pre;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function formParagraphs($text) {
-       #
-       #       Params:
-       #               $text - string to process with html <p> tags
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function formParagraphs( $text ) {
+               #
+               #       Params:
+               #               $text - string to process with html <p> tags
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Strip leading and trailing lines:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('/\A\n+|\n+\z/', '', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '/\A\n+|\n+\z/', '', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $grafs = preg_split( '/\n{2,}/', $text, - 1, PREG_SPLIT_NO_EMPTY );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Wrap <p> tags and unhashify HTML blocks
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($grafs as $key => $value) {
-                       if (!preg_match('/^B\x1A[0-9]+B$/', $value)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $grafs as $key => $value ) {
+                       if ( ! preg_match( '/^B\x1A[0-9]+B$/', $value ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Is a paragraph.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $value = $this->runSpanGamut($value);
-                               $value = preg_replace('/^([ ]*)/', "<p>", $value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $value = $this->runSpanGamut( $value );
+                               $value = preg_replace( '/^([ ]*)/', "<p>", $value );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $value .= "</p>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $grafs[$key] = $this->unhash($value);
-                       }
-                       else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $grafs[ $key ] = $this->unhash( $value );
+                       } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Is a block.
</span><span class="cx" style="display: block; padding: 0 10px">                                # Modify elements of @grafs in-place...
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $graf = $value;
-                               $block = $this->html_hashes[$graf];
-                               $graf = $block;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $graf  = $value;
+                               $block = $this->html_hashes[ $graf ];
+                               $graf  = $block;
</ins><span class="cx" style="display: block; padding: 0 10px"> //                              if (preg_match('{
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     \A
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     (                                                       # $1 = <div> tag
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1389,7 +1390,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     # We can't call Markdown(), because that resets the hash;
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     # that initialization code should be pulled into its own sub, though.
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     $div_content = $this->hashHTMLBlocks($div_content);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-//                                      
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+//
</ins><span class="cx" style="display: block; padding: 0 10px"> //                                      # Run document gamut methods on the content.
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     foreach ($this->document_gamut as $method => $priority) {
</span><span class="cx" style="display: block; padding: 0 10px"> //                                             $div_content = $this->$method($div_content);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1400,52 +1401,50 @@
</span><span class="cx" style="display: block; padding: 0 10px"> //
</span><span class="cx" style="display: block; padding: 0 10px"> //                                     $graf = $div_open . "\n" . $div_content . "\n" . $div_close;
</span><span class="cx" style="display: block; padding: 0 10px"> //                             }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $grafs[$key] = $graf;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $grafs[ $key ] = $graf;
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return implode("\n\n", $grafs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return implode( "\n\n", $grafs );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function encodeAttribute( $text ) {
+               #
+               # Encode text for a double-quoted HTML attribute. This function
+               # is *not* suitable for attributes enclosed in single quotes.
+               #
+               $text = $this->encodeAmpsAndAngles( $text );
+               $text = str_replace( '"', '&quot;', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function encodeAttribute($text) {
-       #
-       # Encode text for a double-quoted HTML attribute. This function
-       # is *not* suitable for attributes enclosed in single quotes.
-       #
-               $text = $this->encodeAmpsAndAngles($text);
-               $text = str_replace('"', '&quot;', $text);
</del><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       function encodeAmpsAndAngles($text) {
-       #
-       # Smart processing for ampersands and angle brackets that need to 
-       # be encoded. Valid character entities are left alone unless the
-       # no-entities mode is set.
-       #
-               if ($this->no_entities) {
-                       $text = str_replace('&', '&amp;', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function encodeAmpsAndAngles( $text ) {
+               #
+               # Smart processing for ampersands and angle brackets that need to
+               # be encoded. Valid character entities are left alone unless the
+               # no-entities mode is set.
+               #
+               if ( $this->no_entities ) {
+                       $text = str_replace( '&', '&amp;', $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        # Ampersand-encoding based entirely on Nat Irons's Amputator
</span><span class="cx" style="display: block; padding: 0 10px">                        # MT plugin: <http://bumppo.net/projects/amputator/>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', 
-                                                               '&amp;', $text);;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $text = preg_replace( '/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
+                               '&amp;', $text );;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">                # Encode remaining <'s
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = str_replace('<', '&lt;', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = str_replace( '<', '&lt;', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function doAutoLinks( $text ) {
+               $text = preg_replace_callback( '{<((https?|ftp|dict):[^\'">\s]+)>}i',
+                       array( &$this, '_doAutoLinks_url_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function doAutoLinks($text) {
-               $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i', 
-                       array(&$this, '_doAutoLinks_url_callback'), $text);
-
</del><span class="cx" style="display: block; padding: 0 10px">                 # Email addresses: <address@domain.foo>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         <
</span><span class="cx" style="display: block; padding: 0 10px">                        (?:mailto:)?
</span><span class="cx" style="display: block; padding: 0 10px">                        (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1463,77 +1462,83 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        >
</span><span class="cx" style="display: block; padding: 0 10px">                        }xi',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doAutoLinks_email_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doAutoLinks_email_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doAutoLinks_url_callback($matches) {
-               $url = $this->encodeAttribute($matches[1]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doAutoLinks_url_callback( $matches ) {
+               $url  = $this->encodeAttribute( $matches[1] );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $link = "<a href=\"$url\">$url</a>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->hashPart($link);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return $this->hashPart( $link );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doAutoLinks_email_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doAutoLinks_email_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $address = $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $link = $this->encodeEmailAddress($address);
-               return $this->hashPart($link);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $link    = $this->encodeEmailAddress( $address );
+
+               return $this->hashPart( $link );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function encodeEmailAddress( $addr ) {
+               #
+               #       Input: an email address, e.g. "foo@example.com"
+               #
+               #       Output: the email address as a mailto link, with each character
+               #               of the address encoded as either a decimal or hex entity, in
+               #               the hopes of foiling most address harvesting spam bots. E.g.:
+               #
+               #         <p><a href="&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#58;&#x66;o&#111;
+               #        &#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;&#101;&#46;&#x63;&#111;
+               #        &#x6d;">&#x66;o&#111;&#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;
+               #        &#101;&#46;&#x63;&#111;&#x6d;</a></p>
+               #
+               #       Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
+               #   With some optimizations by Milian Wolff.
+               #
+               $addr  = "mailto:" . $addr;
+               $chars = preg_split( '/(?<!^)(?!$)/', $addr );
+               $seed  = (int) abs( crc32( $addr ) / strlen( $addr ) ); # Deterministic seed.
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function encodeEmailAddress($addr) {
-       #
-       #       Input: an email address, e.g. "foo@example.com"
-       #
-       #       Output: the email address as a mailto link, with each character
-       #               of the address encoded as either a decimal or hex entity, in
-       #               the hopes of foiling most address harvesting spam bots. E.g.:
-       #
-       #         <p><a href="&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#58;&#x66;o&#111;
-       #        &#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;&#101;&#46;&#x63;&#111;
-       #        &#x6d;">&#x66;o&#111;&#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;
-       #        &#101;&#46;&#x63;&#111;&#x6d;</a></p>
-       #
-       #       Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
-       #   With some optimizations by Milian Wolff.
-       #
-               $addr = "mailto:" . $addr;
-               $chars = preg_split('/(?<!^)(?!$)/', $addr);
-               $seed = (int)abs(crc32($addr) / strlen($addr)); # Deterministic seed.
-               
-               foreach ($chars as $key => $char) {
-                       $ord = ord($char);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $chars as $key => $char ) {
+                       $ord = ord( $char );
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Ignore non-ascii chars.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($ord < 128) {
-                               $r = ($seed * (1 + $key)) % 100; # Pseudo-random function.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $ord < 128 ) {
+                               $r = ( $seed * ( 1 + $key ) ) % 100; # Pseudo-random function.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # roughly 10% raw, 45% hex, 45% dec
</span><span class="cx" style="display: block; padding: 0 10px">                                # '@' *must* be encoded. I insist.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($r > 90 && $char != '@') /* do nothing */;
-                               else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';';
-                               else              $chars[$key] = '&#'.$ord.';';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $r > 90 && $char != '@' ) /* do nothing */ {
+                                       ;
+                               } else if ( $r < 45 ) {
+                                       $chars[ $key ] = '&#x' . dechex( $ord ) . ';';
+                               } else {
+                                       $chars[ $key ] = '&#' . $ord . ';';
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $addr = implode('', $chars);
-               $text = implode('', array_slice($chars, 7)); # text without `mailto:`
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $addr = implode( '', $chars );
+               $text = implode( '', array_slice( $chars, 7 ) ); # text without `mailto:`
</ins><span class="cx" style="display: block; padding: 0 10px">                 $addr = "<a href=\"$addr\">$text</a>";
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $addr;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function parseSpan( $str ) {
+               #
+               # Take the string $str and parse it into tokens, hashing embeded HTML,
+               # escaped characters and handling code spans.
+               #
+               $output = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function parseSpan($str) {
-       #
-       # Take the string $str and parse it into tokens, hashing embeded HTML,
-       # escaped characters and handling code spans.
-       #
-               $output = '';
-               
</del><span class="cx" style="display: block; padding: 0 10px">                 $span_re = '{
</span><span class="cx" style="display: block; padding: 0 10px">                                (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        \\\\'.$this->escape_chars_re.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 \\\\' . $this->escape_chars_re . '
</ins><span class="cx" style="display: block; padding: 0 10px">                                 |
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?<![`\\\\])
</span><span class="cx" style="display: block; padding: 0 10px">                                        `+                                              # code span marker
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        '.( $this->no_markup ? '' : '
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 ' . ( $this->no_markup ? '' : '
</ins><span class="cx" style="display: block; padding: 0 10px">                                 |
</span><span class="cx" style="display: block; padding: 0 10px">                                        <!--    .*?     -->               # comment
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1545,316 +1550,306 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
</span><span class="cx" style="display: block; padding: 0 10px">                                        )?
</span><span class="cx" style="display: block; padding: 0 10px">                                        >
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        ').'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 ' ) . '
</ins><span class="cx" style="display: block; padding: 0 10px">                                 )
</span><span class="cx" style="display: block; padding: 0 10px">                                }xs';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                while (1) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         while ( 1 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        # Each loop iteration seach for either the next tag, the next 
-                       # openning code span marker, or the next escaped character. 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 # Each loop iteration seach for either the next tag, the next
+                       # openning code span marker, or the next escaped character.
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Each token is then passed to handleSpanToken.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $parts = preg_split( $span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Create token from text preceding tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($parts[0] != "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $parts[0] != "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $output .= $parts[0];
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Check if we reach the end.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (isset($parts[1])) {
-                               $output .= $this->handleSpanToken($parts[1], $parts[2]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( isset( $parts[1] ) ) {
+                               $output .= $this->handleSpanToken( $parts[1], $parts[2] );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $str = $parts[2];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        }
-                       else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $output;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       function handleSpanToken($token, &$str) {
-       #
-       # Handle $token provided by parseSpan by determining its nature and 
-       # returning the corresponding value that should replace it.
-       #
-               switch ($token{0}) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function handleSpanToken( $token, &$str ) {
+               #
+               # Handle $token provided by parseSpan by determining its nature and
+               # returning the corresponding value that should replace it.
+               #
+               switch ( $token{0} ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         case "\\":
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                return $this->hashPart("&#". ord($token{1}). ";");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return $this->hashPart( "&#" . ord( $token{1} ) . ";" );
</ins><span class="cx" style="display: block; padding: 0 10px">                         case "`":
</span><span class="cx" style="display: block; padding: 0 10px">                                # Search for end marker in remaining text.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm', 
-                                       $str, $matches))
-                               {
-                                       $str = $matches[2];
-                                       $codespan = $this->makeCodeSpan($matches[1]);
-                                       return $this->hashPart($codespan);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( preg_match( '/^(.*?[^`])' . preg_quote( $token ) . '(?!`)(.*)$/sm',
+                                       $str, $matches ) ) {
+                                       $str      = $matches[2];
+                                       $codespan = $this->makeCodeSpan( $matches[1] );
+
+                                       return $this->hashPart( $codespan );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 return $token; // return as text since no ending marker found.
</span><span class="cx" style="display: block; padding: 0 10px">                        default:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                return $this->hashPart($token);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return $this->hashPart( $token );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function outdent($text) {
-       #
-       # Remove one level of line-leading tabs or spaces
-       #
-               return preg_replace('/^(\t|[ ]{1,'.$this->tab_width.'})/m', '', $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function outdent( $text ) {
+               #
+               # Remove one level of line-leading tabs or spaces
+               #
+               return preg_replace( '/^(\t|[ ]{1,' . $this->tab_width . '})/m', '', $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        # String length function for detab. `_initDetab` will create a function to 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ # String length function for detab. `_initDetab` will create a function to
</ins><span class="cx" style="display: block; padding: 0 10px">         # hanlde UTF-8 if the default function does not exist.
</span><span class="cx" style="display: block; padding: 0 10px">        var $utf8_strlen = 'mb_strlen';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function detab($text) {
-       #
-       # Replace tabs with the appropriate amount of space.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function detab( $text ) {
+               #
+               # Replace tabs with the appropriate amount of space.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # For each line we separate the line in blocks delemited by
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                # tab characters. Then we reconstruct every line by adding the 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         # tab characters. Then we reconstruct every line by adding the
</ins><span class="cx" style="display: block; padding: 0 10px">                 # appropriate number of space between each blocks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $text = preg_replace_callback('/^.*\t.*$/m',
-                       array(&$this, '_detab_callback'), $text);
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $text = preg_replace_callback( '/^.*\t.*$/m',
+                       array( &$this, '_detab_callback' ), $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _detab_callback($matches) {
-               $line = $matches[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _detab_callback( $matches ) {
+               $line   = $matches[0];
</ins><span class="cx" style="display: block; padding: 0 10px">                 $strlen = $this->utf8_strlen; # strlen function for UTF-8.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Split in blocks.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $blocks = explode("\t", $line);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $blocks = explode( "\t", $line );
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Add each blocks to the line.
</span><span class="cx" style="display: block; padding: 0 10px">                $line = $blocks[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                unset($blocks[0]); # Do not add first block twice.
-               foreach ($blocks as $block) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         unset( $blocks[0] ); # Do not add first block twice.
+               foreach ( $blocks as $block ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Calculate amount of space, insert spaces, insert block.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $amount = $this->tab_width - 
-                               $strlen($line, 'UTF-8') % $this->tab_width;
-                       $line .= str_repeat(" ", $amount) . $block;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $amount = $this->tab_width -
+                                 $strlen( $line, 'UTF-8' ) % $this->tab_width;
+                       $line .= str_repeat( " ", $amount ) . $block;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $line;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function _initDetab() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Check for the availability of the function in the `utf8_strlen` property
-       # (initially `mb_strlen`). If the function is not available, create a 
-       # function that will loosely count the number of UTF-8 characters with a
-       # regular expression.
-       #
-               if (function_exists($this->utf8_strlen)) return;
-               $this->utf8_strlen = create_function('$text', 'return preg_match_all(
-                       "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", 
-                       $text, $m);');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Check for the availability of the function in the `utf8_strlen` property
+               # (initially `mb_strlen`). If the function is not available, create a
+               # function that will loosely count the number of UTF-8 characters with a
+               # regular expression.
+               #
+               if ( function_exists( $this->utf8_strlen ) ) {
+                       return;
+               }
+               $this->utf8_strlen = create_function( '$text', 'return preg_match_all(
+                       "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
+                       $text, $m);' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function unhash( $text ) {
+               #
+               # Swap back in all the tags hashed by _HashHTMLBlocks.
+               #
+               return preg_replace_callback( '/(.)\x1A[0-9]+\1/',
+                       array( &$this, '_unhash_callback' ), $text );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function unhash($text) {
-       #
-       # Swap back in all the tags hashed by _HashHTMLBlocks.
-       #
-               return preg_replace_callback('/(.)\x1A[0-9]+\1/', 
-                       array(&$this, '_unhash_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function _unhash_callback( $matches ) {
+               return $this->html_hashes[ $matches[0] ];
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _unhash_callback($matches) {
-               return $this->html_hashes[$matches[0]];
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Markdown Extra Parser Class
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> class MarkdownExtra_Parser extends Markdown_Parser {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         # Prefix for footnote ids.
</span><span class="cx" style="display: block; padding: 0 10px">        var $fn_id_prefix = "";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Optional title attribute for footnote links and backlinks.
</span><span class="cx" style="display: block; padding: 0 10px">        var $fn_link_title = MARKDOWN_FN_LINK_TITLE;
</span><span class="cx" style="display: block; padding: 0 10px">        var $fn_backlink_title = MARKDOWN_FN_BACKLINK_TITLE;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Optional class attribute for footnote links and backlinks.
</span><span class="cx" style="display: block; padding: 0 10px">        var $fn_link_class = MARKDOWN_FN_LINK_CLASS;
</span><span class="cx" style="display: block; padding: 0 10px">        var $fn_backlink_class = MARKDOWN_FN_BACKLINK_CLASS;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Predefined abbreviations.
</span><span class="cx" style="display: block; padding: 0 10px">        var $predef_abbr = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px">         function MarkdownExtra_Parser() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Constructor function. Initialize the parser object.
-       #
-               # Add extra escapable characters before parent constructor 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Constructor function. Initialize the parser object.
+               #
+               # Add extra escapable characters before parent constructor
</ins><span class="cx" style="display: block; padding: 0 10px">                 # initialize the table.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->escape_chars .= ':|';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               # Insert extra document, block, and span transformations. 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               # Insert extra document, block, and span transformations.
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Parent constructor will do the sorting.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->document_gamut += array(
</span><span class="cx" style="display: block; padding: 0 10px">                        "doFencedCodeBlocks" => 5,
</span><span class="cx" style="display: block; padding: 0 10px">                        "stripFootnotes"     => 15,
</span><span class="cx" style="display: block; padding: 0 10px">                        "stripAbbreviations" => 25,
</span><span class="cx" style="display: block; padding: 0 10px">                        "appendFootnotes"    => 50,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->block_gamut += array(
</span><span class="cx" style="display: block; padding: 0 10px">                        "doFencedCodeBlocks" => 5,
</span><span class="cx" style="display: block; padding: 0 10px">                        "doTables"           => 15,
</span><span class="cx" style="display: block; padding: 0 10px">                        "doDefLists"         => 45,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->span_gamut += array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        "doFootnotes"        => 5,
-                       "doAbbreviations"    => 70,
-                       );
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 "doFootnotes"     => 5,
+                       "doAbbreviations" => 70,
+               );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 parent::Markdown_Parser();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Extra variables used during extra transformations.
</span><span class="cx" style="display: block; padding: 0 10px">        var $footnotes = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $footnotes_ordered = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $abbr_desciptions = array();
</span><span class="cx" style="display: block; padding: 0 10px">        var $abbr_word_re = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Give the current footnote number.
</span><span class="cx" style="display: block; padding: 0 10px">        var $footnote_counter = 1;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function setup() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Setting up Extra-specific variables.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Setting up Extra-specific variables.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 parent::setup();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $this->footnotes = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $this->footnotes         = array();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->footnotes_ordered = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->abbr_desciptions = array();
-               $this->abbr_word_re = '';
-               $this->footnote_counter = 1;
-               
-               foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
-                       if ($this->abbr_word_re)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->abbr_desciptions  = array();
+               $this->abbr_word_re      = '';
+               $this->footnote_counter  = 1;
+
+               foreach ( $this->predef_abbr as $abbr_word => $abbr_desc ) {
+                       if ( $this->abbr_word_re ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $this->abbr_word_re .= '|';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->abbr_word_re .= preg_quote($abbr_word);
-                       $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 }
+                       $this->abbr_word_re .= preg_quote( $abbr_word );
+                       $this->abbr_desciptions[ $abbr_word ] = trim( $abbr_desc );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         function teardown() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        #
-       # Clearing Extra-specific variables.
-       #
-               $this->footnotes = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
+               # Clearing Extra-specific variables.
+               #
+               $this->footnotes         = array();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->footnotes_ordered = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->abbr_desciptions = array();
-               $this->abbr_word_re = '';
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->abbr_desciptions  = array();
+               $this->abbr_word_re      = '';
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 parent::teardown();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
</ins><span class="cx" style="display: block; padding: 0 10px">         ### HTML Block Parser ###
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         # Tags that are always treated as block tags:
</span><span class="cx" style="display: block; padding: 0 10px">        var $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Tags treated as block tags only if the opening tag is alone on it's line:
</span><span class="cx" style="display: block; padding: 0 10px">        var $context_block_tags_re = 'script|noscript|math|ins|del';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Tags where markdown="1" default to span mode:
</span><span class="cx" style="display: block; padding: 0 10px">        var $contain_span_tags_re = 'p|h[1-6]|li|dd|dt|td|th|legend|address';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       # Tags which must not have their contents modified, no matter where 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ # Tags which must not have their contents modified, no matter where
</ins><span class="cx" style="display: block; padding: 0 10px">         # they appear:
</span><span class="cx" style="display: block; padding: 0 10px">        var $clean_tags_re = 'script|math';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px">         # Tags that do not need to be closed.
</span><span class="cx" style="display: block; padding: 0 10px">        var $auto_close_tags_re = 'hr|img';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function hashHTMLBlocks($text) {
-       #
-       # Hashify HTML Blocks and "clean tags".
-       #
-       # 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.
-       #
-       # This works by calling _HashHTMLBlocks_InMarkdown, which then calls
-       # _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1" 
-       # attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back
-       #  _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag.
-       # These two functions are calling each other. It's recursive!
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function hashHTMLBlocks( $text ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                # Hashify HTML Blocks and "clean tags".
+               #
+               # 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.
+               #
+               # This works by calling _HashHTMLBlocks_InMarkdown, which then calls
+               # _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1"
+               # attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back
+               #  _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag.
+               # These two functions are calling each other. It's recursive!
+               #
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Call the HTML-in-Markdown hasher.
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         list( $text, ) = $this->_hashHTMLBlocks_inMarkdown( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _hashHTMLBlocks_inMarkdown($text, $indent = 0, 
-                                                                               $enclosing_tag_re = '', $span = false)
-       {
-       #
-       # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
-       #
-       # *   $indent is the number of space to be ignored when checking for code 
-       #     blocks. This is important because if we don't take the indent into 
-       #     account, something like this (which looks right) won't work as expected:
-       #
-       #     <div>
-       #         <div markdown="1">
-       #         Hello World.  <-- Is this a Markdown code block or text?
-       #         </div>  <-- Is this a Markdown code block or a real tag?
-       #     <div>
-       #
-       #     If you don't like this, just don't indent the tag on which
-       #     you apply the markdown="1" attribute.
-       #
-       # *   If $enclosing_tag_re is not empty, stops at the first unmatched closing 
-       #     tag with that name. Nested tags supported.
-       #
-       # *   If $span is true, text inside must treated as span. So any double 
-       #     newline will be replaced by a single newline so that it does not create 
-       #     paragraphs.
-       #
-       # Returns an array of that form: ( processed text , remaining text )
-       #
-               if ($text === '') return array('', '');
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function _hashHTMLBlocks_inMarkdown( $text, $indent = 0, $enclosing_tag_re = '', $span = false ) {
+               #
+               # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
+               #
+               # *   $indent is the number of space to be ignored when checking for code
+               #     blocks. This is important because if we don't take the indent into
+               #     account, something like this (which looks right) won't work as expected:
+               #
+               #     <div>
+               #         <div markdown="1">
+               #         Hello World.  <-- Is this a Markdown code block or text?
+               #         </div>  <-- Is this a Markdown code block or a real tag?
+               #     <div>
+               #
+               #     If you don't like this, just don't indent the tag on which
+               #     you apply the markdown="1" attribute.
+               #
+               # *   If $enclosing_tag_re is not empty, stops at the first unmatched closing
+               #     tag with that name. Nested tags supported.
+               #
+               # *   If $span is true, text inside must treated as span. So any double
+               #     newline will be replaced by a single newline so that it does not create
+               #     paragraphs.
+               #
+               # Returns an array of that form: ( processed text , remaining text )
+               #
+               if ( $text === '' ) {
+                       return array( '', '' );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Regex to check for the presense of newlines around a block tag.
</span><span class="cx" style="display: block; padding: 0 10px">                $newline_before_re = '/(?:^\n?|\n\n)*$/';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $newline_after_re = 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $newline_after_re  =
</ins><span class="cx" style="display: block; padding: 0 10px">                         '{
</span><span class="cx" style="display: block; padding: 0 10px">                                ^                                               # Start of text following the tag.
</span><span class="cx" style="display: block; padding: 0 10px">                                (?>[ ]*<!--.*?-->)?            # Optional comment.
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*\n                                  # Must be followed by newline.
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Regex to match any tag.
</span><span class="cx" style="display: block; padding: 0 10px">                $block_tag_re =
</span><span class="cx" style="display: block; padding: 0 10px">                        '{
</span><span class="cx" style="display: block; padding: 0 10px">                                (                                       # $2: Capture hole tag.
</span><span class="cx" style="display: block; padding: 0 10px">                                        </?                                  # Any opening or closing tag.
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?>                          # Tag name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        '.$this->block_tags_re.'                     |
-                                                       '.$this->context_block_tags_re.'     |
-                                                       '.$this->clean_tags_re.'             |
-                                                       (?!\s)'.$enclosing_tag_re.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 ' . $this->block_tags_re . '                 |
+                                                       ' . $this->context_block_tags_re . ' |
+                                                       ' . $this->clean_tags_re . '         |
+                                                       (?!\s)' . $enclosing_tag_re . '
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 )
</span><span class="cx" style="display: block; padding: 0 10px">                                                (?:
</span><span class="cx" style="display: block; padding: 0 10px">                                                        (?=[\s"\'/a-zA-Z0-9])      # Allowed characters after tag name.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1874,25 +1869,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Code span marker
</span><span class="cx" style="display: block; padding: 0 10px">                                        `+
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                '. ( !$span ? ' # If not in span.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         ' . ( ! $span ? ' # If not in span.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 |
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Indented code block
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?: ^[ ]*\n | ^ | \n[ ]*\n )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{'.($indent+4).'}[^\n]* \n
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{' . ( $indent + 4 ) . '}[^\n]* \n
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                (?: [ ]{'.($indent+4).'}[^\n]* | [ ]* ) \n
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         (?: [ ]{' . ( $indent + 4 ) . '}[^\n]* | [ ]* ) \n
</ins><span class="cx" style="display: block; padding: 0 10px">                                         )*
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Fenced code block marker
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?> ^ | \n )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{'.($indent).'}~~~+[ ]*\n
-                               ' : '' ). ' # End (if not is span).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{' . ( $indent ) . '}~~~+[ ]*\n
+                               ' : '' ) . ' # End (if not is span).
</ins><span class="cx" style="display: block; padding: 0 10px">                                 )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $depth = 0;             # Current depth inside the tag tree.
-               $parsed = ""; # Parsed text that will be returned.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $depth  = 0;        # Current depth inside the tag tree.
+               $parsed = "";    # Parsed text that will be returned.
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Loop through every tag until we find the closing tag of the parent
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1902,46 +1896,44 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Split the text using the first $tag_match pattern found.
</span><span class="cx" style="display: block; padding: 0 10px">                        # Text before  pattern will be first in the array, text after
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        # pattern will be at the end, and between will be any catches made 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 # pattern will be at the end, and between will be any catches made
</ins><span class="cx" style="display: block; padding: 0 10px">                         # by the pattern.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $parts = preg_split($block_tag_re, $text, 2, 
-                                                               PREG_SPLIT_DELIM_CAPTURE);
-                       
-                       # If in Markdown span mode, add a empty-string span-level hash 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $parts = preg_split( $block_tag_re, $text, 2,
+                               PREG_SPLIT_DELIM_CAPTURE );
+
+                       # If in Markdown span mode, add a empty-string span-level hash
</ins><span class="cx" style="display: block; padding: 0 10px">                         # after each newline to prevent triggering any block element.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($span) {
-                               $void = $this->hashPart("", ':');
-                               $newline = "$void\n";
-                               $parts[0] = $void . str_replace("\n", $newline, $parts[0]) . $void;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $span ) {
+                               $void     = $this->hashPart( "", ':' );
+                               $newline  = "$void\n";
+                               $parts[0] = $void . str_replace( "\n", $newline, $parts[0] ) . $void;
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $parsed .= $parts[0]; # Text before current tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # If end of $text has been reached. Stop loop.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (count($parts) < 3) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( count( $parts ) < 3 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $text = "";
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                       $tag  = $parts[1]; # Tag to handle.
-                       $text = $parts[2]; # Remaining text after current tag.
-                       $tag_re = preg_quote($tag); # For use in a regular expression.
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       $tag    = $parts[1]; # Tag to handle.
+                       $text   = $parts[2]; # Remaining text after current tag.
+                       $tag_re = preg_quote( $tag ); # For use in a regular expression.
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Code span marker
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($tag{0} == "`") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $tag{0} == "`" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Find corresponding end marker.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $tag_re = preg_quote($tag);
-                               if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
-                                       $text, $matches))
-                               {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $tag_re = preg_quote( $tag );
+                               if ( preg_match( '{^(?>.+?|\n(?!\n))*?(?<!`)' . $tag_re . '(?!`)}',
+                                       $text, $matches ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # End marker found: pass text unchanged until marker.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $parsed .= $tag . $matches[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $text = substr($text, strlen($matches[0]));
-                               }
-                               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $text = substr( $text, strlen( $matches[0] ) );
+                               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Unmatched marker: just skip it.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $parsed .= $tag;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1949,44 +1941,41 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Indented code block.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else if ($tag{0} == "\n" || $tag{0} == " ") {
-                               # Indented code block: pass it unchanged, will be handled 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 else if ( $tag{0} == "\n" || $tag{0} == " " ) {
+                               # Indented code block: pass it unchanged, will be handled
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # later.
</span><span class="cx" style="display: block; padding: 0 10px">                                $parsed .= $tag;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Fenced code block marker.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else if ($tag{0} == "~") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 else if ( $tag{0} == "~" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Fenced code block marker: find matching end marker.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $tag_re = preg_quote(trim($tag));
-                               if (preg_match('{^(?>.*\n)+?'.$tag_re.' *\n}', $text, 
-                                       $matches)) 
-                               {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $tag_re = preg_quote( trim( $tag ) );
+                               if ( preg_match( '{^(?>.*\n)+?' . $tag_re . ' *\n}', $text,
+                                       $matches ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # End marker found: pass text unchanged until marker.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $parsed .= $tag . $matches[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $text = substr($text, strlen($matches[0]));
-                               }
-                               else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $text = substr( $text, strlen( $matches[0] ) );
+                               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # No end marker: just skip it.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $parsed .= $tag;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Opening Block level tag or
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        #            Opening Context Block tag (like ins and del) 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 #            Opening Context Block tag (like ins and del)
</ins><span class="cx" style="display: block; padding: 0 10px">                         #               used as a block tag (tag is alone on it's line).
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else if (preg_match('{^<(?:'.$this->block_tags_re.')\b}', $tag) ||
-                               (       preg_match('{^<(?:'.$this->context_block_tags_re.')\b}', $tag) &&
-                                       preg_match($newline_before_re, $parsed) &&
-                                       preg_match($newline_after_re, $text)    )
-                               )
-                       {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 else if ( preg_match( '{^<(?:' . $this->block_tags_re . ')\b}', $tag ) ||
+                                 ( preg_match( '{^<(?:' . $this->context_block_tags_re . ')\b}', $tag ) &&
+                                   preg_match( $newline_before_re, $parsed ) &&
+                                   preg_match( $newline_after_re, $text ) )
+                       ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Need to parse tag and following text using the HTML parser.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                list($block_text, $text) = 
-                                       $this->_hashHTMLBlocks_inHTML($tag . $text, "hashBlock", true);
-                               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         list( $block_text, $text ) =
+                                       $this->_hashHTMLBlocks_inHTML( $tag . $text, "hashBlock", true );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Make sure it stays outside of any paragraph by adding newlines.
</span><span class="cx" style="display: block; padding: 0 10px">                                $parsed .= "\n\n$block_text\n\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1994,30 +1983,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Clean tag (like script, math)
</span><span class="cx" style="display: block; padding: 0 10px">                        #            HTML Comments, processing instructions.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else if (preg_match('{^<(?:'.$this->clean_tags_re.')\b}', $tag) ||
-                               $tag{1} == '!' || $tag{1} == '?')
-                       {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 else if ( preg_match( '{^<(?:' . $this->clean_tags_re . ')\b}', $tag ) ||
+                                 $tag{1} == '!' || $tag{1} == '?'
+                       ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Need to parse tag and following text using the HTML parser.
</span><span class="cx" style="display: block; padding: 0 10px">                                # (don't check for markdown attribute)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                list($block_text, $text) = 
-                                       $this->_hashHTMLBlocks_inHTML($tag . $text, "hashClean", false);
-                               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         list( $block_text, $text ) =
+                                       $this->_hashHTMLBlocks_inHTML( $tag . $text, "hashClean", false );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $parsed .= $block_text;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Tag with same name as enclosing tag.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        else if ($enclosing_tag_re !== '' &&
-                               # Same name as enclosing tag.
-                               preg_match('{^</?(?:'.$enclosing_tag_re.')\b}', $tag))
-                       {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 else if ( $enclosing_tag_re !== '' &&
+                                 # Same name as enclosing tag.
+                                 preg_match( '{^</?(?:' . $enclosing_tag_re . ')\b}', $tag )
+                       ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 #
</span><span class="cx" style="display: block; padding: 0 10px">                                # Increase/decrease nested tag count.
</span><span class="cx" style="display: block; padding: 0 10px">                                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($tag{1} == '/')                                             $depth--;
-                               else if ($tag{strlen($tag)-2} != '/')   $depth++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $tag{1} == '/' ) {
+                                       $depth --;
+                               } else if ( $tag{strlen( $tag ) - 2} != '/' ) {
+                                       $depth ++;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($depth < 0) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $depth < 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         #
</span><span class="cx" style="display: block; padding: 0 10px">                                        # Going out of parent element. Clean up and break so we
</span><span class="cx" style="display: block; padding: 0 10px">                                        # return to the calling function.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2025,29 +2017,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $text = $tag . $text;
</span><span class="cx" style="display: block; padding: 0 10px">                                        break;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $parsed .= $tag;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        }
-                       else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $parsed .= $tag;
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                } while ($depth >= 0);
-               
-               return array($parsed, $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } while ( $depth >= 0 );
+
+               return array( $parsed, $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
-       #
-       # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
-       #
-       # *   Calls $hash_method to convert any blocks.
-       # *   Stops when the first opening tag closes.
-       # *   $md_attr indicate if the use of the `markdown="1"` attribute is allowed.
-       #     (it is not inside clean tags)
-       #
-       # Returns an array of that form: ( processed text , remaining text )
-       #
-               if ($text === '') return array('', '');
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _hashHTMLBlocks_inHTML( $text, $hash_method, $md_attr ) {
+               #
+               # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
+               #
+               # *   Calls $hash_method to convert any blocks.
+               # *   Stops when the first opening tag closes.
+               # *   $md_attr indicate if the use of the `markdown="1"` attribute is allowed.
+               #     (it is not inside clean tags)
+               #
+               # Returns an array of that form: ( processed text , remaining text )
+               #
+               if ( $text === '' ) {
+                       return array( '', '' );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Regex to match `markdown` attribute inside of a tag.
</span><span class="cx" style="display: block; padding: 0 10px">                $markdown_attr_re = '
</span><span class="cx" style="display: block; padding: 0 10px">                        {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2055,15 +2049,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                markdown
</span><span class="cx" style="display: block; padding: 0 10px">                                \s*=\s*
</span><span class="cx" style="display: block; padding: 0 10px">                                (?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        (["\'])            # $1: quote delimiter           
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 (["\'])            # $1: quote delimiter
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (.*?)           # $2: attribute value
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        \1                      # matching delimiter    
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 \1                      # matching delimiter
</ins><span class="cx" style="display: block; padding: 0 10px">                                 |
</span><span class="cx" style="display: block; padding: 0 10px">                                        ([^\s>]*)    # $3: unquoted attribute value
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                                ()                              # $4: make $3 always defined (avoid warnings)
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Regex to match any tag.
</span><span class="cx" style="display: block; padding: 0 10px">                $tag_re = '{
</span><span class="cx" style="display: block; padding: 0 10px">                                (                                       # $2: Capture hole tag.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2086,19 +2080,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        <!\[CDATA\[.*?\]\]>       # CData Block
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                        }xs';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               $original_text = $text;         # Save original text in case of faliure.
-               
-               $depth          = 0;    # Current depth inside the tag tree.
-               $block_text     = ""; # Temporary text holder for current text.
-               $parsed         = ""; # Parsed text that will be returned.
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $original_text = $text;        # Save original text in case of faliure.
+
+               $depth      = 0;    # Current depth inside the tag tree.
+               $block_text = "";    # Temporary text holder for current text.
+               $parsed     = "";    # Parsed text that will be returned.
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><span class="cx" style="display: block; padding: 0 10px">                # Get the name of the starting tag.
</span><span class="cx" style="display: block; padding: 0 10px">                # (This pattern makes $base_tag_name_re safe without quoting.)
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( preg_match( '/^<([\w:$]*)\b/', $text, $matches ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $base_tag_name_re = $matches[1];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Loop through every tag until we find the corresponding closing tag.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2107,127 +2102,130 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Split the text using the first $tag_match pattern found.
</span><span class="cx" style="display: block; padding: 0 10px">                        # Text before  pattern will be first in the array, text after
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        # pattern will be at the end, and between will be any catches made 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 # pattern will be at the end, and between will be any catches made
</ins><span class="cx" style="display: block; padding: 0 10px">                         # by the pattern.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
-                       
-                       if (count($parts) < 3) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $parts = preg_split( $tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE );
+
+                       if ( count( $parts ) < 3 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 #
</span><span class="cx" style="display: block; padding: 0 10px">                                # End of $text reached with unbalenced tag(s).
</span><span class="cx" style="display: block; padding: 0 10px">                                # In that case, we return original text unchanged and pass the
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                # first character as filtered to prevent an infinite loop in the 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         # first character as filtered to prevent an infinite loop in the
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # parent function.
</span><span class="cx" style="display: block; padding: 0 10px">                                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                return array($original_text{0}, substr($original_text, 1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return array( $original_text{0}, substr( $original_text, 1 ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $block_text .= $parts[0]; # Text before current tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $tag         = $parts[1]; # Tag to handle.
-                       $text        = $parts[2]; # Remaining text after current tag.
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $tag  = $parts[1]; # Tag to handle.
+                       $text = $parts[2]; # Remaining text after current tag.
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         #
</span><span class="cx" style="display: block; padding: 0 10px">                        # Check for: Auto-close tag (like <hr/>)
</span><span class="cx" style="display: block; padding: 0 10px">                        #                        Comments and Processing Instructions.
</span><span class="cx" style="display: block; padding: 0 10px">                        #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if (preg_match('{^</?(?:'.$this->auto_close_tags_re.')\b}', $tag) ||
-                               $tag{1} == '!' || $tag{1} == '?')
-                       {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( preg_match( '{^</?(?:' . $this->auto_close_tags_re . ')\b}', $tag ) ||
+                            $tag{1} == '!' || $tag{1} == '?'
+                       ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Just add the tag to the block as if it was text.
</span><span class="cx" style="display: block; padding: 0 10px">                                $block_text .= $tag;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        }
-                       else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 #
</span><span class="cx" style="display: block; padding: 0 10px">                                # Increase/decrease nested tag count. Only do so if
</span><span class="cx" style="display: block; padding: 0 10px">                                # the tag's name match base tag's.
</span><span class="cx" style="display: block; padding: 0 10px">                                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if (preg_match('{^</?'.$base_tag_name_re.'\b}', $tag)) {
-                                       if ($tag{1} == '/')                                             $depth--;
-                                       else if ($tag{strlen($tag)-2} != '/')   $depth++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( preg_match( '{^</?' . $base_tag_name_re . '\b}', $tag ) ) {
+                                       if ( $tag{1} == '/' ) {
+                                               $depth --;
+                                       } else if ( $tag{strlen( $tag ) - 2} != '/' ) {
+                                               $depth ++;
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 #
</span><span class="cx" style="display: block; padding: 0 10px">                                # Check for `markdown="1"` attribute and handle it.
</span><span class="cx" style="display: block; padding: 0 10px">                                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ($md_attr && 
-                                       preg_match($markdown_attr_re, $tag, $attr_m) &&
-                                       preg_match('/^1|block|span$/', $attr_m[2] . $attr_m[3]))
-                               {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( $md_attr &&
+                                    preg_match( $markdown_attr_re, $tag, $attr_m ) &&
+                                    preg_match( '/^1|block|span$/', $attr_m[2] . $attr_m[3] )
+                               ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Remove `markdown` attribute from opening tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $tag = preg_replace($markdown_attr_re, '', $tag);
-                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $tag = preg_replace( $markdown_attr_re, '', $tag );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Check if text inside this tag must be parsed in span mode.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $this->mode = $attr_m[2] . $attr_m[3];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $span_mode = $this->mode == 'span' || $this->mode != 'block' &&
-                                               preg_match('{^<(?:'.$this->contain_span_tags_re.')\b}', $tag);
-                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $span_mode  = $this->mode == 'span' || $this->mode != 'block' &&
+                                                                              preg_match( '{^<(?:' . $this->contain_span_tags_re . ')\b}', $tag );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Calculate indent before tag.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( preg_match( '/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $strlen = $this->utf8_strlen;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $indent = $strlen($matches[1], 'UTF-8');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $indent = $strlen( $matches[1], 'UTF-8' );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                                $indent = 0;
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # End preceding block with this tag.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $block_text .= $tag;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $parsed .= $this->$hash_method($block_text);
-                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $parsed .= $this->$hash_method( $block_text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Get enclosing tag name for the ParseMarkdown function.
</span><span class="cx" style="display: block; padding: 0 10px">                                        # (This pattern makes $tag_name_re safe without quoting.)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        preg_match('/^<([\w:$]*)\b/', $tag, $matches);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 preg_match( '/^<([\w:$]*)\b/', $tag, $matches );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $tag_name_re = $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Parse the content using the HTML-in-Markdown parser.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        list ($block_text, $text)
-                                               = $this->_hashHTMLBlocks_inMarkdown($text, $indent, 
-                                                       $tag_name_re, $span_mode);
-                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 list ( $block_text, $text )
+                                               = $this->_hashHTMLBlocks_inMarkdown( $text, $indent,
+                                               $tag_name_re, $span_mode );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Outdent markdown text.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ($indent > 0) {
-                                               $block_text = preg_replace("/^[ ]{1,$indent}/m", "", 
-                                                                                                       $block_text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( $indent > 0 ) {
+                                               $block_text = preg_replace( "/^[ ]{1,$indent}/m", "",
+                                                       $block_text );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Append tag content to parsed text.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if (!$span_mode)        $parsed .= "\n\n$block_text\n\n";
-                                       else                            $parsed .= "$block_text";
-                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! $span_mode ) {
+                                               $parsed .= "\n\n$block_text\n\n";
+                                       } else {
+                                               $parsed .= "$block_text";
+                                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         # Start over a new block.
</span><span class="cx" style="display: block; padding: 0 10px">                                        $block_text = "";
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                } else {
+                                       $block_text .= $tag;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                else $block_text .= $tag;
</del><span class="cx" style="display: block; padding: 0 10px">                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-               } while ($depth > 0);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } while ( $depth > 0 );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><span class="cx" style="display: block; padding: 0 10px">                # Hash last block text that wasn't processed inside the loop.
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $parsed .= $this->$hash_method($block_text);
-               
-               return array($parsed, $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $parsed .= $this->$hash_method( $block_text );
+
+               return array( $parsed, $text );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function hashClean($text) {
-       #
-       # Called whenever a tag must be hashed when a function insert a "clean" tag
-       # in $text, it pass through this function and is automaticaly escaped, 
-       # blocking invalid nested overlap.
-       #
-               return $this->hashPart($text, 'C');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function hashClean( $text ) {
+               #
+               # Called whenever a tag must be hashed when a function insert a "clean" tag
+               # in $text, it pass through this function and is automaticaly escaped,
+               # blocking invalid nested overlap.
+               #
+               return $this->hashPart( $text, 'C' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doHeaders($text) {
-       #
-       # Redefined to add id attribute support.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doHeaders( $text ) {
+               #
+               # Redefined to add id attribute support.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Setext-style headers:
</span><span class="cx" style="display: block; padding: 0 10px">                #         Header 1  {#header1}
</span><span class="cx" style="display: block; padding: 0 10px">                #         ========
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                #  
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         #
</ins><span class="cx" style="display: block; padding: 0 10px">                 #         Header 2  {#header2}
</span><span class="cx" style="display: block; padding: 0 10px">                #         --------
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2237,7 +2235,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})?        # $2: Id attribute
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*\n(=+|-+)[ ]*\n+                            # $3: Header footer
</span><span class="cx" style="display: block; padding: 0 10px">                        }mx',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doHeaders_callback_setext'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doHeaders_callback_setext' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # atx-style headers:
</span><span class="cx" style="display: block; padding: 0 10px">                #       # Header 1        {#header1}
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2246,7 +2244,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                #       ...
</span><span class="cx" style="display: block; padding: 0 10px">                #       ###### Header 6   {#header2}
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ^(\#{1,6})      # $1 = string of #\'s
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                (.+?)           # $2 = Header text
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2256,34 +2254,42 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                                \n+
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doHeaders_callback_atx'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doHeaders_callback_atx' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doHeaders_attr($attr) {
-               if (empty($attr))  return "";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doHeaders_attr( $attr ) {
+               if ( empty( $attr ) ) {
+                       return "";
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return " id=\"$attr\"";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doHeaders_callback_setext($matches) {
-               if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doHeaders_callback_setext( $matches ) {
+               if ( $matches[3] == '-' && preg_match( '{^- }', $matches[1] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return $matches[0];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px">                 $level = $matches[3]{0} == '=' ? 1 : 2;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $attr  = $this->_doHeaders_attr($id =& $matches[2]);
-               $block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
-               return "\n" . $this->hashBlock($block) . "\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $attr  = $this->_doHeaders_attr( $id =& $matches[2] );
+               $block = "<h$level$attr>" . $this->runSpanGamut( $matches[1] ) . "</h$level>";
+
+               return "\n" . $this->hashBlock( $block ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doHeaders_callback_atx($matches) {
-               $level = strlen($matches[1]);
-               $attr  = $this->_doHeaders_attr($id =& $matches[3]);
-               $block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
-               return "\n" . $this->hashBlock($block) . "\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doHeaders_callback_atx( $matches ) {
+               $level = strlen( $matches[1] );
+               $attr  = $this->_doHeaders_attr( $id =& $matches[3] );
+               $block = "<h$level$attr>" . $this->runSpanGamut( $matches[2] ) . "</h$level>";
+
+               return "\n" . $this->hashBlock( $block ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function doTables($text) {
-       #
-       # Form HTML tables.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doTables( $text ) {
+               #
+               # Form HTML tables.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="cx" style="display: block; padding: 0 10px">                # Find tables with leading pipe.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2293,16 +2299,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                #       | Cell 1   | Cell 2
</span><span class="cx" style="display: block; padding: 0 10px">                #       | Cell 3   | Cell 4
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '
</ins><span class="cx" style="display: block; padding: 0 10px">                         {
</span><span class="cx" style="display: block; padding: 0 10px">                                ^                                                       # Start of a line
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}       # Allowed whitespace.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}   # Allowed whitespace.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 [|]                                                     # Optional leading pipe (present)
</span><span class="cx" style="display: block; padding: 0 10px">                                (.+) \n                                         # $1: Header row (at least one pipe)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
-                               [ ]{0,'.$less_than_tab.'}       # Allowed whitespace.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               [ ]{0,' . $less_than_tab . '}   # Allowed whitespace.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 [|] ([ ]*[-:]+[-| :]*) \n       # $2: Header underline
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (                                                       # $3: Cells
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                [ ]*                            # Allowed whitespace.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2311,8 +2317,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                                (?=\n|\Z)                                       # Stop at final double newline.
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doTable_leadingPipe_callback'), $text);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doTable_leadingPipe_callback' ), $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><span class="cx" style="display: block; padding: 0 10px">                # Find tables without leading pipe.
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2321,15 +2327,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                #       Cell 1   | Cell 2
</span><span class="cx" style="display: block; padding: 0 10px">                #       Cell 3   | Cell 4
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '
</ins><span class="cx" style="display: block; padding: 0 10px">                         {
</span><span class="cx" style="display: block; padding: 0 10px">                                ^                                                       # Start of a line
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}       # Allowed whitespace.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}   # Allowed whitespace.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (\S.*[|].*) \n                          # $1: Header row (at least one pipe)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
-                               [ ]{0,'.$less_than_tab.'}       # Allowed whitespace.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               [ ]{0,' . $less_than_tab . '}   # Allowed whitespace.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ([-:]+[ ]*[|][-| :]*) \n        # $2: Header underline
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (                                                       # $3: Cells
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                .* [|] .* \n            # Row content
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2337,93 +2343,101 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                                (?=\n|\Z)                                       # Stop at final double newline.
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_DoTable_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_DoTable_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doTable_leadingPipe_callback($matches) {
-               $head           = $matches[1];
-               $underline      = $matches[2];
-               $content        = $matches[3];
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doTable_leadingPipe_callback( $matches ) {
+               $head      = $matches[1];
+               $underline = $matches[2];
+               $content   = $matches[3];
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Remove leading pipe for each row.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content        = preg_replace('/^ *[|]/m', '', $content);
-               
-               return $this->_doTable_callback(array($matches[0], $head, $underline, $content));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $content = preg_replace( '/^ *[|]/m', '', $content );
+
+               return $this->_doTable_callback( array( $matches[0], $head, $underline, $content ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doTable_callback($matches) {
-               $head           = $matches[1];
-               $underline      = $matches[2];
-               $content        = $matches[3];
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function _doTable_callback( $matches ) {
+               $head      = $matches[1];
+               $underline = $matches[2];
+               $content   = $matches[3];
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Remove any tailing pipes for each line.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $head           = preg_replace('/[|] *$/m', '', $head);
-               $underline      = preg_replace('/[|] *$/m', '', $underline);
-               $content        = preg_replace('/[|] *$/m', '', $content);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $head      = preg_replace( '/[|] *$/m', '', $head );
+               $underline = preg_replace( '/[|] *$/m', '', $underline );
+               $content   = preg_replace( '/[|] *$/m', '', $content );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Reading alignement from header underline.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $separators     = preg_split('/ *[|] */', $underline);
-               foreach ($separators as $n => $s) {
-                       if (preg_match('/^ *-+: *$/', $s))              $attr[$n] = ' align="right"';
-                       else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"';
-                       else if (preg_match('/^ *:-+ *$/', $s)) $attr[$n] = ' align="left"';
-                       else                                                                    $attr[$n] = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $separators = preg_split( '/ *[|] */', $underline );
+               foreach ( $separators as $n => $s ) {
+                       if ( preg_match( '/^ *-+: *$/', $s ) ) {
+                               $attr[ $n ] = ' align="right"';
+                       } else if ( preg_match( '/^ *:-+: *$/', $s ) ) {
+                               $attr[ $n ] = ' align="center"';
+                       } else if ( preg_match( '/^ *:-+ *$/', $s ) ) {
+                               $attr[ $n ] = ' align="left"';
+                       } else {
+                               $attr[ $n ] = '';
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               # Parsing span elements, including code spans, character escapes, 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               # Parsing span elements, including code spans, character escapes,
</ins><span class="cx" style="display: block; padding: 0 10px">                 # and inline HTML tags, so that pipes inside those gets ignored.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $head           = $this->parseSpan($head);
-               $headers        = preg_split('/ *[|] */', $head);
-               $col_count      = count($headers);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $head      = $this->parseSpan( $head );
+               $headers   = preg_split( '/ *[|] */', $head );
+               $col_count = count( $headers );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Write column headers.
</span><span class="cx" style="display: block; padding: 0 10px">                $text = "<table>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "<thead>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "<tr>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($headers as $n => $header)
-                       $text .= "  <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $headers as $n => $header ) {
+                       $text .= "  <th$attr[$n]>" . $this->runSpanGamut( trim( $header ) ) . "</th>\n";
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">                 $text .= "</tr>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "</thead>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Split content by row.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $rows = explode("\n", trim($content, "\n"));
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $rows = explode( "\n", trim( $content, "\n" ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $text .= "<tbody>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($rows as $row) {
-                       # Parsing span elements, including code spans, character escapes, 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $rows as $row ) {
+                       # Parsing span elements, including code spans, character escapes,
</ins><span class="cx" style="display: block; padding: 0 10px">                         # and inline HTML tags, so that pipes inside those gets ignored.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $row = $this->parseSpan($row);
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $row = $this->parseSpan( $row );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Split row by cell.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $row_cells = preg_split('/ *[|] */', $row, $col_count);
-                       $row_cells = array_pad($row_cells, $col_count, '');
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $row_cells = preg_split( '/ *[|] */', $row, $col_count );
+                       $row_cells = array_pad( $row_cells, $col_count, '' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "<tr>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        foreach ($row_cells as $n => $cell)
-                               $text .= "  <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 foreach ( $row_cells as $n => $cell ) {
+                               $text .= "  <td$attr[$n]>" . $this->runSpanGamut( trim( $cell ) ) . "</td>\n";
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "</tr>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "</tbody>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                $text .= "</table>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               return $this->hashBlock($text) . "\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return $this->hashBlock( $text ) . "\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function doDefLists($text) {
-       #
-       # Form HTML definition lists.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function doDefLists( $text ) {
+               #
+               # Form HTML definition lists.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Re-usable pattern to match any entire dl list:
</span><span class="cx" style="display: block; padding: 0 10px">                $whole_list_re = '(?>
</span><span class="cx" style="display: block; padding: 0 10px">                        (                                                               # $1 = whole list
</span><span class="cx" style="display: block; padding: 0 10px">                          (                                                             # $2
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ((?>.*\S.*\n)+)                              # $3 = defined term
</span><span class="cx" style="display: block; padding: 0 10px">                                \n?
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}:[ ]+ # colon starting definition
</ins><span class="cx" style="display: block; padding: 0 10px">                           )
</span><span class="cx" style="display: block; padding: 0 10px">                          (?s:.+?)
</span><span class="cx" style="display: block; padding: 0 10px">                          (                                                             # $4
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2432,128 +2446,130 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                  \n{2,}
</span><span class="cx" style="display: block; padding: 0 10px">                                  (?=\S)
</span><span class="cx" style="display: block; padding: 0 10px">                                  (?!                                           # Negative lookahead for another term
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{0,'.$less_than_tab.'}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{0,' . $less_than_tab . '}
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?: \S.*\n )+?                  # defined term
</span><span class="cx" style="display: block; padding: 0 10px">                                        \n?
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{0,' . $less_than_tab . '}:[ ]+ # colon starting definition
</ins><span class="cx" style="display: block; padding: 0 10px">                                   )
</span><span class="cx" style="display: block; padding: 0 10px">                                  (?!                                           # Negative lookahead for another definition
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{0,' . $less_than_tab . '}:[ ]+ # colon starting definition
</ins><span class="cx" style="display: block; padding: 0 10px">                                   )
</span><span class="cx" style="display: block; padding: 0 10px">                          )
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                )'; // mx
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (?>\A\n?|(?<=\n\n))
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                '.$whole_list_re.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         ' . $whole_list_re . '
</ins><span class="cx" style="display: block; padding: 0 10px">                         }mx',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doDefLists_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doDefLists_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doDefLists_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doDefLists_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Re-usable patterns to match list item bullets and number markers:
</span><span class="cx" style="display: block; padding: 0 10px">                $list = $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Turn double returns into triple returns, so that we can make a
</span><span class="cx" style="display: block; padding: 0 10px">                # paragraph for the last item in a list, if necessary:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $result = trim($this->processDefListItems($list));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $result = trim( $this->processDefListItems( $list ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $result = "<dl>\n" . $result . "\n</dl>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $this->hashBlock($result) . "\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return $this->hashBlock( $result ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function processDefListItems( $list_str ) {
+               #
+               #       Process the contents of a single definition list, splitting it
+               #       into individual term and definition list items.
+               #
+               $less_than_tab = $this->tab_width - 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function processDefListItems($list_str) {
-       #
-       #       Process the contents of a single definition list, splitting it
-       #       into individual term and definition list items.
-       #
-               $less_than_tab = $this->tab_width - 1;
-               
</del><span class="cx" style="display: block; padding: 0 10px">                 # trim trailing blank lines:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $list_str = preg_replace( "/\n{2,}\\z/", "\n", $list_str );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Process definition terms.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $list_str = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $list_str = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         (?>\A\n?|\n\n+)                                      # leading line
</span><span class="cx" style="display: block; padding: 0 10px">                        (                                                               # definition terms = $1
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}       # leading whitespace
-                               (?![:][ ]|[ ])                          # negative lookahead for a definition 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}   # leading whitespace
+                               (?![:][ ]|[ ])                          # negative lookahead for a definition
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                                         #   mark (colon) or more whitespace.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                (?> \S.* \n)+?                               # actual term (not whitespace). 
-                       )                       
-                       (?=\n?[ ]{0,3}:[ ])                             # lookahead for following line feed 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (?> \S.* \n)+?                               # actual term (not whitespace).
+                       )
+                       (?=\n?[ ]{0,3}:[ ])                             # lookahead for following line feed
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                                         #   with a definition mark.
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_processDefListItems_callback_dt'), $list_str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_processDefListItems_callback_dt' ), $list_str );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Process actual definitions.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $list_str = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $list_str = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                         \n(\n+)?                                                # leading line = $1
</span><span class="cx" style="display: block; padding: 0 10px">                        (                                                               # marker space = $2
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                [ ]{0,'.$less_than_tab.'}       # whitespace before colon
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         [ ]{0,' . $less_than_tab . '}   # whitespace before colon
</ins><span class="cx" style="display: block; padding: 0 10px">                                 [:][ ]+                                         # definition mark (colon)
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                        ((?s:.+?))                                              # definition text = $3
</span><span class="cx" style="display: block; padding: 0 10px">                        (?= \n+                                                 # stop at next definition mark,
</span><span class="cx" style="display: block; padding: 0 10px">                                (?:                                                     # next term or end of text
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        [ ]{0,'.$less_than_tab.'} [:][ ]        |
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 [ ]{0,' . $less_than_tab . '} [:][ ]    |
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <dt> | \z
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                )                                               
-                       )                                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         )
+                       )
</ins><span class="cx" style="display: block; padding: 0 10px">                         }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_processDefListItems_callback_dd'), $list_str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_processDefListItems_callback_dd' ), $list_str );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $list_str;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _processDefListItems_callback_dt($matches) {
-               $terms = explode("\n", trim($matches[1]));
-               $text = '';
-               foreach ($terms as $term) {
-                       $term = $this->runSpanGamut(trim($term));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _processDefListItems_callback_dt( $matches ) {
+               $terms = explode( "\n", trim( $matches[1] ) );
+               $text  = '';
+               foreach ( $terms as $term ) {
+                       $term = $this->runSpanGamut( trim( $term ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "\n<dt>" . $term . "</dt>";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _processDefListItems_callback_dd($matches) {
-               $leading_line   = $matches[1];
-               $marker_space   = $matches[2];
-               $def                    = $matches[3];
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($leading_line || preg_match('/\n{2,}/', $def)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function _processDefListItems_callback_dd( $matches ) {
+               $leading_line = $matches[1];
+               $marker_space = $matches[2];
+               $def          = $matches[3];
+
+               if ( $leading_line || preg_match( '/\n{2,}/', $def ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Replace marker with the appropriate whitespace indentation
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $def = str_repeat(' ', strlen($marker_space)) . $def;
-                       $def = $this->runBlockGamut($this->outdent($def . "\n\n"));
-                       $def = "\n". $def ."\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $def = str_repeat( ' ', strlen( $marker_space ) ) . $def;
+                       $def = $this->runBlockGamut( $this->outdent( $def . "\n\n" ) );
+                       $def = "\n" . $def . "\n";
+               } else {
+                       $def = rtrim( $def );
+                       $def = $this->runSpanGamut( $this->outdent( $def ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                else {
-                       $def = rtrim($def);
-                       $def = $this->runSpanGamut($this->outdent($def));
-               }
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return "\n<dd>" . $def . "</dd>\n";
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function doFencedCodeBlocks( $text ) {
+               #
+               # Adding the fenced code block syntax to regular Markdown:
+               #
+               # ~~~
+               # Code block
+               # ~~~
+               #
+               $less_than_tab = $this->tab_width;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function doFencedCodeBlocks($text) {
-       #
-       # Adding the fenced code block syntax to regular Markdown:
-       #
-       # ~~~
-       # Code block
-       # ~~~
-       #
-               $less_than_tab = $this->tab_width;
-               
-               $text = preg_replace_callback('{
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
</ins><span class="cx" style="display: block; padding: 0 10px">                                 (?:\n|\A)
</span><span class="cx" style="display: block; padding: 0 10px">                                # 1: Opening marker
</span><span class="cx" style="display: block; padding: 0 10px">                                (
</span><span class="cx" style="display: block; padding: 0 10px">                                        ~{3,} # Marker: three tilde or more.
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><span class="cx" style="display: block; padding: 0 10px">                                [ ]* \n # Whitespace and newline following marker.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # 2: Content
</span><span class="cx" style="display: block; padding: 0 10px">                                (
</span><span class="cx" style="display: block; padding: 0 10px">                                        (?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2561,25 +2577,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                .*\n+
</span><span class="cx" style="display: block; padding: 0 10px">                                        )+
</span><span class="cx" style="display: block; padding: 0 10px">                                )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Closing marker.
</span><span class="cx" style="display: block; padding: 0 10px">                                \1 [ ]* \n
</span><span class="cx" style="display: block; padding: 0 10px">                        }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_doFencedCodeBlocks_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_doFencedCodeBlocks_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doFencedCodeBlocks_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doFencedCodeBlocks_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $codeblock = $matches[2];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
-               $codeblock = preg_replace_callback('/^\n+/',
-                       array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $codeblock = htmlspecialchars( $codeblock, ENT_NOQUOTES );
+               $codeblock = preg_replace_callback( '/^\n+/',
+                       array( &$this, '_doFencedCodeBlocks_newlines' ), $codeblock );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $codeblock = "<pre><code>$codeblock</code></pre>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return "\n\n".$this->hashBlock($codeblock)."\n\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return "\n\n" . $this->hashBlock( $codeblock ) . "\n\n";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doFencedCodeBlocks_newlines($matches) {
-               return str_repeat("<br$this->empty_element_suffix", 
-                       strlen($matches[0]));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doFencedCodeBlocks_newlines( $matches ) {
+               return str_repeat( "<br$this->empty_element_suffix",
+                       strlen( $matches[0] ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2591,258 +2610,263 @@
</span><span class="cx" style="display: block; padding: 0 10px">                ''  => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '*' => '(?<=\S|^)(?<!\*)\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '_' => '(?<=\S|^)(?<!_)_(?![a-zA-Z0-9_])',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">         var $strong_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                ''   => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '**' => '(?<=\S|^)(?<!\*)\*\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '__' => '(?<=\S|^)(?<!_)__(?![a-zA-Z0-9_])',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px">         var $em_strong_relist = array(
</span><span class="cx" style="display: block; padding: 0 10px">                ''    => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S|$)(?![.,:;]\s)',
</span><span class="cx" style="display: block; padding: 0 10px">                '***' => '(?<=\S|^)(?<!\*)\*\*\*(?!\*)',
</span><span class="cx" style="display: block; padding: 0 10px">                '___' => '(?<=\S|^)(?<!_)___(?![a-zA-Z0-9_])',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       function formParagraphs($text) {
-       #
-       #       Params:
-       #               $text - string to process with html <p> tags
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function formParagraphs( $text ) {
+               #
+               #       Params:
+               #               $text - string to process with html <p> tags
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Strip leading and trailing lines:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace('/\A\n+|\n+\z/', '', $text);
-               
-               $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace( '/\A\n+|\n+\z/', '', $text );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $grafs = preg_split( '/\n{2,}/', $text, - 1, PREG_SPLIT_NO_EMPTY );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 #
</span><span class="cx" style="display: block; padding: 0 10px">                # Wrap <p> tags and unhashify HTML blocks
</span><span class="cx" style="display: block; padding: 0 10px">                #
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ($grafs as $key => $value) {
-                       $value = trim($this->runSpanGamut($value));
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $grafs as $key => $value ) {
+                       $value = trim( $this->runSpanGamut( $value ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Check if this should be enclosed in a paragraph.
</span><span class="cx" style="display: block; padding: 0 10px">                        # Clean tag hashes & block tag hashes are left alone.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $is_p = !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value);
-                       
-                       if ($is_p) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $is_p = ! preg_match( '/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value );
+
+                       if ( $is_p ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $value = "<p>$value</p>";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $grafs[$key] = $value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $grafs[ $key ] = $value;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               # Join grafs in one text, then unhash HTML tags. 
-               $text = implode("\n\n", $grafs);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               # Join grafs in one text, then unhash HTML tags.
+               $text = implode( "\n\n", $grafs );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Finish by removing any tag hashes still present in $text.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = $this->unhash($text);
-               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = $this->unhash( $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         ### Footnotes
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function stripFootnotes($text) {
-       #
-       # Strips link definitions from text, stores the URLs and titles in
-       # hash references.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function stripFootnotes( $text ) {
+               #
+               # Strips link definitions from text, stores the URLs and titles in
+               # hash references.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Link defs are in the form: [^id]: url "optional title"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
-                       ^[ ]{0,'.$less_than_tab.'}\[\^(.+?)\][ ]?:      # note_id = $1
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
+                       ^[ ]{0,' . $less_than_tab . '}\[\^(.+?)\][ ]?:  # note_id = $1
</ins><span class="cx" style="display: block; padding: 0 10px">                           [ ]*
</span><span class="cx" style="display: block; padding: 0 10px">                          \n?                                   # maybe *one* newline
</span><span class="cx" style="display: block; padding: 0 10px">                        (                                               # text = $2 (no blank lines allowed)
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                (?:                                     
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         (?:
</ins><span class="cx" style="display: block; padding: 0 10px">                                         .+                              # actual text
</span><span class="cx" style="display: block; padding: 0 10px">                                |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        \n                              # newlines but 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 \n                              # newlines but
</ins><span class="cx" style="display: block; padding: 0 10px">                                         (?!\[\^.+?\]:\s)# negative lookahead for footnote marker.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                         # by non-indented content
</span><span class="cx" style="display: block; padding: 0 10px">                                )*
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        )               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 )
</ins><span class="cx" style="display: block; padding: 0 10px">                         }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_stripFootnotes_callback'),
-                       $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_stripFootnotes_callback' ),
+                       $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _stripFootnotes_callback($matches) {
-               $note_id = $this->fn_id_prefix . $matches[1];
-               $this->footnotes[$note_id] = $this->outdent($matches[2]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _stripFootnotes_callback( $matches ) {
+               $note_id                     = $this->fn_id_prefix . $matches[1];
+               $this->footnotes[ $note_id ] = $this->outdent( $matches[2] );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return ''; # String that will replace the block
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        function doFootnotes( $text ) {
+               #
+               # Replace footnote references in $text [^id] with a special text-token
+               # which will be replaced by the actual footnote marker in appendFootnotes.
+               #
+               if ( ! $this->in_anchor ) {
+                       $text = preg_replace( '{\[\^(.+?)\]}', "F\x1Afn:\\1\x1A:", $text );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function doFootnotes($text) {
-       #
-       # Replace footnote references in $text [^id] with a special text-token 
-       # which will be replaced by the actual footnote marker in appendFootnotes.
-       #
-               if (!$this->in_anchor) {
-                       $text = preg_replace('{\[\^(.+?)\]}', "F\x1Afn:\\1\x1A:", $text);
-               }
</del><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function appendFootnotes($text) {
-       #
-       # Append footnote list to text.
-       #
-               $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', 
-                       array(&$this, '_appendFootnotes_callback'), $text);
-       
-               if (!empty($this->footnotes_ordered)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function appendFootnotes( $text ) {
+               #
+               # Append footnote list to text.
+               #
+               $text = preg_replace_callback( '{F\x1Afn:(.*?)\x1A:}',
+                       array( &$this, '_appendFootnotes_callback' ), $text );
+
+               if ( ! empty( $this->footnotes_ordered ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "\n\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        $text .= "<div class=\"footnotes\">\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $text .= "<hr". $this->empty_element_suffix ."\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $text .= "<hr" . $this->empty_element_suffix . "\n";
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "<ol>\n\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $attr = " rev=\"footnote\"";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($this->fn_backlink_class != "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $this->fn_backlink_class != "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $class = $this->fn_backlink_class;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $class = $this->encodeAttribute($class);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $class = $this->encodeAttribute( $class );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $attr .= " class=\"$class\"";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($this->fn_backlink_title != "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $this->fn_backlink_title != "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $title = $this->fn_backlink_title;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $title = $this->encodeAttribute($title);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $title = $this->encodeAttribute( $title );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $attr .= " title=\"$title\"";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                        $num = 0;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                       while (!empty($this->footnotes_ordered)) {
-                               $footnote = reset($this->footnotes_ordered);
-                               $note_id = key($this->footnotes_ordered);
-                               unset($this->footnotes_ordered[$note_id]);
-                               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       while ( ! empty( $this->footnotes_ordered ) ) {
+                               $footnote = reset( $this->footnotes_ordered );
+                               $note_id  = key( $this->footnotes_ordered );
+                               unset( $this->footnotes_ordered[ $note_id ] );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $footnote .= "\n"; # Need to append newline before parsing.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $footnote = $this->runBlockGamut("$footnote\n");                           
-                               $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', 
-                                       array(&$this, '_appendFootnotes_callback'), $footnote);
-                               
-                               $attr = str_replace("%%", ++$num, $attr);
-                               $note_id = $this->encodeAttribute($note_id);
-                               
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $footnote = $this->runBlockGamut( "$footnote\n" );
+                               $footnote = preg_replace_callback( '{F\x1Afn:(.*?)\x1A:}',
+                                       array( &$this, '_appendFootnotes_callback' ), $footnote );
+
+                               $attr    = str_replace( "%%", ++ $num, $attr );
+                               $note_id = $this->encodeAttribute( $note_id );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 # Add backlink to last paragraph; create new paragraph if needed.
</span><span class="cx" style="display: block; padding: 0 10px">                                $backlink = "<a href=\"#fnref:$note_id\"$attr>&#8617;</a>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if (preg_match('{</p>$}', $footnote)) {
-                                       $footnote = substr($footnote, 0, -4) . "&#160;$backlink</p>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( preg_match( '{</p>$}', $footnote ) ) {
+                                       $footnote = substr( $footnote, 0, - 4 ) . "&#160;$backlink</p>";
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } else {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $footnote .= "\n\n<p>$backlink</p>";
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $text .= "<li id=\"fn:$note_id\">\n";
</span><span class="cx" style="display: block; padding: 0 10px">                                $text .= $footnote . "\n";
</span><span class="cx" style="display: block; padding: 0 10px">                                $text .= "</li>\n\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $text .= "</ol>\n";
</span><span class="cx" style="display: block; padding: 0 10px">                        $text .= "</div>";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _appendFootnotes_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _appendFootnotes_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $node_id = $this->fn_id_prefix . $matches[1];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 # Create footnote marker only if it has a corresponding footnote *and*
</span><span class="cx" style="display: block; padding: 0 10px">                # the footnote hasn't been used by another marker.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (isset($this->footnotes[$node_id])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $this->footnotes[ $node_id ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         # Transfert footnote content to the ordered list.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->footnotes_ordered[$node_id] = $this->footnotes[$node_id];
-                       unset($this->footnotes[$node_id]);
-                       
-                       $num = $this->footnote_counter++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->footnotes_ordered[ $node_id ] = $this->footnotes[ $node_id ];
+                       unset( $this->footnotes[ $node_id ] );
+
+                       $num  = $this->footnote_counter ++;
</ins><span class="cx" style="display: block; padding: 0 10px">                         $attr = " rel=\"footnote\"";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($this->fn_link_class != "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $this->fn_link_class != "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $class = $this->fn_link_class;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $class = $this->encodeAttribute($class);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $class = $this->encodeAttribute( $class );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $attr .= " class=\"$class\"";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ($this->fn_link_title != "") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( $this->fn_link_title != "" ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $title = $this->fn_link_title;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $title = $this->encodeAttribute($title);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $title = $this->encodeAttribute( $title );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $attr .= " title=\"$title\"";
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        
-                       $attr = str_replace("%%", $num, $attr);
-                       $node_id = $this->encodeAttribute($node_id);
-                       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       $attr    = str_replace( "%%", $num, $attr );
+                       $node_id = $this->encodeAttribute( $node_id );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         return
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                "<sup id=\"fnref:$node_id\">".
-                               "<a href=\"#fn:$node_id\"$attr>$num</a>".
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         "<sup id=\"fnref:$node_id\">" .
+                               "<a href=\"#fn:$node_id\"$attr>$num</a>" .
</ins><span class="cx" style="display: block; padding: 0 10px">                                 "</sup>";
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-               return "[^".$matches[1]."]";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               return "[^" . $matches[1] . "]";
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                
-       
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         ### Abbreviations ###
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       function stripAbbreviations($text) {
-       #
-       # Strips abbreviations from text, stores titles in hash references.
-       #
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function stripAbbreviations( $text ) {
+               #
+               # Strips abbreviations from text, stores titles in hash references.
+               #
</ins><span class="cx" style="display: block; padding: 0 10px">                 $less_than_tab = $this->tab_width - 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                # Link defs are in the form: [id]*: url "optional title"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $text = preg_replace_callback('{
-                       ^[ ]{0,'.$less_than_tab.'}\*\[(.+?)\][ ]?:      # abbr_id = $1
-                       (.*)                                    # text = $2 (no blank lines allowed)    
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $text = preg_replace_callback( '{
+                       ^[ ]{0,' . $less_than_tab . '}\*\[(.+?)\][ ]?:  # abbr_id = $1
+                       (.*)                                    # text = $2 (no blank lines allowed)
</ins><span class="cx" style="display: block; padding: 0 10px">                         }xm',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(&$this, '_stripAbbreviations_callback'),
-                       $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array( &$this, '_stripAbbreviations_callback' ),
+                       $text );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _stripAbbreviations_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _stripAbbreviations_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $abbr_word = $matches[1];
</span><span class="cx" style="display: block; padding: 0 10px">                $abbr_desc = $matches[2];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ($this->abbr_word_re)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->abbr_word_re ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this->abbr_word_re .= '|';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->abbr_word_re .= preg_quote($abbr_word);
-               $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         }
+               $this->abbr_word_re .= preg_quote( $abbr_word );
+               $this->abbr_desciptions[ $abbr_word ] = trim( $abbr_desc );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return ''; # String that will replace the block
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        
-       
-       function doAbbreviations($text) {
-       #
-       # Find defined abbreviations in text and wrap them in <abbr> elements.
-       #
-               if ($this->abbr_word_re) {
-                       // cannot use the /x modifier because abbr_word_re may 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function doAbbreviations( $text ) {
+               #
+               # Find defined abbreviations in text and wrap them in <abbr> elements.
+               #
+               if ( $this->abbr_word_re ) {
+                       // cannot use the /x modifier because abbr_word_re may
</ins><span class="cx" style="display: block; padding: 0 10px">                         // contain significant spaces:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $text = preg_replace_callback('{'.
-                               '(?<![\w\x1A])'.
-                               '(?:'.$this->abbr_word_re.')'.
-                               '(?![\w\x1A])'.
-                               '}', 
-                               array(&$this, '_doAbbreviations_callback'), $text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $text = preg_replace_callback( '{' .
+                                                      '(?<![\w\x1A])' .
+                                                      '(?:' . $this->abbr_word_re . ')' .
+                                                      '(?![\w\x1A])' .
+                                                      '}',
+                               array( &$this, '_doAbbreviations_callback' ), $text );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $text;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        function _doAbbreviations_callback($matches) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       function _doAbbreviations_callback( $matches ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $abbr = $matches[0];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if (isset($this->abbr_desciptions[$abbr])) {
-                       $desc = $this->abbr_desciptions[$abbr];
-                       if (empty($desc)) {
-                               return $this->hashPart("<abbr>$abbr</abbr>");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( isset( $this->abbr_desciptions[ $abbr ] ) ) {
+                       $desc = $this->abbr_desciptions[ $abbr ];
+                       if ( empty( $desc ) ) {
+                               return $this->hashPart( "<abbr>$abbr</abbr>" );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $desc = $this->encodeAttribute($desc);
-                               return $this->hashPart("<abbr title=\"$desc\">$abbr</abbr>");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $desc = $this->encodeAttribute( $desc );
+
+                               return $this->hashPart( "<abbr title=\"$desc\">$abbr</abbr>" );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                } else {
</span><span class="cx" style="display: block; padding: 0 10px">                        return $matches[0];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> PHP Markdown Extra
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2851,9 +2875,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> Description
</span><span class="cx" style="display: block; padding: 0 10px"> -----------
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-This is a PHP port of the original Markdown formatter written in Perl 
-by John Gruber. This special "Extra" version of PHP Markdown features 
-further enhancements to the syntax for making additional constructs 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+This is a PHP port of the original Markdown formatter written in Perl
+by John Gruber. This special "Extra" version of PHP Markdown features
+further enhancements to the syntax for making additional constructs
</ins><span class="cx" style="display: block; padding: 0 10px"> such as tables and definition list.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> Markdown is a text-to-HTML filter; it translates an easy-to-read /
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2883,7 +2907,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> Version History
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">---------------- 
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+---------------
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> See the readme file for detailed release notes for this version.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2891,14 +2915,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> Copyright and License
</span><span class="cx" style="display: block; padding: 0 10px"> ---------------------
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-PHP Markdown & Extra  
-Copyright (c) 2004-2009 Michel Fortin  
-<http://michelf.com/>  
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+PHP Markdown & Extra
+Copyright (c) 2004-2009 Michel Fortin
+<http://michelf.com/>
</ins><span class="cx" style="display: block; padding: 0 10px"> All rights reserved.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Based on Markdown  
-Copyright (c) 2003-2006 John Gruber   
-<http://daringfireball.net/>   
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Based on Markdown
+Copyright (c) 2003-2006 John Gruber
+<http://daringfireball.net/>
</ins><span class="cx" style="display: block; padding: 0 10px"> All rights reserved.
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> Redistribution and use in source and binary forms, with or without
</span></span></pre>
</div>
</div>

</body>
</html>