Commits

Natalie Weizenbaum  committed 781935a

Add support in the Haml lexer for comma multiline blocks.

  • Participants
  • Parent commits a32d798

Comments (0)

Files changed (1)

File pygments/lexers/web.py

     # which is ignored and used to wrap long lines.
     # To accomodate this, use this custom faux dot instead.
     _dot = r'(?: \|\n(?=.* \|)|.)'
+
+    # In certain places, a comma at the end of the line
+    # allows line wrapping as well.
+    _comma_dot = r'(?:,\s*\n|' + _dot + ')'
     tokens = {
         'root': [
             (r'[ \t]*\n', Text),
 
         'eval-or-plain': [
             (r'[&!]?==', Punctuation, 'plain'),
-            (r'([&!]?[=~])(' + _dot + '*\n)',
+            (r'([&!]?[=~])(' + _comma_dot + '*\n)',
              bygroups(Punctuation, using(RubyLexer)),
              'root'),
             (r'', Text, 'plain'),
              '#pop'),
             (r'-#' + _dot + '*\n', _starts_block(Comment.Preproc,
                                                  'haml-comment-block'), '#pop'),
-            (r'(-)(' + _dot + '*\n)',
+            (r'(-)(' + _comma_dot + '*\n)',
              bygroups(Punctuation, using(RubyLexer)),
              '#pop'),
             (r':' + _dot + '*\n', _starts_block(Name.Decorator, 'filter-block'),