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

Commit 4fc46cc9 authored by Suhas CV's avatar Suhas CV
Browse files

footnotes

parent 41838cff
......@@ -68,52 +68,50 @@ def extractAndConvert(extractpath):
split1,split2=file_content.split("</body>")
custom_script= '''
<script>
<script>
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;"
"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++;
}
ele=document.getElementsByTagName("article")[0];
let outer =document.createElement("div",{class:"footnotes-display"});
let heading =document.createElement("h3")
heading.appendChild(document.createTextNode("Footnotes"));
outer.appendChild(heading);
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++;
}
ele.appendChild(outer);
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++;
}
ele = document.getElementsByTagName("article")[0];
let outer = document.createElement("div", { class: "footnotes-display" });
let heading = document.createElement("h3");
heading.appendChild(document.createTextNode("Footnotes"));
outer.appendChild(heading);
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++;
}
ele.appendChild(outer);
</script>
</body>
</body>
'''
html = split1+custom_script+split2
file_in.close()
......
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