Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/constants/node-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ export enum NodeTypes {
DoctypeAttributeValue = "DoctypeAttributeValue",
DoctypeAttributeWrapperStart = "DoctypeAttributeWrapperStart",
DoctypeAttributeWrapperEnd = "DoctypeAttributeWrapperEnd",

OpenTemplate = "OpenTemplate",
Template = "Template",
CloseTemplate = "CloseTemplate",
Part = "Part",
}
4 changes: 4 additions & 0 deletions src/constants/token-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ export enum TokenTypes {
OpenStyleTagEnd = "OpenStyleTagEnd",
StyleTagContent = "StyleTagContent",
CloseStyleTag = "CloseStyleTag",
Part = "Part",
OpenTemplate = "OpenTemplate",
Template = "Template",
CloseTemplate = "CloseTemplate",
}
8 changes: 4 additions & 4 deletions src/parser/__tests__/__snapshots__/token-adapter.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ exports[`parse basic 1`] = `
"line": 1,
},
},
"parts": [],
"range": [
5,
12,
],
"templates": [],
"type": "Text",
"value": "content",
},
Expand Down Expand Up @@ -164,11 +164,11 @@ exports[`parse basic 1`] = `
"line": 1,
},
},
"parts": [],
"range": [
5,
12,
],
"templates": [],
"type": "Text",
"value": "content",
},
Expand Down Expand Up @@ -212,11 +212,11 @@ exports[`parse token adapter 1`] = `
"line": 2,
},
},
"parts": [],
"range": [
6,
13,
],
"templates": [],
"type": "Text",
"value": "content",
},
Expand Down Expand Up @@ -358,11 +358,11 @@ exports[`parse token adapter 1`] = `
"line": 2,
},
},
"parts": [],
"range": [
6,
13,
],
"templates": [],
"type": "Text",
"value": "content",
},
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Options } from "../types/parse";

export function parse(html: string, options?: Options): ParseResult {
const tokenAdapter = (options && options.tokenAdapter) || defaultTokenAdapter;
const { tokens } = tokenize(html, tokenAdapter, options?.templateRanges);
const { tokens } = tokenize(html, tokenAdapter, options?.templateInfos);
const { ast } = constructTree(tokens);
return {
ast: clearParent(ast),
Expand Down
32 changes: 16 additions & 16 deletions src/tokenizer/__tests__/__output__/attributes-apostrophe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default [
column: 2,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagStart,
Expand Down Expand Up @@ -76,7 +76,7 @@ export default [
column: 13,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -122,7 +122,7 @@ export default [
column: 25,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeValueWrapperEnd,
Expand Down Expand Up @@ -153,7 +153,7 @@ export default [
column: 36,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -199,7 +199,7 @@ export default [
column: 48,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeValueWrapperEnd,
Expand Down Expand Up @@ -245,7 +245,7 @@ export default [
column: 4,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagStart,
Expand Down Expand Up @@ -291,7 +291,7 @@ export default [
column: 6,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagStart,
Expand Down Expand Up @@ -322,7 +322,7 @@ export default [
column: 19,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -368,7 +368,7 @@ export default [
column: 33,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeValueWrapperEnd,
Expand Down Expand Up @@ -399,7 +399,7 @@ export default [
column: 19,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -445,7 +445,7 @@ export default [
line: 10,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeValueWrapperEnd,
Expand Down Expand Up @@ -491,7 +491,7 @@ export default [
line: 14,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -522,7 +522,7 @@ export default [
column: 4,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -553,7 +553,7 @@ export default [
column: 2,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -584,7 +584,7 @@ export default [
column: 0,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -615,6 +615,6 @@ export default [
column: 0,
},
},
templates: [],
parts: [],
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const OUTPUT: AnyToken[] = [
column: 9,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -62,7 +62,7 @@ const OUTPUT: AnyToken[] = [
column: 18,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagEnd,
Expand Down
30 changes: 15 additions & 15 deletions src/tokenizer/__tests__/__output__/attributes-bare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default [
column: 8,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -61,7 +61,7 @@ export default [
column: 16,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeKey,
Expand All @@ -77,7 +77,7 @@ export default [
column: 29,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -108,7 +108,7 @@ export default [
column: 37,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagEnd,
Expand Down Expand Up @@ -154,7 +154,7 @@ export default [
column: 0,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagStart,
Expand Down Expand Up @@ -185,7 +185,7 @@ export default [
column: 10,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -216,7 +216,7 @@ export default [
column: 27,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagEnd,
Expand Down Expand Up @@ -247,7 +247,7 @@ export default [
column: 2,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagStart,
Expand Down Expand Up @@ -278,7 +278,7 @@ export default [
column: 21,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -309,7 +309,7 @@ export default [
column: 26,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeKey,
Expand All @@ -325,7 +325,7 @@ export default [
column: 12,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.AttributeAssignment,
Expand Down Expand Up @@ -356,7 +356,7 @@ export default [
column: 19,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.OpenTagEnd,
Expand Down Expand Up @@ -387,7 +387,7 @@ export default [
column: 2,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -418,7 +418,7 @@ export default [
column: 0,
},
},
templates: [],
parts: [],
},
{
type: TokenTypes.CloseTag,
Expand Down Expand Up @@ -449,6 +449,6 @@ export default [
column: 0,
},
},
templates: [],
parts: [],
},
];
Loading
Loading