Menu icon Foundation

My Posts

No Content

My Comments

Jan Müller commented on Chris Peters's post about 1 year

I found out how to avoid the problem.
https://stackoverflow.com/questions/31753617/how-can-i-remove-leading-whitespace-in-my-pre-code-block-without-removing-in
It's caused by the way how partials are included.
Here some example files.
Layout:
...
<html>
...
<body>
{{> body}}
</body>
</html>
Then the index.html:
<div class="grid-x">
<div class="cell">
{{> partial-with-pre-tag}}
</div>
</div>
And then partial-with-pre-tag.html:
And then partial-with-pre-tag.html:
<div>
<pre>1st line
2nd line
3rd line
for-loop
do something
end-loop
last line</pre>
</div>
Each partial include takes all whitespaces BEFORE the include and puts them in front of EVERY line of the included Partial!
In this example we have 2 tabs before {{> body}} plus 2 tabs before {{> partial-with-pre-tag}}. That makes 4 tabs before EVERY line in the <pre> element. Resulting in something like this:
1st line
2nd line
3rd line
for-loop
do something
end-loop
last line
I still regard this behaviour as a bug.
The "solution" is to destroy indention in all partial includes on the way until the <pre> element, e.g. like this:
...
<body>
<div>
<any-element>
<another-element>
<div>
<something>
<div>
<div>
{{> partial-name}}
</div>
</div>
</something>
</div>
</another-element>
</any-element>
</div>
</body>

Jan Müller commented on Chris Peters's post about 1 year

Although this thread is 2 years old, the problem still exists.
Chris, did you find a way to get around that bug?

Posts Followed


Following

    No Content

Followers

My Posts

No Content

My Comments

You commented on Chris Peters's post about 1 year

I found out how to avoid the problem.
https://stackoverflow.com/questions/31753617/how-can-i-remove-leading-whitespace-in-my-pre-code-block-without-removing-in
It's caused by the way how partials are included.
Here some example files.
Layout:
...
<html>
...
<body>
{{> body}}
</body>
</html>
Then the index.html:
<div class="grid-x">
<div class="cell">
{{> partial-with-pre-tag}}
</div>
</div>
And then partial-with-pre-tag.html:
And then partial-with-pre-tag.html:
<div>
<pre>1st line
2nd line
3rd line
for-loop
do something
end-loop
last line</pre>
</div>
Each partial include takes all whitespaces BEFORE the include and puts them in front of EVERY line of the included Partial!
In this example we have 2 tabs before {{> body}} plus 2 tabs before {{> partial-with-pre-tag}}. That makes 4 tabs before EVERY line in the <pre> element. Resulting in something like this:
1st line
2nd line
3rd line
for-loop
do something
end-loop
last line
I still regard this behaviour as a bug.
The "solution" is to destroy indention in all partial includes on the way until the <pre> element, e.g. like this:
...
<body>
<div>
<any-element>
<another-element>
<div>
<something>
<div>
<div>
{{> partial-name}}
</div>
</div>
</something>
</div>
</another-element>
</any-element>
</div>
</body>

You commented on Chris Peters's post about 1 year

Although this thread is 2 years old, the problem still exists.
Chris, did you find a way to get around that bug?

Posts Followed

Following

  • No Content

Followers

  • No Content