Importing data (and hard returns), Movable Type to Wordpress
March 3, 2009 5:34 PM   Subscribe

How do I get WordPress to recognize hard returns when importing Movable Type data?

I'm in the process of setting up my blog using WordPress 2.7.1 (migrating from Movable Type 4.2.3). I was able to import all of my entries no problem, but I'm noticing that many of the hard returns don't seem to have carried over.

Specifically, when I view posts via WordPress... I can tell where paragraphs end/begin, but there's no space between paragraphs. It's as though a single hard return registered, but the second hard return did not.

In cracking open the MT export file (just a .txt file), I see that the hard returns are present in the exported file. No paragraph tags or break tags, just hard returns.

In the MT exported .txt file, the entry text looks like this:

Text in paragraph 1.

Text in paragraph 2.


But when viewed via WordPress, the entry text looks like this:

Text in paragraph 1.
Text in paragraph 2.


At this point, my options are:

1) Revisit MT and try to export data out with paragraph and break tags.

I've looked, and there doesn't seem to be anything other than a big "export" button. I've verified that my text formatting settings are set to "convert line breaks."

2) Run GREP patterns sweeps on my exported .txt file and insert any necessary paragraph or break tags for every entry.

3) Figure out some way for WordPress to recognize the hard returns - or at least, the second hard return. In looking a bit closer at the exported MT text file, I see this:

--------
AUTHOR: avoision
TITLE: This Week's Assignment is...
BASENAME: this_weeks_assignment_is
STATUS: Publish
ALLOW COMMENTS: 1
CONVERT BREAKS: __default__
ALLOW PINGS: 1
DATE: 07/04/2002 12:00:01 AM
-----

Is it possible that there's some other value I can change the CONVERT BREAKS line to, so that WordPress will pick up both hard returns in my entry bodies? Again, WP seems to be picking up a singular hard return... but not in cases where I have more than one.

I can create some text factories in BBEdit, but man... I really, really don't want to. I've been keeping a daily blog for about 6 years now, and have about 6,000 entries all in all. It's not that I'm unwilling to roll up my sleeves and do the dirty work - I just am hoping there's another approach that I may not know of.

I'm dusting off my regular expression chops as we speak, but would love to hear any other ideas/options regarding importing this info.
posted by avoision to Computers & Internet (3 answers total) 1 user marked this as a favorite
 
Check out how the formatting is described in this post.

The second hard return is a second line of dashes, like so:
AUTHOR: Shelly
TITLE: I'm Back!
STATUS: Publish
ALLOW COMMENTS: 2
CONVERT BREAKS: 1
ALLOW PINGS: 0

DATE: 09/27/2002 10:58:04 PM
-----
BODY:
post text here
-----
EXTENDED BODY:

-----
EXCERPT:

-----
KEYWORDS:

-----

--------

I successfully imported totally borked up MT data into WP using this formatting.
posted by 8dot3 at 5:38 PM on March 3, 2009


Response by poster: First off - I tip my fucking hat for the 4 minute response time, 8dot3. Color me impressed. I've had a question posted over at the WordPress forums and haven't gotten any bites yet so far.

Unfortunately, I tried changing the CONVERT BREAKS line as suggested, but

CONVERT BREAKS: __default__
CONVERT BREAKS: 1

both seem to be doing the same thing. Namely: registering one hard return, but not two.

Unlike the post mentioned 8dot3 pointed to, I do have a good export from MT. I'm just not sure what other approaches I might take to get WP to register these hard returns. Anyone know of any other settings for the CONVERT BREAKS attribute?
posted by avoision at 7:39 AM on March 4, 2009


Given my response time is somewhat less impressive than 8dot3, you may no longer need this. But I had the same problem today and couldn't find an existing solution, so I wrote my own PHP script to get the job done.

http://www.prqueue.com/mefi/double_break.php.txt

It handles post bodies and extended bodies, but not comments. Those were easier for me to edit manually.
posted by DrJohnEvans at 1:45 PM on May 9, 2009


« Older online swimsuits   |   How do I work this drill? Newer »
This thread is closed to new comments.