BBCode "2.0" refresher

frm

Well-known member
I have been racking my brain around how we can allow users to input more information into a BBCode tag without an add on to create it, and it seems that the methodology would be to finally give BBCode a refresher after all these years.

For starters, some BB codes don't require a closing tag. An example of this would be sharing media gallery items with:
Code:
[GALLERY=album, 100][/GALLERY]

Instead of having a closing tag, why not treat it with an opening tag only, like some HTML tags and XF syntax?
HTML:
<img src="" />
And
HTML:
<xf:avatar user="{$xf.visitor}" size="o" canonical="true" />

Why not a refresher (with backward compatibility to allow for a closing tag if users are too used to it) to:
Code:
[GALLERY=album, 100 /]

But that wouldn't be the only update for a custom BB code refresher.

How about {option} supporting full JSON support, and instead of only HTML replacement, allow for XF syntax and functions too.

It would be difficult for some users to grasp, but it would be up to forum admins to create the custom BB code and then educate users on how to use it.

But the idea would be to have at least 1 {option} such as:
Code:
[CUSTOM id={"name":"John", "age":30, cars":["Ford", "BMW", "Fiat"]} /]

With HTML replacement also allowing for XF template syntax, we could create a "card" of John to display like this:

NameAgeCars owned
John30Ford
BMW
Fiat

By obviously creating the table structure in HTML, but for the name, using something like
Code:
{{ id.name }}
, age
Code:
{{ id.age }}
, and for the cars, since XF syntax could be used,

HTML:
<xf:foreach loop="{{ id.cars }}" key="$key" value="$cars" i="$i">  
{$cars}<br />
</xf:foreach>

As it'd also support XF syntax, (custom) macros of add ons could be used with the args of id, allowing for even more flexibility by calling XenForo variables too. This could also essentially allow the creation of custom BB code for add ons that don't come with BB code to call in any place BB code is accepted and use their macros (or create a macro) for output of desired content, which you could combine 2 or 3 add on's macros into 1 custom BB code if you wanted.

If JSON is too difficult, then, why not multiple {option} variables like:
Code:
[CUSTOM name=John, age=30, cars=Ford|BMW|Fiat]

Then instead of {option} we could use any of the variables set such as {name}/{CUSTOM.name}, {age}/{CUSTOM.age}, and {cars}/{CUSTOM.cars} as an array to be used in the above
Code:
<xf:foreach>
example of the HTML/XF syntax replacement.

It'd allow for much more advanced BB codes without the need of creating add ons to accomplish certain tasks, especially if we can use functions in the replacement too (e.g. to do math with the given numbers or format dates differently).

The possibilities of a custom BB code to do anything would be almost endless then and we wouldn't have to rely on developers to create an add on to make a custom BB code, if we took the time to learn XF syntax and familiarized ourselves with having more {options} (variables) and how macros of certain add ons work to create our own for use in BB code.

With the options we have available to us now, we can only really output 2 things, {option} and {tag}, but we couldn't do date formatting, etc., unless XF syntax and functions were also a part of the replacement.

In summary
  • Don't require a closing tag for BB code that doesn't have or require {text}, with or without an optional trailing slash.
  • Allow JSON formatting for {option} or the ability to set multiple variables or allow for multiple variables to be set and called by their name somehow.
  • Allow XF syntax and functions to be a part of the HTML replacement
This is just an idea of the beginning of a new BB code framework. It could still be kept simple by merely using the old format as well, if admins didn't have the need to do more advanced formatting and output for BB code.
 
Upvote 1
The formatting bar becomes disabled when you toggle BB code, which means that to use it you have to manually type it. That's a huge indication they want to drop it completely. They've said similar things in a recent thread which triggered a bunch of people to explain why they still use it.

So the first thing they'd need to do is enable the formatting buttons for BB code.
 
The formatting bar becomes disabled when you toggle BB code, which means that to use it you have to manually type it. That's a huge indication they want to drop it completely. They've said similar things in a recent thread which triggered a bunch of people to explain why they still use it.

So the first thing they'd need to do is enable the formatting buttons for BB code.
I would be in favor of it completely if they allowed us to design "blocks" and them easily be inserted. Then again, blocks would need access to XF conditionals and functions to really customize some outputs.

But, if BB code remains, there should be a refresher to at least allow XF syntax and functions at a minimum, and to have one of those functions to "split" and create an array of either {option} or {text} so that we can create custom macros for each of our add ons to be displayed in the same BB code as we'd need to pass more than 2 variables as args to get anything valuable back.

Closing out tags is more of a beautification thing. That said, there's no necessity to close out a BB code that doesn't require {text} like in the above gallery example. Also, it deviates from HTML and even XF syntax.
 
Back
Top Bottom