Permalink
Browse files

Upgrade to Markdown Extra v1.2.3. Regular Markdown library could be r…

…emoved, because Markdown Extra library now contains also regular version. The bonus is that both can be used at the same time, i.e., entry can have one field with markdown formatter and other field with markdown extra formatter.

Signed-off-by: Alistair Kearney <alistair@21degrees.com.au>
  • Loading branch information...
1 parent 98683c3 commit bbc0f6ffdda7057669cd2dab62516c422da7beff @ahwayakchih ahwayakchih committed with Alistair Kearney Mar 13, 2009
View
3,754 lib/markdown.php 100755 → 100644
View
@@ -1,22 +1,27 @@
<?php
Class formatterpb_markdown extends TextFormatter{
-
+
+ private static $_parser;
+
function about(){
return array(
'name' => 'Markdown Text Formatter',
- 'version' => '1.5',
- 'release-date' => '2007-12-06',
+ 'version' => '1.6',
+ 'release-date' => '2009-03-13',
'author' => array('name' => 'Alistair Kearney',
'website' => 'http://www.pointybeard.com',
'email' => 'alistair@pointybeard.com'),
'description' => 'Write entries in the Markdown format. Wrapper for the PHP Markdown text-to-HTML conversion tool written by Michel Fortin.'
);
}
- function run($string){
- if(!function_exists('Markdown')) include_once(EXTENSIONS . '/markdown/lib/markdown.php');
- return stripslashes(Markdown($string));
+ function run($string){
+ if(!self::$_parser){
+ include_once(EXTENSIONS . '/markdown/lib/markdown.php');
+ self::$_parser = new Markdown_Parser();
+ }
+ return stripslashes(self::$_parser->transform($string));
}
}
@@ -1,12 +1,14 @@
<?php
Class formatterpb_markdownextra extends TextFormatter{
-
+
+ private static $_parser;
+
function about(){
return array(
'name' => 'Markdown Extra Text Formatter',
- 'version' => '1.3',
- 'release-date' => '2007-12-06',
+ 'version' => '1.4',
+ 'release-date' => '2009-03-13',
'author' => array('name' => 'Alistair Kearney',
'website' => 'http://www.pointybeard.com',
'email' => 'alistair@pointybeard.com'),
@@ -15,8 +17,11 @@ function about(){
}
function run($string){
- if(!function_exists('Markdown')) include_once(EXTENSIONS . '/markdown/lib/markdown_extra.php');
- return stripslashes(Markdown($string));
+ if(!self::$_parser){
+ include_once(EXTENSIONS . '/markdown/lib/markdown.php');
+ self::$_parser = new MarkdownExtra_Parser();
+ }
+ return stripslashes(self::$_parser->transform($string));
}
}
@@ -1,25 +1,30 @@
<?php
Class formatterpb_markdownextrasmartypants extends TextFormatter{
-
+
+ private static $_parser;
+
function about(){
return array(
'name' => 'Markdown Extra plus SmartyPants',
- 'version' => '1.3',
- 'release-date' => '2007-12-06',
+ 'version' => '1.4',
+ 'release-date' => '2009-03-13',
'author' => array('name' => 'Alistair Kearney',
'website' => 'http://www.pointybeard.com',
'email' => 'alistair@pointybeard.com'),
'description' => 'Write entries in the Markdown Extra format. The final result is passed through SmartyPants. Wrapper for the PHP Markdown Extra and SmrtyPants text-to-HTML conversion tool written by Michel Fortin.'
);
}
- function run($string){
- if(!function_exists('Markdown')) include_once(EXTENSIONS . '/markdown/lib/markdown_extra.php');
+ function run($string){
+ if(!self::$_parser){
+ include_once(EXTENSIONS . '/markdown/lib/markdown.php');
+ self::$_parser = new MarkdownExtra_Parser();
+ }
+
if(!function_exists('SmartyPants')) include_once(EXTENSIONS . '/markdown/lib/smartypants.php');
- $result = stripslashes(Markdown($string));
- return SmartyPants($result);
+ return SmartyPants(stripslashes(self::$_parser->transform($string)));
}
}

2 comments on commit bbc0f6f

@michael-e

Shouldn’t this get a new version number, e.g. 1.9?

@pointybeard
Owner

yeah, you’re right. I got lazy. ;)

Please sign in to comment.