Skip to content

Commit

Permalink
Generate list of candidate corrections in appendix
Browse files Browse the repository at this point in the history
  • Loading branch information
dontcallmedom committed Sep 27, 2022
1 parent f1f939b commit 13cb50c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
6 changes: 6 additions & 0 deletions webrtc.html
Expand Up @@ -17519,6 +17519,12 @@ <h2>
effectively and consistently standardise RTT support internationally.
</p>
</section>
<section class="appendix" id="changes">
<h2>
Candidate Amendments
</h2>
<p>Since its publication as a <a href="https://www.w3.org/TR/2021/REC-webrtc-20210126/">W3C Recommendation in January 2021</a>, the following <a href="https://www.w3.org/2021/Process-20211102/#candidate-changes">candidate amendments</a> have been integrated in this document.</p>
</section>
<section class="appendix">
<h2>
Acknowledgements
Expand Down
61 changes: 60 additions & 1 deletion webrtc.js
Expand Up @@ -24,6 +24,64 @@ function markTestableAssertions() {
);
}

function listCandidateChanges() {
let changes = {};
let m;
let i = 0;
document.querySelectorAll(".correction").forEach((correction) => {
const marker = document.createElement("span");
marker.className = "marker";
if ((m = correction.id.match(/^change-(pr[0-9]+)$/))) {
i++;
marker.textContent = `Candidate Correction ${i}:`;
changes[m[1]] = {
number: i,
title: correction.querySelector(".title").cloneNode(true),
entries: [{
id: correction.id,
sectionTitle: correction.closest("section").querySelector("h1,h2,h3,h4,h5,h6").textContent
}]
};
correction.prepend(marker);
} else if ((m = correction.id.match(/^change-(pr[0-9]+)-/))) {
// We copy over the text from the first instance
correction.innerHTML = document.getElementById("change-" + m[1])?.innerHTML;
if (changes[m[1]]) {
changes[m[1]].entries.push({
id: correction.id,
sectionTitle: correction.closest("section").querySelector("h1,h2,h3,h4,h5,h6").textContent
});
}
}
});
if (document.getElementById("changes")) {
const ul = document.createElement("ul");
Object.values(changes).forEach(({title, entries, number}, i) => {
const li = document.createElement("li");
li.appendChild(document.createTextNode(`Candidate Correction ${number}: `));
li.appendChild(title);
li.appendChild(document.createTextNode(" - "));
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
const link = document.createElement("a");
link.href = "#" + entry.id;
link.textContent = `section ${entry.sectionTitle}`;
li.appendChild(link);
// Adding separators between links
if (i < entries.length - 2) {
li.appendChild(document.createTextNode(", "));
} else if (i === entries.length - 2) {
li.appendChild(document.createTextNode(" and "));
} else if (i === entries.length - 1) {
li.appendChild(document.createTextNode("."));
}
}
ul.appendChild(li);
});
document.getElementById("changes").appendChild(ul);
}
}

function highlightTests() {
[...document.querySelectorAll("[data-tests]")].forEach(el => {
if (el.dataset['tests'])
Expand Down Expand Up @@ -138,7 +196,8 @@ var respecConfig = {
preProcess: [
highlightTests,
markTestableAssertions,
function linkToJsep() {
listCandidateChanges,
function linkToJsep() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'jsep-mapping/map.json');
xhr.onload = function(e) {
Expand Down

0 comments on commit 13cb50c

Please sign in to comment.