mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Merge pull request #2945 from 5e-Cleric/TOC-generate-fix
exclude covers from TOC generation
This commit is contained in:
@@ -29,21 +29,23 @@ const getTOC = (pages)=>{
|
|||||||
|
|
||||||
const res = [];
|
const res = [];
|
||||||
_.each(pages, (page, pageNum)=>{
|
_.each(pages, (page, pageNum)=>{
|
||||||
const lines = page.split('\n');
|
if(!page.includes("{{frontCover}}") && !page.includes("{{insideCover}}") && !page.includes("{{partCover}}") && !page.includes("{{backCover}}")) {
|
||||||
_.each(lines, (line)=>{
|
const lines = page.split('\n');
|
||||||
if(_.startsWith(line, '# ')){
|
_.each(lines, (line)=>{
|
||||||
const title = line.replace('# ', '');
|
if(_.startsWith(line, '# ')){
|
||||||
add1(title, pageNum);
|
const title = line.replace('# ', '');
|
||||||
}
|
add1(title, pageNum);
|
||||||
if(_.startsWith(line, '## ')){
|
}
|
||||||
const title = line.replace('## ', '');
|
if(_.startsWith(line, '## ')){
|
||||||
add2(title, pageNum);
|
const title = line.replace('## ', '');
|
||||||
}
|
add2(title, pageNum);
|
||||||
if(_.startsWith(line, '### ')){
|
}
|
||||||
const title = line.replace('### ', '');
|
if(_.startsWith(line, '### ')){
|
||||||
add3(title, pageNum);
|
const title = line.replace('### ', '');
|
||||||
}
|
add3(title, pageNum);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user