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
package/src/markdown/bnf.js
CHANGED
|
@@ -2,314 +2,277 @@
|
|
|
2
2
|
|
|
3
3
|
const bnf = `
|
|
4
4
|
|
|
5
|
-
markdown
|
|
5
|
+
markdown ::= ( division | error )+ ;
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
division
|
|
8
|
+
division ::= ( subDivision | verticalSpace )+ ;
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
subDivision
|
|
11
|
+
subDivision.. ::= directives
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
| primaryHeading
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
| secondaryHeading
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
| tertiaryHeading
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
| quaternaryHeading
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
| table
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
| footnote
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
| orderedList
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
| unorderedList
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
| blockListing
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
| paragraph
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
;
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
verticalSpace
|
|
36
|
+
verticalSpace ::= <END_OF_LINE>+ ;
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
error.
|
|
39
|
+
error. ::= . ;
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
directives
|
|
42
|
+
directives ::= indexDirective
|
|
43
43
|
|
|
44
|
-
|
|
|
44
|
+
| ignoreDirective
|
|
45
45
|
|
|
46
|
-
|
|
|
46
|
+
| contentsDirective
|
|
47
47
|
|
|
48
|
-
|
|
|
48
|
+
| footnotesDirective
|
|
49
49
|
|
|
50
|
-
|
|
|
50
|
+
| pageNumberDirective
|
|
51
51
|
|
|
52
|
-
|
|
|
52
|
+
| embedDirective ( endOfLine embedDirective )*
|
|
53
53
|
|
|
54
|
-
|
|
|
54
|
+
| includeDirective ( endOfLine includeDirective )*
|
|
55
55
|
|
|
56
56
|
;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
primaryHeading
|
|
59
|
+
primaryHeading ::= "#" line ;
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
secondaryHeading
|
|
62
|
+
secondaryHeading ::= "##" line ;
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
tertiaryHeading
|
|
65
|
+
tertiaryHeading ::= "###" line ;
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
quaternaryHeading
|
|
68
|
+
quaternaryHeading ::= "####" line ;
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
table
|
|
71
|
+
table ::= tableHead endOfLine tableDivider endOfLine tableBody ;
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
footnote.
|
|
74
|
+
footnote. ::= reference paragraph ;
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
orderedList
|
|
77
|
+
orderedList ::= orderedItem ( endOfLine orderedItem )* ;
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
unorderedList
|
|
80
|
+
unorderedList ::= unorderedItem ( endOfLine unorderedItem )* ;
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
blockListing
|
|
83
|
+
blockListing ::= blockStart blockLine* blockEnd ;
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
paragraph
|
|
86
|
+
paragraph ::= line ( endOfLine line )* ;
|
|
87
87
|
|
|
88
88
|
|
|
89
|
-
indexDirective
|
|
89
|
+
indexDirective ::= "@index" ;
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
ignoreDirective
|
|
92
|
+
ignoreDirective ::= "@ignore" ;
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
embedDirective
|
|
95
|
+
embedDirective ::= "@embed" ( path | nonsense ) ;
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
includeDirective
|
|
98
|
+
includeDirective ::= "@include" ( path | nonsense ) ;
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
contentsDirective
|
|
101
|
+
contentsDirective ::= "@contents" ;
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
footnotesDirective
|
|
104
|
+
footnotesDirective ::= "@footnotes" ;
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
pageNumberDirective
|
|
107
|
+
pageNumberDirective ::= "@pageNumber" ;
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
nonsense
|
|
110
|
+
nonsense ::= ( [escaped] | [number] | [identifier] | [word] | [special] | [unassigned] )+ ;
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
tableHead
|
|
113
|
+
tableHead ::= tableHeadRow ;
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
tableBody
|
|
116
|
+
tableBody ::= tableBodyRow ( endOfLine tableBodyRow )* ;
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
orderedItem
|
|
119
|
+
orderedItem ::= [marker] line ( endOfLine line )* ;
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
unorderedItem
|
|
122
|
+
unorderedItem ::= [bullet] line ( endOfLine line )* ;
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
blockLine.
|
|
125
|
+
blockLine. ::= blockText* endOfLine ;
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
tableHeadRow
|
|
128
|
+
tableHeadRow ::= tableCellDivider tableHeadCell+ ;
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
tableBodyRow
|
|
131
|
+
tableBodyRow ::= tableCellDivider tableBodyCell+ ;
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
tableHeadCell
|
|
134
|
+
tableHeadCell ::= emptyTableCell
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
| tableCell
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
;
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
tableBodyCell
|
|
141
|
+
tableBodyCell ::= emptyTableCell
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
| tableCell
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
;
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
emptyTableCell
|
|
148
|
+
emptyTableCell ::= "." tableCellDivider ;
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
tableCell
|
|
151
|
+
tableCell ::= line tableCellDivider ;
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
contentsItem ::= contentsLink
|
|
154
|
+
line ::= ( inlineListing
|
|
158
155
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
contentsLink ::= line ;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
footnotesList ::= footnotesItem+ ;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
footnotesItem ::= anchor paragraph ;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
indexHeading ::= line ;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
indexList ::= indexItem+ ;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
indexItem ::= line... comma indexLink ( comma indexLink )* ;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
line. ::= ( inlineListing
|
|
183
|
-
|
|
184
|
-
| footnoteLink
|
|
156
|
+
| footnoteLink
|
|
185
157
|
|
|
186
|
-
|
|
158
|
+
| emailLink
|
|
187
159
|
|
|
188
|
-
|
|
160
|
+
| hyperlink
|
|
189
161
|
|
|
190
|
-
|
|
162
|
+
| image
|
|
191
163
|
|
|
192
|
-
|
|
164
|
+
| plainText
|
|
193
165
|
|
|
194
|
-
|
|
166
|
+
| strongText
|
|
195
167
|
|
|
196
|
-
|
|
168
|
+
| emphasisedText
|
|
197
169
|
|
|
198
|
-
|
|
170
|
+
| stronglyEmphasisedText )+ ;
|
|
199
171
|
|
|
200
172
|
|
|
201
|
-
|
|
173
|
+
footnoteLink. ::= [link] ;
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
emailLink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [email-address] ")"
|
|
202
177
|
|
|
203
|
-
|
|
178
|
+
| [email-address]
|
|
204
179
|
|
|
205
|
-
|
|
180
|
+
;
|
|
206
181
|
|
|
207
182
|
|
|
208
|
-
hyperlink.
|
|
183
|
+
hyperlink. ::= "[" inlineText... "]"<NO_WHITESPACE>"(" [url] ")"
|
|
209
184
|
|
|
210
|
-
|
|
185
|
+
| [url]
|
|
211
186
|
|
|
212
|
-
|
|
187
|
+
;
|
|
213
188
|
|
|
214
189
|
|
|
215
|
-
image.
|
|
190
|
+
image. ::= "![" inlineText... "]"<NO_WHITESPACE>"(" path ")" ;
|
|
216
191
|
|
|
217
192
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
strongText ::= "***" inlineText "***" ;
|
|
193
|
+
strongText ::= "***" inlineText "***" ;
|
|
222
194
|
|
|
223
195
|
|
|
224
|
-
emphasisedText
|
|
196
|
+
emphasisedText ::= "**" inlineText "**" ;
|
|
225
197
|
|
|
226
198
|
|
|
227
|
-
stronglyEmphasisedText ::= "****" inlineText "****" ;
|
|
199
|
+
stronglyEmphasisedText. ::= "****" inlineText "****" ;
|
|
228
200
|
|
|
229
201
|
|
|
230
|
-
|
|
202
|
+
inlineText. ::= plainText+ ;
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
className ::= <NO_WHITESPACE>[identifier] ;
|
|
231
206
|
|
|
232
207
|
|
|
233
|
-
blockStart
|
|
234
|
-
|
|
208
|
+
blockStart ::= [backticks] className? <END_OF_LINE> ;
|
|
235
209
|
|
|
236
|
-
blockEnd ::= [backticks] ;
|
|
237
210
|
|
|
211
|
+
blockEnd ::= [backticks] ;
|
|
238
212
|
|
|
239
|
-
footnoteLink. ::= [link] ;
|
|
240
|
-
|
|
241
213
|
|
|
242
|
-
tableCellDivider
|
|
214
|
+
tableCellDivider ::= [vertical-bar] ;
|
|
243
215
|
|
|
244
216
|
|
|
245
|
-
tableDivider
|
|
217
|
+
tableDivider ::= [dashes] ;
|
|
246
218
|
|
|
247
219
|
|
|
248
|
-
plainText ::= [escaped]
|
|
220
|
+
plainText. ::= [escaped]
|
|
249
221
|
|
|
250
|
-
|
|
222
|
+
| [number]
|
|
251
223
|
|
|
252
|
-
|
|
224
|
+
| [identifier]
|
|
253
225
|
|
|
254
|
-
|
|
226
|
+
| [email-address]
|
|
255
227
|
|
|
256
|
-
|
|
228
|
+
| [url]
|
|
257
229
|
|
|
258
|
-
|
|
230
|
+
| [path]
|
|
259
231
|
|
|
260
|
-
|
|
232
|
+
| [word]
|
|
261
233
|
|
|
262
|
-
|
|
234
|
+
| [special]
|
|
263
235
|
|
|
264
|
-
|
|
236
|
+
| [unassigned]
|
|
265
237
|
|
|
266
|
-
|
|
238
|
+
;
|
|
267
239
|
|
|
268
240
|
|
|
269
|
-
blockText ::= [escaped]
|
|
241
|
+
blockText. ::= [escaped]
|
|
270
242
|
|
|
271
|
-
|
|
243
|
+
| [number]
|
|
272
244
|
|
|
273
|
-
|
|
245
|
+
| [identifier]
|
|
274
246
|
|
|
275
|
-
|
|
247
|
+
| [email-address]
|
|
276
248
|
|
|
277
|
-
|
|
249
|
+
| [url]
|
|
278
250
|
|
|
279
|
-
|
|
251
|
+
| [path]
|
|
280
252
|
|
|
281
|
-
|
|
253
|
+
| [word]
|
|
282
254
|
|
|
283
|
-
|
|
255
|
+
| [special]
|
|
284
256
|
|
|
285
|
-
|
|
257
|
+
| [unassigned]
|
|
286
258
|
|
|
287
|
-
|
|
259
|
+
| [dashes]
|
|
288
260
|
|
|
289
|
-
|
|
261
|
+
| [vertical-bar]
|
|
290
262
|
|
|
291
|
-
|
|
263
|
+
;
|
|
292
264
|
|
|
293
265
|
|
|
294
|
-
inlineListing ::= [backticked-literal] ;
|
|
266
|
+
inlineListing. ::= [backticked-literal] ;
|
|
295
267
|
|
|
296
268
|
|
|
297
|
-
reference
|
|
269
|
+
reference ::= [reference] ;
|
|
298
270
|
|
|
299
271
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
path ::= [path] ;
|
|
272
|
+
path ::= [path] ;
|
|
304
273
|
|
|
305
274
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
anchor. ::= ε ;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
endOfLine. ::= <END_OF_LINE> ;
|
|
275
|
+
endOfLine ::= <END_OF_LINE> ;
|
|
313
276
|
|
|
314
277
|
`;
|
|
315
278
|
|
package/src/node/html/anchor.js
CHANGED
|
@@ -2,73 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../node/html";
|
|
4
4
|
|
|
5
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
|
+
import { ANCHOR_RULE_NAME } from "../../ruleNames";
|
|
5
7
|
import { ID_ATTRIBUTE_NAME } from "../../attributeNames";
|
|
6
8
|
|
|
7
9
|
export default class AnchorHTMLNode extends HTMLNode {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
constructor(outerNode, parentNode, childNodes, domElement, prepend, identifier) {
|
|
11
|
+
super(outerNode, parentNode, childNodes, domElement);
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
this.prepend = prepend;
|
|
14
|
+
this.identifier = identifier;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return attributeValue;
|
|
17
|
+
getPrepend() {
|
|
18
|
+
return this.prepend;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
indent = null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
indent = this.adjustIndent(indent);
|
|
21
|
+
getIdentifier() {
|
|
22
|
+
return this.identifier;
|
|
23
|
+
}
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
closingTag = this.closingTag(context),
|
|
32
|
-
html = (indent === null) ?
|
|
33
|
-
`${startingTag}${childNodesHTML}${closingTag}` :
|
|
34
|
-
`${indent}${startingTag}
|
|
35
|
-
${childNodesHTML}${indent}${closingTag}
|
|
36
|
-
`;
|
|
25
|
+
getRuleName() {
|
|
26
|
+
const ruleName = ANCHOR_RULE_NAME; ///
|
|
37
27
|
|
|
38
|
-
return
|
|
28
|
+
return ruleName;
|
|
39
29
|
}
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
content(context) {
|
|
32
|
+
const content = EMPTY_STRING;
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
return content;
|
|
35
|
+
}
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
attributeName(context) {
|
|
38
|
+
const attributeName = ID_ATTRIBUTE_NAME;
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
return attributeName;
|
|
41
|
+
}
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
attributeValue(context) {
|
|
44
|
+
const attributeValue = `#${this.prepend}-${this.identifier}`; ///
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
return attributeValue;
|
|
47
|
+
}
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
asString() {
|
|
50
|
+
const ruleName = this.getRuleName(),
|
|
51
|
+
string = ruleName; ///
|
|
56
52
|
|
|
57
|
-
return
|
|
53
|
+
return string;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
// childNodesAsHTML(indent, context) {
|
|
61
|
-
// const content = this.content(context),
|
|
62
|
-
// childNodesHTML = content; ///
|
|
63
|
-
//
|
|
64
|
-
// return childNodesHTML;
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
56
|
static tagName = "a";
|
|
68
57
|
|
|
69
58
|
static className = "anchor";
|
|
70
59
|
|
|
71
|
-
static
|
|
60
|
+
static fromPrependAndIdentifier(prepend, identifier) {
|
|
61
|
+
const anchorHTMLNode = HTMLNode.fromNothing(AnchorHTMLNode, prepend, identifier);
|
|
72
62
|
|
|
73
|
-
|
|
63
|
+
return anchorHTMLNode;
|
|
64
|
+
}
|
|
74
65
|
}
|
|
@@ -2,26 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
import HTMLNode from "../../node/html";
|
|
4
4
|
|
|
5
|
+
import { assignIndexes, deleteIndexes } from "../../utilities/whitespace";
|
|
5
6
|
import { EMPTY_STRING, CARRIAGE_RETURN } from "../../constants";
|
|
6
7
|
|
|
7
8
|
export default class BlockLineHTMLNode extends HTMLNode {
|
|
8
9
|
mount(parentDOMElement, siblingDOMElement, context) {
|
|
10
|
+
const node = this; ///
|
|
11
|
+
|
|
12
|
+
assignIndexes(node, context);
|
|
13
|
+
|
|
9
14
|
super.mount(parentDOMElement, siblingDOMElement, context);
|
|
10
15
|
|
|
11
16
|
let domElement;
|
|
12
17
|
|
|
13
18
|
domElement = this.getDOMElement();
|
|
14
19
|
|
|
15
|
-
parentDOMElement = domElement;
|
|
20
|
+
parentDOMElement = domElement; ///
|
|
16
21
|
|
|
17
22
|
siblingDOMElement = null;
|
|
18
23
|
|
|
19
24
|
const content = CARRIAGE_RETURN,
|
|
20
25
|
textNode = document.createTextNode(content);
|
|
21
26
|
|
|
22
|
-
domElement = textNode;
|
|
27
|
+
domElement = textNode; ///
|
|
23
28
|
|
|
24
|
-
parentDOMElement.insertBefore(domElement, siblingDOMElement)
|
|
29
|
+
parentDOMElement.insertBefore(domElement, siblingDOMElement);
|
|
30
|
+
|
|
31
|
+
deleteIndexes(context);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
unmount(parentDOMElement, context) {
|
|
@@ -54,8 +61,28 @@ export default class BlockLineHTMLNode extends HTMLNode {
|
|
|
54
61
|
return html;
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
childNodesAsHTML(indent, context) {
|
|
65
|
+
let childNodesHTML;
|
|
66
|
+
|
|
67
|
+
const node = this; ///
|
|
68
|
+
|
|
69
|
+
assignIndexes(node, context);
|
|
70
|
+
|
|
71
|
+
childNodesHTML = super.childNodesAsHTML(indent, context);
|
|
72
|
+
|
|
73
|
+
deleteIndexes(context);
|
|
74
|
+
|
|
75
|
+
return childNodesHTML;
|
|
76
|
+
}
|
|
77
|
+
|
|
57
78
|
childNodesAsPlainText(context) {
|
|
58
|
-
|
|
79
|
+
let childNodesPlainText;
|
|
80
|
+
|
|
81
|
+
const node = this; ///
|
|
82
|
+
|
|
83
|
+
assignIndexes(node, context);
|
|
84
|
+
|
|
85
|
+
childNodesPlainText = this.reduceChildNode((childNodesPlainText, childNode) => {
|
|
59
86
|
const childNodePlainText = childNode.asPlainText(context);
|
|
60
87
|
|
|
61
88
|
childNodesPlainText = `${childNodesPlainText}${childNodePlainText}`;
|
|
@@ -63,6 +90,8 @@ export default class BlockLineHTMLNode extends HTMLNode {
|
|
|
63
90
|
return childNodesPlainText;
|
|
64
91
|
}, EMPTY_STRING);
|
|
65
92
|
|
|
93
|
+
deleteIndexes(context);
|
|
94
|
+
|
|
66
95
|
return childNodesPlainText;
|
|
67
96
|
}
|
|
68
97
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLNode from "../../../node/html";
|
|
4
|
+
|
|
5
|
+
export default class ContentsDirectiveHTMLNode extends HTMLNode {
|
|
6
|
+
static fromNothing() { return HTMLNode.fromNothing(ContentsDirectiveHTMLNode); }
|
|
7
|
+
|
|
8
|
+
static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(ContentsDirectiveHTMLNode, outerNode); }
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLNode from "../../../node/html";
|
|
4
|
+
|
|
5
|
+
export default class FootnotesDirectiveHTMLNode extends HTMLNode {
|
|
6
|
+
static fromNothing() { return HTMLNode.fromNothing(FootnotesDirectiveHTMLNode); }
|
|
7
|
+
|
|
8
|
+
static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(FootnotesDirectiveHTMLNode, outerNode); }
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLNode from "../../../node/html";
|
|
4
|
+
|
|
5
|
+
export default class IndexDirectiveHTMLNode extends HTMLNode {
|
|
6
|
+
static fromNothing() { return HTMLNode.fromNothing(IndexDirectiveHTMLNode); }
|
|
7
|
+
|
|
8
|
+
static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(IndexDirectiveHTMLNode, outerNode); }
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import HTMLNode from "../../../node/html";
|
|
4
|
+
|
|
5
|
+
export default class PageNumberDirectiveHTMLNode extends HTMLNode {
|
|
6
|
+
static fromNothing() { return HTMLNode.fromNothing(PageNumberDirectiveHTMLNode); }
|
|
7
|
+
|
|
8
|
+
static fromOuterNode(outerNode) { return HTMLNode.fromOuterNode(PageNumberDirectiveHTMLNode, outerNode); }
|
|
9
|
+
}
|