Plugin Directory

Changeset 1115028


Ignore:
Timestamp:
03/18/2015 05:00:28 AM (11 years ago)
Author:
rob1n
Message:

Push v0.3 out

Location:
parsedown-wp
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • parsedown-wp/trunk/parsedown-wp.php

    r1102876 r1115028  
    44    Plugin URI: https://wordpress.org/plugins/parsedown-wp/
    55    Description: A drop-in Markdown plugin using Parsedown Extra.
    6     Version: 0.2
     6    Version: 0.3
    77    Author: Robin Adrianse
    88    Author URI: http://robinadr.com/
     
    1414
    1515/*
    16 
    1716This plugin is intended to be a 100% compatible drop-in replacement for PHP
    1817Markdown Extra by Michel Fortin. Thus, some portions, namely filter order and
     
    5655negligence or otherwise) arising in any way out of the use of this
    5756software, even if advised of the possibility of such damage.
    58 
    5957*/
    6058
     
    6462class Parsedown_WP_Parser extends ParsedownExtra
    6563{
    66     protected function inlineSpecialCharacter( $excerpt )
     64    protected function inlineSpecialCharacter( $text )
    6765    {
    6866        // Do nothing. WordPress handles HTML special characters
     
    9593        remove_filter( 'the_excerpt',       'wpautop' );
    9694
    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 );
    10098        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' )  );
    103101
    104102        remove_filter( 'content_save_pre',  'balanceTags', 50 );
    105103        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 );
    108107
    109108        // Comment filters
     
    111110        remove_filter( 'comment_text',  'make_clickable' );
    112111
    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 );
    119118
    120119        // Taken from PHP Markdown Extra by Michel Fortin
     
    132131    }
    133132
    134     public function pdwp_markdown( $text )
     133    public function markdown( $text )
    135134    {
    136135        return apply_filters( 'pdwp_markdown', $this->parser->text( $text ) );
     
    138137
    139138    // Taken from PHP Markdown Extra by Michel Fortin
    140     public function pdwp_add_p( $text )
     139    public function add_p( $text )
    141140    {
    142141        $regex = apply_filters( 'pdwp_add_p_regex', '{^$|^<(p|ul|ol|dl|pre|blockquote)>}i' );
    143142
    144         if (!preg_match( $regex, $text ) ) {
     143        if ( !preg_match( $regex, $text ) ) {
    145144            $text = '<p>' . $text . '</p>';
    146145            $text = preg_replace( '{\n{2,}}', "</p>\n\n<p>", $text );
     
    151150
    152151    // Taken from PHP Markdown Extra by Michel Fortin
    153     public function pdwp_strip_p( $text )
     152    public function strip_p( $text )
    154153    {
    155         return apply_filters( 'pdwp_strip_p', preg_replace( '{</?p>}i', '', $t ) );
     154        return apply_filters( 'pdwp_strip_p', preg_replace( '{</?p>}i', '', $text ) );
    156155    }
    157156
    158157    // Taken from PHP Markdown Extra by Michel Fortin
    159     public function pdwp_hide_tags( $text )
     158    public function hide_tags( $text )
    160159    {
    161160        return str_replace( $this->hidden_tags, $this->placeholders, $text );
     
    163162
    164163    // Taken from PHP Markdown Extra by Michel Fortin
    165     public function pdwp_show_tags( $text )
     164    public function show_tags( $text )
    166165    {
    167166        return str_replace( $this->placeholders, $this->hidden_tags, $text );
  • parsedown-wp/trunk/readme.txt

    r1102876 r1115028  
    44Tags: markdown, formatting, posting, writing, markup
    55Tested up to: 4.1.1
    6 Stable tag: 0.2
     6Stable tag: 0.3
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
     
    3131== Changelog ==
    3232
     33= 0.3 =
     34
     35* Fixed comment text not showing up in admin (issue #2)
     36
    3337= 0.2 =
    3438
Note: See TracChangeset for help on using the changeset viewer.