Closed ibatullin closed 6 years ago
Your example could be fixed as the following:
.example
| {% for i in (1..6) %}
| <h{{ i }}> Header {{ i }}</h1>
| {% endfor %}
or...
.example.
{% for i in (1..6) %}
<h{{ i }}> Header {{ i }}</h1>
{% endfor %}
In 1.0.1, Jekyll-Pug overwrites the parse method of Jekyll's LiquidRenderer. This allows us to create a more efficient compiling process, but the order of compiling has changed from Pug first then Liquid.
Here's the parse function:
def parse(content)
measure_time do
if @filename =~ /\.pug$/
userSource = $JEKYLLPUG_PROJECT_SOURCE
content = Pug.compile(content, {"filename"=>userSource})
end
@template = Liquid::Template.parse(content, :line_numbers => true)
end
end
Essentially, we need that Liquid::Template.parse
object to be returned, which makes it difficult to first compile the file as Liquid and then compile the file as Pug.
Hello, @ibatullin. Were you able to resolve the issue?
Thanks for your help and quick answer! I will keep in mind the order of compiling.
I also found Pug-only solution:
- var headers = [1, 2, 3, 4, 5, 6]
.example
each i in headers
#{"h" + i} Header #{i}
Nice work!
Liquid tags produce errors after d7fafa1e5cc43f46159a13220e3ae818b8e8a3ed:
The tag doesn't have indentation. It works in version 0.0.1, but needs whitespace control in v1.0.1:
I like syntax in v0.0.1:
How to rewrite the snippet to v1.0.1?