[wp-trac] [WordPress Trac] #45435: Port Gutenberg's `removep` Function to Php
WordPress Trac
noreply at wordpress.org
Fri Nov 30 19:21:18 UTC 2018
#45435: Port Gutenberg's `removep` Function to Php
--------------------------------------+------------------------------
Reporter: conner_bw | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.9.8
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by gaveline):
Well, maybe your implementation is better than mine, but the original
ticket was to expose a function {{{wpremovep}}}, similar to gutenberg one.
When i try your test in the JS version i got this :
Lets init a raw value :
{{{
let raw = `Hi there!
How's it going?
[shortcode id=\"1\"]Fake[/shortcode]
Ok Bye!
<pre>My
line
breaks
must
remain
</pre>`
}}}
And ask to Gutenberg to
{{{
let var = autop(raw)
}}}
After this step, var equals to :
{{{
<p>Hi there!</p>
<p>How's it going?</p>
<p>[shortcode id="1"]Fake[/shortcode]</p>
<p>Ok Bye!</p>
<pre>My
line
breaks
must
remain
</pre>
}}}
Than we do that
{{{
var = removep(var)
}}}
After this step, var equald to
{{{
Hi there!
How's it going?
[shortcode id="1"]Fake[/shortcode]
Ok Bye!
<pre>My
line
breaks
must
remain
</pre>
}}}
Which fits with my implementation too.
I suggest we merge with the strict same implementation and then open a new
ticket for fixing both implementations (JS and PHP).
I think it much consistent to have the same returns in JS and PHP, event
if they have a little weird behavior.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45435#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list