Skip to content

Commit d2ecf11

Browse files
authored
Force currentSpecification for ISO specs (#2040)
The `series.currentSpecification` property is set before the code that processes ISO specs is run, and thus relies on the *computed* shortname, which isn't the final one for ISO specs. Code that processes ISO specs now overrides that property with the actual spec shortname (note: we don't have a notion of levels for ISO specs today)
1 parent fb7660e commit d2ecf11

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/fetch-iso-info.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async function fetchInfoFromISO(specs, options) {
6464

6565
spec.__iso = {
6666
shortname,
67-
series: { shortname },
6867
organization: json.ownerCommittee.startsWith('ISO/IEC') ? 'ISO/IEC' : 'ISO',
6968
groups: [{
7069
name: group.reference,
@@ -90,7 +89,8 @@ async function fetchInfoFromISO(specs, options) {
9089
if (!copy.series) {
9190
copy.series = {};
9291
}
93-
copy.series.shortname = isoInfo?.series.shortname ?? spec.__last?.series.shortname;
92+
copy.series.shortname = isoInfo?.shortname ?? spec.__last?.series.shortname;
93+
copy.series.currentSpecification = isoInfo?.shortname ?? spec.__last?.series.currentSpecification;
9494
return copy;
9595
}
9696
else {

test/fetch-iso-info.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ describe("The ISO catalog module", async function () {
5454
assert.ok(specs[0]);
5555
assert.equal(specs[0].shortname, "iso18074");
5656
assert.equal(specs[0].series?.shortname, "iso18074");
57+
assert.equal(specs[0].series?.currentSpecification, "iso18074");
5758
assert.equal(specs[0].source, "iso");
5859
assert.equal(specs[0].title, "Textiles — Identification of some animal fibres by DNA analysis method — Cashmere, wool, yak and their blends");
5960
assert.equal(specs[0].organization, "ISO");
@@ -69,6 +70,7 @@ describe("The ISO catalog module", async function () {
6970
assert.ok(specs[0]);
7071
assert.equal(specs[0].shortname, "iso10918-5");
7172
assert.equal(specs[0].series?.shortname, "iso10918-5");
73+
assert.equal(specs[0].series?.currentSpecification, "iso10918-5");
7274
assert.equal(specs[0].source, "iso");
7375
assert.equal(specs[0].title, "Information technology — Digital compression and coding of continuous-tone still images: JPEG File Interchange Format (JFIF) — Part 5:");
7476
assert.equal(specs[0].organization, "ISO/IEC");

0 commit comments

Comments
 (0)