mirror of
https://github.com/vale981/practical-cl-beautified
synced 2025-03-04 17:11:42 -05:00
fix footnote bug
This commit is contained in:
parent
34d10f0404
commit
ad1d7662e3
2 changed files with 6 additions and 5 deletions
|
@ -132,15 +132,15 @@ function linkFootnotes() {
|
||||||
let link = document.createElement('a');
|
let link = document.createElement('a');
|
||||||
target.id = `foot${index}${targetid}`;
|
target.id = `foot${index}${targetid}`;
|
||||||
link.href = '#' + target.id;
|
link.href = '#' + target.id;
|
||||||
link.innerText = ++index;
|
link.innerText = (index + 1);
|
||||||
origin.innerHTML = '';
|
origin.innerHTML = '';
|
||||||
origin.appendChild(link);
|
origin.appendChild(link);
|
||||||
};
|
};
|
||||||
|
|
||||||
function createPopover(index, origin, target) {
|
function createPopover(index, origin, target) {
|
||||||
let content = target.parentElement.innerHTML;
|
let content = target.parentElement.innerHTML;
|
||||||
content = content.substring(`<sup>${index+1}</sup>`.length-1);
|
content = content.substring(`<sup>${index+1}</sup>`.length);
|
||||||
if(target.parentElement.nextSibling.tagName !== 'P')
|
if(target.parentElement && target.parentElement.nextSibling && target.parentElement.nextSibling.tagName !== 'P')
|
||||||
content += '…';
|
content += '…';
|
||||||
|
|
||||||
tippy(origin, { content, animateFill: false, animation: 'fade', theme: 'pcl'});
|
tippy(origin, { content, animateFill: false, animation: 'fade', theme: 'pcl'});
|
||||||
|
@ -149,6 +149,7 @@ function linkFootnotes() {
|
||||||
let footMap = collectFootnotes();
|
let footMap = collectFootnotes();
|
||||||
|
|
||||||
for(let index in footMap) {
|
for(let index in footMap) {
|
||||||
|
index = parseInt(index); // I love you JavaScript :/
|
||||||
let pair = footMap[index];
|
let pair = footMap[index];
|
||||||
if(pair && 'origin' in pair && 'target' in pair) {
|
if(pair && 'origin' in pair && 'target' in pair) {
|
||||||
let origin = pair.origin;
|
let origin = pair.origin;
|
||||||
|
@ -166,11 +167,11 @@ loadChapters().then(newChapters => {
|
||||||
setUpNumbering();
|
setUpNumbering();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
linkFootnotes();
|
||||||
wrapPre();
|
wrapPre();
|
||||||
HighlightLisp.highlight_auto();
|
HighlightLisp.highlight_auto();
|
||||||
HighlightLisp.paren_match();
|
HighlightLisp.paren_match();
|
||||||
createTOC();
|
createTOC();
|
||||||
setUpNav();
|
setUpNav();
|
||||||
linkFootnotes();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Beautify Practical Common Lisp",
|
"name": "Beautify Practical Common Lisp",
|
||||||
"version": "1.4",
|
"version": "1.5",
|
||||||
|
|
||||||
"description": "Adds a simple table of contents and syntax highlighting to the web version of Practical Common Lisp by Peter Seibel.",
|
"description": "Adds a simple table of contents and syntax highlighting to the web version of Practical Common Lisp by Peter Seibel.",
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue