diff --git a/package.json b/package.json index 7c29148..a851bd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vardario/svelte-ast-printer", - "version": "0.1.5", + "version": "0.1.6", "description": "", "license": "MIT", "author": "Sahin Vardar", diff --git a/src/print-html.test.ts b/src/print-html.test.ts index 7a2ac9d..37a6317 100644 --- a/src/print-html.test.ts +++ b/src/print-html.test.ts @@ -79,6 +79,10 @@ describe('Element directives', () => { testHtmlPrinter('
  • {item}
  • '); testHtmlPrinter('
    {item}
    '); }); + + test('let:variable', () => { + testHtmlPrinter(''); + }); }); describe('Template', () => { diff --git a/src/print-html.ts b/src/print-html.ts index d95236b..2499025 100644 --- a/src/print-html.ts +++ b/src/print-html.ts @@ -90,6 +90,10 @@ class ElementPrinter extends BaseHtmlNodePrinter { case 'Animation': attributeName = 'animate:'; break; + + case 'Let': + attributeName = 'let:'; + break; } attributeName += attribute.name; @@ -463,8 +467,8 @@ export default function printHtml(params: PrintHtmlParams) { walk(_.cloneDeep(params.rootNode), { enter: function (node: TemplateNode, parent: TemplateNode) { - if(node.skip === true){ - return + if (node.skip === true) { + return; } const printer = printers[node.type]; if (printer === undefined) { @@ -480,10 +484,10 @@ export default function printHtml(params: PrintHtmlParams) { nestingLevel++; }, leave: function (node: TemplateNode, parent: TemplateNode) { - if(node.skip === true){ - return + if (node.skip === true) { + return; } - + const printer = printers[node.type]; printer.leave(node, parent, {