diff --git a/README.md b/README.md index 8171aeb..24d4ee7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ hexo-theme-mellow ================= -[![](https://img.shields.io/badge/release-v1.3.9-blue.svg?style=flat-square)](https://github.com/codefine/hexo-theme-mellow/releases) +[![](https://img.shields.io/badge/release-v1.4.0-blue.svg?style=flat-square)](https://github.com/codefine/hexo-theme-mellow/releases) [![](https://img.shields.io/badge/document-CN-green.svg?style=flat-square)](https://github.com/codefine/hexo-theme-mellow/wiki) [![](https://img.shields.io/badge/preview-Michael.Lu's%20blog-ff69b4.svg?style=flat-square)](https://blog.lujingtao.com) [![Join the chat at https://gitter.im/hexo-theme-mellow/Lobby](https://badges.gitter.im/hexo-theme-mellow/Lobby.svg)](https://gitter.im/codefine/hexo-theme-mellow?utm_source=share-link&utm_medium=link&utm_campaign=share-link) @@ -36,7 +36,7 @@ Material Design 风格的Hexo主题,基于 **Hexo 3.0+** & **Node 7.x+** 制 ## FAQ -初次使用时`hexo g`报错,大部分情况是因为**缺少依赖**。前往[wiki-主题安装](https://github.com/codefine/hexo-theme-mellow/wiki/1.-%E4%B8%BB%E9%A2%98%E5%AE%89%E8%A3%85)查看如何安装依赖。 +初次使用时`hexo g`报错,大部分情况是因为**缺少依赖**,或者依赖版本问题。前往[wiki-主题安装](https://github.com/codefine/hexo-theme-mellow/wiki/1.-%E4%B8%BB%E9%A2%98%E5%AE%89%E8%A3%85)查看如何安装依赖。 ## Community diff --git a/layout/_partial/post.ejs b/layout/_partial/post.ejs index c38a9ea..8d5993d 100644 --- a/layout/_partial/post.ejs +++ b/layout/_partial/post.ejs @@ -1,61 +1,56 @@
-
-

<%- post.title %>

- -
- <% - post.content = post.content.replace(/]+)>/g, function(img) { - var src = img.replace(//, function($1, $2, $3) { - return $3; - }); - var title = img.replace(//, function($1, $2, $3) { - return $3; - }); - var alt = img.replace(//, function($1, $2, $3) { - return $3; - }); - title = title !== img && title ? title : (alt !== img && alt ? alt : ""); - return `${img}`; - }); - post.content = post.content.replace(/(.+)<\/table>/, function(match, $1) { - $1 = $1.replace(/
/g, ''); - return `
${$1}
`; - }); - %> - <%- post.content.replace(/

}<\/p>/g, '

') - .replace(/

@([\w-]+){<\/p>/g, function(match, $1){ - return '

' - }) %> -
- <%- partial('post/copyright') %> - <% if (post.reward || typeof post.reward === "undefined") { - if (theme.reward.alipay || theme.reward.wechat) { %> - <%- partial('post/reward-btn') %> - <% } %> - <% } %> - - <% if (post.comment || typeof post.comment === "undefined") { %> - <%- partial('post/comment') %> - <% } %> -
- <%- partial('post/nav') %> - <% if (page.repo) { %> - <%- partial('post/repo') %> - <% } %> - <%- partial('post/toc', { post: page}) %> -
-<% if (post.reward || typeof post.reward === "undefined") { - if (theme.reward.alipay || theme.reward.wechat) { %> - <%- partial('post/reward') %> - <% } -} %> + class="post-article article-type-<%= post.layout %>" itemprop="blogPost"> +
+

<%- post.title %>

+
+ <%- partial('post/date', {date_format: config.date_format}) %> + <%- partial('post/category') %> + <%- partial('post/visitor') %> + <%- partial('post/comment-count') %> + <%- partial('post/music') %> +
+
+ <% + post.content = post.content.replace(/]+)>/g, function(img) { + var src = img.match(/src="([^"]+)"/)[1]; + var title = img.match(/title="([^"]+)"/) ? img.match(/title="([^"]+)"/)[1] : ''; + var alt = img.match(/alt="([^"]+)"/) ? img.match(/alt="([^"]+)"/)[1] : ''; + title = title !== img && title ? title : (alt !== img && alt ? alt : ""); + return `${img}`; + }); + post.content = post.content.replace(/(.+)<\/table>/, function(match, $1) { + $1 = $1.replace(/
/g, ''); + return `
${$1}
`; + }); + %> + <%- post.content.replace(/

}<\/p>/g, '

') + .replace(/

@([\w-]+){<\/p>/g, function(match, $1){ + return '

' + }) %> +
+ <%- partial('post/copyright') %> + <% if (post.reward || typeof post.reward === "undefined") { + if (theme.reward.alipay || theme.reward.wechat) { %> + <%- partial('post/reward-btn') %> + <% } %> + <% } %> +
+ <%- partial('post/tag') %> + <%- partial('post/share-fab') %> +
+ <% if (post.comment || typeof post.comment === "undefined") { %> + <%- partial('post/comment') %> + <% } %> +
+ <%- partial('post/nav') %> + <% if (page.repo) { %> + <%- partial('post/repo') %> + <% } %> + <%- partial('post/toc', { post: page}) %> + + <% if (post.reward || typeof post.reward === "undefined") { + if (theme.reward.alipay || theme.reward.wechat) { %> + <%- partial('post/reward') %> + <% } + } %> + \ No newline at end of file diff --git a/layout/_partial/script.ejs b/layout/_partial/script.ejs index 0c785bb..bc727f8 100644 --- a/layout/_partial/script.ejs +++ b/layout/_partial/script.ejs @@ -10,7 +10,6 @@ -<%- partial("_third-party/swipebox") %> <% if (page.repo) { %> <%- partial("_third-party/github_repo") %> diff --git a/layout/page.ejs b/layout/page.ejs index 7efb00e..e30f5d7 100644 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -6,15 +6,9 @@ page.reward = 'reward' in page ? !!theme.reward && !!page.reward : !!theme.reward; page.slug = 'hexo-page-' + page.path.replace(/\/index\.html$/,'').split('/').join('-'); page.content = page.content.replace(/]+)>/g, function(img) { - var src = img.replace(//, function($1, $2, $3) { - return $3; - }); - var title = img.replace(//, function($1, $2, $3) { - return $3; - }); - var alt = img.replace(//, function($1, $2, $3) { - return $3; - }); + var src = img.match(/src="([^"]+)"/)[1]; + var title = img.match(/title="([^"]+)"/) ? img.match(/title="([^"]+)"/)[1] : ''; + var alt = img.match(/alt="([^"]+)"/) ? img.match(/alt="([^"]+)"/)[1] : ''; title = title !== img && title ? title : (alt !== img && alt ? alt : ""); return `${img}`; }); diff --git a/package.json b/package.json index bb458a9..0921228 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-mellow", - "version": "1.3.9", + "version": "1.4.0", "description": "Material Design theme for Hexo.", "keywords": [ "hexo",