occam-dom 5.3.53 → 5.3.56
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/README.md +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
## Introduction
|
|
15
15
|
|
|
16
|
-
Specifically, "outer" token arrays and parse trees
|
|
16
|
+
Specifically, "outer" token arrays and parse trees result from the use of Occam's [lexers](https://github.com/djalbat/occam-lexers) and [parsers](https://github.com/djalbat/occam-parsers), respectively.
|
|
17
|
+
These can be distilled into "inner" token arrays and parse trees for a variety of tasks.
|
|
17
18
|
|
|
18
|
-
An example is helpful.
|
|
19
|
+
An example is helpful.
|
|
20
|
+
Consider the following outer parse tree that results from parsing some simple Markdown.
|
|
19
21
|
|
|
20
22
|
```
|
|
21
23
|
|
|
|
@@ -38,7 +40,8 @@ An example is helpful. Consider the following outer parse tree that results from
|
|
|
38
40
|
"Heading"[word] [0] "Paragraph"[word] [2] "."[special] [2]
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
This contains far more information than is needed to render the
|
|
43
|
+
This contains far more information than is needed to render the Markdown as HTML.
|
|
44
|
+
The following inner parse tree will in fact suffice:
|
|
42
45
|
|
|
43
46
|
```
|
|
44
47
|
|
|
|
@@ -55,7 +58,9 @@ This contains far more information than is needed to render the markdown as HTML
|
|
|
55
58
|
plainText plainText
|
|
56
59
|
```
|
|
57
60
|
|
|
58
|
-
Locating the outer nodes that contribute to this inner parse tree is straightforward enough using Occam's [queries](https://github.com/djalbat/occam-query).
|
|
61
|
+
Locating the outer nodes that contribute to this inner parse tree is straightforward enough using Occam's [queries](https://github.com/djalbat/occam-query).
|
|
62
|
+
However, the arrays of nodes that result are not in the above form.
|
|
63
|
+
This package provides the means to form such parse trees.
|
|
59
64
|
|
|
60
65
|
## Installation
|
|
61
66
|
|
|
@@ -83,13 +88,16 @@ The example will then be available at the following URL:
|
|
|
83
88
|
|
|
84
89
|
http://localhost:8888
|
|
85
90
|
|
|
86
|
-
The source for the example can be found in the `src/example.js` file and corresponding `src/example` folder.
|
|
91
|
+
The source for the example can be found in the `src/example.js` file and corresponding `src/example` folder.
|
|
92
|
+
You are encouraged to try the example whilst reading what follows.
|
|
93
|
+
You can rebuild it on the fly with the following command:
|
|
87
94
|
|
|
88
95
|
npm run watch-debug
|
|
89
96
|
|
|
90
97
|
The development server will reload the page whenever you make changes.
|
|
91
98
|
|
|
92
|
-
One last thing to bear in mind is that this package is included by way of a relative rather than a package import.
|
|
99
|
+
One last thing to bear in mind is that this package is included by way of a relative rather than a package import.
|
|
100
|
+
If you are importing it into your own application, however, you should use the standard package import.
|
|
93
101
|
|
|
94
102
|
## Usage
|
|
95
103
|
|
|
@@ -161,7 +169,8 @@ function ClassFromOuterNode(outerNode) {
|
|
|
161
169
|
}
|
|
162
170
|
```
|
|
163
171
|
|
|
164
|
-
Note that the topmost inner node has no corresponding outer node and that a default of `HTMLNode` has been provided.
|
|
172
|
+
Note that the topmost inner node has no corresponding outer node and that a default of `HTMLNode` has been provided.
|
|
173
|
+
There is no need to provide a unique class for every type of outer node that the algorithm may come across, by the way.
|
|
165
174
|
|
|
166
175
|
## Building
|
|
167
176
|
|