highmark-markdown 0.0.72 → 0.0.73

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.
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
 
3
+ import { arrayUtilities } from "necessary";
4
+
3
5
  import MarkdownNode from "../../node/markdown";
4
6
 
5
- import { htmlFromChildNodes, domElementsFromChildNodes } from "../../utilities/childNodes";
7
+ const { first } = arrayUtilities;
6
8
 
7
9
  export default class TableCellMarkdownNode extends MarkdownNode {
8
10
  childNodesAsHTML(indent, context) {
9
11
  const childNodes = this.getChildNodes(),
10
- childNodesHTML = htmlFromChildNodes(childNodes, context);
12
+ firstChildNode = first(childNodes),
13
+ markedTextChildNode = firstChildNode, ///
14
+ markedTextChildNodeChildNodesHTML = markedTextChildNode.childNodesAsHTML(indent, context),
15
+ childNodesHTML = markedTextChildNodeChildNodesHTML; ///
11
16
 
12
17
  return childNodesHTML;
13
18
  }
14
19
 
15
20
  createChildNodeDOMElements(domElement, context) {
16
21
  const childNodes = this.getChildNodes(),
17
- domElements = domElementsFromChildNodes(childNodes, context),
18
- parentDOMElement = domElement, ///
19
- siblingDOMElement = null,
20
- childNodeDOMElements = domElements; ///
21
-
22
- childNodeDOMElements.forEach((childNodeDOMElement) => {
23
- parentDOMElement.insertBefore(childNodeDOMElement, siblingDOMElement);
24
- });
22
+ firstChildNode = first(childNodes),
23
+ markedTextChildNode = firstChildNode;
24
+
25
+ markedTextChildNode.createChildNodeDOMElements(domElement, context);
25
26
  }
26
27
 
27
28
  static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return MarkdownNode.fromRuleNameChildNodesAndOpacity(TableCellMarkdownNode, ruleName, childNodes, opacity); }
@@ -36,45 +36,6 @@ class MarkdownNode extends NonTerminalNode {
36
36
  return className;
37
37
  }
38
38
 
39
- asHTML(indent, context) {
40
- if (context === undefined) {
41
- context = indent; ///
42
-
43
- indent = EMPTY_STRING;
44
- }
45
-
46
- const tagName = this.tagName(context);
47
-
48
- let html = null;
49
-
50
- if (tagName !== null) {
51
- indent = this.adjustIndent(indent);
52
-
53
- const childNodesHTML = this.childNodesAsHTML(indent, context);
54
-
55
- if (childNodesHTML !== null) {
56
- const startingTag = this.startingTag(context),
57
- closingTag = this.closingTag(context);
58
-
59
- html = (indent === null) ?
60
- `${startingTag}${trim(childNodesHTML)}${closingTag}` :
61
- `${indent}${startingTag}
62
- ${trim(childNodesHTML)}
63
- ${indent}${closingTag}
64
- `;
65
- } else {
66
- const selfClosingTag = this.selfClosingTag(context);
67
-
68
- html = (indent === null) ?
69
- selfClosingTag : ///
70
- `${indent}${selfClosingTag}
71
- `;
72
- }
73
- }
74
-
75
- return html;
76
- }
77
-
78
39
  closingTag(context) {
79
40
  const tagName = this.tagName(context),
80
41
  closingTag = `<\\${tagName}>`;
@@ -169,6 +130,45 @@ ${indent}${closingTag}
169
130
  return childNodesHTML;
170
131
  }
171
132
 
133
+ asHTML(indent, context) {
134
+ if (context === undefined) {
135
+ context = indent; ///
136
+
137
+ indent = EMPTY_STRING;
138
+ }
139
+
140
+ const tagName = this.tagName(context);
141
+
142
+ let html = null;
143
+
144
+ if (tagName !== null) {
145
+ indent = this.adjustIndent(indent);
146
+
147
+ const childNodesHTML = this.childNodesAsHTML(indent, context);
148
+
149
+ if (childNodesHTML !== null) {
150
+ const startingTag = this.startingTag(context),
151
+ closingTag = this.closingTag(context);
152
+
153
+ html = (indent === null) ?
154
+ `${startingTag}${trim(childNodesHTML)}${closingTag}` :
155
+ `${indent}${startingTag}
156
+ ${trim(childNodesHTML)}
157
+ ${indent}${closingTag}
158
+ `;
159
+ } else {
160
+ const selfClosingTag = this.selfClosingTag(context);
161
+
162
+ html = (indent === null) ?
163
+ selfClosingTag : ///
164
+ `${indent}${selfClosingTag}
165
+ `;
166
+ }
167
+ }
168
+
169
+ return html;
170
+ }
171
+
172
172
  createDOMElement(context) {
173
173
  let domElement = null;
174
174
 
@@ -218,9 +218,10 @@ ${indent}${closingTag}
218
218
 
219
219
  insertDOMElement(domElement) {
220
220
  const parentDOMElement = this.domElement, ///
221
- siblingDOMElement = null;
221
+ siblingDOMElement = null,
222
+ childNodeDOMElement = domElement; ///
222
223
 
223
- parentDOMElement.insertBefore(domElement, siblingDOMElement);
224
+ parentDOMElement.insertBefore(childNodeDOMElement, siblingDOMElement);
224
225
  }
225
226
 
226
227
  static fromRuleNameChildNodesAndOpacity(Class, ruleName, childNodes, opacity, ...remainingArguments) {