XF 1.4 BBCode tags with variant options

With phpBB, we were able to define two variations of a tag depending on whether an option was given. For example:
Refer to [man]ls[/man].
Refer to [man=1]ls[/man].
Both the display of the contents and the URL link generated were different:

Refer to ls.
Refer to ls(1).

XenForo does BBCode differently, and this is the current definition we have for the HTML replacement:
<a target="_blank" title="A mysterious {text}({option}) manual page" href="https://www.example.org/cgi/man.cgi?query={text}&sektion={option}">{text}({option})</a>
This renders the parens even when the optional parameter is not given, and includes them in the links:

Refer to ls().
Refer to ls(1).

The first looks confusingly like a function call. What is the XenForo way to not include the extra characters when the optional parameter is not included?


XenForo developer
Staff member
To take different paths with an option specified, you'd generally need to use a callback for rendering.