Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"AssertionError: illegal input" when specifying templateEngineOverride and permalink() in .11ty.js template #943

Open
pdehaan opened this issue Feb 17, 2020 · 1 comment

Comments

@pdehaan
Copy link
Contributor

pdehaan commented Feb 17, 2020

Describe the bug
I'm seeing the following error when I try and set both the templateEngineOverride and a permalink() function in the data() method of an *.11ty.js template:

$ npx eleventy

Problem writing Eleventy templates: (more in DEBUG output)
> Having trouble rendering md template ./src/posts/post-8.11ty.js

`TemplateContentRenderError` was thrown
> Having trouble compiling template ./src/posts/post-8.11ty.js

`TemplateContentCompileError` was thrown
> illegal input

`AssertionError` was thrown:
    AssertionError: illegal input
        at assert (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/liquidjs/dist/liquid.common.js:1062:11)
        at parse (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/liquidjs/dist/liquid.common.js:1426:3)
        at Object.parse$$1 [as parse] (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/liquidjs/dist/liquid.common.js:3419:18)
        at Liquid.compile (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/Engines/Liquid.js:181:29)
        at Markdown.compile (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/Engines/Markdown.js:63:25)
        at TemplateRender.getCompiledTemplate (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/TemplateRender.js:192:26)
        at Template.compile (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/TemplateContent.js:167:42)
        at async Template.render (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/TemplateContent.js:181:16)
        at async Template._getLink (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/Template.js:103:26)
        at async Template.getOutputHref (/Volumes/Dev/github/pdehaan/11ty-setQuietMode-test/node_modules/@11ty/eleventy/src/Template.js:138:16)
Wrote 0 files in 0.16 seconds (v0.10.0)

To Reproduce
Steps to reproduce the behavior:

// src/pages/post-8.11ty.js
class Test {
  data() {
    return {
      name: "markdown",
      templateEngineOverride: "11ty.js,md",
      permalink: data => "/aboot/youu/"
    };
  }

  render(data) {
    return `# This is ${data.name}`;
  }
}

module.exports = Test;

What's interesting is, the code seems to work if I omit either templateEngineOverride value or permalink() method, but fails when I use them both. Also interesting is that if I use the static value for a permalink, it seems to work:

permalink: "/about/you/"

Expected behavior
A clear and concise description of what you expected to happen.

Environment:

  • OS and Version: macOS (latest)
  • Eleventy Version: (v0.10.0)

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants