Commit 145bc5c5 authored by Julie Blanc's avatar Julie Blanc

[table-of-content] Keep class of title elements

parent c1f3073a
......@@ -69,7 +69,7 @@
</p>
<h2 id="Pre-digital_era">Pre-digital era</h2>
<h2 id="Pre-digital_era" class="keep-class">Pre-digital era</h2>
<h3>Manual typesetting</h3>
<p>During much of the <a href="/wiki/Letterpress_printing" title="Letterpress printing">letterpress era</a>, movable type was composed by hand for each <a href="/wiki/Page_(paper)" title="Page (paper)">page</a>. Cast metal <i><a href="/wiki/Sort_(typesetting)" title="Sort (typesetting)">sorts</a></i> were composed into words, then lines, then paragraphs, then pages of text and tightly bound together to make up a <i>form</i>, with all letter faces exactly the same "height to paper", creating an even surface of type. The form was placed in a press, inked, and an impression made on paper.
</p><p>During typesetting, individual sorts are picked from a type case with the right hand, and set into a composing stick held in the left hand from left to right, and as viewed by the setter upside down. As seen in the photo of the composing stick, a lower case 'q' looks like a 'd', a lower case 'b' looks like a 'p', a lower case 'p' looks like a 'b' and a lower case 'd' looks like a 'q'. This is reputed to be the origin of the expression "mind your p's and q's". It might just as easily have been "mind your b's and d's".
......
......@@ -13,8 +13,8 @@ function createToc(config){
for(var i= 0; i < titleElements.length; i++){
let titleHierarchy = i + 1;
let titleElement = content.querySelectorAll(titleElements[i]);
let titleElement = content.querySelectorAll(titleElements[i]);
titleElement.forEach(function(element) {
......@@ -39,9 +39,22 @@ function createToc(config){
for(var i= 0; i < tocElements.length; i++){
let tocElement = tocElements[i];
let tocNewLi = document.createElement("li");
// Add class for the hierarcy of toc
tocNewLi.classList.add("toc-element");
tocNewLi.classList.add("toc-element-level-" + tocElement.dataset.titleLevel);
// Keep class of title elements
let classTocElement = tocElement.classList;
for(var n= 0; n < classTocElement.length; n++){
if(classTocElement[n] != "title-element"){
tocNewLi.classList.add(classTocElement[n]);
}
}
// Create the element
tocNewLi.innerHTML = '<a href="#' + tocElement.id + '">' + tocElement.innerHTML + '</a>';
tocUl.appendChild(tocNewLi);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment