Skip to content

Commit 93f09de

Browse files
authored
Drop ":" before "Level" to compute short and series titles (#1677)
Via #1676. The "Privacy-Preserving Attribution" spec separates the main title and the level with a `:`, which wasn't handled as part of the logic used to shorten the title.
1 parent 7d5fafd commit 93f09de

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/build-index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ async function runInfo(specs) {
256256
else if (!res.series.title) {
257257
res.series.title = res.title
258258
.replace(/ \d+(\.\d+)?$/, '') // Drop level number
259-
.replace(/( -)? Level$/, '') // Drop "Level"
259+
.replace(/(:| -)? Level$/, '') // Drop "Level"
260260
.replace(/ Module$/, '') // Drop "Module"
261261
.replace(/^(RDF|SPARQL) \d\.\d/, '$1'); // Handle RDF/SPARQL titles
262262
}

src/compute-shorttitle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function (title) {
3131
.trim()
3232
.replace(/\s/g, ' ') // Replace non-breaking spaces
3333
.replace(/ \d+(\.\d+)?$/, '') // Drop level number for now
34-
.replace(/( -)? Level$/i, '') // Drop "Level"
34+
.replace(/(:| -)? Level$/i, '') // Drop "Level"
3535
.replace(/ \(\v\d+(\.\d+)?\)/i, '') // Drop "(vx.y)"
3636
.replace(/\(Draft\)/i, '') // Drop "(Draft)" indication
3737
.replace(/ Module$/i, '') // Drop "Module" (now followed by level)

test/compute-shorttitle.js

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ describe("compute-shorttitle module", () => {
4949
"Foo 2");
5050
});
5151

52+
it("drops ': Level' from title", () => {
53+
assertTitle(
54+
"Foo: Level 7",
55+
"Foo 7");
56+
});
57+
5258
it("drops 'Module - Level' from title", () => {
5359
assertTitle(
5460
"Foo Module - Level 3",

0 commit comments

Comments
 (0)