Commits

blackbird  committed cb36bf7

[svn] adopted patch #161 and documented it.

  • Participants
  • Parent commits 084467a
  • Branches trunk

Comments (0)

Files changed (3)

File docs/src/lexers.txt

     :Mimetypes: None
 
 
+`BBCodeLexer`
+
+    A Lexer that highlights BBCode(-like) syntax.
+
+    *New in Pygments 0.6.*
+
+    :Aliases: ``bbcode``
+    :Filename patterns: None
+    :Mimetypes: None
+
+
 Iterating over all lexers
 =========================
 

File pygments/lexers/_mapping.py

 
 LEXERS = {
     'ApacheConfLexer': ('pygments.lexers.text', 'ApacheConf', ('apacheconf', 'aconf'), ('.htaccess', 'apache.conf'), ()),
+    'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ()),
     'BashLexer': ('pygments.lexers.other', 'Bash', ('bash', 'sh'), ('*.sh',), ('application/x-sh', 'application/x-shellscript')),
     'BooLexer': ('pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)),
     'BrainfuckLexer': ('pygments.lexers.other', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ()),

File pygments/lexers/text.py

     Lexers for non-source code file types: Diff, Makefiles, Ini configs etc.
 
     :copyright: 2006 by Armin Ronacher, Georg Brandl,
-                Tim Hatch <tim@timhatch.com>.
+                Tim Hatch <tim@timhatch.com>,
+                Ronny Pfannschmidt.
     :license: BSD, see LICENSE for more details.
 """
 
 
 
 __all__ = ['IniLexer', 'MakefileLexer', 'DiffLexer', 'IrcLogsLexer',
-           'TexLexer', 'GroffLexer', 'ApacheConfLexer']
+           'TexLexer', 'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer']
 
 
 class IniLexer(RegexLexer):
     }
 
 
+class BBCodeLexer(RegexLexer):
+    name = 'BBCode'
+    aliases = ['bbcode']
+    
+    tokens = {
+        'root' : [
+            (r'[\s\w]+', Text),
+            (r'(\[)(/?[^\]\n\r=]+)(\])',
+             bygroups(Keyword, Keyword.Pseudo, Keyword)),
+            (r'(\[)([^\]\n\r=]+)(=)([^\]\n\r]+)(\])',
+             bygroups(Keyword, Keyword.Pseudo, Operator, String, Keyword)),
+        ],
+    }
+
+
 class TexLexer(RegexLexer):
     name = 'TeX'
     aliases = ['tex', 'latex']