eric6/ThirdParty/Pygments/pygments/lexers/html.py

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.html 3 pygments.lexers.html
4 ~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for HTML, XML and related markup. 6 Lexers for HTML, XML and related markup.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
75 'script-content': [ 75 'script-content': [
76 (r'(<)(\s*)(/)(\s*)(script)(\s*)(>)', 76 (r'(<)(\s*)(/)(\s*)(script)(\s*)(>)',
77 bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text, 77 bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
78 Punctuation), '#pop'), 78 Punctuation), '#pop'),
79 (r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)), 79 (r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)),
80 # fallback cases for when there is no closing script tag
81 # first look for newline and then go back into root state
82 # if that fails just read the rest of the file
83 # this is similar to the error handling logic in lexer.py
84 (r'.+?\n', using(JavascriptLexer), '#pop'),
85 (r'.+', using(JavascriptLexer), '#pop'),
80 ], 86 ],
81 'style-content': [ 87 'style-content': [
82 (r'(<)(\s*)(/)(\s*)(style)(\s*)(>)', 88 (r'(<)(\s*)(/)(\s*)(style)(\s*)(>)',
83 bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text, 89 bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text,
84 Punctuation),'#pop'), 90 Punctuation),'#pop'),
85 (r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)), 91 (r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)),
92 # fallback cases for when there is no closing style tag
93 # first look for newline and then go back into root state
94 # if that fails just read the rest of the file
95 # this is similar to the error handling logic in lexer.py
96 (r'.+?\n', using(CssLexer), '#pop'),
97 (r'.+', using(CssLexer), '#pop'),
86 ], 98 ],
87 'attr': [ 99 'attr': [
88 ('".*?"', String, '#pop'), 100 ('".*?"', String, '#pop'),
89 ("'.*?'", String, '#pop'), 101 ("'.*?'", String, '#pop'),
90 (r'[^\s>]+', String, '#pop'), 102 (r'[^\s>]+', String, '#pop'),
355 'html-attribute-value': [ 367 'html-attribute-value': [
356 (r'[ \t]+', Text), 368 (r'[ \t]+', Text),
357 (r'\w+', Name.Variable, '#pop'), 369 (r'\w+', Name.Variable, '#pop'),
358 (r'@\w+', Name.Variable.Instance, '#pop'), 370 (r'@\w+', Name.Variable.Instance, '#pop'),
359 (r'\$\w+', Name.Variable.Global, '#pop'), 371 (r'\$\w+', Name.Variable.Global, '#pop'),
360 (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), 372 (r"'(\\\\|\\[^\\]|[^'\\\n])*'", String, '#pop'),
361 (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), 373 (r'"(\\\\|\\[^\\]|[^"\\\n])*"', String, '#pop'),
362 ], 374 ],
363 375
364 'html-comment-block': [ 376 'html-comment-block': [
365 (_dot + '+', Comment), 377 (_dot + '+', Comment),
366 (r'\n', Text, 'root'), 378 (r'\n', Text, 'root'),
467 'html-attribute-value': [ 479 'html-attribute-value': [
468 (r'[ \t]+', Text), 480 (r'[ \t]+', Text),
469 (r'\w+', Name.Variable, '#pop'), 481 (r'\w+', Name.Variable, '#pop'),
470 (r'@\w+', Name.Variable.Instance, '#pop'), 482 (r'@\w+', Name.Variable.Instance, '#pop'),
471 (r'\$\w+', Name.Variable.Global, '#pop'), 483 (r'\$\w+', Name.Variable.Global, '#pop'),
472 (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), 484 (r"'(\\\\|\\[^\\]|[^'\\\n])*'", String, '#pop'),
473 (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), 485 (r'"(\\\\|\\[^\\]|[^"\\\n])*"', String, '#pop'),
474 ], 486 ],
475 487
476 'html-comment-block': [ 488 'html-comment-block': [
477 (_dot + '+', Comment), 489 (_dot + '+', Comment),
478 (r'\n', Text, 'root'), 490 (r'\n', Text, 'root'),
576 'html-attribute-value': [ 588 'html-attribute-value': [
577 (r'[ \t]+', Text), 589 (r'[ \t]+', Text),
578 (r'\w+', Name.Variable, '#pop'), 590 (r'\w+', Name.Variable, '#pop'),
579 (r'@\w+', Name.Variable.Instance, '#pop'), 591 (r'@\w+', Name.Variable.Instance, '#pop'),
580 (r'\$\w+', Name.Variable.Global, '#pop'), 592 (r'\$\w+', Name.Variable.Global, '#pop'),
581 (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), 593 (r"'(\\\\|\\[^\\]|[^'\\\n])*'", String, '#pop'),
582 (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), 594 (r'"(\\\\|\\[^\\]|[^"\\\n])*"', String, '#pop'),
583 ], 595 ],
584 596
585 'html-comment-block': [ 597 'html-comment-block': [
586 (_dot + '+', Comment), 598 (_dot + '+', Comment),
587 (r'\n', Text, 'root'), 599 (r'\n', Text, 'root'),

eric ide

mercurial