WordPress.org

Ready to get started?Download WordPress

Forums

Movable Type and TypePad Importer
Movable Type importer messes up line spacing (4 posts)

  1. Aren Cambre
    Member
    Posted 3 years ago #

    I have Movable Type and TypePad Importer 0.4. My MT export file has double vertical spaces between each paragraph. For example:

    Paragraph 1.
    
    Paragraph 2.
    
    Paragraph 3.

    When this importer imports the data, it converts everything to single spacing:

    Paragraph 1.
    Paragraph 2.
    Paragraph 3.

    I noticed this on the rendered output, and I double-checked by loading an importing blog entry in the editor and clicking on the HTML tab.

    Why is that, and how do I stop it?

    http://wordpress.org/extend/plugins/movabletype-importer/

  2. Aren Cambre
    Member
    Posted 3 years ago #

    Further inspection shows that it's just scooping up the content verbatim and shoving it into WordPress via wp_insert_post.

    I went straight to the mysql database to look at the post_content field directly, and the vertical spacing has indeed been collapsed.

  3. Aren Cambre
    Member
    Posted 3 years ago #

    I think I found it. Lines 455 and 456:

    <?php
       if( !empty($line) )
       $line .= "\n";
    ?>

    At this point, the script is processing the inside of a field. $line was set in line 340 with $line = trim($line);, which per http://php.net/manual/en/function.trim.php would have stripped off the \n. So a line that was originally nothing other than \n is now blank when it hits line 455, and because of if( !empty($line) )

    In a nutshell, if the line was only \n, that \n was stripped and is not added back. Hence double vertical spaces are being collapsed into single vertical spaces.

  4. Aren Cambre
    Member
    Posted 3 years ago #

    Ok, just want to confirm that deleting line 455 (if( !empty($line) )) fixed everything for me. Now line 456 ($line .= "\n";) is executed every time, and paragraphs aren't munged together.

    This may add an extraneous \n to the end of certain variables. This might need to be cleaned elsewhere?

    Submitted bug report: http://core.trac.wordpress.org/ticket/16147

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic