@json-to-office/jto-ops 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2012,7 +2012,7 @@ var RENDERED_QUALITY_RULES = {
2012
2012
  renderedRule({
2013
2013
  id: "rendered/empty-page",
2014
2014
  code: QUALITY_CODES.RENDERED_EMPTY_PAGE,
2015
- description: "A page with no text at all: a full-page figure is fine, a blank page from a stray break is not.",
2015
+ description: "A wordless page (`kind: blank`), or in docx one whose only words are its running head or footer (`kind: chrome-only`): a full-page figure is fine, a blank page from a stray break or an empty section is not.",
2016
2016
  category: "integrity",
2017
2017
  defaultSeverity: "info"
2018
2018
  }),
@@ -2659,15 +2659,18 @@ function draftRenderedFindings(input) {
2659
2659
  }
2660
2660
  }
2661
2661
  pages.forEach((page, pageIndex) => {
2662
- if (page.words.length > 0) return;
2662
+ const hasBody = format === "docx" ? page.words.some((_, i) => !chromeWords.has(`${pageIndex}:${i}`)) : page.words.length > 0;
2663
+ if (hasBody) return;
2664
+ const kind = page.words.length > 0 ? "chrome-only" : "blank";
2663
2665
  findings.push(
2664
2666
  finding({
2665
2667
  ruleId: "rendered/empty-page",
2666
2668
  mapping: "unmapped",
2667
2669
  page: pageIndex + 1,
2668
2670
  path: "",
2669
- message: `Page ${pageIndex + 1} carries no text. A full-page figure is fine; a blank page from a stray break is not.`,
2670
- suggestion: "Preview the page; remove the page break or the empty section if nothing was meant to be there."
2671
+ message: `Page ${pageIndex + 1} carries ${kind === "chrome-only" ? "only its running head or footer" : "no text"}. A full-page figure is fine; a blank page from a stray break or an empty section is not.`,
2672
+ suggestion: "Preview the page; remove the page break or the empty section if nothing was meant to be there.",
2673
+ context: { kind }
2671
2674
  })
2672
2675
  );
2673
2676
  });