Make WordPress Core

Opened 14 years ago

Last modified 5 years ago

#16147 reopened defect (bug)

MT Importer truncates double vertical spaces, munging paragraphs together

Reported by: novasource's profile novasource Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Import Keywords: needs-patch
Focuses: Cc:


Movable Type 3.x-era exports don't use <p> tags. Like TinyMCE (and WordPress), a <p> in final rendered code is represented by two \ns in a row.

The importer strips out double \ns and replaces with a single \n. This causes paragraphs to lose their distinction upon import.

It does this because the $line variable was created by $line = $this->fgets($handle) (line 339). Then $line = trim($line) (line 340) strips out several characters, including \n.

Lines 455 and 456 add back the \n except on blank lines:

   if( !empty($line) )
   $line .= "\n";

So if a $line was nothing but a \n, it's stripped by the trim function and becomes a 0 character line. Then the if( !empty($line) ) declines to add back a \n.

Somehow this needs to be altered so that successive \ns aren't stripped. Otherwise paragraphs get vertically munged together.

Attachments (2) (429 bytes) - added by gene1wood 13 years ago.
Patch to fix this bug (406 bytes) - added by gene1wood 10 years ago.
Updated patch against SVN rev 893863

Download all attachments as: .zip

Change History (13)

#1 @novasource
14 years ago

Just confirmed that deleting line 455 (if( !empty($line) )) fixed everything for me. Now the \n is restored to the end of every line.

I could see it being prudent, as a cleanup step, to remove any trailing \ns from the post_content, extended, post_except, post_keywords, and comment_content values for good measure.

Reference for a forum post.

Version 0, edited 14 years ago by novasource (next)

#2 @garyc40
14 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I think you should post this ticket (and #16148) in the plugins trac instead of core trac.

Choose MT Importer from the list of Components.

#3 @ocean90
14 years ago

  • Milestone Awaiting Review deleted

#4 @duck_
14 years ago

  • Milestone set to
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Version 3.0.4 deleted

This is currently the correct venue for the official importers which were recently moved to plugin repo.

Still needs review to confirm bug.

#5 @gene1wood
13 years ago

  • Version set to 3.2.1

I can confirm that this bug is present in Wordpress 3.2.1. I imported a Movable Type blog which contained sections like the following in the mt-export.txt file :

So The Lad sent me another one of my pieces--even from Munich he comes to my rescue. Thanks love.

My biggest fear right now is that I might run into the Sicilian on campus somewhere and not have a biting remark ready to hand. If any of you have suggestions, I welcome them.

See, I need to keep the scary rage in place because it helps me get out of bed in the morning.

The double carriage returns were turned into single carriage returns which causes Wordpress to render each of these as sentences with a <br> tag at the end instead of paragraphs.

I fixed this by following the suggestions I found here :
The comments in this entry that suggest changing the "CONVERT BREAKS" values in the mt-export.txt file are incorrect. This is not needed.

I'm attaching a patch which fixes this bug and worked for me.

13 years ago

Patch to fix this bug

#6 follow-up: @chriscct7
10 years ago

  • Keywords reporter-feedback added
  • Severity changed from major to normal

@novasource: Can you verify this still exists?

#7 in reply to: ↑ 6 @novasource
10 years ago

Replying to chriscct7:

@novasource: Can you verify this still exists?

Sorry, this was during a major switch from Movable Type a few years ago. We no longer have Movable Type content to migrate, so I can't test.

#8 @chriscct7
10 years ago

  • Keywords close added; reporter-feedback removed

Yeah, I'm not sure what we're going to do with all these old importer tickets now that none of them are in core anymore. Will mark as close, and ask about this at the next core team irc meetup next week

#9 @gene1wood
10 years ago

@chriscct7 I can confirm that this problem hasn't been fixed as of
Movable Type and TypePad Importer v0.5-beta which is the upcoming version.

Here is the line that causes the bug :

I'll attach an updated patch against the head of the repo. Just gotta get it applied and this bug goes away.

10 years ago

Updated patch against SVN rev 893863

This ticket was mentioned in IRC in #wordpress-dev by chriscct7. View the logs.

10 years ago

#11 @chriscct7
9 years ago

  • Keywords needs-patch added; close removed

Removing the close because it's still valid. Needs patch.

Note: See TracTickets for help on using tickets.