tera icon indicating copy to clipboard operation
tera copied to clipboard

error while importing

Open sqrt0x opened this issue 2 years ago • 1 comments

there is no much documentation about imports nor tests in the source code i tried making simple two files

<!-- index.html -->
<html>
	{% import "header.html" as header %}
	{{ header::head() }}
	<body>
		hello world
	</body>
</html>
<!-- header.html -->
{% macro head() %}
	<head>
		<title> title </title>
	</head>
{% endmacro head %}

and I got this error image

sqrt0x avatar Feb 25 '24 22:02 sqrt0x

okay i fixed it. looks like the {% import %} statmetns needs to be at top level of the tml like

{% import "header.html" as header %}
<html>
	{{ header::head() }}
	<body>
		hello world
	</body>
</html>

but there is nothing that says that at the documentation. there is literally only 2 lines about import and they don't talk about this!

sqrt0x avatar Feb 25 '24 22:02 sqrt0x