Repository navigation
Conversation
wpt-pr-bot
requested review from
AmeliaBR,
AutomatedTester,
ChrisParis,
Cwiiis,
alvestrand,
andypaicu,
annevk,
arturjanc,
astearns,
asutherland,
bfgeek,
boggydigital,
caitp,
chrishtr and
cookiecrook
October 7, 2026 21:21
zcorpan
force-pushed
the
zcorpan/single-page-html-links
branch
from
October 7, 2026 22:06
ea6b48a to
2b384c6
Compare
wpt-pr-bot
requested review from
DanielRyanSmith,
darrnshn,
dauwhe,
dbaron,
dirkschulze,
domfarolino,
emilio,
eqrion and
ewilligers
October 7, 2026 22:09
wpt-pr-bot
requested review from
FremyCompany,
fantasai,
foolip,
fred-wang,
frivoal and
fserb
October 7, 2026 22:09
Part of #63371. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zcorpan
force-pushed
the
zcorpan/single-page-html-links
branch
from
October 7, 2026 22:23
2b384c6 to
28b4902
Compare
wpt-pr-bot
requested review from
fsoder,
gregwhitworth,
hayatoito,
hemeryar,
hillbrad,
hiroshige-g,
hoch,
iVanlIsh,
igrigorik,
irori,
jan-ivar,
javifernandez,
jcscottiii,
jdm and
jgraham
October 7, 2026 22:26
Member
Author
Rewrite script, generated by Claude (not checked in):Run from the repo root: curl -sSLO https://html.spec.whatwg.org/multipage/fragment-links.json
python3 rewrite.py fragment-links.json
import re, subprocess, collections
RE = re.compile(r"(https?://)?html\.spec\.whatwg\.org/multipage(?:/multipage)?(?:/([A-Za-z0-9._-]*))?(#[^\s\"'<>`]*)?")
files = subprocess.check_output(["git", "grep", "-l", "html.spec.whatwg.org/multipage", "--", ":!tools/lint"], text=True).split("\n")
c = collections.Counter()
for f in filter(None, files):
s = open(f, encoding="utf-8", errors="surrogateescape").read()
for m in RE.finditer(s):
if not m.group(3):
c[(m.group(2), f)] += 1
for k, v in sorted(c.items()):
print(v, k)
import json, re, subprocess, sys
ids = json.load(open(sys.argv[1]))
special = {"": "", "index": "", "popover": "#the-popover-attribute",
"structured-data": "#safe-passing-of-structured-data"}
RE = re.compile(r"html\.spec\.whatwg\.org/multipage(?:/multipage)?(?:/([A-Za-z0-9-]*)(?:\.html?)?)?/?(?=(#?))")
def repl(m):
page = m.group(1) or ""
if m.group(2):
return "html.spec.whatwg.org/"
if page in special:
return "html.spec.whatwg.org/" + special[page]
if page in ids:
return "html.spec.whatwg.org/#" + page
raise Exception(f"unknown page {page!r}")
files = subprocess.check_output(["git", "grep", "-l", "html.spec.whatwg.org/multipage", "--", ":!tools/lint"], text=True).split("\n")
for f in filter(None, files):
with open(f, "rb") as fh:
s = fh.read().decode("utf-8", "surrogateescape")
try:
t = RE.sub(repl, s)
except Exception as e:
print(f, e)
continue
if t != s:
with open(f, "wb") as fh:
fh.write(t.encode("utf-8", "surrogateescape")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #63371.