From 5120c954789f5f353cde43f5b5b726d4c1195d09 Mon Sep 17 00:00:00 2001
From: Mimi <1119186082@qq.com>
Date: Sun, 22 Mar 2020 18:34:09 +0800
Subject: [PATCH] Run lebab
---
layout/_partials/footer.swig | 2 +-
scripts/events/index.js | 10 +++++-----
scripts/events/lib/config.js | 11 ++++-------
scripts/filters/post.js | 4 ++--
scripts/helpers/engine.js | 2 +-
scripts/helpers/font.js | 12 ++++++------
scripts/helpers/next-url.js | 14 +++++++-------
7 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/layout/_partials/footer.swig b/layout/_partials/footer.swig
index ce82d501a4..f60ea9b42b 100644
--- a/layout/_partials/footer.swig
+++ b/layout/_partials/footer.swig
@@ -42,7 +42,7 @@
{%- endif %}
-{%- if theme.footer.powered.enable %}
+{%- if theme.footer.powered %}
{%- set next_site = 'https://theme-next.org' %}
{%- if theme.scheme !== 'Gemini' %}
diff --git a/scripts/events/index.js b/scripts/events/index.js
index eb811e3c35..9881590926 100644
--- a/scripts/events/index.js
+++ b/scripts/events/index.js
@@ -19,16 +19,16 @@ hexo.on('generateAfter', () => {
'User-Agent': 'Theme NexT Client'
}
}, res => {
- var result = '';
+ let result = '';
res.on('data', data => {
result += data;
});
res.on('end', () => {
try {
- var latest = JSON.parse(result).tag_name.replace('v', '').split('.');
- var current = version.split('.');
- var isOutdated = false;
- for (var i = 0; i < Math.max(latest.length, current.length); i++) {
+ let latest = JSON.parse(result).tag_name.replace('v', '').split('.');
+ let current = version.split('.');
+ let isOutdated = false;
+ for (let i = 0; i < Math.max(latest.length, current.length); i++) {
if (!current[i] || latest[i] > current[i]) {
isOutdated = true;
break;
diff --git a/scripts/events/lib/config.js b/scripts/events/lib/config.js
index c95c329d55..87b3b20f39 100644
--- a/scripts/events/lib/config.js
+++ b/scripts/events/lib/config.js
@@ -16,10 +16,7 @@ function merge(target, source) {
}
module.exports = hexo => {
- if (!hexo.locals.get) return;
-
- var data = hexo.locals.get('data');
- if (!data) return;
+ let data = hexo.locals.get('data');
/**
* Merge configs from _data/next.yml into hexo.theme.config.
@@ -45,10 +42,10 @@ module.exports = hexo => {
// Custom languages support. Introduced in NexT v6.3.0.
if (data.languages) {
- var { language } = hexo.config;
- var { i18n } = hexo.theme;
+ let { language } = hexo.config;
+ let { i18n } = hexo.theme;
- var mergeLang = lang => {
+ const mergeLang = lang => {
i18n.set(lang, merge(i18n.get([lang]), data.languages[lang]));
};
diff --git a/scripts/filters/post.js b/scripts/filters/post.js
index 1bd4fe88ae..851c8243ca 100644
--- a/scripts/filters/post.js
+++ b/scripts/filters/post.js
@@ -11,13 +11,13 @@ hexo.extend.filter.register('after_post_render', data => {
}
if (theme.exturl) {
const url = require('url');
- var siteHost = url.parse(config.url).hostname || config.url;
+ const siteHost = url.parse(config.url).hostname || config.url;
data.content = data.content.replace(/
]* href="([^"]+)"[^>]*>([^<]+)<\/a>/img, (match, href, html) => {
// Exit if the href attribute doesn't exists.
if (!href) return match;
// Exit if the url has same host with `config.url`, which means it's an internal link.
- var link = url.parse(href);
+ let link = url.parse(href);
if (!link.protocol || link.hostname === siteHost) return match;
// If title atribute filled, set it as title; if not, set url as title.
diff --git a/scripts/helpers/engine.js b/scripts/helpers/engine.js
index fa98091548..231841cb96 100644
--- a/scripts/helpers/engine.js
+++ b/scripts/helpers/engine.js
@@ -59,7 +59,7 @@ hexo.extend.helper.register('gitalk_md5', function(path) {
hexo.extend.helper.register('canonical', function() {
// https://support.google.com/webmasters/answer/139066
const { permalink } = hexo.config;
- var url = this.url.replace(/index\.html$/, '');
+ let url = this.url.replace(/index\.html$/, '');
if (!permalink.endsWith('.html')) {
url = url.replace(/\.html$/, '');
}
diff --git a/scripts/helpers/font.js b/scripts/helpers/font.js
index 8e65696e00..d346468a88 100644
--- a/scripts/helpers/font.js
+++ b/scripts/helpers/font.js
@@ -3,17 +3,17 @@
'use strict';
hexo.extend.helper.register('next_font', () => {
- var config = hexo.theme.config.font;
+ const config = hexo.theme.config.font;
if (!config || !config.enable) return '';
- var fontDisplay = '&display=swap';
- var fontSubset = '&subset=latin,latin-ext';
- var fontStyles = ':300,300italic,400,400italic,700,700italic';
- var fontHost = config.host || '//fonts.googleapis.com';
+ const fontDisplay = '&display=swap';
+ const fontSubset = '&subset=latin,latin-ext';
+ const fontStyles = ':300,300italic,400,400italic,700,700italic';
+ const fontHost = config.host || '//fonts.googleapis.com';
//Get a font list from config
- var fontFamilies = ['global', 'title', 'headings', 'posts', 'codes'].map(item => {
+ let fontFamilies = ['global', 'title', 'headings', 'posts', 'codes'].map(item => {
if (config[item] && config[item].family && config[item].external) {
return config[item].family + fontStyles;
}
diff --git a/scripts/helpers/next-url.js b/scripts/helpers/next-url.js
index 5b8f8f0fe9..26aab8741b 100644
--- a/scripts/helpers/next-url.js
+++ b/scripts/helpers/next-url.js
@@ -7,19 +7,19 @@ const url = require('url');
hexo.extend.helper.register('next_url', function(path, text, options = {}) {
const { config } = this;
- var data = url.parse(path);
- var siteHost = url.parse(config.url).hostname || config.url;
+ const data = url.parse(path);
+ const siteHost = url.parse(config.url).hostname || config.url;
- var theme = hexo.theme.config;
- var exturl = '';
- var tag = 'a';
- var attrs = { href: this.url_for(path) };
+ const theme = hexo.theme.config;
+ let exturl = '';
+ let tag = 'a';
+ let attrs = { href: this.url_for(path) };
// If `exturl` enabled, set spanned links only on external links.
if (theme.exturl && data.protocol && data.hostname !== siteHost) {
tag = 'span';
exturl = 'exturl';
- var encoded = Buffer.from(path).toString('base64');
+ const encoded = Buffer.from(path).toString('base64');
attrs = {
class : exturl,
'data-url': encoded