[wp-hackers] Fix for importing Markdown posts from Movable Type

Dr. Drang drdrang at gmail.com
Fri Dec 28 18:33:24 GMT 2007


Recently I tried to import a few hundred posts from Movable Type 3.2  
to WordPress 2.3.1. The posts were written in Markdown format, for  
which leading and trailing spaces on a line can be significant. The  
import mishandled the posts that had lines with leading or trailing  
spaces because of line 281 in wp-admin/import/mt.php:

     $line = trim($line);

Changing this line to

     $line = rtrim($line, "\n");

fixed the problem because it got rid of the trailing newline without  
affecting the other whitespace. I have no idea whether this change  
would break imports from other formats, but it worked for my situation.

I first posted a description of my problem on [this thread][1] of the  
Markdown mailing list. Sam Angove found the offending line.

[1]: http://six.pairlist.net/pipermail/markdown-discuss/2007-December/ 
000924.html


--
Dr. Drang





More information about the wp-hackers mailing list