Why does the sourcecode tag chew up formatted source code?

  • Unknown's avatar

    For the last month or so, WP has been chewing up formatted source code into a single line, by inserting br tags at each former line ending.

    The result looks like this:

    [sourcecode language="cpp" gutter="false"]
    // Dishwasher rack protector
    // Simplified version for OpenSCAD course

    ThreadThick = 0.25;
    ThreadWidth = 0.40;

    Protrusion = 0.1; // make holes end cleanly

    There’s no way to recover the code after that happens, other than pasting it from the source file.

    This doesn’t happen every time and it does *not* happen when saving the post, so there’s a problem with the conversion from the editable post format to the backend database format. The post that’s going up today (26 Sep 2013) looked fine when I saved it yesterday, but all four code blocks were destroyed overnight.

    Perhaps some new chunk of WP code isn’t handling the closing br tag correctly, as only the br / tags remain?

    If you need any further reports, I can (alas) provide them as they happen…

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Oh, and this goofy “forum” interface corrects the br tags, so that code listing looks fine. There’s no obvious way to escape the tag, but just insert one of these at each line end:

    open angle
    br
    space
    front slash
    close angle

    to get the picture. Sigh…

  • The topic ‘Why does the sourcecode tag chew up formatted source code?’ is closed to new replies.