From abd45df7137525b3c0e6ba348ff83006d294905b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8D=C9=AA=E1=B4=8D=C9=AA?= <1119186082@qq.com> Date: Sun, 1 Sep 2019 10:22:18 +0800 Subject: [PATCH] Use nunjucks-compatible syntax & operator (#1068) * Replace && with and * Replace || with or * Replace ! with not * Use ES6 includes method --- layout/_layout.swig | 11 +++++------ layout/_macro/post-collapse.swig | 10 +++++----- layout/_macro/post.swig | 12 ++++++------ layout/_partials/analytics/lean-analytics.swig | 2 +- layout/_partials/footer.swig | 2 +- layout/_partials/head/head-unique.swig | 11 ++--------- layout/_partials/head/head.swig | 9 ++++++++- layout/_partials/header/index.swig | 4 ++-- layout/_partials/header/sub-menu.swig | 2 +- layout/_partials/page/breadcrumb.swig | 10 +++++----- layout/_partials/post/post-copyright.swig | 4 ++-- layout/_partials/post/post-related.swig | 4 ++-- layout/_partials/post/post-reward.swig | 2 +- layout/_third-party/comments/valine.swig | 2 +- layout/_third-party/facebook-sdk.swig | 2 +- layout/_third-party/quicklink.swig | 2 +- layout/page.swig | 2 +- 17 files changed, 45 insertions(+), 46 deletions(-) diff --git a/layout/_layout.swig b/layout/_layout.swig index 5e148adcf6..10ed81f2cb 100644 --- a/layout/_layout.swig +++ b/layout/_layout.swig @@ -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' %} @@ -19,7 +19,6 @@ {% include '_partials/head/head-unique.swig' %} {{- next_inject('head') }}