BBcode issue with 3.2.1

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 7:41 pm

Hi all,
I just noticed a bbcode out of 2 isn't working any more in my extension (which is a port).
Last time I checked time ago it worked just fine, I am unable to cactch the issue atm.

Here is the repo: https://github.com/3D-I/notebbcode

Here are 2 grabs of the usage, the red one is the faulty one.
.
Screenshot_2.png
Screenshot_2.png (8.1 KiB) Viewed 741 times
-
Screenshot_1.png
.
I didn't modify the code. Just prettified the Tooltip via CSS, that's all.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 7:50 pm

BBcodes are installed via migration, here's the excerpt related

Code: Select all

		/**
		 * @var array An array of bbcodes data to install
		 */
		$bbcode_data = array(
			'note' => array(
				'bbcode_match'		=> '[note]{TEXT}[/note]',
				'bbcode_tpl'		=> '<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT}</span>',
				'bbcode_helpline'	=> '[note]note text[/note]',
				'display_on_posting'=> 0,
			),
			'note=' => array(
				'bbcode_match'		=> '[note={TEXT1}]{TEXT2}[/note]',
				'bbcode_tpl'		=> '<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span><span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT2}</span>',
				'bbcode_helpline'	=> '[note=text-to-note]note text[/note]',
				'display_on_posting'=> 0,
			),
		);
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
JoshyPHP
Code Contributor
Posts: 958
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP » Mon Oct 16, 2017 8:12 pm

It's probably related to this: https://tracker.phpbb.com/browse/PHPBB3-14357

Remove the note= BBCode and modify the other one to use a conditional.
I wrote the thing that does BBCodes in 3.2.

User avatar
canonknipser
Registered User
Posts: 1623
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: BBcode issue with 3.2.1

Post by canonknipser » Mon Oct 16, 2017 8:15 pm

You can't have two different bbcodes with the same name in 3.2.x, was discussed earlier, eg. : viewtopic.php?f=556&t=2408021&hilit=bbcode+optional





Grfmph - took too long time to find the topic ...
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 8:21 pm

It doesn't seems to reflect my situation, the first one is not parsed but the second. And I am not using multiple definitions IMO, but..

reading the tracker I see it could be a case-by-case basis
https://tracker.phpbb.com/browse/PHPBB3-14357
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 8:26 pm

JoshyPHP wrote:
Mon Oct 16, 2017 8:12 pm
It's probably related to this: https://tracker.phpbb.com/browse/PHPBB3-14357

Remove the note= BBCode and modify the other one to use a conditional.
Thanks Joshy, I will give this a shot. And report..
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 8:46 pm

Well, no idea and no search results for to where to apply such XSL condition, absolutely no clue atm. :?
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
JoshyPHP
Code Contributor
Posts: 958
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP » Mon Oct 16, 2017 8:57 pm

You should end up with something like that:

Code: Select all

[note text={TEXT1;optional}]{TEXT2}[/note]

Code: Select all

<xsl:choose>
	<xsl:when test="@text">
		<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span>
		<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span>
		<span class="prime_bbcode_note">{TEXT2}</span>
	</xsl:when>
	<xsl:otherwise>
		<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span>
		<span class="prime_bbcode_note">{TEXT2}</span>
	</xsl:otherwise>
</xsl:choose>
Or this, as a simpler template:

Code: Select all

<xsl:if test="@text">
	<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">
		<xsl:value-of select="@text"/>
	</span>
</xsl:if>
<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"/>
<span class="prime_bbcode_note"><xsl:apply-templates/></span>
I wrote the thing that does BBCodes in 3.2.

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 9:23 pm

Ah I see, the XSL replaces the old HTML replacement, I thought that.

Then I got rid of the note= bbcode and amended the note one to the above code..

There is an issue though, that bbcode doesn't work like

[URL=http...etc...etc]your test here[/URL]

But
[note=]your test here[/note]

notice the ending brace right after the =. So it doesn't work as it should.

Thanks for chiming on this :)

edit: I didn't see your last edit... but nothing changes except for the elegance. :)
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 9:31 pm

Resuming the bbcodes (different spans)

Code: Select all

	'bbcode_match'		=> '[note]{TEXT}[/note]',

	'<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT}</span>',


	'bbcode_match'		=> '[note={TEXT1}]{TEXT2}[/note]',

	'<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span><span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT2}</span>',
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
JoshyPHP
Code Contributor
Posts: 958
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP » Mon Oct 16, 2017 9:55 pm

That's because an empty string is not a valid URL but it's a valid text. The template above only tests the presence of an attribute, not its content. If you want a test for a non-empty string it would be this:

Code: Select all

<xsl:if test="@text != ''">
I wrote the thing that does BBCodes in 3.2.

User avatar
3Di
Registered User
Posts: 12945
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di » Mon Oct 16, 2017 10:21 pm

Yup, thanks for the explaination and help. :)
I sorted out that everything's correct and works as it should.
+100

Above stated issue due to unknown causes but surely my fault. :?

Well, time to adjust the migration to take care of two different versions of phpBB, now.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests