From a2bda1789b133a1eba736207884dc883042a3f74 Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Fri, 11 Jan 2019 23:28:04 +0800 Subject: [PATCH 1/2] commit --- layout/_layout.swig | 4 +- layout/_macro/post.swig | 43 +++++++--------------- layout/_partials/github-banner.swig | 2 +- layout/_third-party/comments/changyan.swig | 5 +-- layout/_third-party/comments/disqus.swig | 13 ++++--- layout/_third-party/comments/index.swig | 19 +++++----- layout/_third-party/comments/valine.swig | 2 +- layout/_third-party/copy-code.swig | 10 ++--- 8 files changed, 40 insertions(+), 58 deletions(-) diff --git a/layout/_layout.swig b/layout/_layout.swig index 1198a2c4aa..bbbb3da5fd 100644 --- a/layout/_layout.swig +++ b/layout/_layout.swig @@ -25,9 +25,9 @@ - {% set container_class = "container " %} + {% set container_class = 'container' %} {% if theme.sidebar.position %} - {% set container_class = container_class + 'sidebar-position-' + theme.sidebar.position %} + {% set container_class = container_class + ' sidebar-position-' + theme.sidebar.position %} {% endif %}
diff --git a/layout/_macro/post.swig b/layout/_macro/post.swig index 97d92b9e84..fb564f6ee0 100644 --- a/layout/_macro/post.swig +++ b/layout/_macro/post.swig @@ -139,61 +139,44 @@ {% endif %} {% if post.comments %} - {% if theme.facebook_comments_plugin.enable %} + {% macro comments() %} + {% endmacro %} + {% if theme.facebook_comments_plugin.enable %} + {{ comments() }} 0 {% elseif theme.disqus.enable and theme.disqus.count %} - - - + {{ comments() }} - {% if __('disqus') !== 'disqus' -%} - - {% endif %} - + {% elseif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %} - - - + {{ comments() }} {% if is_post() %} - + {% else %} - + {% endif %} {% elseif is_post() and theme.gitment.enable and theme.gitment.mint and theme.gitment.count %} - - - + {{ comments() }} - + {% elseif (is_post() or theme.valine.comment_count) and theme.valine.enable and theme.valine.appid and theme.valine.appkey %} - - - + {{ comments() }} @@ -201,7 +184,7 @@ {% endif %} {% endif %} - {# LeanCould PageView #} + {# LeanCloud PageView #} {% if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appid and theme.valine.appkey and theme.valine.visitor) %} diff --git a/layout/_partials/github-banner.swig b/layout/_partials/github-banner.swig index fbcebfc153..9666cff84a 100644 --- a/layout/_partials/github-banner.swig +++ b/layout/_partials/github-banner.swig @@ -1,6 +1,6 @@ {% if theme.github_banner %} {% set github_banner_bg_color = theme.android_chrome_color %} - {% set github_banner_fg_color = "#fff" %} + {% set github_banner_fg_color = '#fff' %} {% set github_URL = theme.github_banner.split('||')[0] | trim %} {% set github_title = theme.github_banner.split('||')[1] | trim %} diff --git a/layout/_third-party/comments/changyan.swig b/layout/_third-party/comments/changyan.swig index 9ef9cc9bfc..cf8fd2c251 100644 --- a/layout/_third-party/comments/changyan.swig +++ b/layout/_third-party/comments/changyan.swig @@ -1,6 +1,6 @@ {% if is_home() %} -{% else %} +{% elif page.comments %} diff --git a/layout/_third-party/comments/disqus.swig b/layout/_third-party/comments/disqus.swig index 2e65a0fd4e..8491d686f5 100644 --- a/layout/_third-party/comments/disqus.swig +++ b/layout/_third-party/comments/disqus.swig @@ -1,30 +1,30 @@ {% if theme.disqus.count %} {% endif %} - +{% if page.comments %} +{% endif %} diff --git a/layout/_third-party/comments/index.swig b/layout/_third-party/comments/index.swig index 4f960d5ad7..3110f8b04f 100644 --- a/layout/_third-party/comments/index.swig +++ b/layout/_third-party/comments/index.swig @@ -1,18 +1,17 @@ +{% if theme.disqus.enable %} + {% include 'disqus.swig' %} +{% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %} + {% include 'changyan.swig' %} +{% elif theme.valine.enable and theme.valine.appid and theme.valine.appkey %} + {% include 'valine.swig' %} +{% endif %} + {% if page.comments %} - {% if theme.disqus.enable %} - {% include 'disqus.swig' %} - {% elif theme.livere_uid %} + {% if theme.livere_uid %} {% include 'livere.swig' %} - {% elif theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %} - {% include 'changyan.swig' %} {% elif theme.gitment.enable and theme.gitment.client_id %} {% include 'gitment.swig' %} {% elif theme.gitalk.enable %} {% include 'gitalk.swig' %} {% endif %} {% endif %} - -{# Valine Comment Count #} -{% if theme.valine.enable and theme.valine.appid and theme.valine.appkey %} - {% include 'valine.swig' %} -{% endif %} diff --git a/layout/_third-party/comments/valine.swig b/layout/_third-party/comments/valine.swig index 60c8eb85bc..8ad4f47254 100644 --- a/layout/_third-party/comments/valine.swig +++ b/layout/_third-party/comments/valine.swig @@ -13,7 +13,7 @@