diff options
author | Duncan <duncan@vtllf.org> | 2015-05-05 19:19:58 +1200 |
---|---|---|
committer | Duncan <duncan@vtllf.org> | 2015-05-05 19:37:27 +1200 |
commit | 007295de4aeac4c054cb5650455d41274fb5232f (patch) | |
tree | b20406e1534fced2a839e55d9e072a274dcc312d | |
parent | 7b87085c1880c60aa3be5b3ec4572a0d93fd5537 (diff) | |
download | servo-007295de4aeac4c054cb5650455d41274fb5232f.tar.gz servo-007295de4aeac4c054cb5650455d41274fb5232f.zip |
Suggest how to fix unstable WHATWG links in tidy.py
Fixes #5929
-rw-r--r-- | python/tidy.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/python/tidy.py b/python/tidy.py index 07eebf80677..780cfca647e 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -72,12 +72,10 @@ def check_length(idx, line): yield (idx + 1, "(much) overlong line") def check_whatwg_url(idx, line): - matches = re.findall(r'whatwg.org/multipage.*#', line); - if matches: - for i, match in enumerate(matches): - parts = match.split('multipage') - if len(parts[1]) > 1 and parts[1][1] != '#': - yield (idx + 1, "URL should not point to specific WHATWG multipage page!") + match = re.search(r"https://html\.spec\.whatwg\.org/multipage/[\w-]+\.html#([\w\:-]+)", line) + if match is not None: + preferred_link = "https://html.spec.whatwg.org/multipage/#{}".format(match.group(1)) + yield (idx + 1, "link to WHATWG may break in the future, use this format instead: {}".format(preferred_link)) def check_whitespace(idx, line): if line[-1] == "\n": |