Georg Brandl  committed 41605f2

Closes #841: fix handling for unquoted attribute values in Opa.

  • Participants
  • Parent commits 0bb590c
  • Branches default

Comments (0)

Files changed (2)

File pygments/lexers/

     keywords = [
         'and', 'as', 'begin', 'css', 'database', 'db', 'do', 'else', 'end',
         'external', 'forall', 'if', 'import', 'match', 'package', 'parser',
-        'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser'
+        'rec', 'server', 'then', 'type', 'val', 'with', 'xml_parser',
     # matches both stuff and `stuff`
             (r'[/*]', Comment),
-        # the coy pasting between string and single-string
+        # the copy pasting between string and single-string
         # is kinda sad. Is there a way to avoid that??
         'string': [
             (r'[^\\"{]+', String.Double),
             (r'"', String.Single, ('#pop', 'string')),
             (r'#'+ident_re, String.Single, '#pop'),
             (r'#(?={)', String.Single, ('#pop', 'root')),
+            (r'[^"\'{`=<>]+', String.Single, '#pop'),
             (r'{', Operator, ('#pop', 'root')), # this is a tail call!
             (r'</', String.Single, ('#pop', 'html-end-tag')),
             (r'<', String.Single, 'html-open-tag'),
             (r'{', Operator, 'root'),
-            (r'.|\s+', String.Single),
+            (r'[^<{]+', String.Single),
         'html-comment': [

File tests/examplefiles/test.opa

+function sample_page() {
+  <header>
+    <h3>HTML in Opa</h3>
+  </header>
+  <article>
+    <div class=container>
+      <p>Learning by examples.</p>
+    </div>
+  </article>