Textile lists without the rest
I have a client who wanted a way of doing lists without all of the coding overhead, and without using the visual editor in WordPress. I immediately thought of Textile, and installed TextileWrapper. It worked great for lists. However, it munged in a spectacular way the rest of the site, riding roughshod over her existing markup.
I tend to give each site that I make a custom WordPress plugin of bits and pieces that come in handy. Filters for text, little functions like time_since() and has_tags(), that sort of thing. To this, I added the following:
function textile( $s ) {
$textile = new Textile;
return $textile->fList( $s );
}
function textile_lists( $c ) {
return preg_replace_callback( "/^[#*]+?.*.(^[^#*])/smU" , "textile" , $c );
}
add_filter( 'the_content' , 'textile_lists' , 6);
add_filter( 'the_excerpt' , 'textile_lists' , 6);
// add_filter( 'comment_text' , 'textile_lists' , 6);
I also uploaded classTextile.php to the plugins directory.
A caveat: it gets a teensy bit wonky when the list is the last thing in the entry and there is no linebreak after the last entry in the list. Just make sure there’s a linebreak after the last list item and everything will be fine.
Comments on "Textile lists without the rest"
Leave a comment | Trackback | Comments feed (RSS 2.0)Sorry, there are not any comments on this entry yet. Would you like to leave a comment?