Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/javascript/models/transformations/lineitem/DetectTOC.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export default class DetectTOC extends ToLineItemTransformation {
const pageTocLinks = [];
var lastWordsWithoutNumber;
var lastLine;
//find lines ending with a number per page
page.items.forEach(line => {
// find lines with words containing only "." ...
const tocLines = page.items.filter(line => line.words.includes(word => hasOnly(word.string, '.')))
// ... and ending with a number per page
tocLines.forEach(line => {
var words = line.words.filter(word => !hasOnly(word.string, '.'));
const digits = [];
while (words.length > 0 && isNumber(words[words.length - 1].string)) {
Expand Down