Opened 18 years ago
Closed 17 years ago
#8644 closed defect (bug) (fixed)
wpautop breaks <fieldset> and <legend> markup
| Reported by: | MarkBlankestijn | Owned by: | Sam_a |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9 |
| Component: | Formatting | Version: | 2.7 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
I use the fieldset (and legend) tag in my posts. These tags aren't parsed correctly by Wordpress and produces invalid XHTML. I'm not sure if it's correct, but this is how I fixed it:
formatting.php
Line 120; add fieldset and legend:
$allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|fieldset|legend|address|math|style|input|p|h[1-6]|hr)';
Add the following line, e.g. below line 139:
$pee = str_replace('</fieldset>', '</p></fieldset>', $pee);
Attachments (2)
Change History (14)
#1
@
18 years ago
- Keywords has-patch wpautop added
- Owner changed from to
- Status new → assigned
- Summary Include <fieldset> and <legend> in formatting.php → wpautop should recognize <fieldset> and <legend> as block elements
- Type enhancement → defect (bug)
- Version → 2.7
#2
@
18 years ago
- Summary wpautop should recognize <fieldset> and <legend> as block elements → wpautop breaks <fieldset> and <legend> markup
Patch stops wpautop from wrapping fieldset and legend in paragraph tags.
But I still see invalid markup when text inside the fieldset has less than 2 newlines above and below it; wpautop inserts <p> but omits </p>:
<?php echo wpautop("<fieldset><legend>Legend</legend>Text inside fieldset</fieldset>"); ?>
<fieldset> <legend>Legend</legend> <p>Text inside fieldset</fieldset>
#5
@
18 years ago
- Keywords needs-patch added; has-patch removed
- Milestone 2.8
patch is broken, but easy enough to fix. js patch is needed also
#9
@
17 years ago
- Keywords has-patch tested added; needs-patch removed
- Owner set to
- Status new → accepted
Attached patch autop_fieldset_legend.diff seems to fix the problem in trunk.
Adds FIELDSET and LEGEND to wpautop's list of HTML block elements