Skip to content

Commit

Permalink
Make the error for missing IDs that MDN expects less confusing.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Sep 9, 2024
1 parent 880b32e commit caab1a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bikeshed/mdn/mdnspeclinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ def panelsFromData(doc: t.SpecT, data: MdnDataT) -> list[t.ElementT]:
}

panels = []
missingIds = []
for elementId, features in data.items():
lessThanTwoEngines = 0
onlyTwoEngines = 0
allEngines = 0
featureDivs = []
targetElement = h.find(f"[id='{elementId}']", doc)
if targetElement is None and elementId not in doc.md.ignoreMDNFailure:
m.warn(f"No '{elementId}' ID found, skipping MDN features that would target it.")
missingIds.append(elementId)
continue

for feature in features:
Expand Down Expand Up @@ -150,6 +151,11 @@ def panelsFromData(doc: t.SpecT, data: MdnDataT) -> list[t.ElementT]:
panels.append(anno)
h.appendChild(doc.body, anno)

if missingIds:
msg = "Skipped generating some MDN panels, because the following IDs weren't present in the document:\n"
msg += "\n".join(" #"+missingId for missingId in missingIds)
m.warn(msg)

return panels


Expand Down

0 comments on commit caab1a0

Please sign in to comment.