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

Reduce unnecessary blank lines in templates #1030

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions layout/_layout.swig
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<!DOCTYPE html>

{# NexT version #}
{% set version = next_env('version') %}
{%- 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' && __('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 html_class = 'theme-next ' + theme.scheme %}
{% if theme.motion.enable %}
{% set html_class = html_class + ' use-motion' %}
{% endif %}
{%- set html_class = 'theme-next ' + theme.scheme %}
{%- if theme.motion.enable %}
{%- set html_class = html_class + ' use-motion' %}
{%- endif %}

<html class="{{ html_class | lower }}" lang="{{ config.language }}">
<head>
{{ partial('_partials/head/head.swig', {}, {cache: theme.cache.enable}) }}
{% include '_partials/head/head-unique.swig' %}
{% for inject_item in theme.injects.head %}
{%- for inject_item in theme.injects.head %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{% endfor %}
{%- endfor %}
<title>{% block title %}{% endblock %}</title>
{% include '_third-party/analytics/index.swig' %}
{{ partial('_scripts/noscript.swig', {}, {cache: theme.cache.enable}) }}
</head>

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

{% set container_class = 'container' %}
{% if theme.sidebar.position %}
{% set container_class = container_class + ' sidebar-position-' + theme.sidebar.position %}
{% endif %}
{%- set container_class = 'container' %}
{%- if theme.sidebar.position %}
{%- set container_class = container_class + ' sidebar-position-' + theme.sidebar.position %}
{%- endif %}

<div class="{{ container_class }} {% block page_class %}{% endblock %}">
<div class="headband"></div>
Expand All @@ -45,17 +45,17 @@
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
{% if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %}
{%- if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %}
{% include '_partials/header/sub-menu.swig' %}
{% endif %}
{%- endif %}
<div id="content" class="content">
{% block content %}{% endblock %}
</div>
{% include '_partials/comments.swig' %}
</div>
{% if theme.sidebar.display !== 'remove' %}
{%- if theme.sidebar.display !== 'remove' %}
{% block sidebar %}{% endblock %}
{% endif %}
{%- endif %}
</div>
</main>

Expand All @@ -67,22 +67,22 @@
</div>
</footer>

{% if theme.back2top.enable and not theme.back2top.sidebar %}
{%- if theme.back2top.enable and not theme.back2top.sidebar %}
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
{% if theme.back2top.scrollpercent %}
{%- if theme.back2top.scrollpercent %}
<span id="scrollpercent"><span>0</span>%</span>
{% endif %}
{%- endif %}
</div>
{% endif %}
{%- endif %}

{% include '_partials/share/index.swig' %}
</div>

{% include '_scripts/vendors.swig' %}
{% include '_scripts/commons.swig' %}

{% set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
{%- set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
{% include scheme_script %}

{% block script_extra %}{% endblock %}
Expand All @@ -94,9 +94,9 @@

{% include '_third-party/index.swig' %}

{% for inject_item in theme.injects.bodyEnd %}
{%- for inject_item in theme.injects.bodyEnd %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{% endfor %}
{%- endfor %}

</body>
</html>
10 changes: 5 additions & 5 deletions layout/_macro/menu/menu-badge.swig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% macro render(name) %}

{% set badges = {
{%- set badges = {
archives: site.posts.length,
categories: site.categories.length,
tags: site.tags.length }
%}
{% for menu, count in badges %}
{% if name == menu %}
{%- for menu, count in badges %}
{%- if name == menu %}
<span class="badge">{{ count }}</span>
{% endif %}
{% endfor %}
{%- endif %}
{%- endfor %}

{% endmacro %}
22 changes: 11 additions & 11 deletions layout/_macro/menu/menu-item.swig
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% macro render(name, value) %}
{% import 'menu-badge.swig' as menu_badge %}

{% set itemURL = value.split('||')[0] | trim %}
{% if itemURL.indexOf('http') != 0 %}
{% set itemURL = itemURL | replace('//', '/', 'g') %}
{% endif %}
{%- set itemURL = value.split('||')[0] | trim %}
{%- if itemURL.indexOf('http') != 0 %}
{%- set itemURL = itemURL | replace('//', '/', 'g') %}
{%- endif %}
<li class="menu-item menu-item-{{ itemName | replace(' ', '-', 'g') }}{{ item_active(itemURL, 'menu-item-active') }}">

{% set menuText = __('menu.' + name) | replace('menu.', '') %}
{% if theme.menu_settings.icons %}
{% set menuIcon = '<i class="menu-item-icon fa fa-fw fa-' + value.split('||')[1] | trim | default('question-circle') + '"></i> <br/>' %}
{% endif %}
{%- set menuText = __('menu.' + name) | replace('menu.', '') %}
{%- if theme.menu_settings.icons %}
{%- set menuIcon = '<i class="menu-item-icon fa fa-fw fa-' + value.split('||')[1] | trim | default('question-circle') + '"></i> <br/>' %}
{%- endif %}

{% if theme.menu_settings.badges %}
{% set menuBadge = menu_badge.render(name) | trim %}
{% endif %}
{%- if theme.menu_settings.badges %}
{%- set menuBadge = menu_badge.render(name) | trim %}
{%- endif %}

{{ next_url(itemURL, menuIcon + menuText + menuBadge, {rel: 'section'}) }}

Expand Down
16 changes: 8 additions & 8 deletions layout/_macro/post-collapse.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
<article class="post post-type-{{ post.type | default('normal') }}" itemscope itemtype="http://schema.org/Article">
<header class="post-header">

<{% if theme.seo %}h3{% else %}h2{% endif %} class="post-title">
{% if post.link %}{# Link posts #}
{% set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{% set postText = post.title or post.link %}
<{%- if theme.seo %}h3{% else %}h2{%- endif %} class="post-title">
{%- if post.link %}{# Link posts #}
{%- set postTitleIcon = '<i class="fa fa-external-link"></i>' %}
{%- set postText = post.title or post.link %}
{{ next_url(post.link, postText + postTitleIcon, {class: 'post-title-link post-title-link-external', itemprop: 'url' }) }}
{% else %}
<a class="post-title-link" href="{{ url_for(post.path) }}" itemprop="url">
{% if post.type === 'picture' %}
{%- if post.type === 'picture' %}
{{ post.content }}
{% else %}
<span itemprop="name">{{ post.title | default(__('post.untitled')) }}</span>
{% endif %}
{%- endif %}
</a>
{% endif %}
</{% if theme.seo %}h3{% else %}h2{% endif %}>
{%- endif %}
</{%- if theme.seo %}h3{% else %}h2{%- endif %}>

<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
Expand Down
Loading