error_behaviour = self::LEAVE is the default behaviour. In this case,
we don’t even need to bother recognising such tags. Rather than
replacing with marker images and re-inserting the original text after
we’re done, we can leave them alone.
This should make the code faster and more reliable.
The problem is that the marker images aren’t picked up by DOMDocument
if they are inserted into a <script> tag, due to the semantics of HTML.
This fix does an additional replacement after the marker images are
replaced in this way to pick up any leftover tags.
This allows shortcodes to perform more complex actions on the element
which contains them. For example, the element reference can be used
to add extra classes or attributes to links which provide additional
metadata.
Since that used to be the default shortcode notation
for our core "insert media" functionality, its important
to have this fixed and keep supporting "legacy" content
created with 3.0.
Shortcodes have traditionally had a problem that they are inside <p> tags,
but generate block level elements. This breaks HTML compliance.
This makes the shortcode parser now mutate the DOM based on the "class" attribute on
the shortcode to insert the generated block level element at the right place in the DOM
- for "left" and "right" elements it puts them just before the block level
element they are inside
- for "leftAlone" and "center" elements it splits the DOM around the shortcode.
The trade off is that shortcodes are no longer "text level" features. They need
knowledge of the HTML they are in to perform this transformation, so they can
only be used in (valid) HTML
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit. This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
Space delimiter is often confused by browsers, and encoded as %20 which
breaks the shortcode system. Change to comma delimitation has already
been implemented, this is a followup cleanup.
Ref http://open.silverstripe.org/ticket/7337
MINOR Fixed appropriate failing tests to use PHP_EOL (from r92220)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92460 467b73ca-7a2a-4603-9d3b-597d59a354a9
From: Andrew Short <andrewjshort@gmail.com>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@88472 467b73ca-7a2a-4603-9d3b-597d59a354a9