WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 10 years ago

#2259 closed defect (bug) (invalid)

autop creates unclosed paras inside list items

Reported by: Viper007Bond Owned by:
Milestone: Priority: low
Severity: minor Version: 2.0
Component: Template Keywords: autop has-patch
Focuses: Cc:

Description

This is what I entered into my post:

<strong>Frequently Asked Questions:</strong>

<ul>
	<li><strong>Q:</strong> My points are too low! Both BFHQ ingame and BF2S.com show more points than the plugin is currently showing. Why is that?

<strong>A:</strong> This plugin only refreshes it's data every 6 hours as BF2S.com only allows 3 queries per 6 hours per IP address. This plugin is limited to just 1 query per 6 hours incase anyone else on your server also uses this plugin, plus 6 hours isn't all that long.</li>
	<li><strong>Q:</strong> The plugin output says I'm 100% to the next rank and I have more points than required to get the next rank. What's going on?

<strong>A:</strong> Go play on a different server and get a kill. Your rank should be updated then.</li>
</ul>

This is what was outputted:

<p><strong>Frequently Asked Questions:</strong></p>
<ul>
<li><strong>Q:</strong> My points are too low! Both BFHQ ingame and BF2S.com show more points than the plugin is currently showing. Why is that?
<p><strong>A:</strong> This plugin only refreshes it&#8217;s data every 6 hours as BF2S.com only allows 3 queries per 6 hours per IP address. This plugin is limited to just 1 query per 6 hours incase anyone else on your server also uses this plugin, plus 6 hours isn&#8217;t all that long.</li>
<li><strong>Q:</strong> The plugin output says I&#8217;m 100% to the next rank and I have more points than required to get the next rank. What&#8217;s going on?

<p><strong>A:</strong> Go play on a different server and get a kill. Your rank should be updated then.</li>
</ul>

Note the lack of </p>'s.

Attachments (1)

wp_multiline_li_unclosed_p.patch (1.2 KB) - added by ono 12 years ago.
This patch fixes closing of para for last line of multiline list items

Download all attachments as: .zip

Change History (21)

#1 @skeltoac
13 years ago

Please note exactly what behavior you expected.

#2 @davidhouse
13 years ago

I guess,

{{{<p><strong>Frequently Asked Questions:</strong></p>
<ul>
<li><p><strong>Q:</strong> My points are too low! Both BFHQ ingame and BF2S.com show more points than the plugin is currently showing. Why is that?</p>
<p><strong>A:</strong> This plugin only refreshes it&#8217;s data every 6 hours as BF2S.com only allows 3 queries per 6 hours per IP address. This plugin is limited to just 1 query per 6 hours incase anyone else on your server also uses this plugin, plus 6 hours isn&#8217;t all that long.</p></li>
<li><p><strong>Q:</strong> The plugin output says I&#8217;m 100% to the next rank and I have more points than required to get the next rank. What&#8217;s going on?</p>

<p><strong>A:</strong> Go play on a different server and get a kill. Your rank should be updated then.</p></li>
</ul>}}}

Would be the correct behaviour.

#3 @davidhouse
13 years ago

Grr.

<p><strong>Frequently Asked Questions:</strong></p> <ul> <li><p><strong>Q:</strong> My points are too low! Both BFHQ ingame and BF2S.com show more points than the plugin is currently showing. Why is that?</p> <p><strong>A:</strong> This plugin only refreshes it&#8217;s data every 6 hours as BF2S.com only allows 3 queries per 6 hours per IP address. This plugin is limited to just 1 query per 6 hours incase anyone else on your server also uses this plugin, plus 6 hours isn&#8217;t all that long.</p></li> <li><p><strong>Q:</strong> The plugin output says I&#8217;m 100% to the next rank and I have more points than required to get the next rank. What&#8217;s going on?</p>

<p><strong>A:</strong> Go play on a different server and get a kill. Your rank should be updated then.</p></li> </ul>

#4 @davidhouse
13 years ago

Let's try that one more time with feeling.

<p><strong>Frequently Asked Questions:</strong></p>

<ul>
<li><p><strong>Q:</strong> My points are too low! Both BFHQ ingame and BF2S.com show more points than the plugin is currently showing. Why is that?</p>
<p><strong>A:</strong> This plugin only refreshes it&#8217;s data every 6 hours as BF2S.com only allows 3 queries per 6 hours per IP address. This plugin is limited to just 1 query per 6 hours incase anyone else on your server also uses this plugin, plus 6 hours isn&#8217;t all that long.</p></li>
<li><p><strong>Q:</strong> The plugin output says I&#8217;m 100% to the next rank and I have more points than required to get the next rank. What&#8217;s going on?</p>

<p><strong>A:</strong> Go play on a different server and get a kill. Your rank should be updated then.</p></li>
</ul>

#5 @davidhouse
13 years ago

Okay, I give up. Basically, the <p>s should be closed before the </li>s and probably be opened <p> after the <li>s.

#6 @skeltoac
13 years ago

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

I don't expect autop to nest blocks or read minds. Write a patch, use a proper definition list or use <br /> in your list items.

#7 @Viper007Bond
13 years ago

  • Component changed from Administration to General
  • Priority changed from normal to low
  • Resolution invalid deleted
  • Severity changed from normal to minor
  • Status changed from closed to reopened
  • Version changed from 1.2 to 2.0

I thought I was being clear, cut me some slack please.

Let me to to re-explain. I enter this mutli-paragraph unordered list:

<ul>
	<li>Item 1, Paragraph 1

Item 1, Paragraph 2</li>
	<li>Item 2, Paragraph 1

Item 2, Paragraph 2</li>
</ul>

No <p>'s, just a list.

I get back this:

<ul>
<li>Item 1, Paragraph 1
<p>Item 1, Paragraph 2</li>
<li>Item 2, Paragraph 1
<p>Item 2, Paragraph 2</li>
</ul>

It has added in 2 <p>'s. I'm not expecting it to read my mind, but it's not even adding the closing tags for the tags it inserted.

As for a patch, I'm sorry, but I'm not as experienced in how this function works as you may be and wouldn't know where to begin on how to fix it.

Sorry for trying to make WordPress better.

#8 @skeltoac
13 years ago

  • Milestone set to 2.1
  • Summary changed from More autop bugginess to autop creates unclosed paras inside list items

Viper, I understand your bug report and I wouldn't prevent you from submitting more like it. I should have made this a balance_tags issue rather than close it. It'll be taken care of. I'm changing the summary to reflect the actual problem.

#9 @matt
12 years ago

  • Milestone changed from 2.1 to 2.2

#10 @priv
12 years ago

In 2.1 the autop are more insane.

Following source:

<ul>
<li>Item 1, Paragraph 1<br /> <br />Item 1, Paragraph 2</li>
<li>Item 2, Paragraph 1<br /> <br />Item 2, Paragraph 2</li>
</ul>

after apply filter will also become

<ul>
<li>Item 1, Paragraph 1
<p>Item 1, Paragraph 2</li>
<li>Item 2, Paragraph 1
<p>Item 2, Paragraph 2</li>
</ul>

You don't have chance to add a newline in the list without break html.

And also, seems now 2.1 eat up any amount of br tags and newlines, and results in p tags.

The only way to get extra space is <p>&nbsp;</p>, and don't think of use it in the list, since it will create a three-line space. Oh, wait, maybe we can turn off the space between paragraph by inline css.

I must say the autop guys are really hate br and newlines, aren't they?

More worse, in 2.1 they're trying to strip the <p> structures created by TinyMCE before saving(to tidy the result??), so the output will have no choice but rely on autop.

If the filter will stay as a set of regexp and won't become a full parser, please don't do too much of the 'smart things', ridiculous.

#11 @Nazgul
12 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.2 to 2.4

@ono
12 years ago

This patch fixes closing of para for last line of multiline list items

#12 @ono
12 years ago

Hi,

I've hit the same problem, and my site no longer was validating with XHTML.

Attaching patch that hopefully fixes it. Please include it into new bugfix release of WP.

Best regards!

#13 @Nazgul
12 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 2.4 (future) to 2.3 (trunk)

#14 @foolswisdom
12 years ago

  • Milestone changed from 2.3 to 2.4

#15 @darkdragon
11 years ago

  • Keywords autop added

#16 @santosj
11 years ago

  • Component changed from General to Template

#17 @lloydbudd
11 years ago

  • Milestone changed from 2.5 to 2.6

#18 @azaozz
11 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

Closing as invalid. This seems to be more a question of how to use the HTML editor. Although it allows entering of raw html, it's still an editor that works together with wpautop() to replace line breaks with <p> tags.

Entering:

<ul>
<li>

Item 1, Paragraph 1

Item 1, Paragraph 2

</li>
<li>

Item 2, Paragraph 1

Item 2, Paragraph 2

</li>
</ul>

would create all <p> properly and the source on the site would look like this:

<ul>
<li>
<p>Item 1, Paragraph 1</p>
<p>Item 1, Paragraph 2</p>
</li>
<li>
<p>Item 2, Paragraph 1</p>
<p>Item 2, Paragraph 2</p>
</li>
</ul>

#19 @Viper007Bond
11 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Sorry, but I have to disagree. That's just a work-around and while it produces valid XHTML, it looks rediculous when it actually renders.

Expected output should be this IMO:

<ul>
<li>Item 1, Paragraph 1<br />
<br />
Item 1, Paragraph 2</li>
<li>Item 2, Paragraph 1<br />
<br />
Item 2, Paragraph 2</li>
</ul>

But if it's gonna be wontfix, so be it I guess.

#20 @thee17
10 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.