[RFC] Integrate s9e\TextFormatter

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.2/Rhea branch. Everything listed in this forum will be available in phpBB 3.2.
Post Reply
User avatar
rxu
Registered User
Posts: 164
Joined: Tue Apr 04, 2006 4:28 pm
Contact:

Re: [RFC] Integrate s9e\TextFormatter

Post by rxu »

If you try to put the following text into the code bbcode tags:
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[url]','[/url]', '[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);

you get this:

Code: Select all

var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','','', '[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);[/code]
Image

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC] Integrate s9e\TextFormatter

Post by JoshyPHP »

Yes, [code][/code][/code] will produce an empty code block followed by [/code].

You can pair BBCode tags by appending a colon and a unique number to their name, e.g. [code:123][/code][/code:123]

Code: Select all

[/code]

User avatar
rxu
Registered User
Posts: 164
Joined: Tue Apr 04, 2006 4:28 pm
Contact:

Re: [RFC] Integrate s9e\TextFormatter

Post by rxu »

Thanks. There's a lot of things we still don't know about that stuff.

Code: Select all

var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[url]','[/url]', '[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
Image

cholo
Registered User
Posts: 2
Joined: Thu Mar 30, 2017 7:38 am

Re: [RFC] Integrate s9e\TextFormatter

Post by cholo »

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!='') ?

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC] Integrate s9e\TextFormatter

Post by JoshyPHP »

COLOR doesn't accept empty strings so it works as intended but if you use a token that accepts empty strings you can do something like @ref != ''. You can't use the token itself (e.g. {COLOR}) in XPath expressions though.

cholo
Registered User
Posts: 2
Joined: Thu Mar 30, 2017 7:38 am

Re: [RFC] Integrate s9e\TextFormatter

Post by cholo »

JoshyPHP wrote: Thu Mar 30, 2017 1:16 pm COLOR doesn't accept empty strings so it works as intended but if you use a token that accepts empty strings you can do something like @ref != ''. You can't use the token itself (e.g. {COLOR}) in XPath expressions though.
Ok, thanks. This is working perfectly for what I'm trying to do.

I think I have a much bigger problem with markup nested inside custom bbcode, which is weird because for what I'm reading in the doc, it should be allowed (of course), and the only issue is related to the same custom bbcode nested multiple times.

Code: Select all

[spoiler]test[b]test[/b] test[/spoiler]
become:
<span class="spoiler"> test[b]test[/b] test</span>
Don't wanna abuse your help but a point in the right direction on where to look for about the error (Text formatter? phpbb 3.2?...), would be helpful.

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC] Integrate s9e\TextFormatter

Post by JoshyPHP »

cholo wrote: Thu Mar 30, 2017 4:22 pm Don't wanna abuse your help but a point in the right direction on where to look for about the error (Text formatter? phpbb 3.2?...), would be helpful.
The best way would be to post in the 3.2 support forum with the exact definition of your BBCode, what you type in the post editor to test it, what you get as its output and how it differs from what you expected. Then you can add [quote=JoshyPHP]...[/quote] so I get notified and I'll read it later.

User avatar
rxu
Registered User
Posts: 164
Joined: Tue Apr 04, 2006 4:28 pm
Contact:

Re: [RFC] Integrate s9e\TextFormatter

Post by rxu »

Image

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC] Integrate s9e\TextFormatter

Post by JoshyPHP »

That's a software crash, nothing we can do about it. Try linking PHP against a more recent version of PCRE and be sure to report the error with a good trace/dump at PHP's bug tracker.

Post Reply