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

adding debug:true causes a crash #255

Closed
morandd opened this issue Aug 16, 2023 · 1 comment
Closed

adding debug:true causes a crash #255

morandd opened this issue Aug 16, 2023 · 1 comment

Comments

@morandd
Copy link

morandd commented Aug 16, 2023

Adding debug:true to the Eta constructor causes crashes.

templates/mypage.eta template page:

--- start of mypage.eta ---
<%~ 
/* According to 'merge' principle in the documentation, header.eta should receive it.lang and it.name */
include('header.eta',{name:'Ben'}); %>
--- end of mypage.eta ---

which uses the header templates/header.eta partial:

--header.eta
<html lang="<%~ it?.lang%>">
hi I am a header
<tag lang="<%~ JSON.stringify(it) %>">
--end header.eta

And we execute it using a simple script test.js:


import { Eta } from "https://deno.land/x/[email protected]/src/index.ts";
// WORKS: 
const etaDebugFalse = new Eta({ views:  Deno.cwd() + '/templates' });
// CAUSES A CRASH IN eta.render()
const etaDebugTrue = new Eta({ views:  Deno.cwd() + '/templates', debug:true });

console.log( etaDebugFalse.render("mypage.eta", { lang: "en" }) );
console.log( etaDebugTrue.render("mypage.eta", { lang: "en" }) );

Originally posted by @morandd in #254 (comment)

@nebrelbug
Copy link
Collaborator

@morandd yep, that's definitely a bug :)

The error was in compile-string.ts:29. I just released a patch that fixes the issue with [email protected].

Thanks for filing this!

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

No branches or pull requests

2 participants