Opened 4 years ago
Last modified 3 years ago
#11202 new defect (bug)
automatic line breaks in comments
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Future Release |
| Component: | Formatting | Version: | 2.8.5 |
| Severity: | normal | Keywords: | wpautop needs-patch |
| Cc: |
Description
WordPress 2.8.6 has got a Problem with the automatic line break.
Example:
Type the following comment in a WordPress Blog.
Thank you for your comment!<blockquote>this is a small quote</blockquote> Next Text
Then you have to save the comment. If you validate the your publish, you will see, that the sentence "Thank you for your comment!" will be put into the following absurd tags:
p>Thank you for your comment!<br />
If you write a comment with the following code (hit return after the word comment! ),
Thank you for your comment! <blockquote>this is a small quote</blockquote> Next Text
you will get the right codeform when you validate your comment:
<p>Thank you for your comment!</p>
The same Problem exists when you type
test 2 <p> break </p> next text
After the word test 2 you will miss the </p>.
WordPress has got this bug with every single elements like these one:
<p>, <ul>, <ol>, <li>, <h1> bis <h6>, <div>, <blockquote> etc.
When you make manuell a new line in front of these elements, you won't find any problem, so WordPress must put an automatic line break in front of these elements and it doesen't do it. Please fix this nerved bug!!
regards, Dunkelangst from http://www.dunkelangst.org/
Change History (6)
- Component changed from General to Formatting
- Milestone changed from Unassigned to 3.0
- Summary changed from automatic line break to automatic line breaks in comments
Seems this would need something similar to the pre_wpautop function in editor.dev.js (in PHP of course) but a lot simpler since only few HTML elements are allowed in comments.
comment:3
in reply to:
↑ 2
Denis-de-Bernardy — 4 years ago
Replying to azaozz:
Seems this would need something similar to the pre_wpautop function in editor.dev.js (in PHP of course) but a lot simpler since only few HTML elements are allowed in comments.
It's actually much simpler to fix. I've submitted a patch for this in another wpautop ticket somewhere (Formatting component). The only thing that's needed to sort out most of wpautop bugs is to toss in a \n\n character before *and* after opening and closing block elements. It never got committed for some reasons. I still fail to see how such a thing could harm or break, but anyway...
The patch is over in #3833.
The patch in #3833 forces any inline tags or text to be wrapped in <p> when they are inside another block element. Then it tries to fix only <li> by always removing the wrapping <p> from inside of it, but you won't be able to have things like <td>some text</td> or <div>some text</div>, etc.
Related #8644 and few more.

many dups of this