@docx4j/core-ts 0.4.0 → 0.6.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.
Files changed (166) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +34 -3
  3. package/dist/html/convert.mjs +40 -15
  4. package/dist/html/elements.mjs +2 -1
  5. package/dist/model/color/ColorMath.d.mts +29 -0
  6. package/dist/model/color/ColorMath.mjs +146 -0
  7. package/dist/model/color/ColorTables.d.mts +6 -0
  8. package/dist/model/color/ColorTables.mjs +83 -0
  9. package/dist/model/color/DrawingMLColors.d.mts +52 -0
  10. package/dist/model/color/DrawingMLColors.mjs +374 -0
  11. package/dist/model/color/ResolvedColor.d.mts +36 -0
  12. package/dist/model/color/ResolvedColor.mjs +65 -0
  13. package/dist/model/color/SpreadsheetColors.d.mts +36 -0
  14. package/dist/model/color/SpreadsheetColors.mjs +84 -0
  15. package/dist/model/color/StyleFill.d.mts +28 -0
  16. package/dist/model/color/StyleFill.mjs +21 -0
  17. package/dist/model/color/ThemeColors.d.mts +86 -0
  18. package/dist/model/color/ThemeColors.mjs +304 -0
  19. package/dist/model/color/WordColors.d.mts +71 -0
  20. package/dist/model/color/WordColors.mjs +121 -0
  21. package/dist/model/color/index.d.mts +6 -0
  22. package/dist/model/color/index.mjs +30 -0
  23. package/dist/model/content/Body.d.mts +153 -19
  24. package/dist/model/content/Body.mjs +570 -131
  25. package/dist/model/content/Comment.d.mts +21 -3
  26. package/dist/model/content/Comment.mjs +202 -19
  27. package/dist/model/content/ContentControl.d.mts +197 -18
  28. package/dist/model/content/ContentControl.mjs +664 -95
  29. package/dist/model/content/Font.d.mts +67 -17
  30. package/dist/model/content/Font.mjs +114 -35
  31. package/dist/model/content/InlinePicture.d.mts +82 -7
  32. package/dist/model/content/InlinePicture.mjs +221 -28
  33. package/dist/model/content/List.mjs +13 -1
  34. package/dist/model/content/Paragraph.d.mts +213 -14
  35. package/dist/model/content/Paragraph.mjs +936 -100
  36. package/dist/model/content/Range.d.mts +242 -11
  37. package/dist/model/content/Range.mjs +975 -119
  38. package/dist/model/content/ResolvedView.d.mts +104 -0
  39. package/dist/model/content/ResolvedView.mjs +596 -0
  40. package/dist/model/content/Table.d.mts +29 -3
  41. package/dist/model/content/Table.mjs +109 -33
  42. package/dist/model/content/TrackedChange.d.mts +301 -16
  43. package/dist/model/content/TrackedChange.mjs +1284 -158
  44. package/dist/model/content/binder.d.mts +2 -1
  45. package/dist/model/content/binder.mjs +48 -1
  46. package/dist/model/content/comments.d.mts +20 -6
  47. package/dist/model/content/comments.mjs +67 -57
  48. package/dist/model/content/generalException.d.mts +18 -0
  49. package/dist/model/content/generalException.mjs +24 -0
  50. package/dist/model/content/index.d.mts +8 -3
  51. package/dist/model/content/index.mjs +7 -2
  52. package/dist/model/content/mathText.d.mts +21 -0
  53. package/dist/model/content/mathText.mjs +267 -0
  54. package/dist/model/content/officeText.d.mts +27 -0
  55. package/dist/model/content/officeText.mjs +74 -0
  56. package/dist/model/content/outline.d.mts +5 -0
  57. package/dist/model/content/outline.mjs +13 -0
  58. package/dist/model/content/placeholders.d.mts +110 -0
  59. package/dist/model/content/placeholders.mjs +253 -0
  60. package/dist/model/content/relationships.d.mts +30 -0
  61. package/dist/model/content/relationships.mjs +133 -0
  62. package/dist/model/content/search.d.mts +72 -0
  63. package/dist/model/content/search.mjs +204 -2
  64. package/dist/model/content/spanEdits.d.mts +159 -0
  65. package/dist/model/content/spanEdits.mjs +728 -0
  66. package/dist/model/content/story.d.mts +44 -0
  67. package/dist/model/content/story.mjs +92 -0
  68. package/dist/model/content/tableColumns.d.mts +1 -1
  69. package/dist/model/content/tableColumns.mjs +108 -80
  70. package/dist/model/content/tableRevisions.d.mts +11 -3
  71. package/dist/model/content/tableRevisions.mjs +72 -42
  72. package/dist/model/content/tableRules.d.mts +30 -0
  73. package/dist/model/content/tableRules.mjs +100 -0
  74. package/dist/model/content/textBoxes.d.mts +18 -0
  75. package/dist/model/content/textBoxes.mjs +105 -0
  76. package/dist/model/content/trackedChangeFilter.d.mts +39 -0
  77. package/dist/model/content/trackedChangeFilter.mjs +81 -0
  78. package/dist/model/content/tracking.d.mts +28 -0
  79. package/dist/model/content/tracking.mjs +149 -10
  80. package/dist/model/content/tree.d.mts +212 -13
  81. package/dist/model/content/tree.mjs +356 -35
  82. package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
  83. package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
  84. package/dist/model/customxml/XmlMapping.d.mts +1 -1
  85. package/dist/model/customxml/XmlMapping.mjs +11 -0
  86. package/dist/model/customxml/bindings.d.mts +21 -2
  87. package/dist/model/customxml/bindings.mjs +76 -32
  88. package/dist/model/customxml/kinds.d.mts +8 -3
  89. package/dist/model/customxml/kinds.mjs +26 -5
  90. package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
  91. package/dist/model/customxml/picturePlaceholder.mjs +32 -0
  92. package/dist/model/customxml/pictures.d.mts +9 -5
  93. package/dist/model/customxml/pictures.mjs +31 -13
  94. package/dist/model/customxml/xhtml.mjs +8 -2
  95. package/dist/model/fonts/families.generated.mjs +2 -2
  96. package/dist/model/fonts/registry.mjs +7 -1
  97. package/dist/model/fonts/substitutions.generated.mjs +2 -2
  98. package/dist/model/fonts/themes.generated.mjs +1 -1
  99. package/dist/model/index.d.mts +2 -0
  100. package/dist/model/index.mjs +4 -0
  101. package/dist/model/listnumbering/Emulator.d.mts +37 -5
  102. package/dist/model/listnumbering/Emulator.mjs +63 -9
  103. package/dist/model/listnumbering/definitions.mjs +18 -0
  104. package/dist/model/properties/PropertyResolver.d.mts +87 -7
  105. package/dist/model/properties/PropertyResolver.mjs +197 -17
  106. package/dist/model/properties/catalogue.d.mts +32 -4
  107. package/dist/model/properties/catalogue.mjs +115 -36
  108. package/dist/model/properties/log.d.mts +1 -1
  109. package/dist/model/properties/log.mjs +5 -5
  110. package/dist/model/properties/table.d.mts +16 -2
  111. package/dist/model/properties/table.mjs +17 -5
  112. package/dist/model/text/Extractor.d.mts +289 -0
  113. package/dist/model/text/Extractor.mjs +2162 -0
  114. package/dist/model/text/LinkTargets.d.mts +45 -0
  115. package/dist/model/text/LinkTargets.mjs +170 -0
  116. package/dist/model/text/MarkdownExporter.d.mts +140 -0
  117. package/dist/model/text/MarkdownExporter.mjs +255 -0
  118. package/dist/model/text/PlainText.d.mts +29 -0
  119. package/dist/model/text/PlainText.mjs +539 -0
  120. package/dist/model/text/TextContext.d.mts +161 -0
  121. package/dist/model/text/TextContext.mjs +425 -0
  122. package/dist/model/text/TextOptions.d.mts +150 -0
  123. package/dist/model/text/TextOptions.mjs +278 -0
  124. package/dist/model/text/TextResult.d.mts +504 -0
  125. package/dist/model/text/TextResult.mjs +526 -0
  126. package/dist/model/text/Texts.d.mts +99 -0
  127. package/dist/model/text/Texts.mjs +187 -0
  128. package/dist/model/text/WmlToMarkdown.d.mts +120 -0
  129. package/dist/model/text/WmlToMarkdown.mjs +911 -0
  130. package/dist/model/text/commonmark.d.mts +121 -0
  131. package/dist/model/text/commonmark.mjs +655 -0
  132. package/dist/model/text/index.d.mts +7 -0
  133. package/dist/model/text/index.mjs +8 -0
  134. package/dist/model/text/normalize.d.mts +8 -0
  135. package/dist/model/text/normalize.mjs +13 -0
  136. package/dist/model/text/outline.d.mts +4 -0
  137. package/dist/model/text/outline.mjs +71 -0
  138. package/dist/office-js/fragment.d.mts +7 -5
  139. package/dist/office-js/fragment.mjs +63 -14
  140. package/dist/office-js/proxy.d.mts +8 -0
  141. package/dist/office-js/proxy.mjs +29 -0
  142. package/dist/office-js/run.mjs +2 -0
  143. package/dist/office-js/supported.generated.mjs +16 -0
  144. package/dist/office-js/toApiScript.mjs +21 -5
  145. package/dist/opc/Load.d.mts +9 -2
  146. package/dist/opc/Save.d.mts +17 -0
  147. package/dist/opc/Save.mjs +12 -2
  148. package/dist/opc/index.d.mts +3 -3
  149. package/dist/opc/index.mjs +2 -2
  150. package/dist/opc/mce/preprocessor.d.mts +88 -7
  151. package/dist/opc/mce/preprocessor.mjs +144 -37
  152. package/dist/opc/mce/understood.d.mts +34 -0
  153. package/dist/opc/mce/understood.mjs +55 -3
  154. package/dist/packages/OpcPackage.d.mts +20 -0
  155. package/dist/packages/OpcPackage.mjs +16 -3
  156. package/dist/packages/WordprocessingMLPackage.d.mts +77 -7
  157. package/dist/packages/WordprocessingMLPackage.mjs +242 -11
  158. package/dist/parts/DefaultXmlPart.mjs +2 -2
  159. package/dist/parts/Part.d.mts +10 -2
  160. package/dist/parts/XmlPart.d.mts +35 -32
  161. package/dist/parts/XmlPart.mjs +107 -107
  162. package/dist/parts/wml/comments.mjs +30 -0
  163. package/dist/parts/wml/index.mjs +12 -0
  164. package/dist/xml/dom.d.mts +7 -0
  165. package/dist/xml/dom.mjs +18 -0
  166. package/package.json +2 -2
@@ -0,0 +1,187 @@
1
+ // CR-012 phase 2: the text model's facade, docx4j's org.docx4j.model.text.Texts.
2
+ import { Part } from '../../parts/Part.mjs';
3
+ import { Docx4JException } from '../../opc/exceptions.mjs';
4
+ import { TextOptions, TextOptionError } from './TextOptions.mjs';
5
+ import { Extractor } from './Extractor.mjs';
6
+ import { PlainText } from './PlainText.mjs';
7
+ import { PackageTrees, TextContext } from './TextContext.mjs';
8
+ import { normalize } from './normalize.mjs';
9
+ const WML_CONTENT_TYPES = {
10
+ main: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml', 'application/vnd.ms-word.document.macroEnabled.main+xml',
11
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml', 'application/vnd.ms-word.template.macroEnabledTemplate.main+xml'],
12
+ header: 'application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml',
13
+ footer: 'application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml',
14
+ footnotes: 'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml',
15
+ endnotes: 'application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml',
16
+ comments: 'application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml',
17
+ };
18
+ function optionsOf(options) {
19
+ const o = TextOptions.of(options);
20
+ o.checkImplemented();
21
+ return o;
22
+ }
23
+ /** A content object: a typed value (`TYPE_NAME`) or an element pair. */
24
+ function isContent(value) {
25
+ var _a;
26
+ if (typeof value !== 'object' || value === null || value instanceof TextOptions)
27
+ return false;
28
+ if (typeof value.TYPE_NAME === 'string')
29
+ return true;
30
+ return 'name' in value && 'value' in value && typeof ((_a = value.value) === null || _a === void 0 ? void 0 : _a.TYPE_NAME) === 'string';
31
+ }
32
+ function isPackage(value) {
33
+ return typeof value === 'object' && value !== null && typeof value.getMainDocumentPart === 'function'
34
+ && typeof value.getPropertyResolver === 'function';
35
+ }
36
+ /**
37
+ * docx4j's text model (its CR-046; the portfolio's *WordprocessingML Text Extraction*, WD): a text is
38
+ * `serialize(scope(view(resolve(package))))` (WD REQ-201). `Texts.of` makes the block model
39
+ * (`TextResult`); `PlainText.of` writes plain text from it.
40
+ *
41
+ * ```ts
42
+ * const result = await Texts.of(pkg, { view: 'markup', include: ['headers', 'footers'], hidden: true });
43
+ * PlainText.of(result);
44
+ * result.warnings;
45
+ * ```
46
+ *
47
+ * - **resolve**: each `mc:AlternateContent` is read from the branch the content API reads
48
+ * (`selectedBranchOf`, CR-010), so that the text model and `Paragraph.text` take the same branch.
49
+ * - **view**: `accepted` (the default), `original` or `markup`; the first two are the text of the document
50
+ * `acceptAllRevisions` or `rejectAllRevisions` leaves, worked out without resolving anything
51
+ * (`ResolvedView`), held equal to that copy route by the agreement test (REQ-406).
52
+ * - **scope**: the main story, each text box once after its anchoring paragraph (after the table for one in
53
+ * a cell), then the footnotes and endnotes in reference order; headers, footers and comments where
54
+ * included, and the glossary, last, under `include: glossary`; hidden text excluded; placeholders
55
+ * included; a bound control's value from its custom XML part; images' descriptions by an
56
+ * `ImageDescriber`; the document properties in the metadata.
57
+ *
58
+ * **Not yet** (CR-012 section 5): `fields: update` and `embedded: true` are refused (REQ-1001); an equation
59
+ * is its text inside `$...$`, not LaTeX (phase 5b); a chart or SmartArt contributes nothing (5c); an
60
+ * `altChunk` is not expanded and raises `altchunk.not_expanded` (5e).
61
+ *
62
+ * **The package is never changed** (REQ-204): every part is read with `readContents()`, the live tree where
63
+ * the part is unmarshalled and a private one where it is not, so a save afterwards is byte for byte where it
64
+ * was before.
65
+ *
66
+ * **Cost.** Each call reads every story and, in the `accepted` and `original` views, their tracked changes
67
+ * once, whether it reads the whole package or one paragraph of it. A `TextContext` (`contextOf`) holds what
68
+ * was read, so calls under one context read it once.
69
+ *
70
+ * **Not Office JS's text.** `Paragraph.text` and the other Office JS readers keep Office JS's text (CR-012
71
+ * D2, REQ-202's emulated-API exemption); each `TextRun` records where its text lies in its paragraph's
72
+ * `Paragraph.text` (`officeOffset`), so that the two map onto each other.
73
+ */
74
+ export class Texts {
75
+ constructor() { }
76
+ static async of(first, second, third, fourth) {
77
+ if (first instanceof Part)
78
+ return Texts.ofPart(first, second, third);
79
+ if (isPackage(first)) {
80
+ if (isContent(second))
81
+ return Texts.ofContent(first, second, third, fourth);
82
+ const o = optionsOf(second);
83
+ const context = await Texts.context(first, third, o);
84
+ return new Extractor(context.trees, o, 'view', context).extract();
85
+ }
86
+ if (isContent(first)) {
87
+ const o = optionsOf(second);
88
+ return new Extractor(PackageTrees.none(), o, 'planless', new TextContext(PackageTrees.none())).extractContent(first, 'MAIN', 'content', undefined);
89
+ }
90
+ throw new Docx4JException('Texts.of takes a WordprocessingMLPackage, a story part of one, or content');
91
+ }
92
+ static async ofContent(pkg, content, options, given) {
93
+ const o = optionsOf(options);
94
+ const context = await Texts.context(pkg, given, o);
95
+ const v = 'name' in content && 'value' in content ? content.value : content;
96
+ return new Extractor(context.trees, o, 'view', context).extractContent(content, 'MAIN', 'content', context.trees.partOf(v));
97
+ }
98
+ static async ofPart(part, options, given) {
99
+ const o = optionsOf(options);
100
+ const pkg = part.package;
101
+ if (!isPackage(pkg))
102
+ throw new Docx4JException(`${part.partName.name} belongs to no WordprocessingML package; read content with Texts.of(content)`);
103
+ const context = await Texts.context(pkg, given, o);
104
+ const trees = context.trees;
105
+ const main = trees.main;
106
+ const ct = part.contentType;
107
+ if (main && part === main.part) {
108
+ return new Extractor(trees, o, 'view', context).extractContent(main.document, 'MAIN', 'body', part);
109
+ }
110
+ if (ct === WML_CONTENT_TYPES.header || ct === WML_CONTENT_TYPES.footer) {
111
+ const rId = main ? relationshipIdOf(main.part, part) : undefined;
112
+ return new Extractor(trees, o, 'view', context).headerOrFooterPart(part, ct === WML_CONTENT_TYPES.header ? 'HEADER' : 'FOOTER', rId !== null && rId !== void 0 ? rId : part.partName.name);
113
+ }
114
+ if (ct === WML_CONTENT_TYPES.footnotes || ct === WML_CONTENT_TYPES.endnotes) {
115
+ if (!context.mainRead && main) {
116
+ // the notes are numbered in their references' order: read the main story for it, its blocks unused
117
+ const first = context.sibling();
118
+ new Extractor(trees, o, 'view', first).extractContent(main.document, 'MAIN', 'body', main.part);
119
+ context.adoptNotes(first);
120
+ context.mainRead = true;
121
+ }
122
+ return new Extractor(trees, o, 'view', context).extractNotes(ct === WML_CONTENT_TYPES.footnotes ? 'footnote' : 'endnote');
123
+ }
124
+ if (ct === WML_CONTENT_TYPES.comments)
125
+ return new Extractor(trees, o, 'view', context).extractComments();
126
+ throw new Docx4JException(`Not a story part: ${part.partName.name}; use Texts.of(package)`);
127
+ }
128
+ /**
129
+ * The text of a package that `acceptAllRevisions` or `rejectAllRevisions` has already resolved, read with
130
+ * no view logic: the copy route of WD REQ-406, which the views of `Texts.of` are held equal to. The
131
+ * options' view says which resolution it was (`accepted` or `original`).
132
+ */
133
+ static async ofResolved(resolved, options) {
134
+ const o = optionsOf(options);
135
+ if (o.view === 'markup')
136
+ throw new TextOptionError('A resolved package has no markup view', 'view', 'REQ-406', 'invalid');
137
+ const context = await Texts.context(resolved, undefined, o);
138
+ return new Extractor(context.trees, o, 'resolved', context).extract();
139
+ }
140
+ /** Plain text of a package (WD section 7.1): `PlainText.of(await Texts.of(pkg, options))`. */
141
+ static async plainText(pkg, options) {
142
+ return PlainText.of(await Texts.of(pkg, options));
143
+ }
144
+ /**
145
+ * A context for calls over one package (CR-012 section 4.4): it reads the package's stories once, makes
146
+ * each view's plan once, and carries the note numbers, numbering states and bookmarks from one call to the
147
+ * next. A snapshot: after the package changes, make another.
148
+ */
149
+ static async contextOf(pkg) {
150
+ return new TextContext(await PackageTrees.read(pkg));
151
+ }
152
+ /** WD REQ-1201's normalisation, under which texts are compared. */
153
+ static normalize(value) {
154
+ return normalize(value);
155
+ }
156
+ static async context(pkg, given, o) {
157
+ return contextFor(pkg, given, o);
158
+ }
159
+ }
160
+ /**
161
+ * The context a call reads under: the one given, checked against the package and the view, or a new one
162
+ * (internal: `Texts` and the outline reader share it).
163
+ */
164
+ export async function contextFor(pkg, given, o) {
165
+ if (given !== undefined && given.pkg !== pkg)
166
+ throw new Docx4JException('This TextContext was made for another package');
167
+ const context = given !== null && given !== void 0 ? given : await Texts.contextOf(pkg);
168
+ if (context.view !== undefined && context.view !== o.view) {
169
+ throw new TextOptionError(`This TextContext read in the ${context.view} view, and its note numbers and list counts are that view's: make another for ${o.view}`, 'view', 'REQ-401', 'invalid');
170
+ }
171
+ context.view = o.view;
172
+ if (o.includes.has('glossary'))
173
+ await context.trees.readGlossary();
174
+ return context;
175
+ }
176
+ /** Options checked as `Texts.of` checks them (internal). */
177
+ export { optionsOf, isPackage };
178
+ /** The id of the main document part's relationship to a part. */
179
+ function relationshipIdOf(main, part) {
180
+ var _a;
181
+ const rels = main.getRelationshipsPart(false);
182
+ for (const rel of (_a = rels === null || rels === void 0 ? void 0 : rels.relationships.relationship) !== null && _a !== void 0 ? _a : []) {
183
+ if ((rels === null || rels === void 0 ? void 0 : rels.getPart(rel)) === part)
184
+ return rel.id;
185
+ }
186
+ return undefined;
187
+ }
@@ -0,0 +1,120 @@
1
+ import type { PropertyResolver } from '../properties/PropertyResolver.mjs';
2
+ import type { TextResult, TextRun } from './TextResult.mjs';
3
+ import { MdDocument, MdImage } from './commonmark.mjs';
4
+ /** An image node waiting for its destination, which needs its part's bytes (`MarkdownExporter`). */
5
+ export interface PendingImage {
6
+ readonly node: MdImage;
7
+ readonly run: TextRun;
8
+ }
9
+ /**
10
+ * Writes the text model's block model (`TextResult`) as a Markdown tree (WD REQ-703): a heading from its
11
+ * outline level, not its style's name; a list from its numbering; bold, italic, struck-through and code text
12
+ * from what a run adds to its paragraph's style (so a heading's inherent bold doesn't become `**markers**`);
13
+ * links from a `w:hyperlink` or a HYPERLINK field; images with the describer's text; notes as `[^n]`; in the
14
+ * `markup` view, CriticMarkup (`{++ ++}`, `{-- --}`, `{>> <<}`). A table of contents is the text model's to
15
+ * leave out (`toc: false`, the default). Each node made for a block carries it as its `tag`, so that
16
+ * `MarkdownExporter.blocks` can say where each block's Markdown begins. docx4j `WmlToMarkdown`.
17
+ */
18
+ export declare class WmlToMarkdown {
19
+ private readonly result;
20
+ /** For a style's own indent (a block quote's depth); undefined where there are no styles to ask. */
21
+ private readonly resolver;
22
+ /** The schemes a link may use beyond `LinkTargets`' defaults (`MarkdownExportOptions.linkSchemes`). */
23
+ private readonly linkSchemes;
24
+ private readonly textOptions;
25
+ /** The open lists, the deepest last. */
26
+ private readonly openLists;
27
+ /** The count each list level last showed (`numId/ilvl`), for a parent item reopened after an interruption. */
28
+ private readonly lastValues;
29
+ private openQuote;
30
+ private openQuoteDepth;
31
+ /** Above 0 while building a GFM header row, whose bold is convention, not markup. */
32
+ private tableHeaderDepth;
33
+ private readonly styleIndents;
34
+ /** The images, in the order written, for their destinations. */
35
+ readonly images: PendingImage[];
36
+ /** Whether a link target was refused (`LinkTargets`): logged once per document. */
37
+ private linkRefused;
38
+ constructor(result: TextResult,
39
+ /** For a style's own indent (a block quote's depth); undefined where there are no styles to ask. */
40
+ resolver: PropertyResolver | undefined,
41
+ /** The schemes a link may use beyond `LinkTargets`' defaults (`MarkdownExportOptions.linkSchemes`). */
42
+ linkSchemes?: readonly string[]);
43
+ convert(): MdDocument;
44
+ private body;
45
+ /** Returns the index of the last block consumed (a code block spans several). */
46
+ private block;
47
+ private paragraph;
48
+ private inlineParagraph;
49
+ /** A code paragraph's text, unescaped; in `markup`, its revisions marked. */
50
+ private codeText;
51
+ /** A paragraph style's own left indent, in twips: 0 where it has none, or there are no styles to ask. */
52
+ private styleIndentLeft;
53
+ private appendToQuote;
54
+ private closeQuote;
55
+ /**
56
+ * The open list whose last item an unlabelled paragraph continues: the deepest whose item's text the
57
+ * paragraph is indented to (its left indent at least the item's, and not at the margin), or the deepest
58
+ * open list for a ListParagraph-styled paragraph; the lists deeper than it are closed. Undefined where
59
+ * none: the paragraph ends the lists.
60
+ */
61
+ private followOnItem;
62
+ private top;
63
+ private listParagraph;
64
+ private closeLists;
65
+ /**
66
+ * GFM pipes: the header row is the table's `w:tblHeader` rows, else its first (several `w:tblHeader` rows
67
+ * are one header, their cells' texts ` / ` apart, as plain text's listed format joins them); block content
68
+ * in cells flattens to inline with `<br>`, a nested table's paragraphs included; `w:vMerge` and
69
+ * `w:gridSpan` degrade (top-left wins, empty cells elsewhere), GFM having no spans.
70
+ *
71
+ * The table style's formatting is left out on purpose (docx4j CR-030 decision 4): a header row the style
72
+ * makes bold is not written `**bold**` (its being the GFM header says as much), and GFM has no table
73
+ * styling for the rest.
74
+ */
75
+ private table;
76
+ /** The header: one row's cells, or several rows' cells by grid column, ` / ` apart. */
77
+ private headerRow;
78
+ private tableCell;
79
+ /**
80
+ * A cell's paragraphs, a nested table's included, `<br>` apart (GFM cells are single-line); its empty
81
+ * paragraphs left out, as plain text leaves them out (Word ends every cell with a paragraph, so a nested
82
+ * table or a block-level control comes with an empty one after it).
83
+ *
84
+ * A cell's alignment is its first paragraph's effective `w:jc`, empty or not; GFM aligns a column, from
85
+ * its header cell's (the delimiter row), so a body cell's is not seen.
86
+ */
87
+ private cellContent;
88
+ /**
89
+ * A chart: its note (docx4j CR-047: `[chart: clustered column; value axis: Revenue]`), its title and its
90
+ * data as a table, after the paragraph it is in, the categories down and the series across (CR-012 phase
91
+ * 5c fills them in; until then the text model makes no chart block).
92
+ */
93
+ private chart;
94
+ private inlines;
95
+ /** A block's runs, in `markup` each revision's between its CriticMarkup marks (REQ-703, REQ-702). */
96
+ private runs;
97
+ /** Runs, those with the same link target in one link. */
98
+ private linked;
99
+ private run;
100
+ private text;
101
+ private comment;
102
+ /** Runs under one marker: the same type, and the same author and date where the detail shows them. */
103
+ private sameMarker;
104
+ /** The marker as one string, for a code block, where nothing is markup. */
105
+ private open;
106
+ /** The marker in a paragraph: its braces raw, its author and date text (docx4j's `open(revision, sink)`). */
107
+ private openMarker;
108
+ /**
109
+ * The marker's author and date as text, which the renderer escapes as it does any document text (docx4j CR-056,
110
+ * `30fb41024`; CR-012 section 21.1): only the braces are raw. Before, the detail went out raw with them, so an
111
+ * author of `<script>...</script>` reached a renderer that allows raw HTML as markup.
112
+ */
113
+ private detailText;
114
+ private detail;
115
+ /**
116
+ * A picture with the describer's text (REQ-703, REQ-514); its destination, which needs its image part's
117
+ * bytes, is the exporter's to fill in (`images`), empty for a picture whose image can't be had.
118
+ */
119
+ private image;
120
+ }