-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for list tags #9
Comments
This is possible with the current version but with limitations. You could define a [list] bbcode and a list item bbcode. This type of syntax is possible:
However, there's currently no way to prohibit
This is not possible with jBBCode because there's no support for unary tags. Limiting bbcodes to certain contexts and unary tags would both require modifications to the parser, but it's definitely something to consider. In the meantime, if you want to create bbcodes for the example above, you could do something like: $builder = new JBBCode\CodeDefinitionBuilder('list', '<ul>{param}</ul>');
$parser->addCodeDefinition($builder->build());
$builder = new JBBCode\CodeDefinitionBuilder('li', '<li>{param}</li>');
$parser->addCodeDefinition($builder->build()); |
I take that back. This is possible right now by defining a custom https://gist.github.com/jbowens/5646994 Since I don't think there are very many other use cases for unary tags, this might be preferable to baking support into the parser itself. This does have limitations though. Since you're hacking with already produced HTML of the children of the list element, this will do nasty things if there are unclosed tags within lists. |
It would be also great if there was a functionality that could read the bbCode template from phpBB (just as an example) and use the read template as a |
Any chance that gist can be merged into the main code base? I'd argue that lists are a common feature. |
@axelson Not as is. That gist is pretty hacky. While I agree it'd be nice to add list support by default, I'd want to find a better way to do it. In the meantime, the API is designed for adding arbitrary code definitions, so there's not much of a burden for developers who do want to use that code definition. |
Somewhat unrelated but then again not: I'm not really satisfied with how the |
Enhancement suggestion: Support for list tags [li] and its various attributes as well a [*] which indicated each new list item.
Or is this currently possible some how?
The text was updated successfully, but these errors were encountered: