Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AOM specs #1141

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion schema/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

"filename": {
"type": "string",
"pattern": "^[\\w\\-\\.]+\\.html$"
"pattern": "^[\\w\\-\\.]+\\.(html|pdf)$"
},

"relativePath": {
Expand Down Expand Up @@ -75,6 +75,7 @@
"Discontinued Draft",
"Draft Note",
"Draft Registry",
"Final Deliverable",
"First Public Working Draft",
"Note",
"Proposed Recommendation",
Expand All @@ -101,10 +102,12 @@
"enum": [
"A Collection of Interesting Ideas",
"Draft Community Group Report",
"Draft Deliverable",
"Draft Finding",
"Draft Registry",
"Editor's Draft",
"Experimental",
"Final Deliverable",
"Informational",
"Internet Standard",
"Living Standard",
Expand Down
49 changes: 48 additions & 1 deletion specs.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,61 @@
[
{
"url": "https://aomediacodec.github.io/afgs1-spec/",
"categories": [
"-browser"
]
},
{
"url": "https://aomediacodec.github.io/av1-avif/",
"organization": "Alliance for Open Media",
"groups": [
{
"name": "Storage and Transport Formats Working Group",
"url": "https://aomedia.org/about/#storage-and-transport-formats-working-group"
}
],
"nightly": {
"status": "Final Deliverable"
}
},
{
"url": "https://aomediacodec.github.io/av1-hdr10plus/",
"nightly": {
"status": "Final Deliverable"
}
},
{
"url": "https://aomediacodec.github.io/av1-isobmff/",
"groups": [
{
"name": "Storage and Transport Formats Working Group",
"url": "https://aomedia.org/about/#storage-and-transport-formats-working-group"
}
]
},
{
"url": "https://aomediacodec.github.io/av1-mpeg2-ts/",
"groups": [
{
"name": "Storage and Transport Formats Working Group",
"url": "https://aomedia.org/about/#storage-and-transport-formats-working-group"
}
]
},
{
"url": "https://aomediacodec.github.io/av1-rtp-spec/",
"groups": [
{
"name": "Storage and Transport Formats Working Group",
"url": "https://aomedia.org/about/#storage-and-transport-formats-working-group"
}
]
},
{
"url": "https://aomediacodec.github.io/av1-spec/av1-spec.pdf",
"nightly": {
"url": "https://aomediacodec.github.io/av1-spec/"
}
},
{
"url": "https://compat.spec.whatwg.org/",
"nightly": {
Expand Down
1 change: 1 addition & 0 deletions src/compute-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ module.exports = async function (specs, options) {
"index.src.html",
"index.bs",
"spec.bs",
"index.md",
"index.html"
);

Expand Down
24 changes: 14 additions & 10 deletions src/compute-shorttitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@ module.exports = function (title) {

const level = title.match(/\s(\d+(\.\d+)?)$/);
const shortTitle = title
.replace(/\s/g, ' ') // Replace non-breaking spaces
.replace(/ \d+(\.\d+)?$/, '') // Drop level number for now
.replace(/( -)? Level$/, '') // Drop "Level"
.replace(/ Module$/, '') // Drop "Module" (now followed by level)
.replace(/ Proposal$/, '') // Drop "Proposal" (TC39 proposals)
.replace(/ Specification$/, '') // Drop "Specification"
.replace(/ Standard$/, '') // Drop "Standard" and "Living Standard"
.replace(/ Living$/, '')
.replace(/ \([^\)]+ Edition\)/, '') // Drop edition indication
.replace(/^.*\(([^\)]+)\).*$/, '$1'); // Use abbr between parentheses
.trim()
.replace(/\s/g, ' ') // Replace non-breaking spaces
.replace(/ \d+(\.\d+)?$/, '') // Drop level number for now
.replace(/( -)? Level$/i, '') // Drop "Level"
.replace(/ \(\v\d+(\.\d+)?\)/i, '') // Drop "(vx.y)"
.replace(/\(Draft\)/i, '') // Drop "(Draft)" indication
.replace(/ Module$/i, '') // Drop "Module" (now followed by level)
.replace(/ Proposal$/i, '') // Drop "Proposal" (TC39 proposals)
.replace(/ Specification$/i, '') // Drop "Specification"
.replace(/ Standard$/i, '') // Drop "Standard" and "Living Standard"
.replace(/ Living$/i, '')
.replace(/ \([^\)]+ Edition\)/i, '') // Drop edition indication
.replace(/^.*\(([^\)]+)\).*$/, '$1') // Use abbr between parentheses
.trim();

if (level) {
return shortTitle + " " + level[1];
Expand Down
2 changes: 1 addition & 1 deletion src/determine-filename.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

module.exports = async function (url) {
// Extract filename directly from the URL when possible
const match = url.match(/\/([^/]+\.html)$/);
const match = url.match(/\/([^/]+\.(html|pdf))$/);
if (match) {
return match[1];
}
Expand Down
11 changes: 11 additions & 0 deletions src/fetch-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ module.exports = async function (specs, options) {
}];
}

// For the Alliance for Open Media (AOM), let's consider that the Codec WG
// is the default group, noting that it is not super clear which AOM group
// develops which spec in practice: https://aomedia.org/about/
if (info && info.owner === "aomediacodec") {
spec.organization = spec.organization ?? "Alliance for Open Media";
spec.groups = spec.groups ?? [{
name: "Codec Working Group",
url: "https://aomedia.org/about/#codec-working-group"
}]
}

// All specs that remain should be developed by some W3C group.
spec.organization = spec.organization ?? "W3C";

Expand Down
19 changes: 18 additions & 1 deletion src/fetch-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,27 @@ async function fetchInfoFromSpecs(specs, options) {
throw new Error(titleAndStatus.error + `, in ${url} for ${spec.shortname}`);
}
else {
return {
const res = {
nightly: { url, status: titleAndStatus.status },
title: titleAndStatus.title
};

// The AOM has Draft Deliverables and Final Deliverables. Most AOM
// specs don't say what they are, we'll assume that they are drafts.
if (spec.organization === "Alliance for Open Media") {
if (res.nightly.status === "Editor's Draft" ||
res.nightly.status === "AOM Working Group Draft") {
res.nightly.status = "Draft Deliverable";
}
if (spec.nightly?.url && spec.url !== spec.nightly.url) {
res.release = {
url: spec.url,
status: "Final Deliverable"
};
}
}

return res;
}
}
finally {
Expand Down
12 changes: 12 additions & 0 deletions test/compute-shorttitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ describe("compute-shorttitle module", () => {
"Foo Bar");
});

it("drops '(Draft)' from title", () => {
assertTitle(
"(Draft) Beer",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍻 ☺

"Beer");
});

it("preserves title when needed", () => {
assertTitle(
"Edition Module Standard Foo",
Expand All @@ -96,4 +102,10 @@ describe("compute-shorttitle module", () => {
"Hypertext Transfer Protocol (HTTP/1.1): Foo bar",
"HTTP/1.1 Foo bar")
});

it("applies rules in order", () => {
assertTitle(
" AOMedia Film Grain Synthesis (v1.0) (AFGS1) specification (Draft) ",
"AFGS1")
});
});
8 changes: 7 additions & 1 deletion test/determine-filename.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ describe("determine-filename module", function () {
this.slow(5000);
this.timeout(30000);

it("extracts filename from URL", async () => {
it("extracts filename from URL (.html)", async () => {
const url = "https://example.org/spec/filename.html";
const filename = await determineFilename(url);
assert.equal(filename, "filename.html");
});

it("extracts filename from URL (.pdf)", async () => {
const url = "https://example.org/spec/filename.pdf";
const filename = await determineFilename(url);
assert.equal(filename, "filename.pdf");
});

it("finds index.html filenames", async () => {
const url = "https://w3c.github.io/presentation-api/";
const filename = await determineFilename(url);
Expand Down
9 changes: 9 additions & 0 deletions test/fetch-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ describe("fetch-groups module (without API keys)", function () {
}]);
});

it("handles AOM specs", async () => {
const res = await fetchGroupsFor("https://aomediacodec.github.io/afgs1-spec/");
assert.equal(res.organization, "Alliance for Open Media");
assert.deepStrictEqual(res.groups, [{
name: "Codec Working Group",
url: "https://aomedia.org/about/#codec-working-group"
}]);
});

it("preserves provided info", async () => {
const spec = {
url: "https://url.spec.whatwg.org/",
Expand Down
18 changes: 18 additions & 0 deletions test/fetch-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ describe("fetch-info module", function () {
assert.equal(info[spec.shortname].nightly.status, "Editor's Draft");
assert.equal(info[spec.shortname].title, "Intl.Segmenter Proposal");
});

it("creates a release for final AOM deliverables published as PDF", async () => {
const spec = {
organization: "Alliance for Open Media",
url: "https://aomediacodec.github.io/av1-spec/av1-spec.pdf",
shortname: "av1-spec",
nightly: {
url: "https://aomediacodec.github.io/av1-spec/"
}
};
const info = await fetchInfo([spec]);
assert.ok(info[spec.shortname]);
assert.equal(info[spec.shortname].source, "spec");
assert.equal(info[spec.shortname].nightly.url, spec.nightly.url);
assert.ok(info[spec.shortname].release);
assert.equal(info[spec.shortname].release.url, spec.url);
assert.equal(info[spec.shortname].release.status, "Final Deliverable");
});
});

describe("fetch from W3C API", () => {
Expand Down