@notatki/parser 0.0.2 → 0.0.4
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/nodes.d.ts +2 -2
- package/package.json +3 -2
- package/parser$.js +7 -7
package/nodes.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type ModelNode = {
|
|
|
26
26
|
cloze: Token;
|
|
27
27
|
fields: ModelFieldNode[];
|
|
28
28
|
cards: ModelCardNode[];
|
|
29
|
-
|
|
29
|
+
styles: CardStylesNode | null;
|
|
30
30
|
} & Node;
|
|
31
31
|
|
|
32
32
|
export type ModelIdNode = {
|
|
@@ -53,7 +53,7 @@ export type CardBackNode = {
|
|
|
53
53
|
text: string;
|
|
54
54
|
} & Node;
|
|
55
55
|
|
|
56
|
-
export type
|
|
56
|
+
export type CardStylesNode = {
|
|
57
57
|
text: string;
|
|
58
58
|
} & Node;
|
|
59
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notatki/parser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A collection of tools for creating and syncing Anki notes from simple text files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anki",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/aradzie/notatki.git"
|
|
17
17
|
},
|
|
18
|
+
"license": "MIT",
|
|
18
19
|
"type": "module",
|
|
19
20
|
"main": "index.js",
|
|
20
21
|
"devDependencies": {
|
|
@@ -28,5 +29,5 @@
|
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|
|
30
31
|
},
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "b2237839f8310ecbb0b05de29dcfe5571b1d786c"
|
|
32
33
|
}
|
package/parser$.js
CHANGED
|
@@ -181,7 +181,7 @@ function peg$parse(input, options) {
|
|
|
181
181
|
const peg$c11 = "card";
|
|
182
182
|
const peg$c12 = "front";
|
|
183
183
|
const peg$c13 = "back";
|
|
184
|
-
const peg$c14 = "
|
|
184
|
+
const peg$c14 = "styles";
|
|
185
185
|
const peg$c15 = "{{";
|
|
186
186
|
const peg$c16 = "}}";
|
|
187
187
|
const peg$c17 = "#";
|
|
@@ -213,7 +213,7 @@ function peg$parse(input, options) {
|
|
|
213
213
|
const peg$e15 = peg$literalExpectation("card", false);
|
|
214
214
|
const peg$e16 = peg$literalExpectation("front", false);
|
|
215
215
|
const peg$e17 = peg$literalExpectation("back", false);
|
|
216
|
-
const peg$e18 = peg$literalExpectation("
|
|
216
|
+
const peg$e18 = peg$literalExpectation("styles", false);
|
|
217
217
|
const peg$e19 = peg$literalExpectation("{{", false);
|
|
218
218
|
const peg$e20 = peg$classExpectation(["#", "/", "^"], false, false, false);
|
|
219
219
|
const peg$e21 = peg$literalExpectation("}}", false);
|
|
@@ -241,7 +241,7 @@ function peg$parse(input, options) {
|
|
|
241
241
|
function peg$f11(text) { return { text, loc: location() }; }
|
|
242
242
|
function peg$f12(text) { return { text, loc: location() }; }
|
|
243
243
|
function peg$f13(list) { return list; }
|
|
244
|
-
function peg$f14(name, id, cloze, fields, cards,
|
|
244
|
+
function peg$f14(name, id, cloze, fields, cards, styles) { return { name, id, cloze, fields, cards, styles, loc: location() } }
|
|
245
245
|
function peg$f15(text) { return { text, loc: location() }; }
|
|
246
246
|
function peg$f16(id) { return { id, value: Number.parseInt(id.text), loc: location() }; }
|
|
247
247
|
function peg$f17(text) { return { text, loc: location() }; }
|
|
@@ -1453,7 +1453,7 @@ function peg$parse(input, options) {
|
|
|
1453
1453
|
s12 = peg$FAILED;
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
s12 = peg$
|
|
1456
|
+
s12 = peg$parseModelStyles();
|
|
1457
1457
|
if (s12 !== peg$FAILED) {
|
|
1458
1458
|
s13 = peg$parse_();
|
|
1459
1459
|
s14 = peg$parseNewline();
|
|
@@ -1832,13 +1832,13 @@ function peg$parse(input, options) {
|
|
|
1832
1832
|
return s0;
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
|
-
function peg$
|
|
1835
|
+
function peg$parseModelStyles() {
|
|
1836
1836
|
let s0, s1, s2, s3, s4;
|
|
1837
1837
|
|
|
1838
1838
|
s0 = peg$currPos;
|
|
1839
|
-
if (input.substr(peg$currPos,
|
|
1839
|
+
if (input.substr(peg$currPos, 6) === peg$c14) {
|
|
1840
1840
|
s1 = peg$c14;
|
|
1841
|
-
peg$currPos +=
|
|
1841
|
+
peg$currPos += 6;
|
|
1842
1842
|
} else {
|
|
1843
1843
|
s1 = peg$FAILED;
|
|
1844
1844
|
if (peg$silentFails === 0) { peg$fail(peg$e18); }
|