Changeset 1115028
- Timestamp:
- 03/18/2015 05:00:28 AM (11 years ago)
- Location:
- parsedown-wp
- Files:
-
- 8 added
- 2 edited
-
tags/0.3 (added)
-
tags/0.3/Parsedown (added)
-
tags/0.3/Parsedown/LICENSE.txt (added)
-
tags/0.3/Parsedown/Parsedown.php (added)
-
tags/0.3/Parsedown/ParsedownExtra.php (added)
-
tags/0.3/license.txt (added)
-
tags/0.3/parsedown-wp.php (added)
-
tags/0.3/readme.txt (added)
-
trunk/parsedown-wp.php (modified) (10 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
parsedown-wp/trunk/parsedown-wp.php
r1102876 r1115028 4 4 Plugin URI: https://wordpress.org/plugins/parsedown-wp/ 5 5 Description: A drop-in Markdown plugin using Parsedown Extra. 6 Version: 0. 26 Version: 0.3 7 7 Author: Robin Adrianse 8 8 Author URI: http://robinadr.com/ … … 14 14 15 15 /* 16 17 16 This plugin is intended to be a 100% compatible drop-in replacement for PHP 18 17 Markdown Extra by Michel Fortin. Thus, some portions, namely filter order and … … 56 55 negligence or otherwise) arising in any way out of the use of this 57 56 software, even if advised of the possibility of such damage. 58 59 57 */ 60 58 … … 64 62 class Parsedown_WP_Parser extends ParsedownExtra 65 63 { 66 protected function inlineSpecialCharacter( $ excerpt )64 protected function inlineSpecialCharacter( $text ) 67 65 { 68 66 // Do nothing. WordPress handles HTML special characters … … 95 93 remove_filter( 'the_excerpt', 'wpautop' ); 96 94 97 add_filter( 'the_content', array( $this, ' pdwp_markdown' ), 6 );98 add_filter( 'the_content_rss', array( $this, ' pdwp_markdown' ), 6 );99 add_filter( 'get_the_excerpt', array( $this, ' pdwp_markdown' ), 6 );95 add_filter( 'the_content', array( $this, 'markdown' ), 6 ); 96 add_filter( 'the_content_rss', array( $this, 'markdown' ), 6 ); 97 add_filter( 'get_the_excerpt', array( $this, 'markdown' ), 6 ); 100 98 add_filter( 'get_the_excerpt', 'trim', 7 ); 101 add_filter( 'the_excerpt', array( $this, ' pdwp_add_p' ) );102 add_filter( 'the_excerpt_rss', array( $this, ' pdwp_strip_p' ) );99 add_filter( 'the_excerpt', array( $this, 'add_p' ) ); 100 add_filter( 'the_excerpt_rss', array( $this, 'strip_p' ) ); 103 101 104 102 remove_filter( 'content_save_pre', 'balanceTags', 50 ); 105 103 remove_filter( 'excerpt_save_pre', 'balanceTags', 50 ); 106 add_filter( 'the_content', 'balanceTags', 50 ); 107 add_filter( 'get_the_excerpt', 'balanceTags', 9 ); 104 105 add_filter( 'the_content', 'balanceTags', 50 ); 106 add_filter( 'get_the_excerpt', 'balanceTags', 9 ); 108 107 109 108 // Comment filters … … 111 110 remove_filter( 'comment_text', 'make_clickable' ); 112 111 113 add_filter( 'pre_comment_content', array( $this, ' pdwp_markdown' ), 6 );114 add_filter( 'pre_comment_content', array( $this, ' pdwp_hide_tags' ), 8 );115 add_filter( 'pre_comment_content', array( $this, ' pdwp_show_tags' ), 12 );116 add_filter( 'get_comment_text', array( $this, ' pdwp_markdown' ), 6 );117 add_filter( 'get_comment_excerpt', array( $this, ' pdwp_markdown' ), 6 );118 add_filter( 'get_comment_excerpt', array( $this, ' pdwp_strip_p' ), 7 );112 add_filter( 'pre_comment_content', array( $this, 'markdown' ), 6 ); 113 add_filter( 'pre_comment_content', array( $this, 'hide_tags' ), 8 ); 114 add_filter( 'pre_comment_content', array( $this, 'show_tags' ), 12 ); 115 add_filter( 'get_comment_text', array( $this, 'markdown' ), 6 ); 116 add_filter( 'get_comment_excerpt', array( $this, 'markdown' ), 6 ); 117 add_filter( 'get_comment_excerpt', array( $this, 'strip_p' ), 7 ); 119 118 120 119 // Taken from PHP Markdown Extra by Michel Fortin … … 132 131 } 133 132 134 public function pdwp_markdown( $text )133 public function markdown( $text ) 135 134 { 136 135 return apply_filters( 'pdwp_markdown', $this->parser->text( $text ) ); … … 138 137 139 138 // Taken from PHP Markdown Extra by Michel Fortin 140 public function pdwp_add_p( $text )139 public function add_p( $text ) 141 140 { 142 141 $regex = apply_filters( 'pdwp_add_p_regex', '{^$|^<(p|ul|ol|dl|pre|blockquote)>}i' ); 143 142 144 if ( !preg_match( $regex, $text ) ) {143 if ( !preg_match( $regex, $text ) ) { 145 144 $text = '<p>' . $text . '</p>'; 146 145 $text = preg_replace( '{\n{2,}}', "</p>\n\n<p>", $text ); … … 151 150 152 151 // Taken from PHP Markdown Extra by Michel Fortin 153 public function pdwp_strip_p( $text )152 public function strip_p( $text ) 154 153 { 155 return apply_filters( 'pdwp_strip_p', preg_replace( '{</?p>}i', '', $t ) );154 return apply_filters( 'pdwp_strip_p', preg_replace( '{</?p>}i', '', $text ) ); 156 155 } 157 156 158 157 // Taken from PHP Markdown Extra by Michel Fortin 159 public function pdwp_hide_tags( $text )158 public function hide_tags( $text ) 160 159 { 161 160 return str_replace( $this->hidden_tags, $this->placeholders, $text ); … … 163 162 164 163 // Taken from PHP Markdown Extra by Michel Fortin 165 public function pdwp_show_tags( $text )164 public function show_tags( $text ) 166 165 { 167 166 return str_replace( $this->placeholders, $this->hidden_tags, $text ); -
parsedown-wp/trunk/readme.txt
r1102876 r1115028 4 4 Tags: markdown, formatting, posting, writing, markup 5 5 Tested up to: 4.1.1 6 Stable tag: 0. 26 Stable tag: 0.3 7 7 License: MIT 8 8 License URI: http://opensource.org/licenses/MIT … … 31 31 == Changelog == 32 32 33 = 0.3 = 34 35 * Fixed comment text not showing up in admin (issue #2) 36 33 37 = 0.2 = 34 38
Note: See TracChangeset
for help on using the changeset viewer.