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]
3a0add4b6e caused existing configs to fall
back to defaults. But since we know exactly how to fix the user config
so that the behavior doesn't change, we should do so, while still
warning that use of %s is deprecated.
Also fixes a bug where we tried to look for %s in None.
At the moment aborts with the following:
File "/usr/lib/python3.7/site-packages/pelican/settings.py", line 327, in handle_deprecated_settings
if t not in settings['PAGINATED_TEMPLATES']:
KeyError: 'PAGINATED_TEMPLATES'
The refresh_metadata_intersite_links() is called again later, so this
bit was only causing everything to be processed twice. Besides
that, it makes the processing dependent on file order -- in particular,
when metadata references a file that was not parsed yet, it reported an
"Unable to find" warning. But everything is found in the second pass, so
this only causes a superflous false warning and no change to the output.
The related test now needs to call the
refresh_metadata_intersite_links() explicitly. That function is called
from Pelican.run() and all generators but the test processes just one
page so it has no chance of being called implicitly.
Related discussion: https://github.com/getpelican/pelican/pull/2288/files#r204337359
With the current implementation, links to articles/pages that have not
been processed yet are reported with a warning, yet later replaced with
a correct value. That's not wanted.