Skip to content

Commit eb48e2e

Browse files
authored
Merge branch 'main' into issues/fix-tests
2 parents 49ef6d5 + c06766e commit eb48e2e

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

doc/main.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,17 +564,34 @@ <h4>Normative references section</h4>
564564
<li>The <code>cite</code> element shall contain an <code>id</code> attribute with value prefixed by
565565
<code>bib-</code>.</li>
566566
<li>Each <code>li</code> element may contain additional title information.
567+
567568
<li>Each <code>li</code> element may contain one <code>a</code> element that contains a location where the reference can
568569
be retrieved.</li>
570+
<li>Each <code>li</code> element may contain one <code>span</code> element with a <code>class="doi"</code> attribute that contains the DOI of the document. Using this will also create a DOI resolver URL.</li>
569571
</ul>
570-
572+
<p>Undated references should be used, since they point to the most most up-to-date edition of a document.</p>
573+
574+
<p>Dated references shall be used when referencing a specific element of the document, e.g., a table. They should also be used when past and future editions of the document are likely to be inadequate. </p>
575+
576+
<p class="note">The DOI <code>span</code> element should be used, and not the <code>a</code> element, for both the most recent and specific editions of a SMPTE document. SMPTE HO can provide guidance for specific DOIs available.</p>
577+
571578
<div class="example">
572579
<pre>&lt;section id=&quot;sec-normative-references&quot;&gt;
573580
&lt;ul&gt;
574581
&lt;li&gt;
575582
&lt;cite id=&quot;bib-HTML-5&quot;&gt;HTML Standard&lt;/cite&gt;, Living Standard.
576583
&lt;a&gt;https://html.spec.whatwg.org/multipage/&lt;/a&gt;&lt;/li&gt;
577584
&lt;/li&gt;
585+
&lt;li&gt;
586+
&lt;cite id=&quot;bib-SMPTE-st429-18&quot;&gt;SMPTE ST 429-18&lt;/cite&gt;, D-Cinema Packaging — Immersive Audio Track
587+
File
588+
&lt;span class=&quot;doi&quot;&gt;10.5594/SMPTE.ST429-18/&lt;/span&gt;&lt;/li&gt;
589+
&lt;/li&gt;
590+
&lt;li&gt;
591+
&lt;cite id=&quot;bib-SMPTE-st429-18-2023&quot;&gt;SMPTE ST 429-18:2023&lt;/cite&gt;, D-Cinema Packaging — Immersive
592+
Audio Track File (2023 Edition)
593+
&lt;span class=&quot;doi&quot;&gt;10.5594/SMPTE.ST429-18.2023/&lt;/span&gt;&lt;/li&gt;
594+
&lt;/li&gt;
578595
&lt;/ul&gt;
579596
&lt;/section&gt;</pre>
580597
</div>
@@ -2383,6 +2400,7 @@ <h3>Sample Workflow </h3>
23832400
<a>https://doc.smpte-doc.org/ag-16/main/</a></li>
23842401
<li><cite id="bib-smpte-gh-om">SMPTE GitHub Operating Manual</cite>
23852402
<a>https://github.com/SMPTE/github-operating-manual</a></li>
2403+
23862404
</ul>
23872405
</section>
23882406

js/validate.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ class ReferenceMatcher {
543543

544544
let aCount = 0;
545545
let citeCount = 0;
546+
let doiCount = 0;
546547

547548
for (const child of element.children) {
548549
if (child.localName === "a") {
@@ -551,6 +552,8 @@ class ReferenceMatcher {
551552
if (child.id === null)
552553
logger.error(`All cite element must have an id attribute`, child);
553554
citeCount++;
555+
} else if (child.matches("span.doi")) {
556+
doiCount++;
554557
}
555558
}
556559

@@ -560,6 +563,9 @@ class ReferenceMatcher {
560563
if (citeCount !== 1)
561564
logger.error(`Reference element must contain exactly one cite element`, element);
562565

566+
if (doiCount > 1)
567+
logger.error(`Reference element must contain at most one DOI`, element);
568+
563569
return true;
564570
}
565571
}

smpte.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,21 @@ function insertNormativeReferences(docMetadata) {
453453

454454
h2.innerText = "Normative references";
455455

456+
/* style DOIs */
457+
458+
for (const doi of sec.querySelectorAll("ul span.doi")) {
459+
doi.parentNode.insertBefore(document.createElement("br"), doi);
460+
doi.parentNode.insertBefore(document.createTextNode("doi:\u00a0"), doi);
461+
462+
const prefix = "https://doi.org/";
463+
const url = prefix + doi.textContent.trim();
464+
465+
const label = document.createTextNode("url:\u00a0");
466+
const link = document.createElement("a");
467+
link.textContent = url;
468+
doi.parentNode.insertBefore(link, label.nextSibling);
469+
}
470+
456471
/* style URLs */
457472

458473
for(const u of sec.querySelectorAll("ul a")) {
@@ -542,6 +557,21 @@ function insertBibliography(docMetadata) {
542557

543558
h2.innerText = "Bibliography";
544559

560+
/* style DOIs */
561+
562+
for (const doi of sec.querySelectorAll("ul span.doi")) {
563+
doi.parentNode.insertBefore(document.createElement("br"), doi);
564+
doi.parentNode.insertBefore(document.createTextNode("doi:\u00a0"), doi);
565+
566+
const prefix = "https://doi.org/";
567+
const url = prefix + doi.textContent.trim();
568+
569+
const label = document.createTextNode("url:\u00a0");
570+
const link = document.createElement("a");
571+
link.textContent = url;
572+
doi.parentNode.insertBefore(link, label.nextSibling);
573+
}
574+
545575
/* style links */
546576

547577
for(const u of sec.querySelectorAll("ul a")) {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!doctype html>
2+
<html>
3+
<head itemscope="itemscope" itemtype="http://smpte.org/standards/documents">
4+
<meta charset="utf-8" />
5+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<script type="module" src="../../../../smpte.js"></script>
8+
<meta itemprop="test" content="valid" />
9+
<meta itemprop="pubType" content="AG" />
10+
<meta itemprop="pubNumber" content="99" />
11+
<meta itemprop="pubState" content="draft" />
12+
<title>Title of the document</title>
13+
</head>
14+
<body>
15+
<section id="sec-scope">
16+
<p>This is the scope of the document.</p>
17+
</section>
18+
<section id="sec-normative-references">
19+
<ul>
20+
<li>
21+
<cite id="bib-HTML-5">HTML Standard</cite>, Living Standard.
22+
<a>https://html.spec.whatwg.org/multipage/</a></li>
23+
</li>
24+
<li>
25+
<cite id="bib-SMPTE-st429-18">SMPTE ST 429-18</cite>, D-Cinema Packaging — Immersive Audio Track
26+
File
27+
<span class="doi">10.5594/SMPTE.ST429-18/</span></li>
28+
</li>
29+
<li>
30+
<cite id="bib-SMPTE-st429-18-2023">SMPTE ST 429-18:2023</cite>, D-Cinema Packaging — Immersive
31+
Audio Track File (2023 Edition)
32+
<span class="doi">10.5594/SMPTE.ST429-18.2023/</span></li>
33+
</ul>
34+
</section>
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)