0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-10 13:32:45 +00:00

Corrections per PR

Remove off by one error realted to change in page number detection.
Dewrap quotes from exclude screen.
This commit is contained in:
dbolack
2024-03-23 18:57:53 -05:00
parent 1e4f804542
commit 1705e66be2

View File

@@ -5,7 +5,7 @@ const getTOC = ()=>{
const add1 = (title, page)=>{ const add1 = (title, page)=>{
res.push({ res.push({
title : title, title : title,
page : page + 1, page : page,
children : [] children : []
}); });
}; };
@@ -13,7 +13,7 @@ const getTOC = ()=>{
if(!_.last(res)) add1(null, page); if(!_.last(res)) add1(null, page);
_.last(res).children.push({ _.last(res).children.push({
title : title, title : title,
page : page + 1, page : page,
children : [] children : []
}); });
}; };
@@ -22,7 +22,7 @@ const getTOC = ()=>{
if(!_.last(_.last(res).children)) add2(null, page); if(!_.last(_.last(res).children)) add2(null, page);
_.last(_.last(res).children).children.push({ _.last(_.last(res).children).children.push({
title : title, title : title,
page : page + 1, page : page,
children : [] children : []
}); });
}; };
@@ -35,7 +35,7 @@ const getTOC = ()=>{
_.each(headings, (heading)=>{ _.each(headings, (heading)=>{
const onPage = parseInt(heading.closest('.page,.phb').id?.replace(/^p/, '')); const onPage = parseInt(heading.closest('.page,.phb').id?.replace(/^p/, ''));
const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC'); const ToCExclude = getComputedStyle(heading).getPropertyValue('--TOC');
if(ToCExclude != '"exclude"') { if(ToCExclude != 'exclude') {
if(!isNaN(onPage)) { if(!isNaN(onPage)) {
const headingText = heading.innerText; const headingText = heading.innerText;
if(heading.tagName == 'H1') { if(heading.tagName == 'H1') {