MichaelBelgium / mybb_to_flarum

A Flarum extension to convert a mybb forum to a fresh flarum install
MIT License
26 stars 15 forks source link

Add custom SIZE bbcode #6

Closed MichaelBelgium closed 7 years ago

MichaelBelgium commented 7 years ago

If anyone has this fix/addition i'll appreciate the help. Searching for days after this fix.

The problem is that MyBB SIZE tag uses text instead of numbers, example: [size=x-large]My title[/size]. Adding this to the formatter isn't so easy as it looks like for some reason.

In Config.php I've tried the following lines:

$configurator->BBCodes->addCustom('[size={CHOICE=large,small,xx-small,x-small,medium,x-large,xx-large}]{TEXT}[/size]','<span style="font-size:{CHOICE}">{TEXT}</span>'); //not working for me.
$configurator->BBCodes->addCustom('[size={TEXT1}]{TEXT2}[/size]', new UnsafeTemplate('<span style="font-size:{TEXT1}">{TEXT2}</span>')); //not working for me either

On both "solutions" the parser does this:

<span style="font-size:x-largepx">My title</span>

It add "px" at the end every damn time.

Need help with this. I searched my ass off where the "px" comes from.

MichaelBelgium commented 7 years ago

Fixed in commit https://github.com/MichaelBelgium/mybb_to_flarum/commit/5e05cf68d253f8f0c1e83a963ddaa150f54397af