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
|
@@ -4,9 +4,24 @@ import HTMLNode from "../../../node/html";
|
|
|
4
4
|
|
|
5
5
|
import { CONTENTS_PREPEND } from "../../../prepends";
|
|
6
6
|
import { HREF_ATTRIBUTE_NAME } from "../../../attributeNames";
|
|
7
|
+
import { CONTENTS_LINK_RULE_NAME } from "../../../ruleNames";
|
|
7
8
|
|
|
8
9
|
export default class ContentsLinkHTMLNode extends HTMLNode {
|
|
9
|
-
|
|
10
|
+
constructor(outerNode, parentNode, childNodes, domElement, identifier) {
|
|
11
|
+
super(outerNode, parentNode, childNodes, domElement);
|
|
12
|
+
|
|
13
|
+
this.identifier = identifier;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getIdentifier() {
|
|
17
|
+
return this.identifier;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getRuleName() {
|
|
21
|
+
const ruleName = CONTENTS_LINK_RULE_NAME;
|
|
22
|
+
|
|
23
|
+
return ruleName;
|
|
24
|
+
}
|
|
10
25
|
|
|
11
26
|
attributeName(context) {
|
|
12
27
|
const attributeName = HREF_ATTRIBUTE_NAME;
|
|
@@ -16,17 +31,29 @@ export default class ContentsLinkHTMLNode extends HTMLNode {
|
|
|
16
31
|
|
|
17
32
|
attributeValue(context) {
|
|
18
33
|
const prepend = CONTENTS_PREPEND,
|
|
19
|
-
|
|
20
|
-
attributeValue = `#${prepend}-${identifier}`;
|
|
34
|
+
attributeValue = `#${prepend}-${this.identifier}`;
|
|
21
35
|
|
|
22
36
|
return attributeValue;
|
|
23
37
|
}
|
|
24
38
|
|
|
39
|
+
asString() {
|
|
40
|
+
const ruleName = this.getRuleName(),
|
|
41
|
+
string = ruleName; ///
|
|
42
|
+
|
|
43
|
+
return string;
|
|
44
|
+
}
|
|
45
|
+
|
|
25
46
|
static tagName = "a";
|
|
26
47
|
|
|
27
48
|
static className = "contents-link";
|
|
28
49
|
|
|
29
|
-
static
|
|
50
|
+
static fromLineHTMLTransformAndIdentifier(lineHTMLTransform, identifier) {
|
|
51
|
+
const lineHTMLNode = lineHTMLTransform.getLineHTMLNode(),
|
|
52
|
+
childNodes = [
|
|
53
|
+
lineHTMLNode
|
|
54
|
+
],
|
|
55
|
+
contentsLinkHTMLNode = HTMLNode.fromChildNodes(ContentsLinkHTMLNode, childNodes, identifier);
|
|
30
56
|
|
|
31
|
-
|
|
57
|
+
return contentsLinkHTMLNode;
|
|
58
|
+
}
|
|
32
59
|
}
|
|
@@ -7,6 +7,13 @@ import { HREF_ATTRIBUTE_NAME } from "../../../attributeNames";
|
|
|
7
7
|
export default class EmailLinkHTMLNode extends HTMLNode {
|
|
8
8
|
isSimple() { return this.outerNode.isSimple(); }
|
|
9
9
|
|
|
10
|
+
content(context) {
|
|
11
|
+
const emailAddress = this.emailAddress(context),
|
|
12
|
+
content = emailAddress; ///
|
|
13
|
+
|
|
14
|
+
return content;
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
emailAddress(context) { return this.outerNode.emailAddress(context); }
|
|
11
18
|
|
|
12
19
|
attributeName(context) {
|
|
@@ -23,34 +30,61 @@ export default class EmailLinkHTMLNode extends HTMLNode {
|
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
26
|
-
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
27
|
-
|
|
28
33
|
const simple = this.isSimple();
|
|
29
34
|
|
|
30
|
-
if (simple) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
domElement = textNode, ///
|
|
35
|
-
parentDOMElement = this.domElement, ///
|
|
36
|
-
siblingDOMElement = null;
|
|
37
|
-
|
|
38
|
-
parentDOMElement.insertBefore(domElement, siblingDOMElement)
|
|
35
|
+
if (!simple) {
|
|
36
|
+
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
let domElement;
|
|
42
|
+
|
|
43
|
+
domElement = this.createDOMElement(context);
|
|
44
|
+
|
|
45
|
+
this.setDOMElement(domElement);
|
|
46
|
+
|
|
47
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
48
|
+
|
|
49
|
+
parentDOMElement = domElement; ///
|
|
50
|
+
|
|
51
|
+
siblingDOMElement = null;
|
|
52
|
+
|
|
53
|
+
const content = this.content(context),
|
|
54
|
+
textNode = document.createTextNode(content);
|
|
55
|
+
|
|
56
|
+
domElement = textNode; ///
|
|
57
|
+
|
|
58
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
40
59
|
}
|
|
41
60
|
|
|
42
61
|
unmount(parentDOMElement, context) {
|
|
43
62
|
const simple = this.isSimple();
|
|
44
63
|
|
|
45
|
-
if (simple) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
if (!simple) {
|
|
65
|
+
super.unmount(parentDOMElement, context);
|
|
66
|
+
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
let domElement;
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
domElement = this.getDOMElement();
|
|
74
|
+
|
|
75
|
+
const parentDOMElement = domElement, ///
|
|
76
|
+
firstChild = domElement.firstChild
|
|
77
|
+
|
|
78
|
+
domElement = firstChild; ///
|
|
79
|
+
|
|
80
|
+
parentDOMElement.removeChild(domElement);
|
|
51
81
|
}
|
|
52
82
|
|
|
53
|
-
|
|
83
|
+
domElement = this.getDOMElement();
|
|
84
|
+
|
|
85
|
+
parentDOMElement.removeChild(domElement);
|
|
86
|
+
|
|
87
|
+
this.resetDOMElement();
|
|
54
88
|
}
|
|
55
89
|
|
|
56
90
|
asPlainText(context) {
|
|
@@ -2,10 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../../node/html";
|
|
4
4
|
|
|
5
|
+
import { EMPTY_STRING } from "../../../constants";
|
|
5
6
|
import { FOOTNOTE_PREPEND } from "../../../prepends";
|
|
6
7
|
import { HREF_ATTRIBUTE_NAME } from "../../../attributeNames";
|
|
7
8
|
|
|
8
9
|
export default class FootnoteLinkHTMLNode extends HTMLNode {
|
|
10
|
+
constructor(outerNode, parentNode, childNodes, domElement, number) {
|
|
11
|
+
super(outerNode, parentNode, childNodes, domElement);
|
|
12
|
+
|
|
13
|
+
this.number = number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getNumber() {
|
|
17
|
+
return this.number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setNumber(number) {
|
|
21
|
+
this.number = number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
content(context) {
|
|
25
|
+
const content = (this.number !== null) ?
|
|
26
|
+
this.number :
|
|
27
|
+
EMPTY_STRING;
|
|
28
|
+
|
|
29
|
+
return content;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
identifier(context) { return this.outerNode.identifier(context); }
|
|
33
|
+
|
|
9
34
|
attributeName(context) {
|
|
10
35
|
const attributeName = HREF_ATTRIBUTE_NAME;
|
|
11
36
|
|
|
@@ -20,6 +45,63 @@ export default class FootnoteLinkHTMLNode extends HTMLNode {
|
|
|
20
45
|
return attributeValue;
|
|
21
46
|
}
|
|
22
47
|
|
|
48
|
+
mount(parentDOMElement, siblingDOMElement, context) {
|
|
49
|
+
let domElement;
|
|
50
|
+
|
|
51
|
+
domElement = this.createDOMElement(context);
|
|
52
|
+
|
|
53
|
+
this.setDOMElement(domElement);
|
|
54
|
+
|
|
55
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
56
|
+
|
|
57
|
+
parentDOMElement = domElement; ///
|
|
58
|
+
|
|
59
|
+
siblingDOMElement = null;
|
|
60
|
+
|
|
61
|
+
const content = this.content(context),
|
|
62
|
+
textNode = document.createTextNode(content);
|
|
63
|
+
|
|
64
|
+
domElement = textNode; ///
|
|
65
|
+
|
|
66
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
unmount(parentDOMElement, context) {
|
|
70
|
+
let domElement;
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
domElement = this.getDOMElement();
|
|
74
|
+
|
|
75
|
+
const parentDOMElement = domElement, ///
|
|
76
|
+
firstChild = domElement.firstChild
|
|
77
|
+
|
|
78
|
+
domElement = firstChild; ///
|
|
79
|
+
|
|
80
|
+
parentDOMElement.removeChild(domElement);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
domElement = this.getDOMElement();
|
|
84
|
+
|
|
85
|
+
parentDOMElement.removeChild(domElement);
|
|
86
|
+
|
|
87
|
+
this.resetDOMElement();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
asHTML(indent, context) {
|
|
91
|
+
let html;
|
|
92
|
+
|
|
93
|
+
indent = this.adjustIndent(indent);
|
|
94
|
+
|
|
95
|
+
const childNodesHTML = this.childNodesAsHTML(indent, context),
|
|
96
|
+
startingTag = this.startingTag(context),
|
|
97
|
+
closingTag = this.closingTag(context);
|
|
98
|
+
|
|
99
|
+
html = `${indent}${startingTag}${childNodesHTML}${closingTag}
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
return html;
|
|
103
|
+
}
|
|
104
|
+
|
|
23
105
|
childNodesAsHTML(indent, context) {
|
|
24
106
|
const content = this.content(context),
|
|
25
107
|
childNodesHTML = content; ///
|
|
@@ -27,7 +109,21 @@ export default class FootnoteLinkHTMLNode extends HTMLNode {
|
|
|
27
109
|
return childNodesHTML;
|
|
28
110
|
}
|
|
29
111
|
|
|
30
|
-
static
|
|
112
|
+
static tagName = "a";
|
|
113
|
+
|
|
114
|
+
static className = "footnote";
|
|
115
|
+
|
|
116
|
+
static fromNothing() {
|
|
117
|
+
const number = null,
|
|
118
|
+
footnoteLinkHTMLNode = HTMLNode.fromNothing(FootnoteLinkHTMLNode, number);
|
|
119
|
+
|
|
120
|
+
return footnoteLinkHTMLNode;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static fromOuterNode(outerNode) {
|
|
124
|
+
const number = null,
|
|
125
|
+
footnoteLinkHTMLNode = HTMLNode.fromOuterNode(FootnoteLinkHTMLNode, outerNode, number);
|
|
31
126
|
|
|
32
|
-
|
|
127
|
+
return footnoteLinkHTMLNode;
|
|
128
|
+
}
|
|
33
129
|
}
|
|
@@ -9,6 +9,13 @@ export default class HyperlinkHTMLNode extends HTMLNode {
|
|
|
9
9
|
|
|
10
10
|
url(context) { return this.outerNode.url(context); }
|
|
11
11
|
|
|
12
|
+
content(context) {
|
|
13
|
+
const url = this.url(context),
|
|
14
|
+
content = url; ///
|
|
15
|
+
|
|
16
|
+
return content;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
attributeName(context) {
|
|
13
20
|
const attributeName = HREF_ATTRIBUTE_NAME;
|
|
14
21
|
|
|
@@ -23,34 +30,61 @@ export default class HyperlinkHTMLNode extends HTMLNode {
|
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
26
|
-
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
27
|
-
|
|
28
33
|
const simple = this.isSimple();
|
|
29
34
|
|
|
30
|
-
if (simple) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
domElement = textNode, ///
|
|
35
|
-
parentDOMElement = this.domElement, ///
|
|
36
|
-
siblingDOMElement = null;
|
|
37
|
-
|
|
38
|
-
parentDOMElement.insertBefore(domElement, siblingDOMElement)
|
|
35
|
+
if (!simple) {
|
|
36
|
+
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
37
|
+
|
|
38
|
+
return;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
let domElement;
|
|
42
|
+
|
|
43
|
+
domElement = this.createDOMElement(context);
|
|
44
|
+
|
|
45
|
+
this.setDOMElement(domElement);
|
|
46
|
+
|
|
47
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
48
|
+
|
|
49
|
+
parentDOMElement = domElement; ///
|
|
50
|
+
|
|
51
|
+
siblingDOMElement = null;
|
|
52
|
+
|
|
53
|
+
const content = this.content(context),
|
|
54
|
+
textNode = document.createTextNode(content);
|
|
55
|
+
|
|
56
|
+
domElement = textNode; ///
|
|
57
|
+
|
|
58
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
40
59
|
}
|
|
41
60
|
|
|
42
61
|
unmount(parentDOMElement, context) {
|
|
43
62
|
const simple = this.isSimple();
|
|
44
63
|
|
|
45
|
-
if (simple) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
if (!simple) {
|
|
65
|
+
super.unmount(parentDOMElement, context);
|
|
66
|
+
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
let domElement;
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
domElement = this.getDOMElement();
|
|
74
|
+
|
|
75
|
+
const parentDOMElement = domElement, ///
|
|
76
|
+
firstChild = domElement.firstChild
|
|
77
|
+
|
|
78
|
+
domElement = firstChild; ///
|
|
79
|
+
|
|
80
|
+
parentDOMElement.removeChild(domElement);
|
|
51
81
|
}
|
|
52
82
|
|
|
53
|
-
|
|
83
|
+
domElement = this.getDOMElement();
|
|
84
|
+
|
|
85
|
+
parentDOMElement.removeChild(domElement);
|
|
86
|
+
|
|
87
|
+
this.resetDOMElement();
|
|
54
88
|
}
|
|
55
89
|
|
|
56
90
|
asPlainText(context) {
|
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../../node/html";
|
|
4
4
|
|
|
5
|
+
import { EMPTY_STRING } from "../../../constants";
|
|
5
6
|
import { INDEX_PREPEND } from "../../../prepends";
|
|
6
7
|
import { HREF_ATTRIBUTE_NAME } from "../../../attributeNames";
|
|
8
|
+
import { INDEX_LINK_RULE_NAME } from "../../../ruleNames";
|
|
7
9
|
|
|
8
10
|
export default class IndexLinkHTMLNode extends HTMLNode {
|
|
11
|
+
constructor(outerNode, parentNode, childNodes, domElement, pageNumber) {
|
|
12
|
+
super(outerNode, parentNode, childNodes, domElement);
|
|
13
|
+
|
|
14
|
+
this.pageNumber = pageNumber;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getIndexLink() {
|
|
18
|
+
return this.pageNumber;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getRuleName() {
|
|
22
|
+
const ruleName = INDEX_LINK_RULE_NAME;
|
|
23
|
+
|
|
24
|
+
return ruleName;
|
|
25
|
+
}
|
|
26
|
+
|
|
9
27
|
attributeName(context) {
|
|
10
28
|
const attributeName = HREF_ATTRIBUTE_NAME;
|
|
11
29
|
|
|
@@ -13,60 +31,75 @@ export default class IndexLinkHTMLNode extends HTMLNode {
|
|
|
13
31
|
}
|
|
14
32
|
|
|
15
33
|
attributeValue(context) {
|
|
16
|
-
const
|
|
17
|
-
attributeValue = `#${
|
|
34
|
+
const prepend = INDEX_PREPEND,
|
|
35
|
+
attributeValue = `#${prepend}-${this.pageNumber}`;
|
|
18
36
|
|
|
19
37
|
return attributeValue;
|
|
20
38
|
}
|
|
21
39
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
startingTag = this.startingTag(context),
|
|
25
|
-
closingTag = this.closingTag(context),
|
|
26
|
-
html = `${startingTag}${childNodesHTML}${closingTag}`;
|
|
40
|
+
mount(parentDOMElement, siblingDOMElement, context) {
|
|
41
|
+
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
}
|
|
43
|
+
let domElement;
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
const content = this.content(context),
|
|
33
|
-
childNodesHTML = content; ///
|
|
45
|
+
domElement = this.getDOMElement();
|
|
34
46
|
|
|
35
|
-
|
|
36
|
-
}
|
|
47
|
+
parentDOMElement = domElement; ///
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
let domElement;
|
|
49
|
+
siblingDOMElement = null;
|
|
40
50
|
|
|
41
|
-
const content = this.
|
|
51
|
+
const content = this.pageNumber, ///
|
|
42
52
|
textNode = document.createTextNode(content);
|
|
43
53
|
|
|
44
|
-
domElement =
|
|
54
|
+
domElement = textNode; ///
|
|
55
|
+
|
|
56
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
unmount(parentDOMElement, context) {
|
|
60
|
+
{
|
|
61
|
+
let domElement;
|
|
45
62
|
|
|
46
|
-
|
|
63
|
+
domElement = this.getDOMElement();
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
const parentDOMElement = domElement, ///
|
|
66
|
+
lastChild = domElement.lastChild
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
domElement = lastChild; ///
|
|
51
69
|
|
|
52
|
-
|
|
70
|
+
parentDOMElement.removeChild(domElement);
|
|
71
|
+
}
|
|
53
72
|
|
|
54
|
-
|
|
73
|
+
super.unmount(parentDOMElement, context);
|
|
55
74
|
}
|
|
56
75
|
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
textNode = document.createTextNode(content),
|
|
60
|
-
domElement = textNode; ///
|
|
76
|
+
asPlainText(context) {
|
|
77
|
+
const plainText = EMPTY_STRING;
|
|
61
78
|
|
|
62
|
-
|
|
79
|
+
return plainText;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
childNodesAsHTML(indent, context) {
|
|
83
|
+
const childNodesHTML = `${this.pageNumber}
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
return childNodesHTML;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
asString() {
|
|
90
|
+
const ruleName = this.getRuleName(),
|
|
91
|
+
string = ruleName; ///
|
|
92
|
+
|
|
93
|
+
return string;
|
|
63
94
|
}
|
|
64
95
|
|
|
65
96
|
static tagName = "a";
|
|
66
97
|
|
|
67
98
|
static className = "index";
|
|
68
99
|
|
|
69
|
-
static
|
|
100
|
+
static fromPageNumber(pageNumber) {
|
|
101
|
+
const indexLinkHTMLNode = HTMLNode.fromNothing(IndexLinkHTMLNode, pageNumber);
|
|
70
102
|
|
|
71
|
-
|
|
103
|
+
return indexLinkHTMLNode;
|
|
104
|
+
}
|
|
72
105
|
}
|
|
@@ -2,12 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../../node/html";
|
|
4
4
|
|
|
5
|
+
import { CONTENTS_LIST_RULE_NAME } from "../../../ruleNames";
|
|
6
|
+
|
|
5
7
|
export default class ContentsListHTMLNode extends HTMLNode {
|
|
8
|
+
getRuleName() {
|
|
9
|
+
const ruleName = CONTENTS_LIST_RULE_NAME;
|
|
10
|
+
|
|
11
|
+
return ruleName;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
asString() {
|
|
15
|
+
const ruleName = this.getRuleName(),
|
|
16
|
+
string = ruleName; ///
|
|
17
|
+
|
|
18
|
+
return string;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
static tagName = "ul";
|
|
7
22
|
|
|
8
23
|
static className = "contents";
|
|
9
24
|
|
|
10
|
-
static
|
|
25
|
+
static fromContentsItemHTMLTransforms(contentsItemHTMLTransforms) {
|
|
26
|
+
const contentsItemHTMLNodes = contentsItemHTMLTransforms.map((contentsItemHTMLTransform) => {
|
|
27
|
+
const contentsItemHTMLNode = contentsItemHTMLTransform.getContentsItemHTMLNode();
|
|
28
|
+
|
|
29
|
+
return contentsItemHTMLNode;
|
|
30
|
+
}),
|
|
31
|
+
childNodes = contentsItemHTMLNodes, ///
|
|
32
|
+
contentsListHTMLNode = HTMLNode.fromChildNodes(ContentsListHTMLNode, childNodes);
|
|
11
33
|
|
|
12
|
-
|
|
34
|
+
return contentsListHTMLNode;
|
|
35
|
+
}
|
|
13
36
|
}
|
|
@@ -3,8 +3,25 @@
|
|
|
3
3
|
import HTMLNode from "../../../node/html";
|
|
4
4
|
|
|
5
5
|
import { START_ATTRIBUTE_NAME } from "../../../attributeNames";
|
|
6
|
+
import { FOOTNOTES_LIST_RULE_NAME } from "../../../ruleNames";
|
|
6
7
|
|
|
7
8
|
export default class FootnotesListHTMLNode extends HTMLNode {
|
|
9
|
+
constructor(outerNode, parentNode, childNodes, domElement, start) {
|
|
10
|
+
super(outerNode, parentNode, childNodes, domElement);
|
|
11
|
+
|
|
12
|
+
this.start = start;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getStart() {
|
|
16
|
+
return this.start;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getRuleName() {
|
|
20
|
+
const ruleName = FOOTNOTES_LIST_RULE_NAME;
|
|
21
|
+
|
|
22
|
+
return ruleName;
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
attributeName(context) {
|
|
9
26
|
const attributeName = START_ATTRIBUTE_NAME;
|
|
10
27
|
|
|
@@ -17,11 +34,26 @@ export default class FootnotesListHTMLNode extends HTMLNode {
|
|
|
17
34
|
return attributeValue;
|
|
18
35
|
}
|
|
19
36
|
|
|
37
|
+
asString() {
|
|
38
|
+
const ruleName = this.getRuleName(),
|
|
39
|
+
string = ruleName; ///
|
|
40
|
+
|
|
41
|
+
return string;
|
|
42
|
+
}
|
|
43
|
+
|
|
20
44
|
static tagName = "ol";
|
|
21
45
|
|
|
22
46
|
static className = "footnotes";
|
|
23
47
|
|
|
24
|
-
static
|
|
48
|
+
static fromStartAndFootnoteItemHTMLTransforms(start, footnoteItemHTMLTransforms) {
|
|
49
|
+
const footnoteItemHTMLNodes = footnoteItemHTMLTransforms.map((footnoteItemHTMLTransform) => {
|
|
50
|
+
const footnoteItemHTMLNode = footnoteItemHTMLTransform.getFootnoteItemHTMLNode();
|
|
51
|
+
|
|
52
|
+
return footnoteItemHTMLNode;
|
|
53
|
+
}),
|
|
54
|
+
childNodes = footnoteItemHTMLNodes, ///
|
|
55
|
+
footnotesListHTMLNode = HTMLNode.fromChildNodes(FootnotesListHTMLNode, childNodes, start);
|
|
25
56
|
|
|
26
|
-
|
|
57
|
+
return footnotesListHTMLNode;
|
|
58
|
+
}
|
|
27
59
|
}
|
|
@@ -2,12 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../../node/html";
|
|
4
4
|
|
|
5
|
+
import { INDEX_LIST_RULE_NAME } from "../../../ruleNames";
|
|
6
|
+
|
|
5
7
|
export default class IndexListHTMLNode extends HTMLNode {
|
|
8
|
+
getRuleName() {
|
|
9
|
+
const ruleName = INDEX_LIST_RULE_NAME;
|
|
10
|
+
|
|
11
|
+
return ruleName;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
asString() {
|
|
15
|
+
const ruleName = this.getRuleName(),
|
|
16
|
+
string = ruleName; ///
|
|
17
|
+
|
|
18
|
+
return string;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
static tagName = "ul";
|
|
7
22
|
|
|
8
23
|
static className = "index";
|
|
9
24
|
|
|
10
|
-
static
|
|
25
|
+
static fromIndexItemHTMLTransforms(indexItemHTMLTransforms) {
|
|
26
|
+
const indexItemHTMLNodes = indexItemHTMLTransforms.map((indexItemHTMLTransform) => {
|
|
27
|
+
const indexListHTMLNode = indexItemHTMLTransform.getIndexItemHTMLNode();
|
|
28
|
+
|
|
29
|
+
return indexListHTMLNode;
|
|
30
|
+
}),
|
|
31
|
+
childNodes = indexItemHTMLNodes,
|
|
32
|
+
indexListHTMLNode = HTMLNode.fromChildNodes(IndexListHTMLNode, childNodes);
|
|
11
33
|
|
|
12
|
-
|
|
34
|
+
return indexListHTMLNode;
|
|
35
|
+
}
|
|
13
36
|
}
|