highmark-markdown 1.0.169 → 1.0.170

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 (92) hide show
  1. package/example.js +6921 -3362
  2. package/lib/classFromOuterNode.js +30 -0
  3. package/lib/constants.js +5 -1
  4. package/lib/example/constants.js +5 -1
  5. package/lib/example/view/button/page.js +2 -2
  6. package/lib/example/view/div/container/markdown.js +33 -4
  7. package/lib/example/view/div/container/markdownStyle.js +31 -2
  8. package/lib/example/view/div/container/preview.js +3 -9
  9. package/lib/example/view/div/container.js +2 -2
  10. package/lib/example/view/div/html.js +2 -2
  11. package/lib/example/view/div/pageButtons.js +2 -2
  12. package/lib/example/view/div/preview.js +1 -14
  13. package/lib/example/view/textarea/css.js +2 -2
  14. package/lib/example/view/textarea/markdown.js +2 -2
  15. package/lib/example/view/textarea/markdownStyle.js +2 -2
  16. package/lib/example/view/textarea/parseTree/markdown/inner.js +179 -0
  17. package/lib/example/view/textarea/parseTree/markdown/outer.js +148 -0
  18. package/lib/example/view/textarea/parseTree/markdown.js +1 -27
  19. package/lib/example/view/textarea/parseTree/markdownStyle.js +23 -2
  20. package/lib/example/view/textarea/parseTree.js +2 -2
  21. package/lib/example/view/textarea/plainText.js +2 -2
  22. package/lib/example/view/textarea.js +2 -2
  23. package/lib/example/view.js +20 -10
  24. package/lib/node/html/anchor.js +154 -0
  25. package/lib/node/html/blockLine.js +134 -0
  26. package/lib/node/html/blockListing.js +127 -0
  27. package/lib/node/html/blockListingEnd.js +120 -0
  28. package/lib/node/html/blockListingStart.js +120 -0
  29. package/lib/node/html/className.js +120 -0
  30. package/lib/node/html/comma.js +127 -0
  31. package/lib/node/html/contentsLink.js +136 -0
  32. package/lib/node/html/directive/pageNumber.js +178 -0
  33. package/lib/node/html/item/ordered.js +135 -0
  34. package/lib/node/html/topmost.js +123 -0
  35. package/lib/node/html.js +281 -0
  36. package/lib/node/markdown/anchor.js +1 -34
  37. package/lib/node/markdown/blockLine.js +1 -15
  38. package/lib/node/markdown/blockListing.js +1 -8
  39. package/lib/node/markdown/comma.js +1 -8
  40. package/lib/node/markdown/contentsLink.js +1 -17
  41. package/lib/node/markdown/directive/pageNumber.js +1 -16
  42. package/lib/node/markdown/item/ordered.js +1 -16
  43. package/lib/node/markdown.js +1 -66
  44. package/lib/queries.js +60 -0
  45. package/lib/ruleNameToClassMap.js +44 -0
  46. package/lib/utilities/query.js +12 -1
  47. package/package.json +4 -4
  48. package/src/classFromOuterNode.js +20 -0
  49. package/src/constants.js +1 -0
  50. package/src/example/constants.js +1 -0
  51. package/src/example/view/button/page.js +1 -1
  52. package/src/example/view/div/container/markdown.js +23 -4
  53. package/src/example/view/div/container/markdownStyle.js +21 -2
  54. package/src/example/view/div/container/preview.js +1 -9
  55. package/src/example/view/div/container.js +2 -0
  56. package/src/example/view/div/html.js +1 -1
  57. package/src/example/view/div/pageButtons.js +2 -2
  58. package/src/example/view/div/preview.js +0 -17
  59. package/src/example/view/textarea/css.js +1 -1
  60. package/src/example/view/textarea/markdown.js +2 -2
  61. package/src/example/view/textarea/markdownStyle.js +2 -2
  62. package/src/example/view/textarea/parseTree/markdown/inner.js +36 -0
  63. package/src/example/view/textarea/parseTree/markdown/outer.js +27 -0
  64. package/src/example/view/textarea/parseTree/markdown.js +1 -11
  65. package/src/example/view/textarea/parseTree/markdownStyle.js +10 -2
  66. package/src/example/view/textarea/parseTree.js +0 -2
  67. package/src/example/view/textarea/plainText.js +2 -2
  68. package/src/example/view/textarea.js +1 -1
  69. package/src/example/view.js +38 -19
  70. package/src/node/html/anchor.js +53 -0
  71. package/src/node/html/blockLine.js +27 -0
  72. package/src/node/html/blockListing.js +20 -0
  73. package/src/node/html/blockListingEnd.js +11 -0
  74. package/src/node/html/blockListingStart.js +11 -0
  75. package/src/node/html/className.js +11 -0
  76. package/src/node/html/comma.js +18 -0
  77. package/src/node/html/contentsLink.js +28 -0
  78. package/src/node/html/directive/pageNumber.js +55 -0
  79. package/src/node/html/item/ordered.js +26 -0
  80. package/src/node/html/topmost.js +20 -0
  81. package/src/node/html.js +183 -0
  82. package/src/node/markdown/anchor.js +0 -40
  83. package/src/node/markdown/blockLine.js +0 -16
  84. package/src/node/markdown/blockListing.js +0 -9
  85. package/src/node/markdown/comma.js +0 -7
  86. package/src/node/markdown/contentsLink.js +0 -15
  87. package/src/node/markdown/directive/pageNumber.js +0 -19
  88. package/src/node/markdown/item/ordered.js +0 -15
  89. package/src/node/markdown.js +0 -100
  90. package/src/queries.js +94 -0
  91. package/src/ruleNameToClassMap.js +38 -0
  92. package/src/utilities/query.js +12 -0
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ import { Node } from "occam-dom";
4
+
5
+ import elementMap from "../elementMap";
6
+
7
+ import { EMPTY_STRING, DOUBLE_SPACE } from "../constants";
8
+
9
+ export default class HTMLNode extends Node {
10
+ getRuleName() {
11
+ let ruleName;
12
+
13
+ const outerNode = this.getOuterNode(),
14
+ nonTerminalNode = outerNode; ///
15
+
16
+ ruleName = nonTerminalNode.getRuleName();
17
+
18
+ return ruleName;
19
+ }
20
+
21
+ tagName(context) {
22
+ let tagName;
23
+
24
+ const ruleName = this.getRuleName();
25
+
26
+ const element = elementMap[ruleName];
27
+
28
+ ({ tagName } = element);
29
+
30
+ return tagName;
31
+ }
32
+
33
+ className(context) {
34
+ let className;
35
+
36
+ const ruleName = this.getRuleName();
37
+
38
+ const element = elementMap[ruleName];
39
+
40
+ ({ className } = element);
41
+
42
+ return className;
43
+ }
44
+
45
+ closingTag(context) {
46
+ const tagName = this.tagName(context),
47
+ closingTag = `</${tagName}>`;
48
+
49
+ return closingTag;
50
+ }
51
+
52
+ startingTag(context) {
53
+ const tagName = this.tagName(context),
54
+ className = this.className(context),
55
+ attributeName = this.attributeName(context),
56
+ attributeValue = this.attributeValue(context),
57
+ classHTML = (className !== null) ?
58
+ ` class="${className}"` :
59
+ EMPTY_STRING,
60
+ attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
61
+ ` ${attributeName}="${attributeValue}"` :
62
+ EMPTY_STRING,
63
+ startingTag = `<${tagName}${classHTML}${attributeHTML}>`;
64
+
65
+ return startingTag;
66
+ }
67
+
68
+ selfClosingTag(context) {
69
+ const tagName = this.tagName(context),
70
+ className = this.className(context),
71
+ attributeName = this.attributeName(context),
72
+ attributeValue = this.attributeValue(context),
73
+ classHTML = (className !== null) ?
74
+ ` class="${className}"` :
75
+ EMPTY_STRING,
76
+ attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
77
+ ` ${attributeName}="${attributeValue}"` :
78
+ EMPTY_STRING,
79
+ selfClosingTag = `<${tagName}${classHTML}${attributeHTML}/>`;
80
+
81
+ return selfClosingTag;
82
+ }
83
+
84
+ attributeName(context) {
85
+ const attributeName = null;
86
+
87
+ return attributeName;
88
+ }
89
+
90
+ attributeValue(context) {
91
+ const attributeValue = null;
92
+
93
+ return attributeValue;
94
+ }
95
+
96
+ adjustIndent(indent) {
97
+ indent = (indent === null) ?
98
+ EMPTY_STRING :
99
+ `${DOUBLE_SPACE}${indent}`;
100
+
101
+ return indent;
102
+ }
103
+
104
+ asHTML(indent, context) {
105
+ if (context === undefined) {
106
+ context = indent; ///
107
+
108
+ indent = EMPTY_STRING;
109
+ }
110
+
111
+ let html;
112
+
113
+ const tagName = this.tagName(context);
114
+
115
+ if (tagName === null) {
116
+ const childNodesHTML = this.childNodesAsHTML(indent, context);
117
+
118
+ html = childNodesHTML; ///
119
+ } else {
120
+ indent = this.adjustIndent(indent);
121
+
122
+ const childNodesHTML = this.childNodesAsHTML(indent, context);
123
+
124
+ if (childNodesHTML !== null) {
125
+ const startingTag = this.startingTag(context),
126
+ closingTag = this.closingTag(context);
127
+
128
+ html = (indent === null) ?
129
+ `${startingTag}${childNodesHTML}${closingTag}` :
130
+ `${indent}${startingTag}
131
+ ${childNodesHTML}${indent}${closingTag}
132
+ `;
133
+ } else {
134
+ const selfClosingTag = this.selfClosingTag(context);
135
+
136
+ html = (indent === null) ?
137
+ selfClosingTag : ///
138
+ `${indent}${selfClosingTag}
139
+ `;
140
+ }
141
+ }
142
+
143
+ return html;
144
+ }
145
+
146
+ childNodesAsHTML(indent, context) {
147
+ const childNodesHTML = this.reduceChildNode((childNodesHTML, childNode) => {
148
+ const childNodeHTML = childNode.asHTML(indent, context);
149
+
150
+ if (childNodeHTML !== null) {
151
+ childNodesHTML = (childNodesHTML === null) ?
152
+ childNodeHTML : ///
153
+ `${childNodesHTML}${childNodeHTML}`;
154
+ }
155
+
156
+ return childNodesHTML;
157
+ }, null);
158
+
159
+ return childNodesHTML;
160
+ }
161
+
162
+ static fromNothing(Class) {
163
+ if (Class === undefined) {
164
+ Class = HTMLNode; ///
165
+ }
166
+
167
+ const node = Node.fromNothing(Class);
168
+
169
+ return node;
170
+ }
171
+
172
+ static fromOuterNode(Class, outerNode) {
173
+ if (outerNode === undefined) {
174
+ outerNode = Class; ///
175
+
176
+ Class = HTMLNode; ///
177
+ }
178
+
179
+ const node = Node.fromOuterNode(Class, outerNode);
180
+
181
+ return node;
182
+ }
183
+ }
@@ -24,18 +24,6 @@ export default class AnchorMarkdownNode extends MarkdownNode {
24
24
  return this.identifier;
25
25
  }
26
26
 
27
- attributeName(context) {
28
- const attributeName = ID_ATTRIBUTE_NAME;
29
-
30
- return attributeName;
31
- }
32
-
33
- attributeValue(context) {
34
- const attributeValue = `${this.prepend}-${this.identifier}`;
35
-
36
- return attributeValue;
37
- }
38
-
39
27
  createDOMElement(context) {
40
28
  let domElement;
41
29
 
@@ -55,34 +43,6 @@ export default class AnchorMarkdownNode extends MarkdownNode {
55
43
  return domElement;
56
44
  }
57
45
 
58
- asHTML(indent, context) {
59
- if (context === undefined) {
60
- context = indent; ///
61
-
62
- indent = null;
63
- }
64
-
65
- indent = this.adjustIndent(indent);
66
-
67
- const childNodesHTML = this.childNodesAsHTML(indent, context),
68
- startingTag = this.startingTag(context),
69
- closingTag = this.closingTag(context),
70
- html = (indent === null) ?
71
- `${startingTag}${childNodesHTML}${closingTag}` :
72
- `${indent}${startingTag}
73
- ${childNodesHTML}${indent}${closingTag}
74
- `;
75
-
76
- return html;
77
- }
78
-
79
- childNodesAsHTML(indent, context) {
80
- const content = this.content(context),
81
- childNodesHTML = content; ///
82
-
83
- return childNodesHTML;
84
- }
85
-
86
46
  content(context) {
87
47
  const content = EMPTY_STRING;
88
48
 
@@ -77,22 +77,6 @@ export default class BlockLineMarkdownNode extends MarkdownNode {
77
77
  return domElement;
78
78
  }
79
79
 
80
- asHTML(indent, context) {
81
- const childNodesHTML = this.childNodesAsHTML(indent, context),
82
- startingTag = this.startingTag(context),
83
- closingTag = this.closingTag(context),
84
- html = `${startingTag}${childNodesHTML}${closingTag}`;
85
-
86
- return html;
87
- }
88
-
89
- childNodesAsHTML(indent, context) {
90
- const content = this.content(context),
91
- childNodesHTML = content; ///
92
-
93
- return childNodesHTML;
94
- }
95
-
96
80
  childNodesAsPlainText(context) {
97
81
  const content = this.content(context),
98
82
  childNodesPlainText = content; ///
@@ -3,15 +3,6 @@
3
3
  import MarkdownNode from "../../node/markdown";
4
4
 
5
5
  export default class BlockListingMarkdownNode extends MarkdownNode {
6
- asHTML(indent, context) {
7
- const childNodesHTML = this.childNodesAsHTML(indent, context),
8
- startingTag = this.startingTag(context),
9
- closingTag = this.closingTag(context),
10
- html = `${startingTag}${childNodesHTML}${closingTag}`;
11
-
12
- return html;
13
- }
14
-
15
6
  className(context) {
16
7
  let className = super.className(context);
17
8
 
@@ -13,13 +13,6 @@ export default class CommaMarkdownNode extends MarkdownNode {
13
13
  return domElement;
14
14
  }
15
15
 
16
- asHTML(indent, context) {
17
- const content = this.content(context),
18
- html = content; ///
19
-
20
- return html;
21
- }
22
-
23
16
  content(context) {
24
17
  const content = COMMA; ///
25
18
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  import MarkdownNode from "../../node/markdown";
4
4
 
5
- import { CONTENTS_PREPEND } from "../../prepends";
6
- import { HREF_ATTRIBUTE_NAME } from "../../attributeNames";
7
5
  import { CONTENTS_LINK_RULE_NAME } from "../../ruleNames";
8
6
 
9
7
  export default class ContentsLinkMarkdownNode extends MarkdownNode {
@@ -17,19 +15,6 @@ export default class ContentsLinkMarkdownNode extends MarkdownNode {
17
15
  return this.identifier;
18
16
  }
19
17
 
20
- attributeName(context) {
21
- const attributeName = HREF_ATTRIBUTE_NAME;
22
-
23
- return attributeName;
24
- }
25
-
26
- attributeValue(context) {
27
- const prepend = CONTENTS_PREPEND,
28
- attributeValue = `#${prepend}-${this.identifier}`;
29
-
30
- return attributeValue;
31
- }
32
-
33
18
  clone() { return super.clone(this.identifier); }
34
19
 
35
20
  static fromLineReplacementAndIdentifier(lineReplacement, identifier) {
@@ -23,18 +23,6 @@ export default class PageNumberDirectiveMarkdownNode extends DirectiveMarkdownNo
23
23
  return content;
24
24
  }
25
25
 
26
- asHTML(indent, context) {
27
- indent = this.adjustIndent(indent);
28
-
29
- const childNodesHTML = this.childNodesAsHTML(indent, context),
30
- startingTag = this.startingTag(context),
31
- closingTag = this.closingTag(context),
32
- html = `${indent}${startingTag}${childNodesHTML}${closingTag}
33
- `;
34
-
35
- return html;
36
- }
37
-
38
26
  createDOMElement(context) {
39
27
  let domElement;
40
28
 
@@ -54,13 +42,6 @@ export default class PageNumberDirectiveMarkdownNode extends DirectiveMarkdownNo
54
42
  return domElement;
55
43
  }
56
44
 
57
- childNodesAsHTML(indent, context) {
58
- const content = this.content(context),
59
- childNodesHTML = content; ///
60
-
61
- return childNodesHTML;
62
- }
63
-
64
45
  clone() { return super.clone(this.pageNumber); }
65
46
 
66
47
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) {
@@ -4,8 +4,6 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import ItemNode from "../../../node/markdown/item";
6
6
 
7
- import { VALUE_ATTRIBUTE_NAME } from "../../../attributeNames";
8
-
9
7
  const { second } = arrayUtilities;
10
8
 
11
9
  export default class OrderedItemMarkdownNode extends ItemNode {
@@ -20,19 +18,6 @@ export default class OrderedItemMarkdownNode extends ItemNode {
20
18
  return value;
21
19
  }
22
20
 
23
- attributeName(context) {
24
- const attributeName = VALUE_ATTRIBUTE_NAME;
25
-
26
- return attributeName;
27
- }
28
-
29
- attributeValue(context) {
30
- const value = this.value(context),
31
- attributeValue = value; ///
32
-
33
- return attributeValue;
34
- }
35
-
36
21
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return ItemNode.fromRuleNameChildNodesAndOpacity(OrderedItemMarkdownNode, ruleName, childNodes, opacity); }
37
22
  }
38
23
 
@@ -39,53 +39,6 @@ class MarkdownNode extends NonTerminalNode {
39
39
  return className;
40
40
  }
41
41
 
42
- closingTag(context) {
43
- const tagName = this.tagName(context),
44
- closingTag = `</${tagName}>`;
45
-
46
- return closingTag;
47
- }
48
-
49
- startingTag(context) {
50
- const tagName = this.tagName(context),
51
- className = this.className(context),
52
- attributeName = this.attributeName(context),
53
- attributeValue = this.attributeValue(context),
54
- classHTML = (className !== null) ?
55
- ` class="${className}"` :
56
- EMPTY_STRING,
57
- attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
58
- ` ${attributeName}="${attributeValue}"` :
59
- EMPTY_STRING,
60
- startingTag = `<${tagName}${classHTML}${attributeHTML}>`;
61
-
62
- return startingTag;
63
- }
64
-
65
- selfClosingTag(context) {
66
- const tagName = this.tagName(context),
67
- className = this.className(context),
68
- attributeName = this.attributeName(context),
69
- attributeValue = this.attributeValue(context),
70
- classHTML = (className !== null) ?
71
- ` class="${className}"` :
72
- EMPTY_STRING,
73
- attributeHTML = ((attributeName !== null) && (attributeValue !== null)) ?
74
- ` ${attributeName}="${attributeValue}"` :
75
- EMPTY_STRING,
76
- selfClosingTag = `<${tagName}${classHTML}${attributeHTML}/>`;
77
-
78
- return selfClosingTag;
79
- }
80
-
81
- adjustIndent(indent) {
82
- if (indent !== null) {
83
- indent = ` ${indent}`;
84
- }
85
-
86
- return indent;
87
- }
88
-
89
42
  attributeName(context) {
90
43
  const attributeName = null;
91
44
 
@@ -207,38 +160,6 @@ class MarkdownNode extends NonTerminalNode {
207
160
  return domElement;
208
161
  }
209
162
 
210
- asHTML(indent, context) {
211
- let html = null;
212
-
213
- const tagName = this.tagName(context);
214
-
215
- if (tagName !== null) {
216
- indent = this.adjustIndent(indent);
217
-
218
- const childNodesHTML = this.childNodesAsHTML(indent, context);
219
-
220
- if (childNodesHTML !== null) {
221
- const startingTag = this.startingTag(context),
222
- closingTag = this.closingTag(context);
223
-
224
- html = (indent === null) ?
225
- `${startingTag}${childNodesHTML}${closingTag}` :
226
- `${indent}${startingTag}
227
- ${childNodesHTML}${indent}${closingTag}
228
- `;
229
- } else {
230
- const selfClosingTag = this.selfClosingTag(context);
231
-
232
- html = (indent === null) ?
233
- selfClosingTag : ///
234
- `${indent}${selfClosingTag}
235
- `;
236
- }
237
- }
238
-
239
- return html;
240
- }
241
-
242
163
  asPlainText(context) {
243
164
  let plainText = null;
244
165
 
@@ -253,27 +174,6 @@ ${childNodesHTML}${indent}${closingTag}
253
174
  return plainText;
254
175
  }
255
176
 
256
- childNodesAsHTML(indent, context) {
257
- const childNodesHTML = this.reduceChildNode((childNodesHTML, childNode) => {
258
- const childNodeMarkdownNode = (childNode instanceof MarkdownNode);
259
-
260
- if (childNodeMarkdownNode) {
261
- const markdownNode = childNode, ///
262
- markdownNodeHTML = markdownNode.asHTML(indent, context);
263
-
264
- if (markdownNodeHTML !== null) {
265
- childNodesHTML = (childNodesHTML === null) ?
266
- markdownNodeHTML : ///
267
- `${childNodesHTML}${markdownNodeHTML}`;
268
- }
269
- }
270
-
271
- return childNodesHTML;
272
- }, null);
273
-
274
- return childNodesHTML;
275
- }
276
-
277
177
  childNodesAsPlainText(context) {
278
178
  const childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
279
179
  const childNodeMarkdownNode = (childNode instanceof MarkdownNode);
package/src/queries.js ADDED
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ import { Query } from "occam-query";
4
+
5
+ import { LINE_RULE_NAME,
6
+ IMAGE_RULE_NAME,
7
+ TABLE_RULE_NAME,
8
+ ERROR_RULE_NAME,
9
+ ANCHOR_RULE_NAME,
10
+ DIVISION_RULE_NAME,
11
+ PARAGRAPH_RULE_NAME,
12
+ HYPERLINK_RULE_NAME,
13
+ INDEX_LIST_RULE_NAME,
14
+ INDEX_ITEM_RULE_NAME,
15
+ INDEX_LINK_RULE_NAME,
16
+ TABLE_HEAD_RULE_NAME,
17
+ TABLE_BODY_RULE_NAME,
18
+ BLOCK_LINE_RULE_NAME,
19
+ EMAIL_LINK_RULE_NAME,
20
+ STRONG_TEXT_RULE_NAME,
21
+ ORDERED_LIST_RULE_NAME,
22
+ ORDERED_ITEM_RULE_NAME,
23
+ INDEX_HEADING_RULE_NAME,
24
+ BLOCK_LISTING_RULE_NAME,
25
+ CONTENTS_LINK_RULE_NAME,
26
+ CONTENTS_ITEM_RULE_NAME,
27
+ CONTENTS_LIST_RULE_NAME,
28
+ FOOTNOTE_LINK_RULE_NAME,
29
+ TABLE_HEAD_ROW_RULE_NAME,
30
+ TABLE_BODY_ROW_RULE_NAME,
31
+ INLINE_LISTING_RULE_NAME,
32
+ UNORDERED_LIST_RULE_NAME,
33
+ UNORDERED_ITEM_RULE_NAME,
34
+ FOOTNOTES_ITEM_RULE_NAME,
35
+ FOOTNOTES_LIST_RULE_NAME,
36
+ TABLE_HEAD_CELL_RULE_NAME,
37
+ TABLE_BODY_CELL_RULE_NAME,
38
+ EMPHASISED_TEXT_RULE_NAME,
39
+ PRIMARY_HEADING_RULE_NAME,
40
+ TERTIARY_HEADING_RULE_NAME,
41
+ SECONDARY_HEADING_RULE_NAME,
42
+ QUATERNARY_HEADING_RULE_NAME,
43
+ PAGE_NUMBER_DIRECTIVE_RULE_NAME,
44
+ STRONGLY_EMPHASISED_TEXT_RULE_NAME } from "./ruleNames";
45
+
46
+ const expressionStrings = [
47
+ `//${LINE_RULE_NAME}`,
48
+ `//${IMAGE_RULE_NAME}`,
49
+ `//${TABLE_RULE_NAME}`,
50
+ `//${ERROR_RULE_NAME}`,
51
+ `//${ANCHOR_RULE_NAME}`,
52
+ `//${DIVISION_RULE_NAME}`,
53
+ `//${PARAGRAPH_RULE_NAME}`,
54
+ `//${HYPERLINK_RULE_NAME}`,
55
+ `//${INDEX_LIST_RULE_NAME}`,
56
+ `//${INDEX_ITEM_RULE_NAME}`,
57
+ `//${INDEX_LINK_RULE_NAME}`,
58
+ `//${TABLE_HEAD_RULE_NAME}`,
59
+ `//${TABLE_BODY_RULE_NAME}`,
60
+ `//${BLOCK_LINE_RULE_NAME}`,
61
+ `//${EMAIL_LINK_RULE_NAME}`,
62
+ `//${STRONG_TEXT_RULE_NAME}`,
63
+ `//${ORDERED_LIST_RULE_NAME}`,
64
+ `//${ORDERED_ITEM_RULE_NAME}`,
65
+ `//${INDEX_HEADING_RULE_NAME}`,
66
+ `//${BLOCK_LISTING_RULE_NAME}`,
67
+ `//${CONTENTS_LINK_RULE_NAME}`,
68
+ `//${CONTENTS_ITEM_RULE_NAME}`,
69
+ `//${CONTENTS_LIST_RULE_NAME}`,
70
+ `//${FOOTNOTE_LINK_RULE_NAME}`,
71
+ `//${TABLE_HEAD_ROW_RULE_NAME}`,
72
+ `//${TABLE_BODY_ROW_RULE_NAME}`,
73
+ `//${INLINE_LISTING_RULE_NAME}`,
74
+ `//${UNORDERED_LIST_RULE_NAME}`,
75
+ `//${UNORDERED_ITEM_RULE_NAME}`,
76
+ `//${FOOTNOTES_ITEM_RULE_NAME}`,
77
+ `//${FOOTNOTES_LIST_RULE_NAME}`,
78
+ `//${TABLE_HEAD_CELL_RULE_NAME}`,
79
+ `//${TABLE_BODY_CELL_RULE_NAME}`,
80
+ `//${EMPHASISED_TEXT_RULE_NAME}`,
81
+ `//${PRIMARY_HEADING_RULE_NAME}`,
82
+ `//${TERTIARY_HEADING_RULE_NAME}`,
83
+ `//${SECONDARY_HEADING_RULE_NAME}`,
84
+ `//${QUATERNARY_HEADING_RULE_NAME}`,
85
+ `//${PAGE_NUMBER_DIRECTIVE_RULE_NAME}`,
86
+ `//${STRONGLY_EMPHASISED_TEXT_RULE_NAME}`
87
+ ],
88
+ queries = expressionStrings.map((expressionString) => {
89
+ const query = Query.fromExpressionString(expressionString);
90
+
91
+ return query;
92
+ });
93
+
94
+ export default queries;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import CommaHTMLNode from "./node/html/comma";
4
+ import AnchorHTMLNode from "./node/html/anchor";
5
+ import ClassNameHTMLNode from "./node/html/className";
6
+ import BlockLineHTMLNode from "./node/html/blockLine";
7
+ import OrderedItemHTMLNode from "./node/html/item/ordered";
8
+ import ContentsLinkHTMLNode from "./node/html/contentsLink";
9
+ import BlockListingHTMLNode from "./node/html/blockListing";
10
+ import BlockListingHEndHTMLNode from "./node/html/blockListingEnd";
11
+ import BlockListingHStartHTMLNode from "./node/html/blockListingStart";
12
+ import PageNumberDirectiveHTMLNode from "./node/html/directive/pageNumber";
13
+
14
+ import { COMMA_RULE_NAME,
15
+ ANCHOR_RULE_NAME,
16
+ CLASS_NAME_RULE_NAME,
17
+ BLOCK_LINE_RULE_NAME,
18
+ ORDERED_ITEM_RULE_NAME,
19
+ CONTENTS_LINK_RULE_NAME,
20
+ BLOCK_LISTING_RULE_NAME,
21
+ BLOCK_LISTING_END_RULE_NAME,
22
+ BLOCK_LISTING_START_RULE_NAME,
23
+ PAGE_NUMBER_DIRECTIVE_RULE_NAME } from "./ruleNames";
24
+
25
+ const ruleNameToClassMap = {
26
+ [COMMA_RULE_NAME]: CommaHTMLNode,
27
+ [ANCHOR_RULE_NAME]: AnchorHTMLNode,
28
+ [CLASS_NAME_RULE_NAME]: ClassNameHTMLNode,
29
+ [BLOCK_LINE_RULE_NAME]: BlockLineHTMLNode,
30
+ [ORDERED_ITEM_RULE_NAME]: OrderedItemHTMLNode,
31
+ [CONTENTS_LINK_RULE_NAME]: ContentsLinkHTMLNode,
32
+ [BLOCK_LISTING_RULE_NAME]: BlockListingHTMLNode,
33
+ [BLOCK_LISTING_END_RULE_NAME]: BlockListingHEndHTMLNode,
34
+ [BLOCK_LISTING_START_RULE_NAME]: BlockListingHStartHTMLNode,
35
+ [PAGE_NUMBER_DIRECTIVE_RULE_NAME]: PageNumberDirectiveHTMLNode
36
+ }
37
+
38
+ export default ruleNameToClassMap;
@@ -40,6 +40,18 @@ export function nodesQuery(expression) {
40
40
  }
41
41
  }
42
42
 
43
+ export function nodesFromNodeAndQueries(node, queries) {
44
+ const nodes = [];
45
+
46
+ queries.forEach((query) => {
47
+ const queryNodes = query.execute(node);
48
+
49
+ push(nodes, queryNodes);
50
+ });
51
+
52
+ return nodes;
53
+ }
54
+
43
55
  export function footnoteMarkdownNodeFromNode(node) {
44
56
  const footnoteMarkdownNode = nodeFromNodeAndQuery(node, footnoteMarkdownNodeQuery);
45
57