Opened 20 years ago
Closed 20 years ago
#488 closed defect (bug) (fixed)
convert linebreaks breaks pre-tag formattting
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 1.5 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
When posting something within pre-tags that has empty lines those empty lines get padded with p-tags by the wpautop-filter. First, this breaks XHTML because it closes tags that haven't been opened and opens tags that never get closed, and second, after the p-tags font is not monospaced as it should be within pre-tags.
Change History (12)
#3
@
20 years ago
There is a related post in the forums: http://wordpress.org/support/3/10535
#8
@
20 years ago
OK, have a look at http://wiki.wordpress.org/?pagename=autop-bugs
#9
@
20 years ago
on a side note, using the CODE tags, or PRE doesn't do what I thought - i.e. doesn't just display the code. I've been using this:
http://resources.wordpress.org/tools/encode/
#10
@
20 years ago
These two lines added to wp-includes/functions-formatting.php seem to fix the problem:
function clean_pre($text) {
$text = str_replace('<br />', , $text);
+ $text = str_replace('<p>', "\n", $text);
+ $text = str_replace('</p>', , $text);
return $text;
}
#11
@
20 years ago
bugger, first I did'nt log in and then I mess up the tags once again...
look at http://wiki.wordpress.org/?pagename=autop-bugs for the solution.
edited on: 12-20-04 10:58
The tags in "additional information" up there got swallowed, but is shows that monospaced font gets lost on the way... ;-)
Here's the example again:
<pre>[pre]
line with textp</p>
<p>[p]line with text
pre</pre>
edited on: 11-24-04 12:14
edited on: 11-24-04 12:15