• When I enter <br></br> into the article DB, WordPress outputs </br>. This breaks my, well, breaks. Is there anyway I can get WordPress to stop this behavior? Ideally I would like WordPress to just display my article’s content without any HTML manipulation since I upload the content as legal XHTML anyway.
    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Does it break if you enter <br />? That would be the usual valid XHTML.

    Agreed, either use <br /> or <p></p> should work without problems.

    Thread Starter justfloatingonby

    (@justfloatingonby)

    I actually ran a test. If I enter:

    foo<br></br>bar

    then things work fine.

    But if I enter:

    foo<br></br>bar

    Then my <br></br> gets turned into </br>. So this is a 100% repro bug in WordPress.

    How do I report it?

    If I enter <br/> then things work fine. So there is a bug in WordPress’s processing code.

    Thanks!

    Yaron

    In HTML the <br> tag has no end tag.

    In XHTML the <br> tag must be properly closed, like this: < br / >

    However, if you recently upgraded to 2.2, I believe there are some major linebreak issues going on with the editor.

    Thread Starter justfloatingonby

    (@justfloatingonby)

    Right and my content is XHTML which is XML where <x/> == <x></x>. So <br/> == <br></br>. Unless XHTML put on some additional restriction?

    But in any case I’m guessing that we can all agree that wordpress turning <br></br> into </br> when the breaks are inside of a

     tag isn't the right behavior so hence I want to file a bug but I don't know how.

    BTW I did upgrade to 2.2 but I never use the editor. I actually upload my posts directly to MySQL using JDBC. So is the problem in 2.2 the editor or in whatever code is used to process posts before they are displayed?

    Which leads to one of my original questions - is there anyway to turn off all XHTML pre-processing in WordPress? I want what's in the database to just be displayed. Is this possible in WordPress?

    Thanks!

    HTML <br> tag
    Definition and Usage

    The <br> tag inserts a single line break.

    The <br> tag is an empty tag (means that it has no end tag – the following is wrong: <br></br>).
    Differences Between HTML and XHTML

    In HTML the <br> tag has no end tag.

    In XHTML the <br> tag must be properly closed, like this: <br />. Link

    Other than that, I don’t know of a way to get WordPress to not auto-correct code. I personally use <br /> inside my tags and I’m fine. This really isn’t a wordpress bug.

    Now, the <p> tag does have a closed end on the other side of your content.

    Thread Starter justfloatingonby

    (@justfloatingonby)

    Let’s forget about <br> for a moment. Let’s talk about a new tag I just invented called <foo>.

    If I created:

    <foo></foo>

    and WordPress turned that into

    </foo>

    what would we say?

    We would say – WordPress has a bug. It is always illegal in all and every case without exception in XHTML or XML or HTML to have a close tag without an open tag. </foo> is a close tag. WordPress mangled <foo></foo> into </foo> and produced illegal, invalid XHTML/XML/HTML.

    In this case it so happens that WordPress exhibits this behavior with the <br></br> tag but that isn’t the relevant point. It doesn’t matter what element triggers the behavior. All that matters is that WordPress is outputting illegal HTML/XML/XHTML.

    So how do I file a bug that WordPress is outputting illegal markup?

    Thanks,

    Yaron

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    WordPress expects you to put in TEXT. This is not a bug. This is a design decision.

    GIGO. Garbage In, Garbage Out. No right thinking person would input <br></br> because that’s freakin weird, man.

    Look, WordPress does not have a full XHTML parser and validation system. It’s just using a few regular expressions to handle the most common cases. More to the point, it’s not expecting you to put in XHTML at all. It’s expecting text. It will turn that text into XHTML by automatically adding paragraph tags and line breaks as it deems necessary. The only thing HTML you should be putting in is anything special like links and image tags. The basic stuff will be taken care of for you.

    If, for some weird masochistic reason, you have this burning need to write your own f’ed up version of XHTML manually, then look around for a plugin called “disable autop”. There’s also a plugin called “WP Unformatted” which can disable autop or texturize on a per post basis, if you only want to do this some of the time.

    GIGO. Garbage In, Garbage Out. No right thinking person would input <br></br> because that’s freakin weird, man.

    lol:)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘<BR> Mangling in WordPress’ is closed to new replies.