From 07ecb24ec2791186ab14266b21c7932bf0b76b90 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 26 Jul 2021 22:26:46 +0800 Subject: [PATCH] group -> tags --- layout/_partial/head.ejs | 6 +- layout/_partial/main/article/read_next.ejs | 38 +++--- layout/_partial/main/article/wiki_cover.ejs | 8 +- layout/_partial/main/navbar/breadcrumb.ejs | 34 ++--- layout/_partial/main/navbar/list_wiki.ejs | 12 +- layout/_partial/main/post_list/post_card.ejs | 2 +- layout/_partial/main/post_list/wiki_card.ejs | 7 +- .../plugins/comments/beaudar/layout.ejs | 6 +- layout/_partial/plugins/comments/layout.ejs | 6 +- .../plugins/comments/utterances/layout.ejs | 6 +- layout/_partial/sidebar/logo.ejs | 6 +- layout/_partial/sidebar/widgets/recent.ejs | 19 ++- layout/_partial/sidebar/widgets/repo_info.ejs | 6 +- layout/_partial/sidebar/widgets/toc.ejs | 8 +- layout/_partial/sidebar/widgets/wiki_more.ejs | 56 ++++---- layout/index.ejs | 24 ++-- layout/wiki.ejs | 12 +- scripts/events/lib/config.js | 6 +- scripts/events/lib/doc_tree.js | 122 ++++++++++++------ scripts/generators/wiki.js | 11 +- scripts/helpers/doc_tree.js | 5 +- scripts/tags/lib/tabs.js | 4 +- scripts/tags/note.js | 2 +- scripts/tags/timeline.js | 2 +- scripts/tags/toc.js | 2 +- source/css/_custom.styl | 9 +- source/css/_layout/md.styl | 14 +- source/css/_layout/pages/archives.styl | 14 +- source/css/_layout/sidebar/repo_info.styl | 10 +- source/css/_layout/sidebar/sidebar.styl | 7 +- source/css/_layout/sidebar/toc_blog.styl | 2 +- source/css/_layout/sidebar/toc_common.styl | 8 +- source/css/_layout/sidebar/toc_wiki.styl | 13 +- source/css/_layout/tag-plugins/about.styl | 2 +- source/css/_layout/tag-plugins/copy.styl | 7 +- source/css/_layout/tag-plugins/folding.styl | 2 +- source/css/_layout/tag-plugins/image.styl | 8 +- source/css/_layout/tag-plugins/link.styl | 2 +- source/css/_layout/tag-plugins/note.styl | 4 +- source/css/_layout/tag-plugins/tabs.styl | 1 + 40 files changed, 280 insertions(+), 233 deletions(-) diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 164bb9c..6cbe841 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -2,8 +2,8 @@ function generate_title() { if (page.layout == 'wiki' && page.wiki && (page.title || page.seo_title)) { return page.wiki + __('symbol.colon') + (page.seo_title || page.title) + ' - ' + config.title; - } else if (page.seo_title || page.title || page.wiki || page.layout) { - return (page.seo_title || page.title || page.wiki || page.layout) + ' - ' + config.title; + } else if (page.seo_title || page.title || page.wiki) { + return (page.seo_title || page.title || page.wiki) + ' - ' + config.title; } else if (page.category) { return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title; } else if (page.tag) { @@ -80,7 +80,7 @@ function og_args() { <% if (config.favicon) { %> <%- favicon_tag(config.favicon) %> <% } %> - + <% if (config.inject && config.inject.head){ %> <% (config.inject.head||[]).forEach(function(item){ %> <%- item %> diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs index 523685a..0855438 100644 --- a/layout/_partial/main/article/read_next.ejs +++ b/layout/_partial/main/article/read_next.ejs @@ -10,30 +10,22 @@ function layoutDiv() { title_prev = __('meta.newer'); title_next = __('meta.older'); } else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) { - var wikis = []; - wikis = site.pages.filter(function (p) { - if (p.layout === 'wiki' && p.wiki && p.wiki === page.wiki) { - if (p.order === undefined) { - p.order = 0; + let proj = theme.wiki.projects[page.wiki]; + if (proj) { + proj.pages.forEach((p, i) => { + if (p.order < page.order) { + if (prev == undefined || p.order > prev.order) { + prev = p; + } + } else if (p.order > page.order) { + if (next == undefined || p.order < next.order) { + next = p; + } } - return true; - } else { - return false; - } - }).sort('order'); - page.order = page.order || 0; - wikis.forEach((p, i) => { - if (p.order < page.order) { - if (prev === undefined || p.order > prev.order) { - prev = p; - } - } else if (p.order > page.order) { - if (next === undefined || p.order < next.order) { - next = p; - } - } - }); - if (next === undefined) { + }); + } + if (next == undefined) { + // 项目的最后一篇文档 return '
'; } } diff --git a/layout/_partial/main/article/wiki_cover.ejs b/layout/_partial/main/article/wiki_cover.ejs index 4b81566..a4c30bc 100644 --- a/layout/_partial/main/article/wiki_cover.ejs +++ b/layout/_partial/main/article/wiki_cover.ejs @@ -5,13 +5,13 @@ function layoutWikiCover() { return el; } let proj = theme.wiki.projects[page.wiki]; - if (proj === undefined) { + if (proj == undefined) { return el; } - if (proj.path !== page.path) { + if (proj.homepage.path !== page.path) { return; } - if (proj.cover === undefined || proj.cover === false || proj.cover === '[]') { + if (proj.cover == undefined || proj.cover === false || proj.cover === '[]') { return el; } var cover = proj.cover; @@ -42,7 +42,7 @@ function layoutWikiCover() { el += '
' + desc + '
'; } el += '
'; - el += '' + __('btn.getting_started') + ''; + el += '' + (proj.start || __('btn.getting_started')) + ''; el += '
'; el += ''; el += ''; diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs index 4daaa9f..88ca063 100644 --- a/layout/_partial/main/navbar/breadcrumb.ejs +++ b/layout/_partial/main/navbar/breadcrumb.ejs @@ -4,13 +4,13 @@ function layoutDiv() { if (page.breadcrumb === false) { return el; } - el += '
'; if (page.layout === "post") { var firstCat = ""; if (page.categories && page.categories.length > 0) { firstCat = page.categories.data[0].name; } - el += '