Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#15367 closed defect (bug) (fixed)

WordPress strips multiple line breaks inside of <pre> tags

Reported by: viper007bond's profile Viper007Bond Owned by: garyc40's profile garyc40
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.1
Component: Formatting Keywords: wpautop needs-unit-tests
Focuses: Cc:

Description

Write a post:

<pre>
This


is




a
test.
</pre>

You end up with this:

<pre>
This

is

a
test.
</pre>

Probably related to wpautop() I imagine.

Attachments (1)

15367_formatting_wpautop.patch (2.0 KB) - added by TomAuger 13 years ago.
Modified wpautop in formatting.php

Download all attachments as: .zip

Change History (20)

#1 @Viper007Bond
14 years ago

  • Keywords needs-patch added

#2 @azaozz
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [16394]) Remove invalid parent paragraph when pasting in the visual editor or switching visual to HTML and back, keep multiple empty lines in a <pre> tag, fixes #15095 fixes #15367

#3 follow-up: @Viper007Bond
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This isn't a TinyMCE issue, it's an output filter issue.

#4 in reply to: ↑ 3 @azaozz
14 years ago

Replying to Viper007Bond:
The same was happening when switching editors, perhaps we can apply the changes from the JS version of wpautop to the php one.

#5 @Viper007Bond
14 years ago

No I mean this isn't an editor issue. If I write the above example in the HTML editor, it stays exactly like that. I save the post, still correct. When I view it on the front end however, the extra line breaks are stripped out.

#6 @Viper007Bond
14 years ago

Whoops, I need to learn to read. Yes, we need to apply the code to the PHP-based `wpautp()~ too.

#7 @Viper007Bond
14 years ago

I also need to learn to spell apparently...

#8 @westi
14 years ago

Nah you can spell apparently fairly well it's the other words you should practice ;-)

#9 @nacin
14 years ago

  • Keywords 3.2-early wpautop added
  • Milestone changed from Awaiting Review to Future Release

#10 @garyc40
14 years ago

  • Owner set to garyc40
  • Status changed from reopened to assigned

@TomAuger
13 years ago

Modified wpautop in formatting.php

#12 @TomAuger
13 years ago

  • Keywords needs-testing added

My approach was to preserve all content inside <pre> tags from most of the substitution that occurs on the rest of the text. As a result, the call to clean_pre() is no longer necessary.

#13 @SergeyBiryukov
13 years ago

  • Keywords has-patch added; needs-patch removed

Closed #19666 as a duplicate.

#14 @MikeHansenMe
12 years ago

  • Cc MikeHansenMe added
  • Keywords needs-refresh added

This problem still exists but the patch would not apply. Needs Refresh.

#15 @MikeHansenMe
12 years ago

In addition to my last comment the problem still exist when switching between Visual and Text mode. If you paste the example in text mode and click publish then reload the page it remains as it should. It seems a similar fix is needed for the js.

#16 @nacin
11 years ago

  • Keywords needs-unit-tests added

I can't seem to reproduce this. This needs a unit test, then maybe we can figure out exactly what (PHP/JS/TinyMCE) needs changing.

#17 @azaozz
11 years ago

This was fixed (together with another <pre> issue) in [20307], see #19855. The approach is similar to the patch here.

#18 @miqrogroove
11 years ago

  • Keywords 3.2-early needs-testing has-patch needs-refresh removed

#19 @SergeyBiryukov
11 years ago

  • Milestone changed from Future Release to 3.4
  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.