Skip to content

Commit

Permalink
Markup: Fix lint issuse that don't interfere with Prince
Browse files Browse the repository at this point in the history
  • Loading branch information
gesa committed Jun 14, 2024
1 parent 47d59b6 commit 03215d3
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions js/print.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable no-undef */
'use strict';

Prince.trackBoxes = true;

const year = new Date().getFullYear();
Expand Down Expand Up @@ -86,7 +89,11 @@ function rebuildLi(li) {
* Generates link elements for table of contents items
* */
function renderTocLink(clauseID, clauseNumber, clauseTitle) {
const nonAnnexSections = ['sec-copyright-and-software-license', 'sec-colophon', 'sec-bibliography'];
const nonAnnexSections = [
'sec-copyright-and-software-license',
'sec-colophon',
'sec-bibliography',
];
const link = document.createElement('a');
link.setAttribute('href', '#' + clauseID);
link.setAttribute('title', clauseTitle);
Expand All @@ -99,7 +106,13 @@ function renderTocLink(clauseID, clauseNumber, clauseTitle) {

if (/^[A-Z]$/.test(clauseNumber)) {
const annexType = document.getElementById(clauseID).getAttribute('normative') || 'informative';
link.innerHTML = '<span class="secnum">Annex ' + clauseNumber + ' <span class="unbold">(' + annexType + ')</span></span> ' + clauseTitle;
link.innerHTML =
'<span class="secnum">Annex ' +
clauseNumber +
' <span class="unbold">(' +
annexType +
')</span></span> ' +
clauseTitle;

return link;
}
Expand All @@ -117,10 +130,16 @@ function renderTocLink(clauseID, clauseNumber, clauseTitle) {
* Loops through every clause/annex's h1 and improves the markup
* */
function improveSectionHeadings() {
const sectionHeadings = Array.from(specContainer.querySelectorAll('emu-clause > h1, emu-annex > h1'));
const sectionHeadings = Array.from(
specContainer.querySelectorAll('emu-clause > h1, emu-annex > h1'),
);

/** these section IDs are emu-annex elements but not functionally annexes */
const nonAnnexSections = ["sec-copyright-and-software-license", 'sec-colophon', 'sec-bibliography']
const nonAnnexSections = [
'sec-copyright-and-software-license',
'sec-colophon',
'sec-bibliography',
];

sectionHeadings.forEach(h1 => {
const numElem = h1.firstChild;
Expand All @@ -135,7 +154,8 @@ function improveSectionHeadings() {
} else {
const annexType = parent.getAttribute('normative') || 'informative';

numElem.innerHTML = 'Annex ' + section + ' <br/><span class="unbold">(' + annexType + ')</span><br/>';
numElem.innerHTML =
'Annex ' + section + ' <br/><span class="unbold">(' + annexType + ')</span><br/>';
}
} else {
numElem.textContent = section;
Expand Down Expand Up @@ -217,7 +237,6 @@ function generateInsideCover() {
function generateEcmaCopyrightPage() {
const copyrightNotice = document.createElement('div');


copyrightNotice.classList.add('copyright-notice');
copyrightNotice.innerHTML =
'<p>COPYRIGHT NOTICE</p>\n\n<p>© ' +
Expand All @@ -233,6 +252,7 @@ function generateEcmaCopyrightPage() {
function ecma262fixes() {
const toc = document.getElementById('toc');

// eslint-disable-next-line prettier/prettier
specContainer.insertBefore(document.getElementById('sec-bibliography'), document.getElementById('sec-colophon'));
Array.from(toc.getElementsByTagName('a')).forEach(anchor => {
if (anchor.getAttribute('href') === '#sec-colophon') {
Expand Down

0 comments on commit 03215d3

Please sign in to comment.