Merge pull request #11 from ikatyang/fix/raw-text-end-tag-case-insensitive

fix: raw text end tags should be case insensitive
This commit is contained in:
Max Brunsfeld 2019-10-04 09:59:33 -07:00 committed by GitHub
commit d99b24e035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -145,6 +145,9 @@ Raw text elements
</ </s </st </sty </styl </ </s </st </sty </styl
</style> </style>
<script>
</SCRIPT>
--- ---
(fragment (fragment
@ -157,6 +160,11 @@ Raw text elements
(start_tag (tag_name)) (start_tag (tag_name))
(raw_text) (raw_text)
(end_tag (tag_name))) (end_tag (tag_name)))
(text)
(script_element
(start_tag (tag_name))
(raw_text)
(end_tag (tag_name)))
(text)) (text))
================================== ==================================

View File

@ -123,12 +123,12 @@ struct Scanner {
lexer->mark_end(lexer); lexer->mark_end(lexer);
const string &end_delimiter = tags.back().type == SCRIPT const string &end_delimiter = tags.back().type == SCRIPT
? "</script" ? "</SCRIPT"
: "</style"; : "</STYLE";
unsigned delimiter_index = 0; unsigned delimiter_index = 0;
while (lexer->lookahead) { while (lexer->lookahead) {
if (lexer->lookahead == end_delimiter[delimiter_index]) { if (towupper(lexer->lookahead) == end_delimiter[delimiter_index]) {
delimiter_index++; delimiter_index++;
if (delimiter_index == end_delimiter.size()) break; if (delimiter_index == end_delimiter.size()) break;
lexer->advance(lexer, false); lexer->advance(lexer, false);