[wp-trac] Re: [WordPress Trac] #6969: Don't apply wptexturize() to
the insides of shortcode tags
WordPress Trac
wp-trac at lists.automattic.com
Thu Apr 30 17:48:07 GMT 2009
#6969: Don't apply wptexturize() to the insides of shortcode tags
--------------------------+-------------------------------------------------
Reporter: Viper007Bond | Owner: tellyworth
Type: enhancement | Status: new
Priority: normal | Milestone: 2.8
Component: Formatting | Version: 2.5.1
Severity: normal | Keywords: has-patch needs-testing
--------------------------+-------------------------------------------------
Comment(by mzizka):
> your start regexp doesn't start with (.?) like the real one. it's
potentially problematic in the second use-case I outlined.
I was not familiar with the shortcode escaping feature. I should have read
the comments more closely. I do see your point now. This needs a fix, but
the existing code is already broken in this regard anyway. All the full
regexp will do is capture an extra character on either side of the
shortcode. In our case we would want to NOT consider escaped shortcodes
when splitting the text. This should not be difficult, but require a
different regular expression from the "standard" one.
Regarding the `str_replace` on the regexp, I'd like to bring a little more
precision. The reason why I do this is because the entire regular
expression has to be captured in parentheses (so that the full delimiters
are all captured by `preg_split`). This will increment by 1 any capturing
index in the original shortcode regular expression, so I have to fix the
backreferencing used therein. Short of refactoring the entire function,
this was the only fix I could come up with. The other solution is to not
call the function, and construct another regular expression locally. I
think this is the path I will opt for.
I will change my patch and add some test cases for the case scenarios you
outlined (as well as a few others) when time allows.
(However, I would still like to know why formatting is applied before
processing of shortcodes. I know I'm annoying with this, but I'm having a
hard time with the idea.)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/6969#comment:20>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list