Fixed Jinja error for raw HTML header tags

This commit is contained in:
squidfunk 2017-02-08 23:13:13 +01:00 committed by Martin Donath
parent 9e3403ee4f
commit f40585f528
6 changed files with 20 additions and 20 deletions

View File

@ -110,7 +110,7 @@
<a href="{{ page.edit_url }}" title="{{ lang.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a>
{% endif %}
{% block content %}
{% if not "\x3ch1 id=" in page.content %}
{% if not "\x3ch1" in page.content %}
<h1>{{ page.title | default(config.site_name, true)}}</h1>
{% endif %}
{{ page.content }}

View File

@ -25,10 +25,10 @@
<li class="md-nav__item">
{% set toc_ = page.toc %}
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
{% if "\x3ch1 id=" in page.content %}
{% if toc_ | first is defined %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ and (toc_ | first) %}
{% if toc_ | first is defined %}
<label class="md-nav__link md-nav__link--active" for="toc">
{{ nav_item.title }}
</label>
@ -36,7 +36,7 @@
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% if page.toc %}
{% if toc_ | first is defined %}
{% include "partials/toc.html" %}
{% endif %}
</li>

View File

@ -1,10 +1,10 @@
{% import "partials/language.html" as lang %}
<nav class="md-nav md-nav--secondary">
{% set toc_ = page.toc %}
{% if "\x3ch1 id=" in page.content %}
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ and (toc_ | first) %}
{% if toc_ | first is defined %}
<label class="md-nav__title" for="toc">{{ lang.t('toc.title') }}</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}

View File

@ -218,11 +218,11 @@
{% block content %}
<!--
This is a nasty hack that checks whether the content contains
a h1 headline. If it doesn't, the page title (or respectively
site name) is used as the main headline.
Hack: check whether the content contains a h1 headline. If it
doesn't, the page title (or respectively site name) is used
as the main headline.
-->
{% if not "\x3ch1 id=" in page.content %}
{% if not "\x3ch1" in page.content %}
<h1>{{ page.title | default(config.site_name, true)}}</h1>
{% endif %}

View File

@ -62,13 +62,13 @@
<input class="md-toggle md-nav__toggle" data-md-toggle="toc"
type="checkbox" id="toc" />
<!-- Nasty hack - see partials/toc.html for more information -->
{% if "\x3ch1 id=" in page.content %}
<!-- Hack: see partials/toc.html for more information -->
{% if toc_ | first is defined %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
<!-- Render table of contents, if not empty -->
{% if toc_ and (toc_ | first) %}
{% if toc_ | first is defined %}
<label class="md-nav__link md-nav__link--active" for="toc">
{{ nav_item.title }}
</label>
@ -79,7 +79,7 @@
</a>
<!-- Show table of contents -->
{% if page.toc %}
{% if toc_ | first is defined %}
{% include "partials/toc.html" %}
{% endif %}
</li>

View File

@ -27,17 +27,17 @@
{% set toc_ = page.toc %}
<!--
This is a nasty hack that checks whether the content contains a h1
headline. If it does, the top-level anchor must be skipped, since it would
be redundant to the link to the current page that is located just above the
anchor. Therefore we directly continue with the children of the anchor.
Hack: check whether the content contains a h1 headline. If it does, the
top-level anchor must be skipped, since it would be redundant to the link
to the current page that is located just above the anchor. Therefore we
directly continue with the children of the anchor.
-->
{% if "\x3ch1 id=" in page.content %}
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
<!-- Render item list -->
{% if toc_ and (toc_ | first) %}
{% if toc_ | first is defined %}
<label class="md-nav__title" for="toc">{{ lang.t('toc.title') }}</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}