INNER CODE UNIT · Python
BBCodeFormatter
godotengine/godot-docs · _extensions/bbcode.py:15
class BBCodeFormatter(RegexLexer):
name = "BBCode"
aliases = ["bbcode", "bb"]
STYLE_BRACKETS = Comment.Doc
STYLE_TAG_TYPE = Name.Builtin.Function
STYLE_EQUAL_SIGN = Operator
STYLE_OPTION = String.StringName
STYLE_VALUE = String
tokens = {
"root": [
(r"(\[)(\w*\b)", bygroups(STYLE_BRACKETS, STYLE_TAG_TYPE), "tag"),
(r"(\[)(\/)(\w*)(\])", bygroups(STYLE_BRACKETS, STYLE_BRACKETS, STYLE_TAG_TYPE, STYLE_BRACKETS)),
(r"[^\[]+", Text),
],
"tag": [
(r"=", STYLE_EQUAL_SIGN, "tag_value"),