[wp-hackers] 1.5-gamma fixes

Kimmo Suominen kim at tac.nyc.ny.us
Sun Feb 13 08:35:42 GMT 2005


Hi all!

It's amazing and wonderful how more of my local changes keep becoming
unnecessary with each "cvs update" I do.  I am very happy about it!

With 1.5-gamma as of 7:43pm EST on Saturday, there are only three
remaining issues:

1) Using wptexturize in single_post_title seems wrong: smart quotes are
   not rendered but displayed as their raw entity codes.

   Verified on:
   - Firefox 1.0 (Gecko/20041107)
   - MSIE 6.0 (6.0.2900.2180.xpsp_sp2_rtm.040803-2158)

   Suggested solution is to not add the filter.

2) When using Markdown, the_excerpt can output raw Markdown code.  This
   happens when the excerpt is created from the content, by truncating
   it.  Markdown can include references further into the document, so
   the complete document has to be processed before truncating.

   For example, if you follow the examples on Daring Fireball, you'll
   place all your link references at the bottom of the document.  Since
   they will be truncated away, the unresolved Markdown code remains in
   the output.

   A possible fix is to introduce a new filter class for formatting the
   data in the content column.  I've used "format_content" below.

3) Related to the previous, Markdown is not processed in the excerpt
   due to the Markdown filter not being added for the_excerpt_rss.

The "cvs diff" output is below for your consideration.

Regards,
+ Kim
-- 
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>


Index: wp-includes/default-filters.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/default-filters.php,v
retrieving revision 1.1
diff -u -r1.1 default-filters.php
--- wp-includes/default-filters.php	7 Feb 2005 07:46:40 -0000	1.1
+++ wp-includes/default-filters.php	13 Feb 2005 08:04:46 -0000
@@ -6,7 +6,8 @@
 add_filter('list_cats', 'wptexturize');
 add_filter('comment_author', 'wptexturize');
 add_filter('comment_text', 'wptexturize');
-add_filter('single_post_title', 'wptexturize');
+//smart quotes don't work inside <title> tags
+//add_filter('single_post_title', 'wptexturize');
 add_filter('the_title', 'wptexturize');
 add_filter('the_content', 'wptexturize');
 add_filter('the_excerpt', 'wptexturize');
@@ -75,4 +76,4 @@
 
 add_action('publish_post', 'generic_ping');
 
-?>
\ No newline at end of file
+?>


Index: wp-content/plugins/markdown.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-content/plugins/markdown.php,v
retrieving revision 1.5
diff -u -r1.5 markdown.php
--- wp-content/plugins/markdown.php	24 Jan 2005 06:30:16 -0000	1.5
+++ wp-content/plugins/markdown.php	13 Feb 2005 08:04:46 -0000
@@ -45,6 +45,8 @@
 	# Add Markdown filter with priority 6 (same as Textile).
 	add_filter('the_content', 'Markdown', 6);
 	add_filter('the_excerpt', 'Markdown', 6);
+	add_filter('the_excerpt_rss', 'Markdown', 6);
+	add_filter('format_content', 'Markdown', 6);
 	add_filter('comment_text', 'Markdown', 6);
 }
 
@@ -1279,4 +1281,4 @@
 software, even if advised of the possibility of such damage.
 
 */
-?>
\ No newline at end of file
+?>
Index: wp-includes/template-functions-post.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-post.php,v
retrieving revision 1.50
diff -u -r1.50 template-functions-post.php
--- wp-includes/template-functions-post.php	12 Feb 2005 08:58:10 -0000	1.50
+++ wp-includes/template-functions-post.php	13 Feb 2005 08:04:47 -0000
@@ -109,8 +109,7 @@
 
 function get_the_excerpt($fakeit = true) {
     global $id, $post;
-    $output = '';
-    $output = $post->post_excerpt;
+
     if (!empty($post->post_password)) { // if there's a password
         if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
             $output = __('There is no excerpt because this is a protected post.');
@@ -118,8 +117,11 @@
         }
     }
 
+    $output = $post->post_excerpt;
+
     // If we haven't got an excerpt, make one in the style of the rss ones
     if (($output == '') && $fakeit) {
+        $output = apply_filters('format_content', $post->post_content);
         $output = $post->post_content;
         $output = strip_tags($output);
         $blah = explode(' ', $output);


More information about the hackers mailing list