JoshyPHP wrote: Sun Jan 22, 2017 5:55 pm
You can be useful by handling the PR from start to finish. The best way to handle multiple BBCode definitions with the same name may be to replace them with a definition that covers both use case, and do so as a migration.
[...]
The template for 3.2 wouldn't change but the definitions would need to be merged together as such:
Code: Select all
[url={URL;useContent}]{TEXT}[/url]
As I recall, that's what I implemented in the Gist I posted above.
In the second case, both the definitions and templates would need to be merged into something like this:
Code: Select all
[ref={COLOR;optional}]{TEXT}[/ref]
Code: Select all
<xsl:choose>
<xsl:when test="@*">
<span style="font-weight: bold; color: {COLOR};">{TEXT}</span>
</xsl:when>
<xsl:otherwise>
<span style="font-weight: bold;">{TEXT}</span>
</xsl:otherwise>
</xsl:choose>
In the template above,
@*
is an XPath expression that means "all/any attributes."
If you do this, the bbcode will be registered as [ref=]. And when you click on the button in the editor box, it will be inserted into the textarea as it. And if you don't manually delete the '=', the result will always be the 'Otherwise'. Which may be annoying for the people used to the previous behaviour.
In phpbb 3.1, writing the tag with '=' has the same annoying behaviour, but defining the same bbcode with different definitions, allows you to put into the editor bar just the one you want. So you can put in it the [ref] ones, and show in the help tooltip the chance to specify an attribute for the optional parameter.
Is there any xpath operator to do an expression like (COLOR!='') ?