Skip to content

Commit

Permalink
#61 Make sure to prevent: Unsupported headline level: 7
Browse files Browse the repository at this point in the history
  • Loading branch information
jzillmann committed Mar 18, 2024
1 parent 4ba336f commit 33c2d3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class DetectHeaders extends ToLineItemTransformation {
heights.forEach((height, i) => {
const headlineLevel = i + 2;
if (headlineLevel <= 6) {
const headlineType = headlineByLevel(2 + i);
const headlineType = headlineByLevel(headlineLevel);
parseResult.pages.forEach(page => {
page.items.forEach(item => {
if (!item.type && item.height == height && !isListItem(item.text())) {
Expand Down
6 changes: 5 additions & 1 deletion src/javascript/models/transformations/lineitem/DetectTOC.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,12 @@ function findHeadlineItems(page, headline) {
}

function addHeadlineItems(page, tocLink, foundItems, headlineTypeToHeightRange) {
const headlineLevel=tocLink.level + 2;
if(headlineLevel>6){
return ;
}
foundItems.headlineItems.forEach(item => item.annotation = REMOVED_ANNOTATION);
const headlineType = headlineByLevel(tocLink.level + 2);
const headlineType = headlineByLevel(headlineLevel);
const headlineHeight = foundItems.headlineItems.reduce((max, item) => Math.max(max, item.height), 0);
page.items.splice(foundItems.lineIndex + 1, 0, new LineItem({
...foundItems.headlineItems[0],
Expand Down

0 comments on commit 33c2d3d

Please sign in to comment.