@canopycanopycanopy/b-ber-grammar-renderer 1.2.16 → 3.0.0
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/dist/index.js +10 -10
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logg
|
|
|
22
22
|
|
|
23
23
|
var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// Assign a default object to the `context` argument, since we'll refer to
|
|
26
26
|
// some of its properties during tests. the properties themselves don't
|
|
27
27
|
// need to be defined, though
|
|
28
28
|
const renderer = ({
|
|
@@ -38,21 +38,21 @@ const renderer = ({
|
|
|
38
38
|
markerClose,
|
|
39
39
|
|
|
40
40
|
validateOpen(params, line) {
|
|
41
|
-
//
|
|
41
|
+
// Check to see if we've hit an opening/exit token, i.e., `::: <name>:<id>`
|
|
42
42
|
const match = (0, _trim.default)(params).call(params).match(markerOpen);
|
|
43
|
-
if (!match || !match.length) return false; //
|
|
43
|
+
if (!match || !match.length) return false; // It's a directive - check to see if it's well-formed.
|
|
44
44
|
|
|
45
45
|
const [, type, id] = match;
|
|
46
46
|
|
|
47
47
|
if ((0, _lodash.default)(id)) {
|
|
48
|
-
//
|
|
48
|
+
// The directive's missing an `id` attribute, so we extract the
|
|
49
49
|
// fileName from `context` which we've stored in back in
|
|
50
50
|
// `md/index.es6`, and passed into our `renderer`
|
|
51
|
-
_bBerLogger.default.error(`Missing [id] for [${exports.default.name}:start] at ${context.fileName}.md:${line}`); //
|
|
51
|
+
_bBerLogger.default.error(`Missing [id] for [${exports.default.name}:start] at ${context.fileName}.md:${line}`); // Let the parser know that this wasn't a match
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
return false;
|
|
55
|
-
} //
|
|
55
|
+
} // Add the `id` to the global state so that we can verify that the
|
|
56
56
|
// container is being properly closed in our `validateClose` method
|
|
57
57
|
|
|
58
58
|
|
|
@@ -68,14 +68,14 @@ const renderer = ({
|
|
|
68
68
|
const location = `${context.fileName}.md:${line}`;
|
|
69
69
|
|
|
70
70
|
if (isOpening && inStore) {
|
|
71
|
-
//
|
|
71
|
+
// It's a duplicate `id`
|
|
72
72
|
_bBerLogger.default.error(`Duplicate [id] [${id}]. [id] must be unique at [${location}]`);
|
|
73
73
|
} else if (isClosing && !inStore) {
|
|
74
|
-
//
|
|
74
|
+
// Trying to close an un-opened directive, but it might belong to a
|
|
75
75
|
// different directive type
|
|
76
76
|
return false;
|
|
77
77
|
} else if (isOpening && !inStore) {
|
|
78
|
-
//
|
|
78
|
+
// It's a new directive
|
|
79
79
|
_State.default.add('cursor', {
|
|
80
80
|
id,
|
|
81
81
|
type
|
|
@@ -83,7 +83,7 @@ const renderer = ({
|
|
|
83
83
|
|
|
84
84
|
return true;
|
|
85
85
|
} else if (isClosing && inStore) {
|
|
86
|
-
//
|
|
86
|
+
// It's the end of a directive, handle close in section.js
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
"@babel/cli": "^7.10.5",
|
|
21
21
|
"@babel/core": "^7.10.5",
|
|
22
22
|
"@babel/preset-env": "^7.10.4",
|
|
23
|
+
"browserslist": "^4.17.4",
|
|
23
24
|
"jest": "^26.6.3",
|
|
24
|
-
"rimraf": "^2.
|
|
25
|
+
"rimraf": "^2.7.1"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@canopycanopycanopy/b-ber-lib": "
|
|
28
|
-
"@canopycanopycanopy/b-ber-logger": "
|
|
29
|
-
"@canopycanopycanopy/b-ber-shapes-directives": "
|
|
28
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.0",
|
|
29
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.0",
|
|
30
|
+
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.0",
|
|
30
31
|
"lodash": "^4.17.21",
|
|
31
32
|
"lodash.isundefined": "^3.0.1",
|
|
32
33
|
"tar": "^6.1.11"
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"url": "https://maxwellsimmer.com"
|
|
49
50
|
}
|
|
50
51
|
],
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "676dbec7fbdcc46eb8168f1d437d294ed549e2e8"
|
|
52
53
|
}
|