Ticket #7511 (closed defect (bug): invalid)

Opened 5 months ago

Last modified 1 month ago

Code tags get messed up

Reported by: da3rX Assigned to: anonymous
Priority: normal Milestone:
Component: General Version: 2.6
Severity: normal Keywords:
Cc:

Description

Wordpress doesn't like empty lines between code tags.

<code>
a

b

c
</code>

Turns into:

<code>
a</code>

b

c

Change History

08/13/08 17:18:27 changed by azaozz

  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

<code> is an "inline" tag, like <strong> and <em>. More details: Phrase elements: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, and ACRONYM http://www.w3.org/TR/html401/struct/text.html#h-9.2.1

According to the W3C specification blank spaces and line breaks are ignored in it. The only tag that preserves them is the <pre> tag and that is working well in both editors and autop.

(follow-up: ↓ 3 ) 09/09/08 22:05:01 changed by rdworth

  • status changed from closed to reopened.
  • resolution deleted.

The fact that newlines aren't preserved means

<code> a

b

c </code>

could reasonably become

<code>a b c</code>

but not

<code>a</code> b c

as the original description has.

(in reply to: ↑ 2 ) 09/10/08 02:09:13 changed by azaozz

  • status changed from reopened to closed.
  • resolution set to invalid.
  • component changed from TinyMCE to General.

When using the HTML editor pressing Enter once would insert BR tag, pressing it twice would insert P tag. Since you can't wrap paragraphs in <code>, it is limited only to the first paragraph.

If you want to stop converting new lines to paragraphs, you will have to turn off autop (not recommended).

09/12/08 23:21:24 changed by caesarsgrunt

  • status changed from closed to reopened.
  • resolution deleted.

Shouldn't the converter recognise when it is inside a <code> element and not convert newlines to <p>s inside it?

09/13/08 11:50:21 changed by Viper007Bond

<code> is an inline tag. Shouldn't it not have line breaks inside of it?

09/13/08 11:51:06 changed by Viper007Bond

Also -- there are TONS of plugins for pasting code. Why not use one of those? That way you don't have to manual convert to HTML entities, i.e. like < to &lt;.

12/11/08 05:41:11 changed by rmccue

  • status changed from reopened to closed.
  • resolution set to invalid.