PHP Markdown 1.0.1g
This commit is contained in:
parent
bd6948f81c
commit
89dafd4a13
2 changed files with 107 additions and 112 deletions
|
|
@ -1,7 +1,7 @@
|
|||
PHP Markdown
|
||||
============
|
||||
|
||||
Version 1.0.2b8 - Mon 21 May 2007
|
||||
Version 1.0.1g - Tue 3 Jul 2007
|
||||
|
||||
by Michel Fortin
|
||||
<http://www.michelf.com/>
|
||||
|
|
@ -203,6 +203,57 @@ expected; (3) the output PHP Markdown actually produced.
|
|||
Version History
|
||||
---------------
|
||||
|
||||
1.0.1g (3 Jul 2007):
|
||||
|
||||
* Fix for PHP 5 compiled without the mbstring module. Previous fix to
|
||||
calculate the length of UTF-8 strings in `detab` when `mb_strlen` is
|
||||
not available was only working with PHP 4.
|
||||
|
||||
* Fixed a problem with WordPress 2.x where full-content posts in RSS feeds
|
||||
were not processed correctly by Markdown.
|
||||
|
||||
* Now supports URLs containing literal parentheses for inline links
|
||||
and images, such as:
|
||||
|
||||
[WIMP](http://en.wikipedia.org/wiki/WIMP_(computing))
|
||||
|
||||
Such parentheses may be arbitrarily nested, but must be
|
||||
balanced. Unbalenced parentheses are allowed however when the URL
|
||||
when escaped or when the URL is enclosed in angle brakets `<>`.
|
||||
|
||||
* Fixed a performance problem where the regular expression for strong
|
||||
emphasis introduced in version 1.0.1d could sometime be long to process,
|
||||
give slightly wrong results, and in some circumstances could remove
|
||||
entirely the content for a whole paragraph.
|
||||
|
||||
* Some change in version 1.0.1d made possible the incorrect nesting of
|
||||
anchors within each other. This is now fixed.
|
||||
|
||||
* Fixed a rare issue where certain MD5 hashes in the content could
|
||||
be changed to their corresponding text. For instance, this:
|
||||
|
||||
The MD5 value for "+" is "26b17225b626fb9238849fd60eabdf60".
|
||||
|
||||
was incorrectly changed to this in previous versions of PHP Markdown:
|
||||
|
||||
<p>The MD5 value for "+" is "+".</p>
|
||||
|
||||
* Now convert escaped characters to their numeric character
|
||||
references equivalent.
|
||||
|
||||
This fix an integration issue with SmartyPants and backslash escapes.
|
||||
Since Markdown and SmartyPants have some escapable characters in common,
|
||||
it was sometime necessary to escape them twice. Previously, two
|
||||
backslashes were sometime required to prevent Markdown from "eating" the
|
||||
backslash before SmartyPants sees it:
|
||||
|
||||
Here are two hyphens: \\--
|
||||
|
||||
Now, only one backslash will do:
|
||||
|
||||
Here are two hyphens: \--
|
||||
|
||||
|
||||
1.0.1f (7 Feb 2007):
|
||||
|
||||
* Fixed an issue with WordPress where manually-entered excerpts, but
|
||||
|
|
|
|||
166
markdown.php
166
markdown.php
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
|
||||
|
||||
define( 'MARKDOWN_VERSION', "1.0.2b8" ); # Mon 21 May 2007
|
||||
define( 'MARKDOWN_VERSION', "1.0.1g" ); # Tue 3 Jul 2007
|
||||
|
||||
|
||||
#
|
||||
|
|
@ -62,7 +62,7 @@ function Markdown($text) {
|
|||
Plugin Name: Markdown
|
||||
Plugin URI: http://www.michelf.com/projects/php-markdown/
|
||||
Description: <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://www.michelf.com/projects/php-markdown/">More...</a>
|
||||
Version: 1.0.2b8
|
||||
Version: 1.0.1g
|
||||
Author: Michel Fortin
|
||||
Author URI: http://www.michelf.com/
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@ if (isset($wp_version)) {
|
|||
global $wp_markdown_hidden;
|
||||
$wp_markdown_hidden[1] =
|
||||
'<p> </p> <pre> </pre> <ol> </ol> <ul> </ul> <li> </li>';
|
||||
$wp_markdown_hidden[2] = explode(str_rot13(
|
||||
$wp_markdown_hidden[2] = explode(' ', str_rot13(
|
||||
'pEj07ZbbBZ U1kqgh4w4p pre2zmeN6K QTi31t9pre ol0MP1jzJR '.
|
||||
'ML5IjmbRol ulANi1NsGY J7zRLJqPul liA8ctl16T K9nhooUHli'));
|
||||
}
|
||||
|
|
@ -410,7 +410,7 @@ class Markdown_Parser {
|
|||
[ ]* # trailing spaces/tabs
|
||||
(?=\n+|\Z) # followed by a newline or end of document
|
||||
)
|
||||
}xm',
|
||||
}xmi',
|
||||
array(&$this, '_hashHTMLBlocks_callback'),
|
||||
$text);
|
||||
|
||||
|
|
@ -427,7 +427,7 @@ class Markdown_Parser {
|
|||
[ ]* # trailing spaces/tabs
|
||||
(?=\n+|\Z) # followed by a newline or end of document
|
||||
)
|
||||
}xm',
|
||||
}xmi',
|
||||
array(&$this, '_hashHTMLBlocks_callback'),
|
||||
$text);
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ class Markdown_Parser {
|
|||
[ ]*
|
||||
(?=\n{2,}|\Z) # followed by a blank line or end of document
|
||||
)
|
||||
}x',
|
||||
}xi',
|
||||
array(&$this, '_hashHTMLBlocks_callback'),
|
||||
$text);
|
||||
|
||||
|
|
@ -719,14 +719,14 @@ class Markdown_Parser {
|
|||
# These must come last in case you've also got [link test][1]
|
||||
# or [link test](/foo)
|
||||
#
|
||||
$text = preg_replace_callback('{
|
||||
( # wrap whole match in $1
|
||||
\[
|
||||
([^\[\]]+) # link text = $2; can\'t contain [ or ]
|
||||
\]
|
||||
)
|
||||
}xs',
|
||||
array(&$this, '_doAnchors_reference_callback'), $text);
|
||||
// $text = preg_replace_callback('{
|
||||
// ( # wrap whole match in $1
|
||||
// \[
|
||||
// ([^\[\]]+) # link text = $2; can\'t contain [ or ]
|
||||
// \]
|
||||
// )
|
||||
// }xs',
|
||||
// array(&$this, '_doAnchors_reference_callback'), $text);
|
||||
|
||||
$this->in_anchor = false;
|
||||
return $text;
|
||||
|
|
@ -1285,41 +1285,41 @@ class Markdown_Parser {
|
|||
if (isset($this->html_blocks[$graf])) {
|
||||
$block = $this->html_blocks[$graf];
|
||||
$graf = $block;
|
||||
if (preg_match('{
|
||||
\A
|
||||
( # $1 = <div> tag
|
||||
<div \s+
|
||||
[^>]*
|
||||
\b
|
||||
markdown\s*=\s* ([\'"]) # $2 = attr quote char
|
||||
1
|
||||
\2
|
||||
[^>]*
|
||||
>
|
||||
)
|
||||
( # $3 = contents
|
||||
.*
|
||||
)
|
||||
(</div>) # $4 = closing tag
|
||||
\z
|
||||
}xs', $block, $matches))
|
||||
{
|
||||
list(, $div_open, , $div_content, $div_close) = $matches;
|
||||
|
||||
# We can't call Markdown(), because that resets the hash;
|
||||
# that initialization code should be pulled into its own sub, though.
|
||||
$div_content = $this->hashHTMLBlocks($div_content);
|
||||
|
||||
# Run document gamut methods on the content.
|
||||
foreach ($this->document_gamut as $method => $priority) {
|
||||
$div_content = $this->$method($div_content);
|
||||
}
|
||||
|
||||
$div_open = preg_replace(
|
||||
'{\smarkdown\s*=\s*([\'"]).+?\1}', '', $div_open);
|
||||
|
||||
$graf = $div_open . "\n" . $div_content . "\n" . $div_close;
|
||||
}
|
||||
// if (preg_match('{
|
||||
// \A
|
||||
// ( # $1 = <div> tag
|
||||
// <div \s+
|
||||
// [^>]*
|
||||
// \b
|
||||
// markdown\s*=\s* ([\'"]) # $2 = attr quote char
|
||||
// 1
|
||||
// \2
|
||||
// [^>]*
|
||||
// >
|
||||
// )
|
||||
// ( # $3 = contents
|
||||
// .*
|
||||
// )
|
||||
// (</div>) # $4 = closing tag
|
||||
// \z
|
||||
// }xs', $block, $matches))
|
||||
// {
|
||||
// list(, $div_open, , $div_content, $div_close) = $matches;
|
||||
//
|
||||
// # We can't call Markdown(), because that resets the hash;
|
||||
// # that initialization code should be pulled into its own sub, though.
|
||||
// $div_content = $this->hashHTMLBlocks($div_content);
|
||||
//
|
||||
// # Run document gamut methods on the content.
|
||||
// foreach ($this->document_gamut as $method => $priority) {
|
||||
// $div_content = $this->$method($div_content);
|
||||
// }
|
||||
//
|
||||
// $div_open = preg_replace(
|
||||
// '{\smarkdown\s*=\s*([\'"]).+?\1}', '', $div_open);
|
||||
//
|
||||
// $graf = $div_open . "\n" . $div_content . "\n" . $div_close;
|
||||
// }
|
||||
$grafs[$key] = $graf;
|
||||
}
|
||||
}
|
||||
|
|
@ -1517,7 +1517,7 @@ class Markdown_Parser {
|
|||
# tab characters. Then we reconstruct every line by adding the
|
||||
# appropriate number of space between each blocks.
|
||||
|
||||
$strlen = $this->utf8_strlen; # best strlen function for UTF-8.
|
||||
$strlen = $this->utf8_strlen; # strlen function for UTF-8.
|
||||
$lines = explode("\n", $text);
|
||||
$text = "";
|
||||
|
||||
|
|
@ -1540,18 +1540,14 @@ class Markdown_Parser {
|
|||
function _initDetab() {
|
||||
#
|
||||
# Check for the availability of the function in the `utf8_strlen` property
|
||||
# (probably `mb_strlen`). If the function is not available, create a
|
||||
# (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 = 'Markdown_UTF8_strlen';
|
||||
|
||||
if (function_exists($this->utf8_strlen)) return;
|
||||
function Markdown_UTF8_strlen($text) {
|
||||
return preg_match_all('/[\x00-\xBF]|[\xC0-\xFF][\x80-\xBF]*/',
|
||||
$text, $m);
|
||||
}
|
||||
$this->utf8_strlen = create_function('$text', 'return preg_match_all(
|
||||
"/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
|
||||
$text, $m);');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1608,52 +1604,7 @@ Version History
|
|||
|
||||
See the readme file for detailed release notes for this version.
|
||||
|
||||
1.0.2b8 (21 May 2007):
|
||||
|
||||
* Fixed a problem with WordPress 2.x where full-content posts in RSS feeds
|
||||
were not processed correctly by Markdown.
|
||||
|
||||
* Now supports URLs containing literal parentheses for inline links
|
||||
and images, such as:
|
||||
|
||||
[WIMP](http://en.wikipedia.org/wiki/WIMP_(computing))
|
||||
|
||||
Such parentheses may be arbitrarily nested, but must be
|
||||
balanced. Unbalenced parentheses are allowed however when the URL
|
||||
when escaped or when the URL is enclosed in angle brakets `<>`.
|
||||
|
||||
* Fixed a performance problem with the regular expression for strong
|
||||
emphasis introduced in version 1.0.1d could sometime be long to process,
|
||||
give slightly wrong results, and in some circumstances could remove
|
||||
entirely the content for a whole paragraph.
|
||||
|
||||
* Some change in version 1.0.1d made possible the incorrect nesting of
|
||||
anchors within each other. This is now fixed.
|
||||
|
||||
* Fixed a rare issue where certain MD5 hashes in the content could
|
||||
be changed to their corresponding text. For instance, this:
|
||||
|
||||
The MD5 value for "+" is "26b17225b626fb9238849fd60eabdf60".
|
||||
|
||||
was incorrectly changed to this in previous versions of PHP Markdown:
|
||||
|
||||
<p>The MD5 value for "+" is "+".</p>
|
||||
|
||||
* Now convert the escaped characters to their numeric character
|
||||
references equivalent.
|
||||
|
||||
This fix an integration issue with SmartyPants and backslash escapes.
|
||||
Since Markdown and SmartyPants have some escapable characters in common,
|
||||
it was sometime necessary to escape them twice. Previously, two
|
||||
backslashes were sometime required to prevent Markdown from "eating" the
|
||||
backslash before SmartyPants sees it:
|
||||
|
||||
Here are two hyphens: \\--
|
||||
|
||||
Now, only one backslash will do:
|
||||
|
||||
Here are two hyphens: \--
|
||||
|
||||
1.0.1g (3 Jul 2007)
|
||||
|
||||
1.0.1f (7 Feb 2007)
|
||||
|
||||
|
|
@ -1661,13 +1612,6 @@ See the readme file for detailed release notes for this version.
|
|||
|
||||
1.0.1d (1 Dec 2006)
|
||||
|
||||
1.0.1b7 (16 Sep 2006):
|
||||
|
||||
* Filthy hack to support markdown='1' in div tags.
|
||||
|
||||
* Experimental support for [this] as a synonym for [this][].
|
||||
|
||||
|
||||
1.0.1c (9 Dec 2005)
|
||||
|
||||
1.0.1b (6 Jun 2005)
|
||||
|
|
|
|||
Loading…
Reference in a new issue