diff --git a/bikeshed/h/parser/parser.py b/bikeshed/h/parser/parser.py index ba1a081b35..2220586e23 100644 --- a/bikeshed/h/parser/parser.py +++ b/bikeshed/h/parser/parser.py @@ -202,23 +202,25 @@ def parseNode( if els is not None: return Result(els, i) if s.config.css and not inOpaque: - if first3 == r"\''": - node = RawText.fromStream(s, start, start + 3, "''") - return Result(node, start + 3) - elif first2 == r"\'": - node = RawText.fromStream(s, start, start + 2, "'") - return Result(node, start + 2) + if first2 == r"\'": + i = start + 2 + while s[i] == "'": + i += 1 + node = RawText.fromStream(s, start, i, s[start + 1 : i]) + return Result(node, i) elif first3 == "'''": + i = start + 3 + while s[i] == "'": + i += 1 m.die( - "Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes.", + f"Saw {s[start:i]}. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes.", lineNum=s.loc(start), ) - node = RawText.fromStream(s, start, start + 3) - return Result(node, start + 3) - elif first2 == "''" and s[start - 1] not in ("'", "="): + node = RawText.fromStream(s, start, i) + return Result(node, i) + elif first2 == "''" and s[start - 1] != "=": # Temporary check to remove some error cases - # some weird HTML cases with an empty attr can trigger, - # or there's some bizarre '''' in CSS2. maybeRes = parseCSSMaybe(s, start) if maybeRes.valid: return maybeRes diff --git a/tests/github/w3c/csswg-drafts/css-highlight-api-1/Overview.console.txt b/tests/github/w3c/csswg-drafts/css-highlight-api-1/Overview.console.txt index ae39f79856..29a0396031 100644 --- a/tests/github/w3c/csswg-drafts/css-highlight-api-1/Overview.console.txt +++ b/tests/github/w3c/csswg-drafts/css-highlight-api-1/Overview.console.txt @@ -1,5 +1,5 @@ -LINE 74:6: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. -LINE 74:24: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 74:6: Saw '''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 74:24: Saw '''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. LINE 226: The var 'keyArg' (in algorithm 'to register a custom highlight') is only used once. If this is not a typo, please add an ignore='' attribute to the . LINE 227: The var 'valueArg' (in algorithm 'to register a custom highlight') is only used once. diff --git a/tests/github/w3c/csswg-drafts/css-ui-4/Overview.console.txt b/tests/github/w3c/csswg-drafts/css-ui-4/Overview.console.txt index b8180ebb31..4dd8b828cf 100644 --- a/tests/github/w3c/csswg-drafts/css-ui-4/Overview.console.txt +++ b/tests/github/w3c/csswg-drafts/css-ui-4/Overview.console.txt @@ -1,5 +1,5 @@ LINE 1254:35: Attribute style appears twice in . -LINE 1574:30: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 1574:30: Saw '''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. LINE 1575:28: ''...'' autolink opened at 1575:28 wasn't closed within 3 lines. You might have forgotten to close it; if not, switch to the HTML syntax to spread your link across that many lines. LINE 2468: Saw an end tag , but there's no open element corresponding to it. LINT: Your document appears to use tabs to indent, but line 283 starts with spaces. diff --git a/tests/github/w3c/csswg-drafts/css2/Overview.console.txt b/tests/github/w3c/csswg-drafts/css2/Overview.console.txt index cb2f33dd6e..995437c7e5 100644 --- a/tests/github/w3c/csswg-drafts/css2/Overview.console.txt +++ b/tests/github/w3c/csswg-drafts/css2/Overview.console.txt @@ -1,5 +1,5 @@ -LINE 2196:30: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. -LINE 2217:30: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 2196:30: Saw ''''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 2217:30: Saw ''''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. LINE 2654: Saw an end tag

, but there were unclosed elements remaining before the nearest matching start tag (on line 2646). Open tags:

at 2646:1, ''...'' at 2653:40 LINE 2653:40: ''...'' autolink opened at 2653:40 wasn't closed within 3 lines. You might have forgotten to close it; if not, switch to the HTML syntax to spread your link across that many lines. @@ -10,7 +10,7 @@ Open tags:

at 2655:1, ''...'' at 2657:74 LINE 2657:74: ''...'' autolink opened at 2657:74 wasn't closed within 3 lines. You might have forgotten to close it; if not, switch to the HTML syntax to spread your link across that many lines. LINE 2661:19: ''...'' shorthand (opened on 2657:74) was closed, but there were still open elements inside of it. Open tags:

at 2655:1, ''...'' at 2657:74,

at 2660:1 -LINE 10583:21: Saw ''' (or more). This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. +LINE 10583:21: Saw ''''. This is probably a typo intended to be a double apostrophe, starting a CSS maybe autolink; if not, please escape some of the apostrophes. LINE 15173:17: The autolink ''<>/none'' is using an HTML escape (or <<) in its for value; you probably don't want to escape things there. (See https://speced.github.io/bikeshed/#autolink-limits ) LINT: Your document appears to use spaces to indent, but line 559 starts with tabs.