[wp-trac] [WordPress Trac] #30644: "wpautop" Enhancements
WordPress Trac
noreply at wordpress.org
Tue Dec 9 18:35:15 UTC 2014
#30644: "wpautop" Enhancements
-------------------------+-----------------------------
Reporter: stefanrz | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Since there are several problems (e.g. invalid markup) with the current
"wpautop" function I tried to come up with a new approach. The text gets
parsed and a little analyzed in order to generate valid and comprehensible
markup.
The script is not really compatible with the current implementation since
whitespaces and line breaks are added differently. Performance is slightly
worse, depending on the input (normal text vs. heavy html) of course.
Comments in the code are still missing.
I think Shortcodes should also be considered in this markup generation
process so the additional use of "shortcode_unautop" could be avoided.
Please let me know what you think and test it if you like.
== Sample
=== Input
{{{
paragraph
<!-- comment -->
<hr>
paragraph <strong>test</strong>
<i>italic</i>
normal
<!-- div -->
<div class="whatever">
<blockquote>
paragraph
</blockquote>
paragraph
</div>
paragraph
<ul>
<li>line</li>
<li>
paragraph <!-- paragraph -->
paragraph
</li>
</ul>
paragraph
<pre>
Honor
this whitespace
</pre>
paragraph
<style><!--
Do not alter!
--></style>
paragraph
<p>paragraph</p>
<div>text</div>
}}}
=== Output
{{{
<p>
paragraph
<!-- comment -->
</p>
<hr>
<p>
paragraph <strong>test</strong>
</p>
<p>
<i>italic</i><br>
normal
</p>
<!-- div -->
<div class="whatever">
<blockquote>
<p>
paragraph
</p>
</blockquote>
<p>
paragraph
</p>
</div>
<p>
paragraph
</p>
<ul>
<li>
line
</li>
<li>
<p>
paragraph <!-- paragraph -->
</p>
<p>
paragraph
</p>
</li>
</ul>
<p>
paragraph
</p>
<pre>
Honor
this whitespace
</pre>
<p>
paragraph
</p>
<style><!--
Do not alter!
--></style>
<p>
paragraph
</p>
<p>paragraph</p>
<div>
text
</div>
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30644>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list