Skip to content

Commit

Permalink
Merge branch 'speced:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr authored Oct 22, 2024
2 parents 4cd4b2e + e716a69 commit f22e63a
Show file tree
Hide file tree
Showing 349 changed files with 1,090 additions and 993 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: psf/black@24.8.0
- uses: psf/black@24.10.0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

name: Playwright Tests
on:
push:
branches-ignore:
- "dependabot/**"
- "daily-test-sync"
# push:
# branches-ignore:
# - "dependabot/**"
# - "daily-test-sync"

jobs:
playwright:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# paths need to be relative to tests/
(cd tests; find github -type f) | xargs bikeshed test --rebase
- name: Create/Update PR
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
branch: daily-test-sync
commit-message: 'chore: Sync Bikeshed files from specs.data list'
Expand Down
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. Use `Ignore MDN Failures` if this is expected.\n"
msg += "\n".join(" #" + missingId for missingId in missingIds)
m.warn(msg)

return panels


Expand Down
14 changes: 14 additions & 0 deletions bikeshed/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import contextlib
import dataclasses
import io
import json
import sys
from collections import Counter

Expand Down Expand Up @@ -253,6 +254,19 @@ def formatMessage(type: str, text: str, lineNum: str | int | None = None) -> str
return f"<final-success>{text}</final-success>"
if type == "failure":
return f"<final-failure>{text}</final-failure>"
elif state.printMode == "json":
if not state.seenMessages:
jsonText = "[\n"
else:
jsonText = ""
msg = {"lineNum": lineNum, "messageType": type, "text": text}
jsonText += " " + json.dumps(msg)
if type in ("success", "failure"):
jsonText += "\n]"
else:
jsonText += ", "
return jsonText

if type == "message":
return text
if type == "success":
Expand Down
29 changes: 19 additions & 10 deletions bikeshed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,25 +356,25 @@ def fillTextMacros(self, macros: t.DefaultDict[str, str], doc: t.SpecT) -> None:
statusName = doc.doctype.status.name
if statusName == "FPWD":
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/W3C-WD"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#FPWD"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#FPWD"
elif statusName in ("NOTE-FPWD", "NOTE-WD"):
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/W3C-DNOTE"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#DNOTE"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#DNOTE"
elif statusName == "FINDING":
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/W3C-NOTE"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#FINDING"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#FINDING"
elif statusName == "CG-DRAFT":
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/cg-draft"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#CG-DRAFT"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#CG-DRAFT"
elif statusName == "CG-FINAL":
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/cg-final"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#CG-FINAL"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#CG-FINAL"
elif statusName == "NOTE-ED":
macros["w3c-stylesheet-url"] = "https://www.w3.org/StyleSheets/TR/2021/W3C-ED"
macros["w3c-status-url"] = "https://www.w3.org/standards/types#ED"
macros["w3c-status-url"] = "https://www.w3.org/standards/types/#ED"
else:
macros["w3c-stylesheet-url"] = f"https://www.w3.org/StyleSheets/TR/2021/W3C-{statusName}"
macros["w3c-status-url"] = f"https://www.w3.org/standards/types#{statusName}"
macros["w3c-status-url"] = f"https://www.w3.org/standards/types/#{statusName}"
if self.customWarningText is not None:
macros["customwarningtext"] = parsedTextFromRawLines(
self.customWarningText,
Expand Down Expand Up @@ -1016,6 +1016,12 @@ def parseDieWhen(key: str, val: str, lineNum: str | int | None) -> str:
return "late"


def parseIgnoreMdnFailure(key: str, val: str, lineNum: str | int | None) -> list[str]:
vals = [x.strip() for x in val.split(",")]
vals = [x[1:] if x.startswith("#") else x for x in vals]
return vals


def parse(lines: t.Sequence[Line]) -> tuple[list[Line], MetadataManager]:
# Given HTML document text, in the form of an array of text lines,
# extracts all <pre class=metadata> lines and parses their contents.
Expand Down Expand Up @@ -1099,7 +1105,9 @@ def inferIndent(lines: t.Sequence[Line]) -> IndentInfo:
indentSizes: Counter[int] = Counter()
info = IndentInfo()
for line in lines:
match = re.match("( +)", line.text)
# Purposely require at least two spaces; I don't
# auto-detect single-space indents. Get help.
match = re.match("( {2,})", line.text)
if match:
indentSizes[len(match.group(1))] += 1
info.spaceLines += 1
Expand Down Expand Up @@ -1130,7 +1138,8 @@ def inferIndent(lines: t.Sequence[Line]) -> IndentInfo:
evenDivisions[candidateIndent] += lineCount
if spaceCount == candidateIndent:
evenDivisions[candidateIndent] += lineCount
info.size = evenDivisions.most_common(1)[0][0]
if evenDivisions:
info.size = evenDivisions.most_common(1)[0][0]
return info


Expand Down Expand Up @@ -1364,7 +1373,7 @@ def parseLiteralList(key: str, val: str, lineNum: str | int | None) -> list[str]
joinList,
parseLiteralList,
),
"Ignore Mdn Failure": Metadata("Ignore MDN Failure", "ignoreMDNFailure", joinList, parseLiteralList),
"Ignore Mdn Failure": Metadata("Ignore MDN Failure", "ignoreMDNFailure", joinList, parseIgnoreMdnFailure),
"Ignored Terms": Metadata("Ignored Terms", "ignoredTerms", joinList, parseCommaSeparated),
"Ignored Vars": Metadata("Ignored Vars", "ignoredVars", joinList, parseCommaSeparated),
"Image Auto Size": Metadata("Image Auto Size", "imgAutoSize", joinValue, parseBoolean),
Expand Down
15 changes: 13 additions & 2 deletions bikeshed/refs/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,13 @@ def forRefsIterator(targetFors: str | list[str]) -> t.Generator[t.RefWrapper, No
refs = list(textRefsIterator([text]))
else:
textsToSearch = list(utils.linkTextVariations(text, linkType))
if text.endswith("()") and text in self.methods:
textsToSearch += list(self.methods[text].variants.keys())

if any(st.endswith("()") for st in textsToSearch):
# Let argless methods (either with () at the end, or no parens at all)
# pull in their argful variants for searching.
for st in textsToSearch[:]:
textsToSearch += getArgfulMethodVariants(st, self)

if (linkType is None or linkType in config.lowercaseTypes) and text.lower() != text:
textsToSearch += [t.lower() for t in textsToSearch]
refs = list(textRefsIterator(textsToSearch))
Expand Down Expand Up @@ -400,6 +405,12 @@ def decodeAnchors(linesIter: t.Iterator[str]) -> defaultdict[str, list[t.RefWrap
return anchors


def getArgfulMethodVariants(maybeMethodSig: str, refs: RefSource) -> list[str]:
if maybeMethodSig.endswith("()") and maybeMethodSig in refs.methods:
return list(refs.methods[maybeMethodSig].variants.keys())
return []


@dataclasses.dataclass
class MethodVariants:
arglessSignature: str
Expand Down
2 changes: 1 addition & 1 deletion bikeshed/semver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.12
4.2.1
2 changes: 1 addition & 1 deletion bikeshed/spec-data/readonly/bikeshed-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Bikeshed version 5fcd28d6d, updated Tue May 30 13:12:11 2023 -0700
Bikeshed version 44fb9b41e, updated Mon Oct 21 15:57:35 2024 -0700
4 changes: 3 additions & 1 deletion bikeshed/spec-data/readonly/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"es": {"name": "Spanish", "native-name": "Español"},
"fr": {"name": "French", "native-name": "Français"},
"ja": {"name": "Japanese", "native-name": "日本語"},
"zh-cn": {"name": "Simplified Chinese", "native-name": "简体中文"}
"nl": {"name": "Dutch", "native-name": "Nederlands"},
"zh-cn": {"name": "Simplified Chinese", "native-name": "简体中文"},
"zh-hans": {"name": "Simplified Chinese", "native-name": "简体中文"}
}
24 changes: 11 additions & 13 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -652,16 +652,17 @@ so they're specified before the individual commands:
It does everything else,
just skips that final "save" operation.

: `--print= [ plain | console | markup ]`
: `--print= [ plain | console | markup | json ]`
:: Specifies how Bikeshed should output its messages.
Default is "console",
which outputs colored text using console color codes.
"plain" outputs the same text as "console",
but without any color codes
(which look like gibberish if you're not outputting to a console).
"markup" outputs the text in a light markup structure
(suitable for parsing as HTML),
for easier parsing of the output by tools.

* `plain` prints as plain text.
* `console` (the default) prints as plain text,
but with console color codes to help
(which look like jibberish if not viewed in a console).
* `markup` prints the messages in a light markup structure
(nominally XML, but I don't go out of my way to double check that it's valid;
it's definitely parseable as HTML).
* `json` prints the messages as JSON.

: `--no-update`
:: By default, Bikeshed checks how old its data files are
Expand Down Expand Up @@ -1413,12 +1414,9 @@ There are several additional optional keys:
to allow it to silently upgrade when possible;
otherwise, if directly turned on,
it will emit a fatal error if it can't find your spec.
* <dfn>Ignore MDN Failure</dfn> takes one of the IDs that MDN is attempting to target,
* <dfn>Ignore MDN Failure</dfn> takes a comma-separated list of IDs that MDN is attempting (and failing) to target,
and prevents Bikeshed from emitting a warning
if it can't find that ID.
You can supply this multiple times
to ignore several IDs,
if needed.
This allows you to have avoid having a build warning
while waiting for MDN to be updated.
* Several keys relate to the [Can I Use](https://caniuse.com/) project:
Expand Down
39 changes: 21 additions & 18 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1488,9 +1488,9 @@
}
}
</style>
<meta content="Bikeshed version 26c78a10d, updated Wed Jul 24 12:23:55 2024 -0700" name="generator">
<meta content="Bikeshed version 296e6fd70, updated Mon Oct 21 15:52:55 2024 -0700" name="generator">
<link href="https://speced.github.io/bikeshed/" rel="canonical">
<meta content="26c78a10d73876e96a126dbf7599eab4d0d998ed" name="revision">
<meta content="296e6fd70c6cb8c8a7c774cc980601c21b793e45" name="revision">
<meta content="dark light" name="color-scheme">
<style>/* Boilerplate: style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
Expand Down Expand Up @@ -2299,7 +2299,7 @@
<div class="head">
<p data-fill-with="logo"></p>
<h1 class="p-name no-ref" id="title">Bikeshed Documentation</h1>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Living Standard, <time class="dt-updated" datetime="2024-08-06">6 August 2024</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Living Standard, <time class="dt-updated" datetime="2024-10-21">21 October 2024</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand All @@ -2314,7 +2314,7 @@ <h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span cla
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://creativecommons.org/publicdomain/zero/1.0/" rel="license"><img alt="CC0" height="15" src="https://licensebuttons.net/p/zero/1.0/80x15.png" width="80"></a> To the extent possible under law, the editors have waived all copyright
and related or neighboring rights to this work.
In addition, as of 6 August 2024,
In addition, as of 21 October 2024,
the editors have made this specification available under the <a href="https://www.openwebfoundation.org/the-agreements/the-owf-1-0-agreements-granted-claims/owfa-1-0" rel="license">Open Web Foundation Agreement Version 1.0</a>,
which is available at https://www.openwebfoundation.org/the-agreements/the-owf-1-0-agreements-granted-claims/owfa-1-0.
Parts of this work may be from another specification document. If so, those parts are instead covered by the license of that specification document. </p>
Expand Down Expand Up @@ -2982,17 +2982,23 @@ <h3 class="heading settled" data-level="3.1" id="cli-options"><span class="secno
<p>The <code>-d</code> flag prevents Bikeshed from actually writing anything to disk.
It does everything else,
just skips that final "save" operation.</p>
<dt data-md><code>--print= [ plain | console | markup ]</code>
<dt data-md><code>--print= [ plain | console | markup | json ]</code>
<dd data-md>
<p>Specifies how Bikeshed should output its messages.
Default is "console",
which outputs colored text using console color codes.
"plain" outputs the same text as "console",
but without any color codes
(which look like gibberish if you’re not outputting to a console).
"markup" outputs the text in a light markup structure
(suitable for parsing as HTML),
for easier parsing of the output by tools.</p>
<p>Specifies how Bikeshed should output its messages.</p>
<ul>
<li data-md>
<p><code>plain</code> prints as plain text.</p>
<li data-md>
<p><code>console</code> (the default) prints as plain text,
but with console color codes to help
(which look like jibberish if not viewed in a console).</p>
<li data-md>
<p><code>markup</code> prints the messages in a light markup structure
(nominally XML, but I don’t go out of my way to double check that it’s valid;
it’s definitely parseable as HTML).</p>
<li data-md>
<p><code>json</code> prints the messages as JSON.</p>
</ul>
<dt data-md><code>--no-update</code>
<dd data-md>
<p>By default, Bikeshed checks how old its data files are
Expand Down Expand Up @@ -3799,12 +3805,9 @@ <h2 class="heading settled" data-level="4" id="metadata"><span class="secno">4.
otherwise, if directly turned on,
it will emit a fatal error if it can’t find your spec.</p>
<li data-md>
<p><dfn class="dfn-paneled" data-dfn-for="metadata" data-dfn-type="dfn" data-export id="metadata-ignore-mdn-failure">Ignore MDN Failure</dfn> takes one of the IDs that MDN is attempting to target,
<p><dfn class="dfn-paneled" data-dfn-for="metadata" data-dfn-type="dfn" data-export id="metadata-ignore-mdn-failure">Ignore MDN Failure</dfn> takes a comma-separated list of IDs that MDN is attempting (and failing) to target,
and prevents Bikeshed from emitting a warning
if it can’t find that ID.
You can supply this multiple times
to ignore several IDs,
if needed.
This allows you to have avoid having a build warning
while waiting for MDN to be updated.</p>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ idna==3.6; python_version >= '3.5'
isodate==0.6.1
json-home-client==1.1.1
kdl-py==1.2.0; python_version >= '3.7'
lxml==5.1.0
lxml==5.3.0
multidict==6.0.5; python_version >= '3.7'
pillow==10.2.0
pygments==2.17.2
requests==2.31.0
requests==2.32.3
result==0.16.1; python_version >= '3.8'
setuptools==69.1.1; python_version >= '3.8'
setuptools==75.2.0; python_version >= '3.8'
six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
tenacity==8.2.3
typing-extensions==4.9.0; python_version >= '3.8'
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/WebApiDevice/managed_config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Managed Configuration API</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/aom/spec/custom-element-semantics.html
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Default semantic properties for Custom Elements</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#UD">Unofficial Proposal Draft</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#UD">Unofficial Proposal Draft</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/aom/spec/input-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1>AOM Input Event Types</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#UD">Unofficial Proposal Draft</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#UD">Unofficial Proposal Draft</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<details open>
<summary>More details about this document</summary>
<div data-fill-with="spec-metadata">
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/app-history/spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">App History API</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></p>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down
Loading

0 comments on commit f22e63a

Please sign in to comment.