IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Commit b24f1f53 authored by Suhas CV's avatar Suhas CV
Browse files

footnote and anchor

parent 4fc46cc9
Pipeline #311 failed with stage
in 38 seconds
......@@ -69,30 +69,35 @@ def extractAndConvert(extractpath):
custom_script= '''
<script>
function handleScroll() {
setTimeout(() => {
window.scrollBy(0, -100);
}, 500);
}
var ele = document.getElementsByClassName("ltx_page_main")[0];
var imgElement = document.createElement("img");
imgElement.setAttribute("src", "headerImage.png");
imgElement.setAttribute("alt", "banner");
imgElement.setAttribute(
"style",
"width:100% !important;min-height:auto;"
);
imgElement.setAttribute("style", "width:100% !important;min-height:auto;");
ele.insertBefore(imgElement, ele.firstChild);
var doc = document.getElementById("footnote1");
let cnt = 2;
footnotes = [];
while (doc) {
footnotes.push(doc.id);
let inner = doc.childNodes[1];
let txt = inner.childNodes[0].textContent;
txt = txt.replace(/ +/g, " ");
txt = txt.replace("\n", " ");
if (cnt > 9) footnotes.push(txt.slice(4));
else footnotes.push(txt.slice(2));
doc = document.getElementById("footnote" + cnt);
cnt++;
var docs = document.getElementsByClassName("ltx_note ltx_role_footnote");
let cnt = 0;
let footnotes = [];
let doc = docs[cnt];
while (cnt < docs.length) {
footnotes.push(doc.id);
let inner = doc.childNodes[1];
let txt = inner.childNodes[0].textContent;
txt = txt.replace(/ +/g, " ");
txt = txt.replace("\n", " ");
if (cnt > 9) footnotes.push(txt.slice(2));
else footnotes.push(txt.slice(1));
cnt++;
doc.innerHTML =
`<a href="#fn-${cnt}" onClick="handleScroll()">` + doc.innerHTML + "</a>";
doc = docs[cnt];
}
ele = document.getElementsByTagName("article")[0];
......@@ -103,13 +108,22 @@ def extractAndConvert(extractpath):
let j = 0;
for (let i = 1; i < footnotes.length; i += 2) {
let p = document.createElement("p");
let newC = document.createTextNode(j + 1 + ". " + footnotes[i]);
p.appendChild(newC);
outer.appendChild(p);
j++;
let p = document.createElement("p");
p.setAttribute("id", "fn-" + (j + 1));
let newC = document.createTextNode(j + 1 + ". " + footnotes[i]);
p.appendChild(newC);
outer.appendChild(p);
j++;
}
ele.appendChild(outer);
let sections = document.getElementsByTagName("section");
let sece = sections[sections.length - 1];
let secChildrens = sece.childNodes[3].getElementsByClassName("ltx_p");
for (let i in secChildrens) {
secChildrens[i].style.fontStyle = "italic";
}
</script>
</body>
'''
......
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