Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nunjucks-compatible syntax & operator #1068

Merged
merged 13 commits into from
Sep 1, 2019
12 changes: 6 additions & 6 deletions layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
{%- set version = next_env('version') %}

{# Language & Config #}
{%- set title = __('title') !== 'title' && __('title') || config.title %}
{%- set subtitle = __('subtitle') !== 'subtitle' && __('subtitle') || config.subtitle %}
{%- set author = __('author') !== 'author' && __('author') || config.author %}
{%- set description = __('description') !== 'description' && __('description') || config.description %}
{%- set title = __('title') !== 'title' and __('title') or config.title %}
{%- set subtitle = __('subtitle') !== 'subtitle' and __('subtitle') or config.subtitle %}
{%- set author = __('author') !== 'author' and __('author') or config.author %}
{%- set description = __('description') !== 'description' and __('description') or config.description %}

{%- if theme.pjax %}
{%- set pjax = ' pjax' %}
Expand All @@ -30,7 +30,7 @@
{{ partial('_scripts/noscript.swig', {}, {cache: theme.cache.enable}) }}
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="{{ page.lang || page.language || config.language }}">
<body itemscope itemtype="http://schema.org/WebPage" lang="{{ page.lang or page.language or config.language }}">

{%- set container_class = 'container' %}
{%- if theme.sidebar.position %}
Expand All @@ -49,7 +49,7 @@
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
{%- if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %}
{%- if theme.scheme === 'Pisces' or theme.scheme === 'Gemini' %}
{% include '_partials/header/sub-menu.swig' %}
{%- endif %}
<div id="content" class="content {% block page_class %}{% endblock %}">
Expand Down
12 changes: 6 additions & 6 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{%- set post_class = post_class + ' post-sticky' %}
{%- endif %}

{%- if theme.reading_progress.enable && not is_index %}
{%- if theme.reading_progress.enable and not is_index %}
<div class="reading-progress-bar"></div>
{%- endif %}

Expand All @@ -34,7 +34,7 @@

{# Not to show title for quote posts that do not have a title #}
{%- if not (is_index and post.type === 'quote' and not post.title) %}
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="post-title{%- if post.direction && post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="name headline">{#
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="post-title{%- if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="name headline">{#
#}{# Link posts #}{#
#}{%- if post.link %}
{%- if post.sticky > 0 %}
Expand Down Expand Up @@ -72,7 +72,7 @@
</span>
<span class="post-meta-item-text">{{ __('post.posted') }}</span>

{%- if !date_diff && time_diff && theme.post_meta.updated_at.enable && theme.post_meta.updated_at.another_day %}
{%- if !date_diff and time_diff and theme.post_meta.updated_at.enable and theme.post_meta.updated_at.another_day %}
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) + ' / ' + __('post.modified') + __('symbol.colon') + time(post.updated) %}
{% else %}
{%- set create_title = __('post.created') + __('symbol.colon') + full_date(post.date) %}
Expand All @@ -84,8 +84,8 @@
</span>
{%- endif %}

{%- if theme.post_meta.updated_at.enable && datetime_diff %}
{%- set display_updated = !theme.post_meta.updated_at.another_day || theme.post_meta.updated_at.another_day && date_diff %}
{%- if theme.post_meta.updated_at.enable and datetime_diff %}
{%- set display_updated = !theme.post_meta.updated_at.another_day or theme.post_meta.updated_at.another_day and date_diff %}

{%- if display_updated or !theme.post_meta.created_at %}
<span class="post-meta-item">
Expand Down Expand Up @@ -194,7 +194,7 @@
{#################}
{### POST BODY ###}
{#################}
<div class="post-body{%- if post.direction && post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="articleBody">
<div class="post-body{%- if post.direction and post.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}" itemprop="articleBody">

{# Gallery support #}
{%- if post.photos and post.photos.length %}
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/footer.swig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span class="with-love" id="animate">
<i class="fa fa-{{ theme.footer.icon.name }}"></i>
</span>
<span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright || author }}</span>
<span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright or author }}</span>

{%- if config.symbols_count_time.total_symbols %}
<span class="post-meta-divider">|</span>
Expand Down
4 changes: 2 additions & 2 deletions layout/_partials/header/index.swig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ partial('_partials/header/brand.swig', {}, {cache: theme.cache.enable}) }}

{%- set hasSearch = theme.algolia_search.enable || theme.local_search.enable %}
{%- set hasSearch = theme.algolia_search.enable or theme.local_search.enable %}

<nav class="site-nav">
{{ partial('_partials/header/menu.swig', {}, {cache: theme.cache.enable}) }}

{%- if theme.scheme === 'Muse' || theme.scheme === 'Mist' %}
{%- if theme.scheme === 'Muse' or theme.scheme === 'Mist' %}
{% include 'sub-menu.swig' %}
{%- endif %}

Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/header/sub-menu.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if not is_home() && not is_post() %}
{%- if not is_home() and not is_post() %}
{%- if theme.menu %}

{% import '../../_macro/menu/menu-item.swig' as menu_item %}
Expand Down
2 changes: 1 addition & 1 deletion layout/_partials/page/breadcrumb.swig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{%- if path.indexOf('.html') == -1 %}
<li><a href="{{ url_for(link) }}/">{{ path | upper }}</a></li>
{% else %}
<li>{{ path.replace('.html', '') | upper }}</li>
<li>{{ path | replace('.html', '') | upper }}</li>
{%- endif %}
{%- endif %}
{%- endif %}
Expand Down
4 changes: 2 additions & 2 deletions layout/_partials/post/post-copyright.swig
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<ul class="post-copyright">
<li class="post-copyright-author">
<strong>{{ __('post.copyright.author') + __('symbol.colon') }} </strong>{#
#}{{ post.author || author }}{#
#}{{ post.author or author }}{#
#}</li>
<li class="post-copyright-link">
<strong>{{ __('post.copyright.link') + __('symbol.colon') }}</strong>
{%- set postURL = post.url || post.permalink %}
{%- set postURL = post.url or post.permalink %}
{{ next_url(postURL, postURL, {title: post.title}) }}
</li>
<li class="post-copyright-license">
Expand Down
4 changes: 2 additions & 2 deletions layout/_partials/post/post-related.swig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
{%- if popular_post.date and popular_post.date != '' %}
<div class="popular-posts-date">{{ popular_post.date }}</div>
{%- endif %}
{%- if popular_post.img && popular_post.img != '' %}
{%- if popular_post.img and popular_post.img != '' %}
<div class="popular-posts-img"><img src="{{ popular_post.img }}"></div>
{%- endif %}
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>
{%- if popular_post.excerpt && popular_post.excerpt != '' %}
{%- if popular_post.excerpt and popular_post.excerpt != '' %}
<div class="popular-posts-excerpt"><p>{{ popular_post.excerpt }}</p></div>
{%- endif %}
</li>
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/facebook-sdk.swig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/{{ config.language|replace('-', '_') }}/sdk.js";
js.src = "//connect.facebook.net/{{ config.language | replace('-', '_') }}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/quicklink.swig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
quicklink({
timeout: {{ theme.quicklink.timeout }},
priority: {{ theme.quicklink.priority }},
ignores: [uri => uri.includes('#'),uri => uri == '{{ url.replace('index.html', '') }}',{{ theme.quicklink.ignores }}]
ignores: [uri => uri.includes('#'),uri => uri == '{{ url | replace('index.html', '') }}',{{ theme.quicklink.ignores }}]
});
{%- if theme.quicklink.delay %}
});
Expand Down
2 changes: 1 addition & 1 deletion layout/page.swig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{#################}
{### PAGE BODY ###}
{#################}
<div class="post-body{%- if page.direction && page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}">
<div class="post-body{%- if page.direction and page.direction.toLowerCase() === 'rtl' %} rtl{%- endif %}">
{# tagcloud page support #}
{%- if page.type === 'tags' %}
<div class="tag-cloud">
Expand Down