@json-to-office/core-docx 6.6.0 → 6.8.0
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/core/generateFromIr.d.ts +1 -0
- package/dist/core/generateFromIr.d.ts.map +1 -1
- package/dist/core/generator.d.ts +1 -0
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/imageResources.d.ts +1 -0
- package/dist/core/imageResources.d.ts.map +1 -1
- package/dist/index.js +124 -21
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.js +83 -3
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/types.d.ts +1 -0
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/quality/facts.d.ts +8 -0
- package/dist/quality/facts.d.ts.map +1 -1
- package/dist/quality/rules.d.ts +15 -7
- package/dist/quality/rules.d.ts.map +1 -1
- package/dist/renderers/office-open/emit.d.ts +1 -0
- package/dist/renderers/office-open/emit.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/fixFloatingImageIds.d.ts +1 -0
- package/dist/utils/fixFloatingImageIds.d.ts.map +1 -1
- package/dist/utils/imageUtils.d.ts +1 -0
- package/dist/utils/imageUtils.d.ts.map +1 -1
- package/dist/utils/packageDocument.d.ts +1 -0
- package/dist/utils/packageDocument.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* same IR, which is what makes the IR comparable, cacheable and snapshottable.
|
|
14
14
|
*/
|
|
15
15
|
/// <reference types="node" />
|
|
16
|
+
/// <reference types="node" />
|
|
16
17
|
import type { GenerationWarning, ServicesConfig } from '@json-to-office/shared';
|
|
17
18
|
import type { FontRuntimeOpts } from '@json-to-office/shared';
|
|
18
19
|
import { compileDocument, type UnsupportedComponent } from '../ir/compiler';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateFromIr.d.ts","sourceRoot":"","sources":["../../src/core/generateFromIr.ts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;;;;;OAQG;IACH,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAgB,IAAI,0BAA0B;IAC9C,SAAgB,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;gBAEhD,UAAU,EAAE,SAAS,oBAAoB,EAAE;CAiBxD;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,QAAQ,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,UAAU,CAAC,CAAC;IACzD,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,yBAAyB,EACnC,OAAO,GAAE,uBAA4B,EACrC,SAAS,CAAC,EAAE,iBAAiB,EAAE,GAC9B,OAAO,CAAC,YAAY,CAAC,CAOvB;AA0GD,0EAA0E;AAC1E,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,yBAAyB,EACnC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAcjC"}
|
package/dist/core/generator.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* it part of the contract again.
|
|
13
13
|
*/
|
|
14
14
|
/// <reference types="node" />
|
|
15
|
+
/// <reference types="node" />
|
|
15
16
|
import { ComponentDefinition, ReportProps, ReportComponentDefinition } from '../types';
|
|
16
17
|
import { ThemeConfig } from '../styles';
|
|
17
18
|
import type { ServicesConfig, FontRuntimeOpts } from '@json-to-office/shared';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/core/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/core/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;;AAIH,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EAE1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,EAEL,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAShE,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE;QACX;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;;WAGG;QACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,iEAAiE;QACjE,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAC;IAC9C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,gFAAgF;I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B,EACpE,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAErE;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;CAS7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageResources.d.ts","sourceRoot":"","sources":["../../src/core/imageResources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG
|
|
1
|
+
{"version":3,"file":"imageResources.d.ts","sourceRoot":"","sources":["../../src/core/imageResources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAOpD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC;IACtE,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClD;AAED,yEAAyE;AACzE,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,QAAQ,CAAC,mBAAmB,GAAG,SAAS,CAAC,GACpD,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
|
package/dist/index.js
CHANGED
|
@@ -13693,6 +13693,55 @@ function textSizeFact(node, props, path4, typography, role) {
|
|
|
13693
13693
|
...size.authored && { sizePath: `${path4}/props/font/size` }
|
|
13694
13694
|
};
|
|
13695
13695
|
}
|
|
13696
|
+
function statisticSizeFacts(props, path4, typography) {
|
|
13697
|
+
const named = STATISTIC_SIZE_POINTS[String(props.size)];
|
|
13698
|
+
const styled = (id) => finiteNumber(asRecord2(typography.styles[id])?.size);
|
|
13699
|
+
const numberPoints = named ?? STATISTIC_SIZE_POINTS.medium;
|
|
13700
|
+
const painted = props.size === "small" || props.size === "large" ? numberPoints : styled("StatisticNumber") ?? numberPoints;
|
|
13701
|
+
const present = (value) => value !== void 0 && value !== null && String(value).trim() !== "";
|
|
13702
|
+
const facts = [];
|
|
13703
|
+
const add = (suffix, role, fontSizePt) => facts.push({
|
|
13704
|
+
id: `docx:text-size:${path4}:${suffix}`,
|
|
13705
|
+
kind: "docx/text-size",
|
|
13706
|
+
path: path4,
|
|
13707
|
+
role,
|
|
13708
|
+
fontSizePt,
|
|
13709
|
+
authored: false
|
|
13710
|
+
});
|
|
13711
|
+
if (present(props.number)) add("number", "statistic", painted);
|
|
13712
|
+
if (present(props.unit) || present(props.trend) || present(props.trendValue))
|
|
13713
|
+
add(
|
|
13714
|
+
"suffix",
|
|
13715
|
+
"statistic-suffix",
|
|
13716
|
+
Math.max(12, Math.round(numberPoints)) / 2
|
|
13717
|
+
);
|
|
13718
|
+
if (present(props.description))
|
|
13719
|
+
add(
|
|
13720
|
+
"description",
|
|
13721
|
+
"statistic-description",
|
|
13722
|
+
styled("StatisticDescription") ?? 10
|
|
13723
|
+
);
|
|
13724
|
+
return facts;
|
|
13725
|
+
}
|
|
13726
|
+
function tocSizeFacts(props, path4, typography) {
|
|
13727
|
+
const depth = asRecord2(props.depth);
|
|
13728
|
+
const from = finiteNumber(depth?.from) ?? 1;
|
|
13729
|
+
const to = finiteNumber(depth?.to) ?? 3;
|
|
13730
|
+
const facts = [];
|
|
13731
|
+
for (let level = from; level <= to; level++) {
|
|
13732
|
+
const size = finiteNumber(asRecord2(typography.styles[`TOC${level}`])?.size);
|
|
13733
|
+
if (size === void 0) continue;
|
|
13734
|
+
facts.push({
|
|
13735
|
+
id: `docx:text-size:${path4}:toc${level}`,
|
|
13736
|
+
kind: "docx/text-size",
|
|
13737
|
+
path: path4,
|
|
13738
|
+
role: `toc${level}`,
|
|
13739
|
+
fontSizePt: size,
|
|
13740
|
+
authored: false
|
|
13741
|
+
});
|
|
13742
|
+
}
|
|
13743
|
+
return facts;
|
|
13744
|
+
}
|
|
13696
13745
|
function tableTextSizeFacts(props, authored, path4, typography, page) {
|
|
13697
13746
|
const facts = [];
|
|
13698
13747
|
const sizeOf = (holder) => finiteNumber(asRecord2(asRecord2(holder)?.font)?.size);
|
|
@@ -13906,6 +13955,16 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
13906
13955
|
(value) => `#${resolveDesignColor2(value, visualColors)}`
|
|
13907
13956
|
) ?? SERIES_COLOR_TOKENS.filter((token) => paletteHexes[token] !== void 0);
|
|
13908
13957
|
const authoredPropsAt = (pointer) => asRecord2(asRecord2(nodeAtPointer(context.document, pointer))?.props);
|
|
13958
|
+
const ownSize = (fact) => {
|
|
13959
|
+
if (!fact?.sizePath) return fact;
|
|
13960
|
+
const written = finiteNumber(
|
|
13961
|
+
asRecord2(authoredPropsAt(fact.path)?.font)?.size
|
|
13962
|
+
);
|
|
13963
|
+
if (written !== void 0) return fact;
|
|
13964
|
+
const inherited2 = { ...fact, authored: false };
|
|
13965
|
+
delete inherited2.sizePath;
|
|
13966
|
+
return inherited2;
|
|
13967
|
+
};
|
|
13909
13968
|
const roleSizesPt = {};
|
|
13910
13969
|
for (const key of Object.keys(typography.styles)) {
|
|
13911
13970
|
const size = effectiveFontSize(
|
|
@@ -14059,10 +14118,22 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14059
14118
|
const fact = lineBoxFact(node, props, path4, typography, context.document);
|
|
14060
14119
|
if (fact) addFact(fact);
|
|
14061
14120
|
if (typeof props.text === "string" && props.text.trim() !== "") {
|
|
14062
|
-
const fact2 = textSizeFact(node, props, path4, typography);
|
|
14121
|
+
const fact2 = ownSize(textSizeFact(node, props, path4, typography));
|
|
14063
14122
|
if (fact2) addFact({ ...fact2, generated: authoredPath(path4) !== path4 });
|
|
14064
14123
|
}
|
|
14065
14124
|
}
|
|
14125
|
+
if (node.name === "list" && Array.isArray(props.items) && props.items.length > 0) {
|
|
14126
|
+
const fact = ownSize(textSizeFact(node, props, path4, typography, "list"));
|
|
14127
|
+
if (fact) addFact({ ...fact, generated: authoredPath(path4) !== path4 });
|
|
14128
|
+
}
|
|
14129
|
+
if (node.name === "statistic") {
|
|
14130
|
+
for (const fact of statisticSizeFacts(props, path4, typography))
|
|
14131
|
+
addFact({ ...fact, generated: authoredPath(path4) !== path4 });
|
|
14132
|
+
}
|
|
14133
|
+
if (node.name === "toc") {
|
|
14134
|
+
for (const fact of tocSizeFacts(props, path4, typography))
|
|
14135
|
+
addFact({ ...fact, generated: authoredPath(path4) !== path4 });
|
|
14136
|
+
}
|
|
14066
14137
|
if (node.name === "image" || node.name === "visual") {
|
|
14067
14138
|
for (const fact of svgTextFacts(props, path4)) addFact(fact);
|
|
14068
14139
|
const drawn = drawnRatio(props);
|
|
@@ -14087,6 +14158,7 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14087
14158
|
kind: "docx/heading",
|
|
14088
14159
|
path: `${path4}/props/level`,
|
|
14089
14160
|
level,
|
|
14161
|
+
generated: authoredPath(path4) !== path4,
|
|
14090
14162
|
keepNext: props.keepNext === true || props.keepNext === void 0 && styleKeepNext === true,
|
|
14091
14163
|
...previousHeadingLevel !== void 0 && {
|
|
14092
14164
|
previousLevel: previousHeadingLevel
|
|
@@ -14127,7 +14199,10 @@ function prepareDocxQualityDocument(document, options = {}) {
|
|
|
14127
14199
|
index,
|
|
14128
14200
|
words: texts.filter((fact) => bodyRoles.has(fact.role)).reduce((total, fact) => total + wordsOf(fact.text), 0),
|
|
14129
14201
|
exhibits: own.filter((fact) => exhibitKinds.has(fact.kind)).length,
|
|
14130
|
-
headings: texts.filter((fact) => fact.role === "heading").length
|
|
14202
|
+
headings: texts.filter((fact) => fact.role === "heading").length,
|
|
14203
|
+
// Anything the reader sees on the section's own pages: a heading, a
|
|
14204
|
+
// contents field, body copy. Running heads repeat onto any page.
|
|
14205
|
+
rendersText: texts.some((fact) => fact.role !== "chrome")
|
|
14131
14206
|
});
|
|
14132
14207
|
if (hasColumnsComponent(rec)) return;
|
|
14133
14208
|
const page = pageBox(
|
|
@@ -14203,10 +14278,15 @@ function isCaptioned(facts, image) {
|
|
|
14203
14278
|
return facts.some((fact) => {
|
|
14204
14279
|
if (fact.kind !== "docx/text") return false;
|
|
14205
14280
|
const text = fact;
|
|
14206
|
-
const
|
|
14281
|
+
const node = text.path.replace(/\/props(?:\/.*)?$/, "");
|
|
14282
|
+
const beside = siblingOf(node) === siblingOf(image) && Math.abs(indexIn(node) - indexIn(image)) === 1;
|
|
14283
|
+
const near = beside || text.path.startsWith(`${image}/`) || image.startsWith(`${node}/`);
|
|
14207
14284
|
return near && (text.role === "caption" || CAPTION_LABEL.test(text.text));
|
|
14208
14285
|
});
|
|
14209
14286
|
}
|
|
14287
|
+
function indexIn(pointer) {
|
|
14288
|
+
return Number(pointer.slice(pointer.lastIndexOf("/") + 1));
|
|
14289
|
+
}
|
|
14210
14290
|
function siblingOf(pointer) {
|
|
14211
14291
|
return pointer.slice(0, pointer.lastIndexOf("/"));
|
|
14212
14292
|
}
|
|
@@ -14726,14 +14806,18 @@ var docxHeadingHierarchyRule = {
|
|
|
14726
14806
|
},
|
|
14727
14807
|
// The fact path already addresses `.../props/level`; RFC 6902
|
|
14728
14808
|
// `add` replaces an existing member, so this works whether the
|
|
14729
|
-
// level was explicit or defaulted.
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14809
|
+
// level was explicit or defaulted. A block's heading maps to the
|
|
14810
|
+
// invocation or a slot instead, and an `add` there would replace
|
|
14811
|
+
// the block itself: its level is the definition's to change.
|
|
14812
|
+
...!fact.generated && {
|
|
14813
|
+
fixes: [
|
|
14814
|
+
{
|
|
14815
|
+
op: "add",
|
|
14816
|
+
path: fact.path,
|
|
14817
|
+
value: previousLevel + 1
|
|
14818
|
+
}
|
|
14819
|
+
]
|
|
14820
|
+
}
|
|
14737
14821
|
}
|
|
14738
14822
|
];
|
|
14739
14823
|
})
|
|
@@ -15231,7 +15315,12 @@ var docxRequiredChromeRule = {
|
|
|
15231
15315
|
relatedPaths: [fact.invocation],
|
|
15232
15316
|
message: `${fact.block} states no ${fact.role} in its "${fact.slot}" slot; the ${profile?.id ?? "selected"} profile expects one on every ${fact.block}.`,
|
|
15233
15317
|
suggestion: `Fill the "${fact.slot}" slot. The theme already styles it.`,
|
|
15234
|
-
context: { block: fact.block, slot: fact.slot, role: fact.role }
|
|
15318
|
+
context: { block: fact.block, slot: fact.slot, role: fact.role },
|
|
15319
|
+
evidence: {
|
|
15320
|
+
actual: "empty",
|
|
15321
|
+
expected: fact.role,
|
|
15322
|
+
values: { source: "profile", required }
|
|
15323
|
+
}
|
|
15235
15324
|
}));
|
|
15236
15325
|
}
|
|
15237
15326
|
};
|
|
@@ -15298,7 +15387,12 @@ var docxRunningHeadRule = {
|
|
|
15298
15387
|
path: fact.path,
|
|
15299
15388
|
message: `Section ${fact.index + 1} carries no ${parts}; the ${profile?.id ?? "selected"} profile expects a running head on every section after the cover.`,
|
|
15300
15389
|
suggestion: "Invoke a running-head block at the top of the first body section: its section effect fills every later section with the title and n / N.",
|
|
15301
|
-
context: { section: fact.index, missing }
|
|
15390
|
+
context: { section: fact.index, missing },
|
|
15391
|
+
evidence: {
|
|
15392
|
+
actual: required.filter((part) => fact[part]),
|
|
15393
|
+
expected: required,
|
|
15394
|
+
values: { source: "profile", fromSection: from }
|
|
15395
|
+
}
|
|
15302
15396
|
}
|
|
15303
15397
|
];
|
|
15304
15398
|
});
|
|
@@ -15346,7 +15440,7 @@ var docxTypeScaleRule = {
|
|
|
15346
15440
|
};
|
|
15347
15441
|
var docxSizeCountRule = {
|
|
15348
15442
|
id: "docx/size-count",
|
|
15349
|
-
description: "More distinct text sizes than maximumSizes allows, blocks included. Off until a profile or policy enables it.",
|
|
15443
|
+
description: "More distinct text sizes across the document than maximumSizes allows, blocks, statistics, lists and contents included; counted per document, which bounds every page. Off until a profile or policy enables it.",
|
|
15350
15444
|
code: QUALITY_CODES.TYPE_SIZE_COUNT,
|
|
15351
15445
|
category: "consistency",
|
|
15352
15446
|
defaultSeverity: "warning",
|
|
@@ -15443,7 +15537,7 @@ var docxSectionContentRule = {
|
|
|
15443
15537
|
(fact) => fact.kind === "docx/section"
|
|
15444
15538
|
);
|
|
15445
15539
|
return sections.flatMap((fact) => {
|
|
15446
|
-
if (fact.
|
|
15540
|
+
if (!fact.rendersText && fact.exhibits === 0)
|
|
15447
15541
|
return [
|
|
15448
15542
|
{
|
|
15449
15543
|
path: fact.path,
|
|
@@ -15555,7 +15649,7 @@ var docxImageAspectRule = {
|
|
|
15555
15649
|
};
|
|
15556
15650
|
var docxContentsRule = {
|
|
15557
15651
|
id: "docx/contents-missing",
|
|
15558
|
-
description: "
|
|
15652
|
+
description: "minimumHeadings headings or more with no table of contents. Off at 0.",
|
|
15559
15653
|
code: QUALITY_CODES.CONTENTS_MISSING,
|
|
15560
15654
|
category: "hierarchy",
|
|
15561
15655
|
defaultSeverity: "info",
|
|
@@ -15628,7 +15722,7 @@ var DOCX_QUALITY_PROFILES = {
|
|
|
15628
15722
|
"client-report": {
|
|
15629
15723
|
id: "client-report",
|
|
15630
15724
|
formats: ["docx"],
|
|
15631
|
-
description: "Client or public-administration report: a running head with page numbers on every section after the cover, a takeaway and a source wherever a block declares them, no heading skipped, every size on the theme scale with at most
|
|
15725
|
+
description: "Client or public-administration report: a running head with page numbers on every section after the cover, a takeaway and a source wherever a block declares them, no heading skipped, every size on the theme scale with at most eleven in play, a readable measure, no empty or untitled section, every heading bound to what follows and every figure named, no page rendered empty or left half blank under the running head, and at least one chart or table.",
|
|
15632
15726
|
rules: {
|
|
15633
15727
|
"docx/required-chrome": {
|
|
15634
15728
|
parameters: { required: ["takeaway", "source"] }
|
|
@@ -15641,7 +15735,14 @@ var DOCX_QUALITY_PROFILES = {
|
|
|
15641
15735
|
},
|
|
15642
15736
|
"docx/heading-hierarchy": { severity: "warning" },
|
|
15643
15737
|
"docx/type-scale": { enabled: true },
|
|
15644
|
-
|
|
15738
|
+
// Measured 2026-09-15 with statistics, lists and contents counted: a
|
|
15739
|
+
// client report built from the house blocks paints up to eleven sizes —
|
|
15740
|
+
// body, heading 1 and 2, subtitle, display, table cells and headers,
|
|
15741
|
+
// source and chrome, and the kpi-row's figure, its unit and its label
|
|
15742
|
+
// (28, 14 and 10pt, or 20 and 10 in a row of four). Every one of the
|
|
15743
|
+
// reports of the #360 checkpoint and the #409 verification set came in
|
|
15744
|
+
// at eleven or fewer; a size past the house set is an ad-hoc one.
|
|
15745
|
+
"docx/size-count": { enabled: true, parameters: { maximumSizes: 11 } },
|
|
15645
15746
|
"docx/role-drift": { enabled: true },
|
|
15646
15747
|
// The report blocks place every figure in a captioned block, so a page
|
|
15647
15748
|
// with no text under the running head is a stray break or an empty
|
|
@@ -15672,7 +15773,7 @@ var DOCX_QUALITY_PROFILES = {
|
|
|
15672
15773
|
"technical-report": {
|
|
15673
15774
|
id: "technical-report",
|
|
15674
15775
|
formats: ["docx"],
|
|
15675
|
-
description: "Technical report or memo: numbered sections under a running head with page numbers on every section after the cover, a source wherever a block declares one, no heading skipped, every size on the theme scale with at most nine in play, a readable measure, no empty or untitled section, every heading bound to what follows, every figure named, a contents page
|
|
15776
|
+
description: "Technical report or memo: numbered sections under a running head with page numbers on every section after the cover, a source wherever a block declares one, no heading skipped, every size on the theme scale with at most nine in play, a readable measure, no empty or untitled section, every heading bound to what follows, every figure named, a contents page from eight headings, no page rendered empty or left half blank, and at least one chart or table.",
|
|
15676
15777
|
rules: {
|
|
15677
15778
|
// A figure or table in a technical report cites where its numbers come
|
|
15678
15779
|
// from; the takeaway is the client report's ask, the caption is the
|
|
@@ -15686,8 +15787,10 @@ var DOCX_QUALITY_PROFILES = {
|
|
|
15686
15787
|
},
|
|
15687
15788
|
"docx/heading-hierarchy": { severity: "warning" },
|
|
15688
15789
|
"docx/type-scale": { enabled: true },
|
|
15689
|
-
//
|
|
15690
|
-
//
|
|
15790
|
+
// Measured 2026-09-15: a technical report built from the house blocks
|
|
15791
|
+
// paints eight sizes (no kpi-row; the contents entries at body size),
|
|
15792
|
+
// and every one of the #409 verification set came in at eight or
|
|
15793
|
+
// fewer. Nine leaves room for one deliberate size of the author's.
|
|
15691
15794
|
"docx/size-count": { enabled: true, parameters: { maximumSizes: 9 } },
|
|
15692
15795
|
"docx/role-drift": { enabled: true },
|
|
15693
15796
|
"rendered/empty-page": { severity: "warning" },
|