mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
I used the tool [htmlbeautify][1] like so
htmlbeautifier -t 4 -b 1 pelican/themes/simple/templates/*.html
htmlbeautifier -t 4 -b 1 pelican/themes/notmyidea/templates/*.html
and then manually adjusted the output. The final result follows the
following rules.
- 4-space indentation
- Multiline nested tags like
<tag1><tag2>
... nested content ...
</tag2></tag1>
are broken up into
<tag1>
<tag2>
... nested content ...
</tag2>
</tag1>
but if everything is on one like this
<tag1><tag2>... nested content ...</tag2></tag1>
it's OK.
- Treat new blocks like tags when indenting. E.g.
{% if cond %}
<p>hello</p>
{% endif %}
However, observe the following exceptions:
- Don't indent inside a {% block %}, {% macro %}, or if the block
takes up the entire file.
- If a {% for ... %} block takes up the entire content of an HTML tag,
don't indent it. E.g.
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
I tried to follow the examples in the official Jinja documentation as
closely as possible: <http://jinja.pocoo.org/docs/2.10/templates/>.
Used `git diff --check` to perform basic whitespace checks.
[1]: [https://github.com/threedaymonk/htmlbeautifier]
|
||
|---|---|---|
| .. | ||
| basic | ||
| custom | ||
| custom_locale | ||