highmark-markdown 1.0.183 → 1.0.185
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/example.js +10243 -6411
- package/lib/constants.js +9 -1
- package/lib/defaultMarkdownStyle.js +2 -2
- package/lib/example/importer.js +3 -3
- package/lib/example/indexOptions.js +1 -98
- package/lib/example/view/div/container/markdown.js +2 -2
- package/lib/example/view/div/container/markdownStyle.js +2 -2
- package/lib/example/view/div/container.js +2 -2
- package/lib/example/view/div/pageButtons.js +7 -4
- package/lib/example/view/div/preview.js +1 -5
- package/lib/example/view/div/sizeable/left.js +2 -2
- package/lib/example/view/div/tabButtons/right.js +5 -5
- package/lib/example/view/textarea/markdown.js +2 -2
- package/lib/example/view/textarea/markdownStyle.js +2 -2
- package/lib/example/view/textarea/parseTree/html.js +2 -2
- package/lib/example/view/textarea/plainText.js +1 -5
- package/lib/example/view/xmp.js +1 -5
- package/lib/example/view.js +51 -48
- package/lib/index/list.js +4 -4
- package/lib/index.js +2 -2
- package/lib/map/node/html.js +13 -7
- package/lib/map/node/markdown.js +5 -24
- package/lib/markdown/bnf.js +2 -2
- package/lib/node/html/anchor.js +49 -64
- package/lib/node/html/blockLine.js +23 -4
- package/lib/node/{markdown/paragraph.js → html/directive/contents.js} +20 -14
- package/lib/node/{markdown/strongText.js → html/directive/footnotes.js} +20 -14
- package/lib/node/{markdown/emphasisedText.js → html/directive/index.js} +20 -14
- package/lib/node/{markdown/inlineText.js → html/directive/pageNumber.js} +20 -14
- package/lib/node/html/division.js +118 -7
- package/lib/node/html/footnote.js +4 -10
- package/lib/node/html/heading/index.js +71 -10
- package/lib/node/html/heading/primary.js +8 -7
- package/lib/node/html/heading/quaternary.js +8 -7
- package/lib/node/html/heading/secondary.js +8 -7
- package/lib/node/html/heading/tertiary.js +8 -7
- package/lib/node/html/heading.js +165 -0
- package/lib/node/html/image.js +7 -6
- package/lib/node/html/item/contents.js +22 -8
- package/lib/node/html/item/footnote.js +144 -0
- package/lib/node/html/item/index.js +27 -43
- package/lib/node/html/line.js +55 -2
- package/lib/node/html/link/contents.js +34 -14
- package/lib/node/html/link/email.js +32 -8
- package/lib/node/html/link/footnote.js +95 -5
- package/lib/node/html/link/hyper.js +32 -8
- package/lib/node/html/link/index.js +66 -35
- package/lib/node/html/list/contents.js +22 -8
- package/lib/node/html/list/footnotes.js +39 -12
- package/lib/node/html/list/index.js +22 -8
- package/lib/node/html/pageNumber.js +70 -23
- package/lib/node/html/{item/footnotes.js → reference.js} +14 -14
- package/lib/node/{markdown/heading/primary.js → html/text/comma.js} +38 -28
- package/lib/node/html/text/index.js +146 -0
- package/lib/node/html/text/stronglyEmphasised.js +15 -8
- package/lib/node/html/text.js +43 -5
- package/lib/node/html/topmost.js +67 -1
- package/lib/node/html.js +77 -4
- package/lib/node/markdown/directive/{embee.js → embed.js} +1 -1
- package/lib/node/markdown/division.js +13 -22
- package/lib/node/markdown/link/footnote.js +5 -102
- package/lib/node/markdown/subDivision.js +2 -2
- package/lib/node/markdown/text/block.js +1 -1
- package/lib/node/markdown/text.js +25 -29
- package/lib/ruleNames.js +87 -81
- package/lib/style/selector.js +4 -4
- package/lib/{node/markdown/heading/tertiary.js → transform/html/directive/contents.js} +23 -28
- package/lib/{node/markdown/stronglyEmphasisedText.js → transform/html/directive/footnotes.js} +15 -14
- package/lib/{node/markdown/line.js → transform/html/directive/index.js} +19 -18
- package/lib/transform/html/directive/pageNumber.js +108 -0
- package/lib/transform/html/division.js +130 -0
- package/lib/transform/html/footnote.js +159 -0
- package/lib/transform/html/heading/index.js +109 -0
- package/lib/transform/html/index.js +159 -0
- package/lib/transform/{indexAnchor.js → html/indexAnchor.js} +20 -20
- package/lib/transform/html/item/contents.js +130 -0
- package/lib/transform/html/item/footnote.js +117 -0
- package/lib/transform/html/item/index.js +117 -0
- package/lib/transform/html/line.js +123 -0
- package/lib/transform/html/link/contents.js +130 -0
- package/lib/transform/html/link/footnote.js +158 -0
- package/lib/transform/html/link/nestedFootnote.js +108 -0
- package/lib/transform/html/list/contents.js +180 -0
- package/lib/transform/html/list/footnotes.js +117 -0
- package/lib/transform/html/list/index.js +118 -0
- package/lib/transform/html/pageNumber.js +117 -0
- package/lib/transform/html.js +168 -0
- package/lib/transform/markdown/directive/embed.js +14 -9
- package/lib/transform/markdown/directive/ignore.js +12 -38
- package/lib/transform/markdown/directive/include.js +11 -6
- package/lib/transform/markdown/subDivision.js +18 -50
- package/lib/transform/markdown.js +148 -0
- package/lib/utilities/contents.js +16 -16
- package/lib/utilities/division.js +247 -0
- package/lib/utilities/footnotes.js +8 -8
- package/lib/utilities/html.js +37 -79
- package/lib/utilities/index.js +23 -16
- package/lib/utilities/markdown.js +2 -10
- package/lib/utilities/string.js +16 -10
- package/lib/utilities/whitespace.js +33 -0
- package/package.json +6 -6
- package/src/constants.js +2 -0
- package/src/defaultMarkdownStyle.js +6 -9
- package/src/example/importer.js +11 -5
- package/src/example/indexOptions.js +0 -97
- package/src/example/view/div/container/markdown.js +1 -1
- package/src/example/view/div/container/markdownStyle.js +1 -1
- package/src/example/view/div/container.js +1 -1
- package/src/example/view/div/pageButtons.js +8 -2
- package/src/example/view/div/preview.js +0 -6
- package/src/example/view/div/sizeable/left.js +1 -1
- package/src/example/view/div/tabButtons/right.js +3 -3
- package/src/example/view/textarea/markdown.js +1 -0
- package/src/example/view/textarea/markdownStyle.js +1 -0
- package/src/example/view/textarea/parseTree/html.js +1 -1
- package/src/example/view/textarea/plainText.js +0 -6
- package/src/example/view/xmp.js +0 -6
- package/src/example/view.js +75 -74
- package/src/index/list.js +3 -3
- package/src/index.js +1 -1
- package/src/map/node/html.js +29 -11
- package/src/map/node/markdown.js +8 -65
- package/src/markdown/bnf.js +112 -149
- package/src/node/html/anchor.js +34 -43
- package/src/node/html/blockLine.js +33 -4
- package/src/node/html/directive/contents.js +9 -0
- package/src/node/html/directive/footnotes.js +9 -0
- package/src/node/html/directive/index.js +9 -0
- package/src/node/html/directive/pageNumber.js +9 -0
- package/src/node/html/division.js +154 -4
- package/src/node/html/footnote.js +1 -7
- package/src/node/html/heading/index.js +78 -2
- package/src/node/html/heading/primary.js +6 -4
- package/src/node/html/heading/quaternary.js +6 -4
- package/src/node/html/heading/secondary.js +6 -4
- package/src/node/html/heading/tertiary.js +6 -4
- package/src/node/html/heading.js +59 -0
- package/src/node/html/image.js +8 -5
- package/src/node/html/item/contents.js +25 -2
- package/src/node/html/item/footnote.js +39 -0
- package/src/node/html/item/index.js +35 -16
- package/src/node/html/line.js +41 -2
- package/src/node/html/link/contents.js +32 -5
- package/src/node/html/link/email.js +51 -17
- package/src/node/html/link/footnote.js +98 -2
- package/src/node/html/link/hyper.js +51 -17
- package/src/node/html/link/index.js +63 -30
- package/src/node/html/list/contents.js +25 -2
- package/src/node/html/list/footnotes.js +34 -2
- package/src/node/html/list/index.js +25 -2
- package/src/node/html/pageNumber.js +60 -16
- package/src/node/html/reference.js +13 -0
- package/src/node/html/text/comma.js +29 -0
- package/src/node/html/text/index.js +43 -0
- package/src/node/html/text/stronglyEmphasised.js +22 -11
- package/src/node/html/text.js +3 -3
- package/src/node/html/topmost.js +93 -1
- package/src/node/html.js +34 -6
- package/src/node/markdown/division.js +11 -227
- package/src/node/markdown/link/footnote.js +6 -82
- package/src/node/markdown/subDivision.js +1 -1
- package/src/node/markdown/text/block.js +1 -1
- package/src/node/markdown/text.js +38 -39
- package/src/ruleNames.js +11 -8
- package/src/style/selector.js +3 -4
- package/src/transform/html/directive/contents.js +19 -0
- package/src/transform/html/directive/footnotes.js +12 -0
- package/src/transform/html/directive/index.js +19 -0
- package/src/transform/html/directive/pageNumber.js +12 -0
- package/src/transform/html/division.js +33 -0
- package/src/transform/html/footnote.js +66 -0
- package/src/transform/html/heading/index.js +14 -0
- package/src/transform/html/index.js +77 -0
- package/src/transform/html/indexAnchor.js +24 -0
- package/src/transform/html/item/contents.js +48 -0
- package/src/transform/html/item/footnote.js +21 -0
- package/src/transform/html/item/index.js +21 -0
- package/src/transform/html/line.js +27 -0
- package/src/transform/html/link/contents.js +40 -0
- package/src/transform/html/link/footnote.js +58 -0
- package/src/transform/html/link/nestedFootnote.js +12 -0
- package/src/transform/html/list/contents.js +86 -0
- package/src/transform/html/list/footnotes.js +20 -0
- package/src/transform/html/list/index.js +27 -0
- package/src/transform/html/pageNumber.js +20 -0
- package/src/transform/html.js +78 -0
- package/src/transform/markdown/directive/embed.js +6 -7
- package/src/transform/markdown/directive/ignore.js +3 -9
- package/src/transform/markdown/directive/include.js +3 -3
- package/src/transform/markdown/subDivision.js +5 -17
- package/src/transform/markdown.js +9 -0
- package/src/utilities/contents.js +12 -12
- package/src/utilities/division.js +256 -0
- package/src/utilities/footnotes.js +5 -5
- package/src/utilities/html.js +39 -86
- package/src/utilities/index.js +26 -16
- package/src/utilities/markdown.js +0 -8
- package/src/utilities/string.js +5 -3
- package/src/utilities/whitespace.js +21 -0
- package/lib/node/markdown/anchor.js +0 -171
- package/lib/node/markdown/contentsItem.js +0 -112
- package/lib/node/markdown/directive/pageNumber.js +0 -163
- package/lib/node/markdown/heading/quaternary.js +0 -121
- package/lib/node/markdown/heading/secondary.js +0 -121
- package/lib/node/markdown/heading.js +0 -140
- package/lib/node/markdown/item/footnotes.js +0 -120
- package/lib/node/markdown/link/contents.js +0 -156
- package/lib/node/markdown/link/index.js +0 -117
- package/lib/node/markdown/list/contents.js +0 -112
- package/lib/node/markdown/list/footnotes.js +0 -165
- package/lib/node/markdown/list/index.js +0 -112
- package/lib/transform/contentsDirective.js +0 -112
- package/lib/transform/contentsItem.js +0 -134
- package/lib/transform/contentsLink.js +0 -115
- package/lib/transform/contentsList.js +0 -193
- package/lib/transform/footnote.js +0 -181
- package/lib/transform/footnoteIdentifier.js +0 -120
- package/lib/transform/footnotesDirective.js +0 -112
- package/lib/transform/footnotesItem.js +0 -123
- package/lib/transform/footnotesList.js +0 -172
- package/lib/transform/index.js +0 -166
- package/lib/transform/indexDirective.js +0 -112
- package/lib/transform/indexHeading.js +0 -104
- package/lib/transform/indexItem.js +0 -113
- package/lib/transform/indexList.js +0 -121
- package/lib/transform/line.js +0 -111
- package/lib/transform/pageNumberDirective.js +0 -112
- package/src/node/html/item/footnotes.js +0 -13
- package/src/node/markdown/anchor.js +0 -45
- package/src/node/markdown/contentsItem.js +0 -21
- package/src/node/markdown/directive/pageNumber.js +0 -34
- package/src/node/markdown/emphasisedText.js +0 -7
- package/src/node/markdown/heading/primary.js +0 -9
- package/src/node/markdown/heading/quaternary.js +0 -9
- package/src/node/markdown/heading/secondary.js +0 -9
- package/src/node/markdown/heading/tertiary.js +0 -9
- package/src/node/markdown/heading.js +0 -47
- package/src/node/markdown/inlineText.js +0 -7
- package/src/node/markdown/item/footnotes.js +0 -39
- package/src/node/markdown/line.js +0 -17
- package/src/node/markdown/link/contents.js +0 -31
- package/src/node/markdown/link/index.js +0 -18
- package/src/node/markdown/list/contents.js +0 -21
- package/src/node/markdown/list/footnotes.js +0 -45
- package/src/node/markdown/list/index.js +0 -21
- package/src/node/markdown/paragraph.js +0 -7
- package/src/node/markdown/strongText.js +0 -7
- package/src/node/markdown/stronglyEmphasisedText.js +0 -7
- package/src/transform/contentsDirective.js +0 -18
- package/src/transform/contentsItem.js +0 -55
- package/src/transform/contentsLink.js +0 -28
- package/src/transform/contentsList.js +0 -110
- package/src/transform/footnote.js +0 -51
- package/src/transform/footnoteIdentifier.js +0 -27
- package/src/transform/footnotesDirective.js +0 -18
- package/src/transform/footnotesItem.js +0 -25
- package/src/transform/footnotesList.js +0 -77
- package/src/transform/index.js +0 -90
- package/src/transform/indexAnchor.js +0 -27
- package/src/transform/indexDirective.js +0 -18
- package/src/transform/indexHeading.js +0 -18
- package/src/transform/indexItem.js +0 -29
- package/src/transform/indexList.js +0 -33
- package/src/transform/line.js +0 -19
- package/src/transform/pageNumberDirective.js +0 -18
- /package/src/node/markdown/directive/{embee.js → embed.js} +0 -0
|
@@ -1,217 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MarkdownNode from "../../node/markdown";
|
|
4
|
+
import SubDivisionMarkdownTransform from "../../transform/markdown/subDivision";
|
|
4
5
|
import IgnoreDirectiveMarkdownTransform from "../../transform/markdown/directive/ignore";
|
|
5
6
|
|
|
6
7
|
import { ignoreDirectiveMarkdownNodeFromNode, subDivisionMarkdownNodesFromNode, includeDirectiveMarkdownNodesFromNode } from "../../utilities/markdown";
|
|
7
8
|
|
|
8
9
|
export default class DivisionMarkdownNode extends MarkdownNode {
|
|
9
|
-
// getPageNumber() {
|
|
10
|
-
// let pageNumber = null;
|
|
11
|
-
//
|
|
12
|
-
// const pageNumberDirectiveMarkdownNode = this.findPageNumberDirectiveMarkdownNode();
|
|
13
|
-
//
|
|
14
|
-
// if (pageNumberDirectiveMarkdownNode !== null) {
|
|
15
|
-
// pageNumber = pageNumberDirectiveMarkdownNode.getPageNumber();
|
|
16
|
-
// }
|
|
17
|
-
//
|
|
18
|
-
// return pageNumber;
|
|
19
|
-
// }
|
|
20
|
-
//
|
|
21
|
-
// setPageNumber(pageNumber) {
|
|
22
|
-
// const pageNumberDirectiveMarkdownNode = this.findPageNumberDirectiveMarkdownNode();
|
|
23
|
-
//
|
|
24
|
-
// if (pageNumberDirectiveMarkdownNode !== null) {
|
|
25
|
-
// pageNumberDirectiveMarkdownNode.setPageNumber(pageNumber);
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
//
|
|
29
|
-
// paginate(markdownNodes, context) {
|
|
30
|
-
// const footnotesDirectiveDivisionTransform = this.removeDivisionMarkdownNode(FootnotesDirectiveDivisionTransform, context),
|
|
31
|
-
// pageNumberDirectiveDivisionTransform = this.removeDivisionMarkdownNode(PageNumberDirectiveDivisionTransform, context),
|
|
32
|
-
// subDivisionTransforms = [
|
|
33
|
-
// footnotesDirectiveDivisionTransform,
|
|
34
|
-
// pageNumberDirectiveDivisionTransform
|
|
35
|
-
// ];
|
|
36
|
-
//
|
|
37
|
-
// filter(subDivisionTransforms, (subDivisionTransform) => {
|
|
38
|
-
// if (subDivisionTransform !== null) {
|
|
39
|
-
// return true;
|
|
40
|
-
// }
|
|
41
|
-
// });
|
|
42
|
-
//
|
|
43
|
-
// const { linesPerPage } = context,
|
|
44
|
-
// paginatedChildNodes = [];
|
|
45
|
-
//
|
|
46
|
-
// let { pageNumber } = context,
|
|
47
|
-
// totalLines = 0;
|
|
48
|
-
//
|
|
49
|
-
// this.forEachChildNode((childNode) => {
|
|
50
|
-
// const lines = childNode.lines(context);
|
|
51
|
-
//
|
|
52
|
-
// if ((totalLines + lines) > linesPerPage) {
|
|
53
|
-
// paginateDivisionMarkdownNode(paginatedChildNodes, subDivisionTransforms, this.divisionClassName, markdownNodes, pageNumber, context);
|
|
54
|
-
//
|
|
55
|
-
// pageNumber++;
|
|
56
|
-
//
|
|
57
|
-
// totalLines = 0;
|
|
58
|
-
//
|
|
59
|
-
// clear(paginatedChildNodes);
|
|
60
|
-
// }
|
|
61
|
-
//
|
|
62
|
-
// const paginatedChildNode = childNode; ///
|
|
63
|
-
//
|
|
64
|
-
// paginatedChildNodes.push(paginatedChildNode);
|
|
65
|
-
//
|
|
66
|
-
// totalLines += lines;
|
|
67
|
-
// });
|
|
68
|
-
//
|
|
69
|
-
// if (totalLines > 0) {
|
|
70
|
-
// paginateDivisionMarkdownNode(paginatedChildNodes, subDivisionTransforms, this.divisionClassName, markdownNodes, pageNumber, context);
|
|
71
|
-
//
|
|
72
|
-
// pageNumber++;
|
|
73
|
-
// }
|
|
74
|
-
//
|
|
75
|
-
// Object.assign(context, {
|
|
76
|
-
// pageNumber
|
|
77
|
-
// });
|
|
78
|
-
// }
|
|
79
|
-
//
|
|
80
|
-
// createIndex(divisionMarkdownNodes, context) {
|
|
81
|
-
// let indexCreated = false;
|
|
82
|
-
//
|
|
83
|
-
// const indexDirectiveDivisionTransform = this.findDivisionTransform(IndexDirectiveDivisionTransform, context);
|
|
84
|
-
//
|
|
85
|
-
// if (indexDirectiveDivisionTransform !== null) {
|
|
86
|
-
// const divisionMarkdownNode = this, ///
|
|
87
|
-
// indexTransform = IndexTransform.fromDivisionMarkdownNodesAndDivisionMarkdownNode(divisionMarkdownNodes, divisionMarkdownNode, context);
|
|
88
|
-
//
|
|
89
|
-
// if (indexTransform !== null) {
|
|
90
|
-
// indexTransform.replaceIndexDirectiveSubdivisionTransform(indexDirectiveDivisionTransform, divisionMarkdownNode, context);
|
|
91
|
-
//
|
|
92
|
-
// indexCreated = true;
|
|
93
|
-
// }
|
|
94
|
-
// }
|
|
95
|
-
//
|
|
96
|
-
// return indexCreated;
|
|
97
|
-
// }
|
|
98
|
-
//
|
|
99
|
-
// createContents(divisionMarkdownNodes, context) {
|
|
100
|
-
// let contentsCreated = false;
|
|
101
|
-
//
|
|
102
|
-
// const contentsDirectiveDivisionTransform = this.findDivisionTransform(ContentsDirectiveDivisionTransform, context);
|
|
103
|
-
//
|
|
104
|
-
// if (contentsDirectiveDivisionTransform !== null) {
|
|
105
|
-
// const divisionMarkdownNode = this, ///
|
|
106
|
-
// contentsListTransform = ContentsListTransform.fromDivisionMarkdownNodesAndDivisionMarkdownNode(divisionMarkdownNodes, divisionMarkdownNode, context);
|
|
107
|
-
//
|
|
108
|
-
// if (contentsListTransform !== null) {
|
|
109
|
-
// contentsListTransform.replaceContentsDirectiveSubdivisionTransform(contentsDirectiveDivisionTransform, divisionMarkdownNode, context);
|
|
110
|
-
//
|
|
111
|
-
// contentsCreated = true;
|
|
112
|
-
// }
|
|
113
|
-
// }
|
|
114
|
-
//
|
|
115
|
-
// return contentsCreated;
|
|
116
|
-
// }
|
|
117
|
-
//
|
|
118
|
-
// createFootnotes(footnoteTransformMap, context) {
|
|
119
|
-
// const footnotesDirectiveDivisionTransform = this.findDivisionTransform(FootnotesDirectiveDivisionTransform, context);
|
|
120
|
-
//
|
|
121
|
-
// if (footnotesDirectiveDivisionTransform !== null) {
|
|
122
|
-
// const divisionMarkdownNode = this, ///
|
|
123
|
-
// footnotesListDivisionTransform = FootnotesListTransform.fromDivisionMarkdownNodeAndFootnoteTransformMap(divisionMarkdownNode, footnoteTransformMap, context);
|
|
124
|
-
//
|
|
125
|
-
// if (footnotesListDivisionTransform !== null) {
|
|
126
|
-
// footnotesListDivisionTransform.replaceFootnotesDirectiveDivisionTransform(footnotesDirectiveDivisionTransform, divisionMarkdownNode, context);
|
|
127
|
-
// }
|
|
128
|
-
//
|
|
129
|
-
// renumberFootnoteLinkMarkdownNodes(divisionMarkdownNode, footnoteTransformMap, context);
|
|
130
|
-
// }
|
|
131
|
-
// }
|
|
132
|
-
//
|
|
133
|
-
// prepareFootnotes(footnoteTransformMap, context) {
|
|
134
|
-
// const footnoteDivisionTransforms = this.removeDivisionMarkdownNodes(FootnoteDivisionTransform, context);
|
|
135
|
-
//
|
|
136
|
-
// footnoteDivisionTransforms.forEach((footnoteDivisionTransform) => {
|
|
137
|
-
// const footnoteTransform = FootnoteTransform.fromFootnoteDivisionTransform(footnoteDivisionTransform),
|
|
138
|
-
// identifier = footnoteDivisionTransform.identifier(context);
|
|
139
|
-
//
|
|
140
|
-
// footnoteTransformMap[identifier] = footnoteTransform;
|
|
141
|
-
// });
|
|
142
|
-
// }
|
|
143
|
-
//
|
|
144
|
-
// findDivisionTransform(DivisionTransform, context) {
|
|
145
|
-
// let subDivisionTransform = null;
|
|
146
|
-
//
|
|
147
|
-
// const subDivisionMarkdownNodes = this.findDivisionMarkdownNodes();
|
|
148
|
-
//
|
|
149
|
-
// subDivisionMarkdownNodes.some((subDivisionMarkdownNode) => {
|
|
150
|
-
// subDivisionTransform = DivisionTransform.fromDivisionMarkdownNode(subDivisionMarkdownNode, context);
|
|
151
|
-
//
|
|
152
|
-
// if (subDivisionTransform !== null) {
|
|
153
|
-
// return true;
|
|
154
|
-
// }
|
|
155
|
-
// });
|
|
156
|
-
//
|
|
157
|
-
// return subDivisionTransform;
|
|
158
|
-
// }
|
|
159
|
-
//
|
|
160
|
-
// findDivisionTransforms(DivisionTransform, context) {
|
|
161
|
-
// const subDivisionMarkdownNodes = this.findDivisionMarkdownNodes(),
|
|
162
|
-
// subDivisionTransforms = subDivisionMarkdownNodes.reduce((subDivisionTransforms, subDivisionMarkdownNode) => {
|
|
163
|
-
// const subDivisionTransform = DivisionTransform.fromDivisionMarkdownNode(subDivisionMarkdownNode, context);
|
|
164
|
-
//
|
|
165
|
-
// if (subDivisionTransform !== null) {
|
|
166
|
-
// subDivisionTransforms.push(subDivisionTransform);
|
|
167
|
-
// }
|
|
168
|
-
//
|
|
169
|
-
// return subDivisionTransforms;
|
|
170
|
-
// }, []);
|
|
171
|
-
//
|
|
172
|
-
// return subDivisionTransforms;
|
|
173
|
-
// }
|
|
174
|
-
//
|
|
175
|
-
// findPageNumberDirectiveMarkdownNode() {
|
|
176
|
-
// let pageNumberDirectiveMarkdownNode = null;
|
|
177
|
-
//
|
|
178
|
-
// const subDivisionMarkdownNodes = this.findDivisionMarkdownNodes();
|
|
179
|
-
//
|
|
180
|
-
// subDivisionMarkdownNodes.some((subDivisionMarkdownNode) => {
|
|
181
|
-
// const node = subDivisionMarkdownNode; ///
|
|
182
|
-
//
|
|
183
|
-
// pageNumberDirectiveMarkdownNode = pageNumberDirectiveMarkdownNodeFromNode(node);
|
|
184
|
-
//
|
|
185
|
-
// if (pageNumberDirectiveMarkdownNode !== null) {
|
|
186
|
-
// return true;
|
|
187
|
-
// }
|
|
188
|
-
// });
|
|
189
|
-
//
|
|
190
|
-
// return pageNumberDirectiveMarkdownNode;
|
|
191
|
-
// }
|
|
192
|
-
//
|
|
193
|
-
// removeSubDivisionMarkdownNode(subDivisionMarkdownNode) {
|
|
194
|
-
// const childNode = subDivisionMarkdownNode; ///
|
|
195
|
-
//
|
|
196
|
-
// this.removeChildNode(childNode);
|
|
197
|
-
// }
|
|
198
|
-
//
|
|
199
|
-
// createFootnotesListTransform(footnoteTransformMap, context) {
|
|
200
|
-
// const footnoteDivisionTransforms = this.findDivisionTransforms(FootnoteDivisionTransform, context);
|
|
201
|
-
//
|
|
202
|
-
// footnoteDivisionTransforms.forEach((footnoteDivisionTransform) => {
|
|
203
|
-
// const footnoteTransform = FootnoteTransform.fromFootnoteDivisionTransform(footnoteDivisionTransform),
|
|
204
|
-
// identifier = footnoteDivisionTransform.identifier(context);
|
|
205
|
-
//
|
|
206
|
-
// footnoteTransformMap[identifier] = footnoteTransform;
|
|
207
|
-
// });
|
|
208
|
-
//
|
|
209
|
-
// const divisionMarkdownNode = this, ///
|
|
210
|
-
// footnotesListDivisionTransform = FootnotesListTransform.fromDivisionMarkdownNodeAndFootnoteTransformMap(divisionMarkdownNode, footnoteTransformMap, context);
|
|
211
|
-
//
|
|
212
|
-
// return footnotesListDivisionTransform;
|
|
213
|
-
// }
|
|
214
|
-
|
|
215
10
|
constructor(ruleName, parentNode, childNodes, opacity, precedence, divisionClassName) {
|
|
216
11
|
super(ruleName, parentNode, childNodes, opacity, precedence);
|
|
217
12
|
|
|
@@ -250,7 +45,7 @@ export default class DivisionMarkdownNode extends MarkdownNode {
|
|
|
250
45
|
const divisionMarkdownNode = this, ///
|
|
251
46
|
ignoreDirectiveMarkdownTransform = IgnoreDirectiveMarkdownTransform.fromDivisionMarkdownNode(divisionMarkdownNode);
|
|
252
47
|
|
|
253
|
-
ignoreDirectiveMarkdownTransform.
|
|
48
|
+
ignoreDirectiveMarkdownTransform.remove(context);
|
|
254
49
|
}
|
|
255
50
|
|
|
256
51
|
resolveIncludes(topmostMarkdownNode, context) {
|
|
@@ -280,9 +75,9 @@ export default class DivisionMarkdownNode extends MarkdownNode {
|
|
|
280
75
|
const embeddingsResolved = subDivisionMarkdownNode.resolveEmbeddings(divisionMarkdownNode, context);
|
|
281
76
|
|
|
282
77
|
if (embeddingsResolved) {
|
|
283
|
-
const
|
|
78
|
+
const subDivisionMarkdownTransform = SubDivisionMarkdownTransform.fromSubDivisionMarkdownNode(subDivisionMarkdownNode)
|
|
284
79
|
|
|
285
|
-
|
|
80
|
+
subDivisionMarkdownTransform.remove(context);
|
|
286
81
|
}
|
|
287
82
|
});
|
|
288
83
|
}
|
|
@@ -294,6 +89,13 @@ export default class DivisionMarkdownNode extends MarkdownNode {
|
|
|
294
89
|
return subDivisionMarkdownNodes;
|
|
295
90
|
}
|
|
296
91
|
|
|
92
|
+
removeSubDivisionMarkdownNode(subDivisionMarkdownNode) {
|
|
93
|
+
const node = this, ///
|
|
94
|
+
childNode = subDivisionMarkdownNode; ///
|
|
95
|
+
|
|
96
|
+
node.removeChildNode(childNode);
|
|
97
|
+
}
|
|
98
|
+
|
|
297
99
|
forEachSubDivisionMarkdownNode(callback) {
|
|
298
100
|
const subDivisionMarkdownNodes = this.getSubDivisionMarkdownNodes();
|
|
299
101
|
|
|
@@ -309,21 +111,3 @@ export default class DivisionMarkdownNode extends MarkdownNode {
|
|
|
309
111
|
return divisionMarkdownNode;
|
|
310
112
|
}
|
|
311
113
|
}
|
|
312
|
-
|
|
313
|
-
// function paginateDivisionMarkdownNode(paginatedChildNodes, subDivisionTransforms, divisionClassName, markdownNodes, pageNumber, context) {
|
|
314
|
-
// let markdownNode;
|
|
315
|
-
//
|
|
316
|
-
// const indexAnchorTransform = IndexAnchorTransform.fromPageNumber(pageNumber, context),
|
|
317
|
-
// divisionMarkdownNode = DivisionMarkdownNode.fromPaginatedChildNodesDivisionTransformsAndDivisionClassName(paginatedChildNodes, subDivisionTransforms, divisionClassName, context),
|
|
318
|
-
// anchorMarkdownNode = indexAnchorTransform.getAnchorMarkdownNode();
|
|
319
|
-
//
|
|
320
|
-
// divisionMarkdownNode.setPageNumber(pageNumber);
|
|
321
|
-
//
|
|
322
|
-
// markdownNode = anchorMarkdownNode; ///
|
|
323
|
-
//
|
|
324
|
-
// markdownNodes.push(markdownNode);
|
|
325
|
-
//
|
|
326
|
-
// markdownNode = divisionMarkdownNode; ///
|
|
327
|
-
//
|
|
328
|
-
// markdownNodes.push(markdownNode);
|
|
329
|
-
// }
|
|
@@ -4,37 +4,16 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import MarkdownNode from "../../../node/markdown";
|
|
6
6
|
|
|
7
|
-
import { EMPTY_STRING } from "../../../constants";
|
|
8
|
-
|
|
9
7
|
const { second } = arrayUtilities;
|
|
10
8
|
|
|
11
9
|
export default class FootnoteLinkMarkdownNode extends MarkdownNode {
|
|
12
|
-
constructor(ruleName, childNodes, opacity, precedence, domElement, number) {
|
|
13
|
-
super(ruleName, childNodes, opacity, precedence, domElement);
|
|
14
|
-
|
|
15
|
-
this.number = number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getNumber() {
|
|
19
|
-
return this.number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
setNumber(number) {
|
|
23
|
-
this.number = number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// content(context) {
|
|
27
|
-
// const content = (this.number !== null) ?
|
|
28
|
-
// this.number :
|
|
29
|
-
// EMPTY_STRING;
|
|
30
|
-
//
|
|
31
|
-
// return content;
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
10
|
identifier(context) {
|
|
35
11
|
const identifier = this.fromFirstChildNode((firstChildNode) => {
|
|
36
|
-
const linkTerminalNode = firstChildNode,
|
|
37
|
-
|
|
12
|
+
const linkTerminalNode = firstChildNode, ///
|
|
13
|
+
content = linkTerminalNode.getContent(),
|
|
14
|
+
matches = content.match(/\[\^([^\]]+)]/),
|
|
15
|
+
secondMatch = second(matches),
|
|
16
|
+
identifier = secondMatch; ///
|
|
38
17
|
|
|
39
18
|
return identifier;
|
|
40
19
|
});
|
|
@@ -42,60 +21,5 @@ export default class FootnoteLinkMarkdownNode extends MarkdownNode {
|
|
|
42
21
|
return identifier;
|
|
43
22
|
}
|
|
44
23
|
|
|
45
|
-
|
|
46
|
-
if (this.domElement === null) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const { lastChild = null } = this.domElement;
|
|
51
|
-
|
|
52
|
-
if (lastChild !== null) {
|
|
53
|
-
const domElement = lastChild, ///
|
|
54
|
-
parentDOMElement = this.domElement;
|
|
55
|
-
|
|
56
|
-
parentDOMElement.removeChild(domElement);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
update(context) {
|
|
61
|
-
if (this.domElement === null) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const content = this.content(context);
|
|
66
|
-
|
|
67
|
-
if (content !== EMPTY_STRING) {
|
|
68
|
-
const textNode = document.createTextNode(content),
|
|
69
|
-
domElement = textNode, ///
|
|
70
|
-
parentDOMElement = this.domElement; ///
|
|
71
|
-
|
|
72
|
-
parentDOMElement.appendChild(domElement);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
renumber(number, context) {
|
|
77
|
-
this.setNumber(number);
|
|
78
|
-
|
|
79
|
-
this.clear();
|
|
80
|
-
|
|
81
|
-
this.update(context);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
clone() { return super.clone(this.number); }
|
|
85
|
-
|
|
86
|
-
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) {
|
|
87
|
-
const number = null,
|
|
88
|
-
footnoteLinkMarkdownNode = MarkdownNode.fromRuleNameChildNodesAndOpacity(FootnoteLinkMarkdownNode, ruleName, childNodes, opacity, number);
|
|
89
|
-
|
|
90
|
-
return footnoteLinkMarkdownNode;
|
|
91
|
-
}
|
|
24
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(FootnoteLinkMarkdownNode, ruleName, childNodes, opacity); }
|
|
92
25
|
}
|
|
93
|
-
|
|
94
|
-
function identifierFromLinkTerminalNode(linkTerminalNode) {
|
|
95
|
-
const content = linkTerminalNode.getContent(),
|
|
96
|
-
matches = content.match(/\[\^([^\]]+)]/),
|
|
97
|
-
secondMatch = second(matches),
|
|
98
|
-
identifier = secondMatch; ///
|
|
99
|
-
|
|
100
|
-
return identifier;
|
|
101
|
-
}
|
|
@@ -29,7 +29,7 @@ export default class SubDivisionMarkdownNode extends MarkdownNode {
|
|
|
29
29
|
const subDivisionMarkdownNode = this; ///
|
|
30
30
|
|
|
31
31
|
backwardsForEach(embedDirectiveMarkdownTransforms, (embedDirectiveTransform) => {
|
|
32
|
-
embedDirectiveTransform.addAfterSubDivisionMarkdownNode(subDivisionMarkdownNode,
|
|
32
|
+
embedDirectiveTransform.addAfterSubDivisionMarkdownNode(subDivisionMarkdownNode, context);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
embeddingsResolved = true;
|
|
@@ -4,4 +4,4 @@ import TextMarkdownNode from "../../../node/markdown/text";
|
|
|
4
4
|
|
|
5
5
|
export default class BlockTextMarkdownNode extends TextMarkdownNode {
|
|
6
6
|
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return TextMarkdownNode.fromRuleNameChildNodesAndOpacity(BlockTextMarkdownNode, ruleName, childNodes, opacity); }
|
|
7
|
-
}
|
|
7
|
+
}
|
|
@@ -2,66 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
import MarkdownNode from "../../node/markdown";
|
|
4
4
|
|
|
5
|
-
import { EMPTY_STRING } from "../../constants";
|
|
6
5
|
import { ESCAPED_TOKEN_TYPE } from "../../tokenTypes";
|
|
7
6
|
|
|
8
7
|
export default class TextMarkdownNode extends MarkdownNode {
|
|
9
8
|
text(context) {
|
|
10
|
-
const { tokens } = context;
|
|
11
|
-
|
|
12
|
-
let { whitespaceTokenIndex } = context;
|
|
13
|
-
|
|
14
9
|
const text = this.fromFirstChildNode((firstChildNode) => {
|
|
15
|
-
let text
|
|
10
|
+
let text;
|
|
16
11
|
|
|
17
12
|
const terminalNode = firstChildNode, ///
|
|
18
13
|
significantToken = terminalNode.getSignificantToken(),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (previousTokenIndex > -1) {
|
|
23
|
-
const previousToken = tokens[previousTokenIndex],
|
|
24
|
-
previousTokenWhitespaceToken = previousToken.isWhitespaceToken();
|
|
14
|
+
significantTokenType = significantToken.getType(),
|
|
15
|
+
significantTokenContent = significantToken.getContent();
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
if (previousTokenIndex > whitespaceTokenIndex) {
|
|
28
|
-
const whitespaceToken = previousToken, ///
|
|
29
|
-
whitespaceTokenContent = whitespaceToken.getContent();
|
|
17
|
+
text = significantTokenContent; ///
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
if (significantTokenType === ESCAPED_TOKEN_TYPE) {
|
|
20
|
+
const start = 1;
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
22
|
+
text = text.substring(start);
|
|
36
23
|
}
|
|
37
24
|
|
|
38
|
-
|
|
25
|
+
const { tokens, firstSignificantTokenIndex, lastSignificantTokenIndex, whitespaceTokenIndexes } = context,
|
|
26
|
+
index = tokens.indexOf(significantToken),
|
|
27
|
+
nextIndex = index + 1,
|
|
28
|
+
previousIndex = index - 1;
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
if (previousIndex > firstSignificantTokenIndex) {
|
|
31
|
+
const previousToken = tokens[previousIndex],
|
|
32
|
+
previousTokenWhitespaceToken = previousToken.isWhitespaceToken();
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
if (previousTokenWhitespaceToken) {
|
|
35
|
+
const whitespaceTokenIndexesIncludesPreviousIndex = whitespaceTokenIndexes.includes(previousIndex);
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
if (!whitespaceTokenIndexesIncludesPreviousIndex) {
|
|
38
|
+
const whitespaceToken = previousToken, ///
|
|
39
|
+
whitespaceTokenContent = whitespaceToken.getContent(),
|
|
40
|
+
whitespace = whitespaceTokenContent; ///
|
|
41
|
+
|
|
42
|
+
text = `${whitespace}${text}`;
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
const whitespaceTokenIndex = previousIndex; ///
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
whitespaceTokenIndexes.push(whitespaceTokenIndex);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
52
50
|
|
|
53
|
-
if (
|
|
54
|
-
const nextToken = tokens[
|
|
51
|
+
if (nextIndex < lastSignificantTokenIndex) {
|
|
52
|
+
const nextToken = tokens[nextIndex],
|
|
55
53
|
nextTokenWhitespaceToken = nextToken.isWhitespaceToken();
|
|
56
54
|
|
|
57
55
|
if (nextTokenWhitespaceToken) {
|
|
58
|
-
|
|
56
|
+
const whitespaceTokenIndexesIncludesPreviousIndex = whitespaceTokenIndexes.includes(nextIndex);
|
|
57
|
+
|
|
58
|
+
if (!whitespaceTokenIndexesIncludesPreviousIndex) {
|
|
59
59
|
const whitespaceToken = nextToken, ///
|
|
60
|
-
whitespaceTokenContent = whitespaceToken.getContent()
|
|
60
|
+
whitespaceTokenContent = whitespaceToken.getContent(),
|
|
61
|
+
whitespace = whitespaceTokenContent; ///
|
|
61
62
|
|
|
62
|
-
text = `${text}${
|
|
63
|
+
text = `${text}${whitespace}`;
|
|
63
64
|
|
|
64
|
-
whitespaceTokenIndex =
|
|
65
|
+
const whitespaceTokenIndex = nextIndex; ///
|
|
66
|
+
|
|
67
|
+
whitespaceTokenIndexes.push(whitespaceTokenIndex);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
}
|
|
@@ -69,10 +72,6 @@ export default class TextMarkdownNode extends MarkdownNode {
|
|
|
69
72
|
return text;
|
|
70
73
|
});
|
|
71
74
|
|
|
72
|
-
Object.assign(context, {
|
|
73
|
-
whitespaceTokenIndex
|
|
74
|
-
});
|
|
75
|
-
|
|
76
75
|
return text;
|
|
77
76
|
}
|
|
78
77
|
|
package/src/ruleNames.js
CHANGED
|
@@ -6,7 +6,6 @@ export const PATH_RULE_NAME = "path";
|
|
|
6
6
|
export const IMAGE_RULE_NAME = "image";
|
|
7
7
|
export const TABLE_RULE_NAME = "table";
|
|
8
8
|
export const ERROR_RULE_NAME = "error";
|
|
9
|
-
export const COMMA_RULE_NAME = "comma";
|
|
10
9
|
export const ANCHOR_RULE_NAME = "anchor";
|
|
11
10
|
export const FOOTER_RULE_NAME = "footer";
|
|
12
11
|
export const MARKDOWN_RULE_NAME = "markdown";
|
|
@@ -17,6 +16,8 @@ export const BLOCK_END_RULE_NAME = "blockEnd";
|
|
|
17
16
|
export const REFERENCE_RULE_NAME = "reference";
|
|
18
17
|
export const PARAGRAPH_RULE_NAME = "paragraph";
|
|
19
18
|
export const HYPERLINK_RULE_NAME = "hyperlink";
|
|
19
|
+
export const COMMA_TEXT_RULE_NAME = "commaText";
|
|
20
|
+
export const INDEX_TEXT_RULE_NAME = "indexText";
|
|
20
21
|
export const INDEX_LIST_RULE_NAME = "indexList";
|
|
21
22
|
export const INDEX_ITEM_RULE_NAME = "indexItem";
|
|
22
23
|
export const INDEX_LINK_RULE_NAME = "indexLink";
|
|
@@ -33,7 +34,7 @@ export const BLOCK_START_RULE_NAME = "blockStart";
|
|
|
33
34
|
export const END_OF_LINE_RULE_NAME = "endOfLine";
|
|
34
35
|
export const INLINE_TEXT_RULE_NAME = "inlineText";
|
|
35
36
|
export const STRONG_TEXT_RULE_NAME = "strongText";
|
|
36
|
-
export const
|
|
37
|
+
export const PAGE_NUMBER_RULE_NAME = "pageNumber";
|
|
37
38
|
export const ORDERED_LIST_RULE_NAME = "orderedList";
|
|
38
39
|
export const ORDERED_ITEM_RULE_NAME = "orderedItem";
|
|
39
40
|
export const SUB_DIVISION_RULE_NAME = "subDivision";
|
|
@@ -44,6 +45,7 @@ export const CONTENTS_ITEM_RULE_NAME = "contentsItem";
|
|
|
44
45
|
export const CONTENTS_LIST_RULE_NAME = "contentsList";
|
|
45
46
|
export const FOOTNOTE_LINK_RULE_NAME = "footnoteLink";
|
|
46
47
|
export const TABLE_DIVIDER_RULE_NAME = "tableDivider";
|
|
48
|
+
export const FOOTNOTE_ITEM_RULE_NAME = "footnoteItem";
|
|
47
49
|
export const VERTICAL_SPACE_RULE_NAME = "verticalSpace";
|
|
48
50
|
export const TABLE_HEAD_ROW_RULE_NAME = "tableHeadRow";
|
|
49
51
|
export const TABLE_BODY_ROW_RULE_NAME = "tableBodyRow";
|
|
@@ -51,7 +53,6 @@ export const INLINE_LISTING_RULE_NAME = "inlineListing";
|
|
|
51
53
|
export const UNORDERED_LIST_RULE_NAME = "unorderedList";
|
|
52
54
|
export const UNORDERED_ITEM_RULE_NAME = "unorderedItem";
|
|
53
55
|
export const FOOTNOTES_LIST_RULE_NAME = "footnotesList";
|
|
54
|
-
export const FOOTNOTES_ITEM_RULE_NAME = "footnotesItem";
|
|
55
56
|
export const TABLE_HEAD_CELL_RULE_NAME = "tableHeadCell";
|
|
56
57
|
export const TABLE_BODY_CELL_RULE_NAME = "tableBodyCell";
|
|
57
58
|
export const EMPHASISED_TEXT_RULE_NAME = "emphasisedText";
|
|
@@ -70,11 +71,10 @@ export const FOOTNOTES_DIRECTIVE_RULE_NAME = "footnotesDirective";
|
|
|
70
71
|
export const PAGE_NUMBER_DIRECTIVE_RULE_NAME = "pageNumberDirective";
|
|
71
72
|
export const STRONGLY_EMPHASISED_TEXT_RULE_NAME = "stronglyEmphasisedText";
|
|
72
73
|
|
|
73
|
-
const ruleNames =
|
|
74
|
+
const ruleNames = [
|
|
74
75
|
HTML_RULE_NAME,
|
|
75
76
|
LINE_RULE_NAME,
|
|
76
77
|
PATH_RULE_NAME,
|
|
77
|
-
COMMA_RULE_NAME,
|
|
78
78
|
IMAGE_RULE_NAME,
|
|
79
79
|
TABLE_RULE_NAME,
|
|
80
80
|
ERROR_RULE_NAME,
|
|
@@ -87,6 +87,8 @@ const ruleNames = {
|
|
|
87
87
|
PARAGRAPH_RULE_NAME,
|
|
88
88
|
HYPERLINK_RULE_NAME,
|
|
89
89
|
BLOCK_END_RULE_NAME,
|
|
90
|
+
COMMA_TEXT_RULE_NAME,
|
|
91
|
+
INDEX_TEXT_RULE_NAME,
|
|
90
92
|
INDEX_LIST_RULE_NAME,
|
|
91
93
|
INDEX_ITEM_RULE_NAME,
|
|
92
94
|
INDEX_LINK_RULE_NAME,
|
|
@@ -101,8 +103,9 @@ const ruleNames = {
|
|
|
101
103
|
DIRECTIVES_RULE_NAME,
|
|
102
104
|
END_OF_LINE_RULE_NAME,
|
|
103
105
|
INLINE_TEXT_RULE_NAME,
|
|
104
|
-
STRONG_TEXT_RULE_NAME,
|
|
105
106
|
BLOCK_START_RULE_NAME,
|
|
107
|
+
STRONG_TEXT_RULE_NAME,
|
|
108
|
+
PAGE_NUMBER_RULE_NAME,
|
|
106
109
|
ORDERED_LIST_RULE_NAME,
|
|
107
110
|
ORDERED_ITEM_RULE_NAME,
|
|
108
111
|
SUB_DIVISION_RULE_NAME,
|
|
@@ -113,6 +116,7 @@ const ruleNames = {
|
|
|
113
116
|
CONTENTS_LIST_RULE_NAME,
|
|
114
117
|
FOOTNOTE_LINK_RULE_NAME,
|
|
115
118
|
TABLE_DIVIDER_RULE_NAME,
|
|
119
|
+
FOOTNOTE_ITEM_RULE_NAME,
|
|
116
120
|
VERTICAL_SPACE_RULE_NAME,
|
|
117
121
|
TABLE_HEAD_ROW_RULE_NAME,
|
|
118
122
|
TABLE_BODY_ROW_RULE_NAME,
|
|
@@ -120,7 +124,6 @@ const ruleNames = {
|
|
|
120
124
|
UNORDERED_LIST_RULE_NAME,
|
|
121
125
|
UNORDERED_ITEM_RULE_NAME,
|
|
122
126
|
FOOTNOTES_LIST_RULE_NAME,
|
|
123
|
-
FOOTNOTES_ITEM_RULE_NAME,
|
|
124
127
|
TABLE_HEAD_CELL_RULE_NAME,
|
|
125
128
|
TABLE_BODY_CELL_RULE_NAME,
|
|
126
129
|
EMPHASISED_TEXT_RULE_NAME,
|
|
@@ -138,6 +141,6 @@ const ruleNames = {
|
|
|
138
141
|
FOOTNOTES_DIRECTIVE_RULE_NAME,
|
|
139
142
|
PAGE_NUMBER_DIRECTIVE_RULE_NAME,
|
|
140
143
|
STRONGLY_EMPHASISED_TEXT_RULE_NAME
|
|
141
|
-
|
|
144
|
+
];
|
|
142
145
|
|
|
143
146
|
export default ruleNames;
|
package/src/style/selector.js
CHANGED
|
@@ -16,8 +16,7 @@ const { STRONG_TEXT_RULE_NAME,
|
|
|
16
16
|
UNORDERED_LIST_RULE_NAME,
|
|
17
17
|
STRONGLY_EMPHASISED_TEXT_RULE_NAME } = ruleNames;
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
ruleNameTerminalNodeQuery = nodeQuery("/selector/@rule-name");
|
|
19
|
+
const ruleNameTerminalNodeQuery = nodeQuery("/selector/@rule-name");
|
|
21
20
|
|
|
22
21
|
export default class Selector {
|
|
23
22
|
constructor(content, whitespace) {
|
|
@@ -69,9 +68,9 @@ function contentFromNodeAndTokens(node, tokens) {
|
|
|
69
68
|
} else {
|
|
70
69
|
content = EMPTY_STRING;
|
|
71
70
|
|
|
72
|
-
const
|
|
71
|
+
const ruleNamesIncludesRuleName = ruleNames.includes(ruleName);
|
|
73
72
|
|
|
74
|
-
if (
|
|
73
|
+
if (ruleNamesIncludesRuleName) {
|
|
75
74
|
const tagName = tagNameMap[ruleName];
|
|
76
75
|
|
|
77
76
|
if (tagName !== null) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLTransform from "../../../transform/html"
|
|
4
|
+
|
|
5
|
+
export default class ContentsDirectiveHTMLTransform extends HTMLTransform {
|
|
6
|
+
getContentsDirectiveHTMLNode() {
|
|
7
|
+
const htmlNode = this.getHTMLNode(),
|
|
8
|
+
contentsDirectiveHTMLNode = htmlNode; ///
|
|
9
|
+
|
|
10
|
+
return contentsDirectiveHTMLNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static fromContentsDirectiveHTMLNode(contentsDirectiveHTMLNde) {
|
|
14
|
+
const htmlNode = contentsDirectiveHTMLNde, ///
|
|
15
|
+
contentsDirectiveHTMLTransform = HTMLTransform.fromHTMLNode(ContentsDirectiveHTMLTransform, htmlNode);
|
|
16
|
+
|
|
17
|
+
return contentsDirectiveHTMLTransform;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLTransform from "../../../transform/html"
|
|
4
|
+
|
|
5
|
+
export default class FootnotesDirectiveHTMLTransform extends HTMLTransform {
|
|
6
|
+
static fromFootnotesDirectiveHTMLNode(footnotesDirectiveHTMLNde) {
|
|
7
|
+
const htmlNode = footnotesDirectiveHTMLNde, ///
|
|
8
|
+
footnotesDirectiveHTMLTransform = HTMLTransform.fromHTMLNode(FootnotesDirectiveHTMLTransform, htmlNode);
|
|
9
|
+
|
|
10
|
+
return footnotesDirectiveHTMLTransform;
|
|
11
|
+
}
|
|
12
|
+
}
|