No subject
Tue Apr 20 23:23:57 UTC 2010
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Shortcode Statuses (to implement, or not to implement?)
=A0=A0=A0=A0=A0=A0=A0 enabled =3D the shortcode works as normal (default)
=A0=A0=A0=A0=A0=A0=A0 strip =3D the shortcode will be parsed and removed.=
=A0 e.g.
'[shortcode foo=3D"bar"]' produces ''.=A0 '[shortcode]foo[/shortcode]'
produces 'foo'.
=A0=A0=A0=A0=A0=A0=A0 faux =3D the shortcode will be abbreviated.=A0 e.g. '=
[shortcode
foo=3D"bar"]' products '[shortcode]'.=A0 '[shortocde]foo[/shortcode]'
produces '[shortcode]'
=A0=A0=A0=A0=A0=A0=A0 disabled =3D the shortcode is not parsed at all.=A0 e=
.g.
'[shortcode foo=3D"bar"]' products '[shortcode foo=3D"bar"]'
Major Differences/Improvements:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
I. Addressing http://codex.wordpress.org/Shortcode_API#Limitations
1. You can nest any tag at any depth regardless of ancestors
(Ticket #10702)
2. Tag and attribute names may match
/[A-Za-z][-A-Za-z0-9_:.]*//* (trialing /* because that comment ends),
with case-insensitive interpretation
3. Interpretation doesn't get tripped up by things like hyphens
II. Addressing Ticket #12760,
1. Changed from fix in #6518
Reasoning: balancing double-square-brackets can have
misleading results with nesting
2. Shortcodes escapable by using [[, ]]
3. ']]' is escaped "right to left", so '[shortcode]]]' would
evaluate to 'result]'
4. '[[' is escaped left to right '[[[shortcode]]]' =3D> '[result]'
III. Enhancements
1. Only matches valid shortcode for registered hooks,
everything else will appear as text
2. Can register multiple hooks to single shortcode, uses
priority (default: 10)
IV. Conflicting Design Changes
1. Quoted literals are escaped by entities rather than cslashes
2. Inline (self-closing) shortcodes get passed content to
accomodate multiple callbacks
3. No equivalent to shortcode_parse_atts function
(Not marked private in function reference, but not
documented in shortcode API page)
4. Boolean attributes take the place of positional attributes
[foo bar] gets attributes array('bar' =3D> 'bar') instead of
array('0' =3D> 'bar')
5. Disallows attribute and tag names that don't match
/[A-Za-z][-A-Za-z0-9_:.]*/
6. Disallows unquoted attribute values (also boolean
attributes), unless they match /[-A-Za-z0-9_:.]+/
Basic Interpretation Method:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
1. If an open tag is encountered, it is added to the stack
2. If a close tag is encountered and there is no matching open tag on the s=
tack
the close tag is ignored
3. If a close tag is encountered and there is a matching open tag on the st=
ack
all opened tags on the stack before the matched tag will be
implicitly self-closed
4. If text or an inline tag is encountered, it will be evaluated to its par=
ent's
content immediately
5. If tags are not closed by the end of the interpretation, they will
be implicitly
self-closed
Issues:
=3D=3D=3D=3D=3D=3D=3D
1. Haven't written new unit tests to reflect new functionality added,
functionality differences
2. Documentation is not as good (though I hope most of the code is
self-explanatory)
3. Not 100% backwards compatible
---
I look forward to hearing this list's opinions.
-Jacob Beauregard
More information about the wp-hackers
mailing list