diff --git a/doc/main.html b/doc/main.html index 00a75c1..1bfe663 100644 --- a/doc/main.html +++ b/doc/main.html @@ -564,10 +564,17 @@

Normative references section

  • The cite element shall contain an id attribute with value prefixed by bib-.
  • Each li element may contain additional title information. +
  • Each li element may contain one a element that contains a location where the reference can be retrieved.
  • +
  • Each li element may contain one span element with a class="doi" attribute that contains the DOI of the document. Using this will also create a DOI resolver URL.
  • - +

    Undated references should be used, since they point to the most most up-to-date edition of a document.

    + +

    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.

    + +

    The DOI span element should be used, and not the a element, for both the most recent and specific editions of a SMPTE document. SMPTE HO can provide guidance for specific DOIs available.

    +
    <section id="sec-normative-references">
       <ul>
    @@ -575,6 +582,16 @@ 

    Normative references section

    <cite id="bib-HTML-5">HTML Standard</cite>, Living Standard. <a>https://html.spec.whatwg.org/multipage/</a></li> </li> + <li> + <cite id="bib-SMPTE-st429-18">SMPTE ST 429-18</cite>, D-Cinema Packaging — Immersive Audio Track + File + <span class="doi">10.5594/SMPTE.ST429-18/</span></li> + </li> + <li> + <cite id="bib-SMPTE-st429-18-2023">SMPTE ST 429-18:2023</cite>, D-Cinema Packaging — Immersive + Audio Track File (2023 Edition) + <span class="doi">10.5594/SMPTE.ST429-18.2023/</span></li> + </li> </ul> </section>
    @@ -2383,6 +2400,7 @@

    Sample Workflow

    https://doc.smpte-doc.org/ag-16/main/
  • SMPTE GitHub Operating Manual https://github.com/SMPTE/github-operating-manual
  • + diff --git a/js/validate.mjs b/js/validate.mjs index 5b11c9c..a54d0cd 100644 --- a/js/validate.mjs +++ b/js/validate.mjs @@ -543,6 +543,7 @@ class ReferenceMatcher { let aCount = 0; let citeCount = 0; + let doiCount = 0; for (const child of element.children) { if (child.localName === "a") { @@ -551,6 +552,8 @@ class ReferenceMatcher { if (child.id === null) logger.error(`All cite element must have an id attribute`, child); citeCount++; + } else if (child.matches("span.doi")) { + doiCount++; } } @@ -560,6 +563,9 @@ class ReferenceMatcher { if (citeCount !== 1) logger.error(`Reference element must contain exactly one cite element`, element); + if (doiCount > 1) + logger.error(`Reference element must contain at most one DOI`, element); + return true; } } diff --git a/smpte.js b/smpte.js index 5e8a3c7..c3daca0 100644 --- a/smpte.js +++ b/smpte.js @@ -453,6 +453,21 @@ function insertNormativeReferences(docMetadata) { h2.innerText = "Normative references"; + /* style DOIs */ + + for (const doi of sec.querySelectorAll("ul span.doi")) { + doi.parentNode.insertBefore(document.createElement("br"), doi); + doi.parentNode.insertBefore(document.createTextNode("doi:\u00a0"), doi); + + const prefix = "https://doi.org/"; + const url = prefix + doi.textContent.trim(); + + const label = document.createTextNode("url:\u00a0"); + const link = document.createElement("a"); + link.textContent = url; + doi.parentNode.insertBefore(link, label.nextSibling); + } + /* style URLs */ for(const u of sec.querySelectorAll("ul a")) { @@ -542,6 +557,21 @@ function insertBibliography(docMetadata) { h2.innerText = "Bibliography"; + /* style DOIs */ + + for (const doi of sec.querySelectorAll("ul span.doi")) { + doi.parentNode.insertBefore(document.createElement("br"), doi); + doi.parentNode.insertBefore(document.createTextNode("doi:\u00a0"), doi); + + const prefix = "https://doi.org/"; + const url = prefix + doi.textContent.trim(); + + const label = document.createTextNode("url:\u00a0"); + const link = document.createElement("a"); + link.textContent = url; + doi.parentNode.insertBefore(link, label.nextSibling); + } + /* style links */ for(const u of sec.querySelectorAll("ul a")) { diff --git a/test/resources/html/validation/norm-ref-valid.html b/test/resources/html/validation/norm-ref-valid.html new file mode 100644 index 0000000..1dc730a --- /dev/null +++ b/test/resources/html/validation/norm-ref-valid.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + Title of the document + + +
    +

    This is the scope of the document.

    +
    +
    + +
    + + \ No newline at end of file