@markuplint/liquid-parser 3.12.0 → 4.0.0-alpha.10
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/LICENSE +1 -1
- package/README.md +0 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -5
- package/lib/parser.d.ts +6 -0
- package/lib/parser.js +20 -0
- package/package.json +12 -6
- package/lib/parse.d.ts +0 -2
- package/lib/parse.js +0 -23
- package/test/index.spec.js +0 -11
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -53,13 +53,3 @@ If it doesn't nest by quotations.
|
|
|
53
53
|
<div attr={{ value }}></div>
|
|
54
54
|
```
|
|
55
55
|
<!-- prettier-ignore-end -->
|
|
56
|
-
|
|
57
|
-
If it mixes the tags and spaces.
|
|
58
|
-
|
|
59
|
-
```html
|
|
60
|
-
<div attr=" {{ value }} "></div>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```html
|
|
64
|
-
<div attr="{{ value }} {{ value2 }}"></div>
|
|
65
|
-
```
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { parser } from './parser.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = void 0;
|
|
4
|
-
var parse_1 = require("./parse");
|
|
5
|
-
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
|
|
1
|
+
export { parser } from './parser.js';
|
package/lib/parser.d.ts
ADDED
package/lib/parser.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HtmlParser } from '@markuplint/html-parser';
|
|
2
|
+
class LiquidParser extends HtmlParser {
|
|
3
|
+
constructor() {
|
|
4
|
+
super({
|
|
5
|
+
ignoreTags: [
|
|
6
|
+
{
|
|
7
|
+
type: 'liquid-block',
|
|
8
|
+
start: '{%',
|
|
9
|
+
end: '%}',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'liquid-output',
|
|
13
|
+
start: '{{',
|
|
14
|
+
end: '}}',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const parser = new LiquidParser();
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/liquid-parser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.10",
|
|
4
4
|
"description": "Liquid template parser for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
|
-
"
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./lib/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
10
15
|
"types": "lib/index.d.ts",
|
|
11
16
|
"publishConfig": {
|
|
12
17
|
"access": "public"
|
|
@@ -16,9 +21,10 @@
|
|
|
16
21
|
"clean": "tsc --build --clean"
|
|
17
22
|
},
|
|
18
23
|
"dependencies": {
|
|
19
|
-
"@markuplint/html-parser": "
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
"@markuplint/html-parser": "4.0.0-alpha.10"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@markuplint/parser-utils": "4.0.0-alpha.10"
|
|
22
28
|
},
|
|
23
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "b41153ea665aa8f091daf6114a06047f4ccb8350"
|
|
24
30
|
}
|
package/lib/parse.d.ts
DELETED
package/lib/parse.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = void 0;
|
|
4
|
-
const html_parser_1 = require("@markuplint/html-parser");
|
|
5
|
-
const parser_utils_1 = require("@markuplint/parser-utils");
|
|
6
|
-
const parse = (rawCode, options) => {
|
|
7
|
-
const blocks = (0, parser_utils_1.ignoreBlock)(rawCode, [
|
|
8
|
-
{
|
|
9
|
-
type: 'liquid-block',
|
|
10
|
-
start: /{%/,
|
|
11
|
-
end: /%}/,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
type: 'liquid-output',
|
|
15
|
-
start: /{{/,
|
|
16
|
-
end: /}}/,
|
|
17
|
-
},
|
|
18
|
-
]);
|
|
19
|
-
const doc = (0, html_parser_1.parse)(blocks.replaced, options);
|
|
20
|
-
doc.nodeList = (0, parser_utils_1.restoreNode)(doc.nodeList, blocks);
|
|
21
|
-
return doc;
|
|
22
|
-
};
|
|
23
|
-
exports.parse = parse;
|
package/test/index.spec.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const { parse } = require('../lib/');
|
|
2
|
-
|
|
3
|
-
describe('Tags', () => {
|
|
4
|
-
it('liquid-block', () => {
|
|
5
|
-
expect(parse('{% any %}').nodeList[0].nodeName).toBe('#ps:liquid-block');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
it('liquid-output', () => {
|
|
9
|
-
expect(parse('{{ any }}').nodeList[0].nodeName).toBe('#ps:liquid-output');
|
|
10
|
-
});
|
|
11
|
-
});
|