group -> tags
This commit is contained in:
parent
400254dcfa
commit
07ecb24ec2
|
@ -2,8 +2,8 @@
|
||||||
function generate_title() {
|
function generate_title() {
|
||||||
if (page.layout == 'wiki' && page.wiki && (page.title || page.seo_title)) {
|
if (page.layout == 'wiki' && page.wiki && (page.title || page.seo_title)) {
|
||||||
return page.wiki + __('symbol.colon') + (page.seo_title || page.title) + ' - ' + config.title;
|
return page.wiki + __('symbol.colon') + (page.seo_title || page.title) + ' - ' + config.title;
|
||||||
} else if (page.seo_title || page.title || page.wiki || page.layout) {
|
} else if (page.seo_title || page.title || page.wiki) {
|
||||||
return (page.seo_title || page.title || page.wiki || page.layout) + ' - ' + config.title;
|
return (page.seo_title || page.title || page.wiki) + ' - ' + config.title;
|
||||||
} else if (page.category) {
|
} else if (page.category) {
|
||||||
return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title;
|
return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title;
|
||||||
} else if (page.tag) {
|
} else if (page.tag) {
|
||||||
|
|
|
@ -10,30 +10,22 @@ function layoutDiv() {
|
||||||
title_prev = __('meta.newer');
|
title_prev = __('meta.newer');
|
||||||
title_next = __('meta.older');
|
title_next = __('meta.older');
|
||||||
} else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) {
|
} else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) {
|
||||||
var wikis = [];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
wikis = site.pages.filter(function (p) {
|
if (proj) {
|
||||||
if (p.layout === 'wiki' && p.wiki && p.wiki === page.wiki) {
|
proj.pages.forEach((p, i) => {
|
||||||
if (p.order === undefined) {
|
|
||||||
p.order = 0;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).sort('order');
|
|
||||||
page.order = page.order || 0;
|
|
||||||
wikis.forEach((p, i) => {
|
|
||||||
if (p.order < page.order) {
|
if (p.order < page.order) {
|
||||||
if (prev === undefined || p.order > prev.order) {
|
if (prev == undefined || p.order > prev.order) {
|
||||||
prev = p;
|
prev = p;
|
||||||
}
|
}
|
||||||
} else if (p.order > page.order) {
|
} else if (p.order > page.order) {
|
||||||
if (next === undefined || p.order < next.order) {
|
if (next == undefined || p.order < next.order) {
|
||||||
next = p;
|
next = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (next === undefined) {
|
}
|
||||||
|
if (next == undefined) {
|
||||||
|
// 项目的最后一篇文档
|
||||||
return '<br>';
|
return '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@ function layoutWikiCover() {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj === undefined) {
|
if (proj == undefined) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
if (proj.path !== page.path) {
|
if (proj.homepage.path !== page.path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (proj.cover === undefined || proj.cover === false || proj.cover === '[]') {
|
if (proj.cover == undefined || proj.cover === false || proj.cover === '[]') {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
var cover = proj.cover;
|
var cover = proj.cover;
|
||||||
|
@ -42,7 +42,7 @@ function layoutWikiCover() {
|
||||||
el += '<div class="description">' + desc + '</div>';
|
el += '<div class="description">' + desc + '</div>';
|
||||||
}
|
}
|
||||||
el += '<div class="start-wrap">';
|
el += '<div class="start-wrap">';
|
||||||
el += '<a class="button theme start" href="#start">' + __('btn.getting_started') + '</a>';
|
el += '<a class="button theme start" href="#start">' + (proj.start || __('btn.getting_started')) + '</a>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</article>';
|
el += '</article>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
|
|
@ -4,13 +4,13 @@ function layoutDiv() {
|
||||||
if (page.breadcrumb === false) {
|
if (page.breadcrumb === false) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
el += '<div class="bread-nav fs12">';
|
|
||||||
if (page.layout === "post") {
|
if (page.layout === "post") {
|
||||||
var firstCat = "";
|
var firstCat = "";
|
||||||
if (page.categories && page.categories.length > 0) {
|
if (page.categories && page.categories.length > 0) {
|
||||||
firstCat = page.categories.data[0].name;
|
firstCat = page.categories.data[0].name;
|
||||||
}
|
}
|
||||||
el += '<div id="breadcrumb"' + category_color(firstCat) + '>';
|
el += '<div class="bread-nav fs12">';
|
||||||
|
el += '<div id="breadcrumb">';
|
||||||
el += '<a class="cap breadcrumb" href="/">' + __("btn.home") + '</a>';
|
el += '<a class="cap breadcrumb" href="/">' + __("btn.home") + '</a>';
|
||||||
el += '<span class="sep"></span>';
|
el += '<span class="sep"></span>';
|
||||||
el += '<a class="cap breadcrumb" href="/">' + __("btn.blog") + '</a>';
|
el += '<a class="cap breadcrumb" href="/">' + __("btn.blog") + '</a>';
|
||||||
|
@ -28,16 +28,10 @@ function layoutDiv() {
|
||||||
el += '<div id="post-meta">';
|
el += '<div id="post-meta">';
|
||||||
el += __("meta.created") + ' <time datetime="' + date_xml(page.date) + '">' + date(page.date, config.date_format) + '</time>';
|
el += __("meta.created") + ' <time datetime="' + date_xml(page.date) + '">' + date(page.date, config.date_format) + '</time>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
el += '</div>';
|
||||||
} else if (page.layout === "wiki" && page.wiki && page.wiki.length > 0) {
|
} else if (page.layout === "wiki" && page.wiki && page.wiki.length > 0) {
|
||||||
var cat_name = '';
|
el += '<div class="bread-nav fs12">';
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
el += '<div id="breadcrumb">';
|
||||||
if (proj.group && proj.group.length > 0) {
|
|
||||||
let group = theme.wiki.groups[proj.group];
|
|
||||||
if (group) {
|
|
||||||
cat_name = group.title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
el += '<div id="breadcrumb"' + category_color(cat_name) + '>';
|
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
// home
|
// home
|
||||||
el += '<a class="cap breadcrumb" id="home" href="/">' + __("btn.home") + '</a>';
|
el += '<a class="cap breadcrumb" id="home" href="/">' + __("btn.home") + '</a>';
|
||||||
|
@ -53,17 +47,9 @@ function layoutDiv() {
|
||||||
nodes.push(url);
|
nodes.push(url);
|
||||||
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
||||||
}
|
}
|
||||||
// group
|
|
||||||
if (proj.group && proj.group.length > 0) {
|
|
||||||
let group = theme.wiki.groups[proj.group];
|
|
||||||
let url = url_for(group.path);
|
|
||||||
if (group !== undefined && nodes.includes(url) === false) {
|
|
||||||
el += '<span class="sep"></span>';
|
|
||||||
el += '<a class="cap breadcrumb" id="group" href="' + url + '">' + group.title + '</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 项目名
|
// 项目名
|
||||||
let url_proj = url_for(proj.path);
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
|
let url_proj = url_for(proj.homepage.path);
|
||||||
if (nodes.includes(url_proj) === false) {
|
if (nodes.includes(url_proj) === false) {
|
||||||
el += '<span class="sep"></span>';
|
el += '<span class="sep"></span>';
|
||||||
el += '<a class="cap breadcrumb" id="proj" href="' + url_proj + '">' + proj.title + '</a>';
|
el += '<a class="cap breadcrumb" id="proj" href="' + url_proj + '">' + proj.title + '</a>';
|
||||||
|
@ -73,14 +59,16 @@ function layoutDiv() {
|
||||||
el += '<div id="post-meta">';
|
el += '<div id="post-meta">';
|
||||||
el += __("meta.updated") + ' <time datetime="' + date_xml(page.updated) + '">' + date(page.updated, config.date_format) + '</time>';
|
el += __("meta.updated") + ' <time datetime="' + date_xml(page.updated) + '">' + date(page.updated, config.date_format) + '</time>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
} else {
|
el += '</div>';
|
||||||
|
} else if (page.title || page.seo_title) {
|
||||||
|
el += '<div class="bread-nav fs12">';
|
||||||
el += '<div id="breadcrumb">';
|
el += '<div id="breadcrumb">';
|
||||||
el += '<a class="cap breadcrumb" href="/">' + __("btn.home") + '</a>';
|
el += '<a class="cap breadcrumb" href="/">' + __("btn.home") + '</a>';
|
||||||
el += '<span class="sep"></span>';
|
el += '<span class="sep"></span>';
|
||||||
el += '<a class="cap breadcrumb" href="' + url_for(page.path) + '">' + (page.title || page.seo_title) + '</a>';
|
el += '<a class="cap breadcrumb" href="' + url_for(page.path) + '">' + (page.title || page.seo_title) + '</a>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
}
|
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
}
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
|
@ -11,17 +11,17 @@ function layoutDiv() {
|
||||||
el += ' href="' + url_for(config.wiki_dir || "/wiki/") + '">' + __("btn.all_wiki") + '</a>';
|
el += ' href="' + url_for(config.wiki_dir || "/wiki/") + '">' + __("btn.all_wiki") + '</a>';
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
// 项目分类
|
// 项目分类
|
||||||
for (let group_name of Object.keys(theme.wiki.groups)) {
|
for (let id of Object.keys(theme.wiki.all_tags)) {
|
||||||
let group = theme.wiki.groups[group_name];
|
let tag = theme.wiki.all_tags[id];
|
||||||
let projects = group.projects.filter(function(proj){
|
let projects = tag.items.filter(function(item){
|
||||||
return proj.index !== false;
|
return item.index !== false;
|
||||||
})
|
})
|
||||||
if (projects && projects.length > 0) {
|
if (projects && projects.length > 0) {
|
||||||
el += '<a';
|
el += '<a';
|
||||||
if (group.title && group.title.length > 0 && page.group === group.title) {
|
if (tag.name && tag.name.length > 0 && page.tagName === tag.name) {
|
||||||
el += ' class="active"';
|
el += ' class="active"';
|
||||||
}
|
}
|
||||||
el += ' href="' + url_for(group.path) + '">' + group.title + '</a>';
|
el += ' href="' + url_for(tag.path) + '">' + tag.name + '</a>';
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ function layoutDiv() {
|
||||||
// 封面
|
// 封面
|
||||||
if (post.cover || theme.article.auto_cover) {
|
if (post.cover || theme.article.auto_cover) {
|
||||||
var cover_url;
|
var cover_url;
|
||||||
if (post.cover !== undefined) {
|
if (post.cover != undefined) {
|
||||||
if (post.cover.includes('/')) {
|
if (post.cover.includes('/')) {
|
||||||
cover_url = post.cover;
|
cover_url = post.cover;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,9 +11,10 @@ function layoutDiv() {
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
}
|
}
|
||||||
el += '<div class="excerpt">';
|
el += '<div class="excerpt">';
|
||||||
if (proj.group) {
|
if (proj.tags && proj.tags.length > 0) {
|
||||||
el += '<div class="cap breadcrumb"' + category_color(proj.group) + '>';
|
let tag = proj.tags[0];
|
||||||
el += '<span>' + proj.group + '</span>';
|
el += '<div>';
|
||||||
|
el += '<span class="cap breadcrumb"' + category_color(tag) + '>' + tag + '</span>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
}
|
}
|
||||||
el += '<h2 class="post-title">' + (proj.wiki || proj.title || proj.seo_title) + '</h2>';
|
el += '<h2 class="post-title">' + (proj.wiki || proj.title || proj.seo_title) + '</h2>';
|
||||||
|
|
|
@ -5,7 +5,7 @@ function layoutDiv() {
|
||||||
var config = Object.assign({}, theme.comments[cmt]);
|
var config = Object.assign({}, theme.comments[cmt]);
|
||||||
if (page.layout === 'wiki' && page.wiki) {
|
if (page.layout === 'wiki' && page.wiki) {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj[cmt] !== undefined) {
|
if (proj[cmt] != undefined) {
|
||||||
Object.assign(config, proj[cmt]);
|
Object.assign(config, proj[cmt]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ function layoutDiv() {
|
||||||
if (config['issue-number'] !== null) {
|
if (config['issue-number'] !== null) {
|
||||||
config['issue-term'] = null;
|
config['issue-term'] = null;
|
||||||
} else {
|
} else {
|
||||||
if (page.comment_id !== undefined) {
|
if (page.comment_id != undefined) {
|
||||||
config['issue-term'] = page.comment_id;
|
config['issue-term'] = page.comment_id;
|
||||||
} else if (page.layout === 'wiki' && page.wiki) {
|
} else if (page.layout === 'wiki' && page.wiki) {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj.comment_id !== undefined) {
|
if (proj.comment_id != undefined) {
|
||||||
config['issue-term'] = proj.comment_id;
|
config['issue-term'] = proj.comment_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ if (theme.comments.service && theme.comments.service.length > 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 合并项目评论
|
// 合并项目评论
|
||||||
if (loadComment && page.layout === 'wiki' && page.wiki) {
|
if (loadComment && page.layout == 'wiki' && page.wiki) {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj.comment_title !== undefined && page.comment_title === undefined) {
|
if (proj.comment_title != undefined && page.comment_title == undefined) {
|
||||||
if (['utterances', 'beaudar'].includes(theme.comments.service)) {
|
if (['utterances', 'beaudar'].includes(theme.comments.service)) {
|
||||||
page.comment_title = proj.comment_title;
|
page.comment_title = proj.comment_title;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ if (loadComment && page.layout === 'wiki' && page.wiki) {
|
||||||
<% if (loadComment) { %>
|
<% if (loadComment) { %>
|
||||||
<div class='related-wrap md reveal' id="comments">
|
<div class='related-wrap md reveal' id="comments">
|
||||||
<div class='cmt-title cap theme'>
|
<div class='cmt-title cap theme'>
|
||||||
<%- page.comment_title !== undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
|
<%- page.comment_title != undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
|
||||||
</div>
|
</div>
|
||||||
<div class='cmt-body <%- theme.comments.service %>'>
|
<div class='cmt-body <%- theme.comments.service %>'>
|
||||||
<%- partial(theme.comments.service + '/layout') %>
|
<%- partial(theme.comments.service + '/layout') %>
|
||||||
|
|
|
@ -5,7 +5,7 @@ function layoutDiv() {
|
||||||
var config = Object.assign({}, theme.comments[cmt]);
|
var config = Object.assign({}, theme.comments[cmt]);
|
||||||
if (page.layout === 'wiki' && page.wiki) {
|
if (page.layout === 'wiki' && page.wiki) {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj[cmt] !== undefined) {
|
if (proj[cmt] != undefined) {
|
||||||
Object.assign(config, proj[cmt]);
|
Object.assign(config, proj[cmt]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ function layoutDiv() {
|
||||||
if (config['issue-number'] !== null) {
|
if (config['issue-number'] !== null) {
|
||||||
config['issue-term'] = null;
|
config['issue-term'] = null;
|
||||||
} else {
|
} else {
|
||||||
if (page.comment_id !== undefined) {
|
if (page.comment_id != undefined) {
|
||||||
config['issue-term'] = page.comment_id;
|
config['issue-term'] = page.comment_id;
|
||||||
} else if (page.layout === 'wiki' && page.wiki) {
|
} else if (page.layout === 'wiki' && page.wiki) {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj.comment_id !== undefined) {
|
if (proj.comment_id != undefined) {
|
||||||
config['issue-term'] = proj.comment_id;
|
config['issue-term'] = proj.comment_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function layoutDiv() {
|
||||||
el += __('btn.all_wiki');
|
el += __('btn.all_wiki');
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
// this product
|
// this product
|
||||||
if (proj === undefined) {
|
if (proj == undefined) {
|
||||||
// 如果没有项目名,则使用menu中显示的名字
|
// 如果没有项目名,则使用menu中显示的名字
|
||||||
if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) {
|
if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) {
|
||||||
proj = {
|
proj = {
|
||||||
|
@ -38,9 +38,9 @@ function layoutDiv() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (proj !== undefined) {
|
if (proj != undefined) {
|
||||||
let main = proj.title || proj.wiki || page.wiki || page.title;
|
let main = proj.title || proj.wiki || page.wiki || page.title;
|
||||||
let url = proj.path;
|
let url = proj.homepage.path;
|
||||||
let sub = proj.subtitle;
|
let sub = proj.subtitle;
|
||||||
el += layoutTitle(main, url, sub);
|
el += layoutTitle(main, url, sub);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,20 @@ function layoutDiv() {
|
||||||
}
|
}
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
// body
|
// body
|
||||||
var arr = page.menu_id == "wiki" ? site.pages.filter(function(p){
|
var arr = [];
|
||||||
return p.layout == "wiki" && p.title && p.title.length > 0;
|
if (page.menu_id == 'wiki') {
|
||||||
}) : site.posts.filter(function(p){
|
arr = theme.wiki.all_pages.filter(function(p){
|
||||||
|
if (p.wiki) {
|
||||||
|
let proj = theme.wiki.projects[p.wiki];
|
||||||
|
return proj.index != false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
arr = site.posts.filter(function(p){
|
||||||
return p.title && p.title.length > 0;
|
return p.title && p.title.length > 0;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
el += '<div class="widget-body fs14">';
|
el += '<div class="widget-body fs14">';
|
||||||
arr.sort("updated", -1).limit(item.limit).each(function(post) {
|
arr.sort("updated", -1).limit(item.limit).each(function(post) {
|
||||||
el += '<div class="line"></div>'
|
el += '<div class="line"></div>'
|
||||||
|
|
|
@ -7,7 +7,7 @@ function layoutDiv() {
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj && proj.repo) {
|
if (proj && proj.repo) {
|
||||||
repo = proj.repo;
|
repo = proj.repo;
|
||||||
if (proj.branch !== undefined) {
|
if (proj.branch != undefined) {
|
||||||
branch = proj.branch;
|
branch = proj.branch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ function layoutDiv() {
|
||||||
// 其它的如果有设置 repo 也可以
|
// 其它的如果有设置 repo 也可以
|
||||||
repo = page.repo;
|
repo = page.repo;
|
||||||
}
|
}
|
||||||
if (repo === undefined) {
|
if (repo == undefined) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
// 布局
|
// 布局
|
||||||
|
@ -26,6 +26,7 @@ function layoutDiv() {
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
// body
|
// body
|
||||||
el += '<div class="widget-body fs14">';
|
el += '<div class="widget-body fs14">';
|
||||||
|
el += '<div class="items">';
|
||||||
var items = [];
|
var items = [];
|
||||||
// GitHub
|
// GitHub
|
||||||
items.push({
|
items.push({
|
||||||
|
@ -64,6 +65,7 @@ function layoutDiv() {
|
||||||
});
|
});
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
el += '</div>';
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
|
@ -63,11 +63,11 @@ function layoutDiv(fallback) {
|
||||||
|
|
||||||
var el = '';
|
var el = '';
|
||||||
if (type.length > 0) {
|
if (type.length > 0) {
|
||||||
el += '<div class="widget-wrap" id="toc">';
|
el += '<div class="widget-wrap ' + type + '" id="toc">';
|
||||||
if (page.layout !== 'wiki') {
|
if (page.layout !== 'wiki') {
|
||||||
// post 布局
|
// post 布局
|
||||||
el += layoutTocHeader(page.toc_title || __("meta.toc"));
|
el += layoutTocHeader(page.toc_title || __("meta.toc"));
|
||||||
el += '<div class="widget-body fs14 ' + type + '">';
|
el += '<div class="widget-body fs14">';
|
||||||
el += '<div class="doc-tree active">';
|
el += '<div class="doc-tree active">';
|
||||||
el += layoutToc();
|
el += layoutToc();
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
@ -78,13 +78,13 @@ function layoutDiv(fallback) {
|
||||||
proj.sections.forEach((sec, i) => {
|
proj.sections.forEach((sec, i) => {
|
||||||
// 多 section
|
// 多 section
|
||||||
el += layoutTocHeader(sec.title);
|
el += layoutTocHeader(sec.title);
|
||||||
el += '<div class="widget-body fs14 ' + type + '">';
|
el += '<div class="widget-body fs14">';
|
||||||
el += layoutDocTree(sec.pages);
|
el += layoutDocTree(sec.pages);
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 单 section
|
// 单 section
|
||||||
el += '<div class="widget-body fs14 ' + type + '">';
|
el += '<div class="widget-body fs14">';
|
||||||
el += layoutDocTree(proj.pages);
|
el += layoutDocTree(proj.pages);
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,35 +3,39 @@ function layoutDiv() {
|
||||||
if (page.layout !== "wiki") {
|
if (page.layout !== "wiki") {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
var el = '';
|
var related = [];
|
||||||
let proj = theme.wiki.projects[page.wiki];
|
let proj = theme.wiki.projects[page.wiki];
|
||||||
if (proj.group && proj.group.length > 0) {
|
if (proj.related && proj.related.length > 0) {
|
||||||
let group = theme.wiki.groups[proj.group];
|
proj.related.forEach((pid, i) => {
|
||||||
let projects = group.projects.filter(function(proj){
|
let p = theme.wiki.projects[pid];
|
||||||
return proj.index !== false;
|
if (p && p.title !== proj.title && p.index !== false) {
|
||||||
})
|
related.push(p);
|
||||||
if (projects && projects.length > 1) {
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
var el = '';
|
var el = '';
|
||||||
|
if (related.length > 0) {
|
||||||
el += '<div class="widget-wrap" id="related">';
|
el += '<div class="widget-wrap" id="related">';
|
||||||
el += '<div class="widget-header cap dis-select">';
|
el += '<div class="widget-header cap dis-select">';
|
||||||
el += '<span class="name">更多' + group.title + '</span>';
|
var title = __('btn.wiki');
|
||||||
|
if (proj.tags && proj.tags[0]) {
|
||||||
|
title = proj.tags[0];
|
||||||
|
}
|
||||||
|
el += '<span class="name">' + __('meta.more', title) + '</span>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '<div class="widget-body fs14">';
|
el += '<div class="widget-body fs14">';
|
||||||
projects.forEach((p, i) => {
|
related.forEach((p, i) => {
|
||||||
if (p.title !== proj.title) {
|
|
||||||
// 同一个分组中的其它项目
|
// 同一个分组中的其它项目
|
||||||
el += '<a class="more-item wiki" href="' + url_for(p.path) + '">';
|
el += '<a class="more-item wiki" href="' + url_for(p.homepage.path) + '">';
|
||||||
el += p.title;
|
el += p.title;
|
||||||
el += '<div class="excerpt">';
|
el += '<div class="excerpt">';
|
||||||
el += p.description;
|
el += p.description;
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
}
|
|
||||||
});
|
});
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%
|
<%
|
||||||
if (page.menu_id === undefined) {
|
if (page.menu_id == undefined) {
|
||||||
if (page.layout === 'index' && page.wiki) {
|
if (page.layout === 'index' && page.wiki) {
|
||||||
page.menu_id = 'wiki';
|
page.menu_id = 'wiki';
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +34,7 @@ function layout_posts(partial) {
|
||||||
}
|
}
|
||||||
// unpinned posts
|
// unpinned posts
|
||||||
page.posts.each(function(post){
|
page.posts.each(function(post){
|
||||||
if (post.pin === undefined) {
|
if (post.pin == undefined) {
|
||||||
el += layout_post_card('post', post, partial(post));
|
el += layout_post_card('post', post, partial(post));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -53,23 +53,19 @@ function layout_wikis(partial) {
|
||||||
const projects = theme.wiki.projects;
|
const projects = theme.wiki.projects;
|
||||||
for (let proj_name of Object.keys(projects)) {
|
for (let proj_name of Object.keys(projects)) {
|
||||||
let proj = projects[proj_name];
|
let proj = projects[proj_name];
|
||||||
if (proj.index === false || proj.pages === undefined || proj.pages.length === 0) {
|
if (proj.index === false || proj.pages == undefined || proj.pages.length === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (page.filter === false) {
|
if (page.filter === false) {
|
||||||
// all wikis
|
// all wikis
|
||||||
proj.pages.sort('order').limit(1).forEach((p0, i) => {
|
|
||||||
el += '<div class="post-list wiki">';
|
el += '<div class="post-list wiki">';
|
||||||
el += layout_post_card('wiki', p0, partial(proj));
|
el += layout_post_card('wiki', proj.homepage, partial(proj));
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
});
|
} else if (proj.tags && proj.tags.includes(page.tagName) === true) {
|
||||||
} else if (page.group === proj.group) {
|
|
||||||
// filtered wikis
|
// filtered wikis
|
||||||
proj.pages.sort('order').limit(1).forEach((p0, i) => {
|
|
||||||
el += '<div class="post-list wiki filter">';
|
el += '<div class="post-list wiki filter">';
|
||||||
el += layout_post_card('wiki', p0, partial(proj));
|
el += layout_post_card('wiki', proj.homepage, partial(proj));
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return el;
|
return el;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<%
|
<%
|
||||||
if (page.menu_id === undefined) {
|
if (page.menu_id == undefined) {
|
||||||
page.menu_id = 'wiki';
|
page.menu_id = 'wiki';
|
||||||
}
|
}
|
||||||
if (page.layout === undefined) {
|
if (page.layout == undefined) {
|
||||||
page.layout = 'index';
|
page.layout = 'index';
|
||||||
}
|
}
|
||||||
if (page.title === undefined) {
|
if (page.title == undefined) {
|
||||||
if (page.group) {
|
if (page.tagName) {
|
||||||
page.title = page.group;
|
page.title = page.tagName;
|
||||||
} else {
|
} else {
|
||||||
page.title = __('btn.wiki');
|
page.title = __('btn.wiki');
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ function layoutTitle() {
|
||||||
<%- partial('index') %>
|
<%- partial('index') %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%
|
<%
|
||||||
if (page.header === undefined) {
|
if (page.header == undefined) {
|
||||||
page.header = false;
|
page.header = false;
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
|
@ -32,14 +32,14 @@ module.exports = hexo => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// default menu
|
// default menu
|
||||||
if (hexo.theme.config.sidebar.menu === undefined) {
|
if (hexo.theme.config.sidebar.menu == undefined) {
|
||||||
hexo.theme.config.sidebar.menu = [];
|
hexo.theme.config.sidebar.menu = [];
|
||||||
}
|
}
|
||||||
// default widgets
|
// default widgets
|
||||||
if (hexo.theme.config.sidebar.widgets.repo_info === undefined) {
|
if (hexo.theme.config.sidebar.widgets.repo_info == undefined) {
|
||||||
hexo.theme.config.sidebar.widgets.repo_info = {layout: 'repo_info'};
|
hexo.theme.config.sidebar.widgets.repo_info = {layout: 'repo_info'};
|
||||||
}
|
}
|
||||||
if (hexo.theme.config.sidebar.widgets.wiki_more === undefined) {
|
if (hexo.theme.config.sidebar.widgets.wiki_more == undefined) {
|
||||||
hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'};
|
hexo.theme.config.sidebar.widgets.wiki_more = {layout: 'wiki_more'};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,20 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
function page(page) {
|
||||||
|
return {
|
||||||
|
title: page.title,
|
||||||
|
path: page.path,
|
||||||
|
wiki: page.wiki
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = hexo => {
|
module.exports = hexo => {
|
||||||
const data = hexo.locals.get('data');
|
const data = hexo.locals.get('data');
|
||||||
if (hexo.theme.config.wiki === undefined) {
|
if (hexo.theme.config.wiki == undefined) {
|
||||||
hexo.theme.config.wiki = {};
|
hexo.theme.config.wiki = {};
|
||||||
}
|
}
|
||||||
if (hexo.theme.config.wiki.projects === undefined) {
|
if (hexo.theme.config.wiki.projects == undefined) {
|
||||||
hexo.theme.config.wiki.projects = {};
|
hexo.theme.config.wiki.projects = {};
|
||||||
}
|
}
|
||||||
if (data.projects) {
|
if (data.projects) {
|
||||||
|
@ -22,58 +30,77 @@ module.exports = hexo => {
|
||||||
var wiki = hexo.theme.config.wiki;
|
var wiki = hexo.theme.config.wiki;
|
||||||
// wiki 所有页面
|
// wiki 所有页面
|
||||||
const wiki_pages = hexo.locals.get('pages').filter(function (p) {
|
const wiki_pages = hexo.locals.get('pages').filter(function (p) {
|
||||||
return (p.layout === 'wiki') && (p.wiki !== undefined) && (p.wiki.length > 0);
|
return (p.layout === 'wiki') && (p.wiki != undefined) && (p.wiki.length > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 数据整合:项目组
|
// 数据整合:项目标签
|
||||||
var cats = [];
|
var tagNames = [];
|
||||||
for (let proj_name of Object.keys(wiki.projects)) {
|
for (let id of Object.keys(wiki.projects)) {
|
||||||
let proj = wiki.projects[proj_name];
|
let proj = wiki.projects[id];
|
||||||
if (proj.group !== undefined) {
|
let tags = proj.tags;
|
||||||
if (cats.includes(proj.group) === false) {
|
if (tags) {
|
||||||
cats.push(proj.group);
|
if ((typeof tags == 'string') && tags.constructor == String) {
|
||||||
|
if (tagNames.includes(tags) === false) {
|
||||||
|
tagNames.push(tags);
|
||||||
}
|
}
|
||||||
|
// 类型转换
|
||||||
|
tags = [tags];
|
||||||
|
} else if ((typeof tags == 'object') && tags.constructor == Array) {
|
||||||
|
tags.forEach((tag, i) => {
|
||||||
|
if (tagNames.includes(tag) === false) {
|
||||||
|
tagNames.push(tag);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
wiki.projects[id].tags = tags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 补充未分组的项目
|
// 补充未分组的项目
|
||||||
const projs = Object.keys(wiki.projects);
|
const projs = Object.keys(wiki.projects);
|
||||||
wiki_pages.forEach((p, i) => {
|
wiki_pages.forEach((p, i) => {
|
||||||
if (projs.includes(p.wiki) === false) {
|
if (projs.includes(p.wiki) == false) {
|
||||||
if (wiki.projects[p.wiki] === undefined) {
|
if (wiki.projects[p.wiki] == undefined) {
|
||||||
wiki.projects[p.wiki] = {};
|
wiki.projects[p.wiki] = {};
|
||||||
wiki.projects[p.wiki].pages = [];
|
wiki.projects[p.wiki].pages = [];
|
||||||
}
|
}
|
||||||
var proj = wiki.projects[p.wiki];
|
var proj = wiki.projects[p.wiki];
|
||||||
if (proj.description === undefined) {
|
if (proj.description == undefined) {
|
||||||
proj.description = p.description;
|
proj.description = p.description;
|
||||||
}
|
}
|
||||||
wiki.projects[p.wiki].pages.push(p);
|
wiki.projects[p.wiki].pages.push(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 补充项目名称
|
// 补充项目名称和首页
|
||||||
for (let proj_name of Object.keys(wiki.projects)) {
|
for (let id of Object.keys(wiki.projects)) {
|
||||||
let proj = wiki.projects[proj_name];
|
let proj = wiki.projects[id];
|
||||||
if (proj.title === undefined || proj.title.length === 0) {
|
proj.id = id;
|
||||||
proj.title = proj_name;
|
if (proj.title == undefined || proj.title.length === 0) {
|
||||||
|
proj.title = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 补充 order
|
||||||
|
wiki_pages.forEach((p, i) => {
|
||||||
|
if (p.order == undefined) {
|
||||||
|
p.order = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 数据整合:每个项目的子页面
|
// 数据整合:每个项目的子页面
|
||||||
for (let proj_name of Object.keys(wiki.projects)) {
|
for (let id of Object.keys(wiki.projects)) {
|
||||||
let proj = wiki.projects[proj_name];
|
let proj = wiki.projects[id];
|
||||||
proj.pages = wiki_pages.filter(function (p) {
|
proj.pages = wiki_pages.filter(function (p) {
|
||||||
return p.wiki === proj_name;
|
return p.wiki === id;
|
||||||
}).sort('order');
|
}).sort('order');
|
||||||
proj.pages.limit(1).forEach((p, i) => {
|
proj.pages.limit(1).forEach((p, i) => {
|
||||||
proj.path = p.path;
|
proj.homepage = p;
|
||||||
});
|
});
|
||||||
// 内页按 section 分组
|
// 内页按 section 分组
|
||||||
var secs = [];
|
var sectionConfigs = [];
|
||||||
if (proj.sections) {
|
if (proj.sections) {
|
||||||
for (let t of Object.keys(proj.sections)) {
|
for (let t of Object.keys(proj.sections)) {
|
||||||
let range = proj.sections[t];
|
let range = proj.sections[t];
|
||||||
if (range.length > 1) {
|
if (range.length > 1) {
|
||||||
secs.push({
|
sectionConfigs.push({
|
||||||
title: t,
|
title: t,
|
||||||
from: range[0],
|
from: range[0],
|
||||||
to: range[1]
|
to: range[1]
|
||||||
|
@ -81,37 +108,52 @@ module.exports = hexo => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var newSections = [];
|
var sections = [];
|
||||||
secs.forEach((sec, i) => {
|
sectionConfigs.forEach((sec, i) => {
|
||||||
const pages = proj.pages.filter(function (p) {
|
const pages = proj.pages.filter(function (p) {
|
||||||
return p.order >= sec.from && p.order <= sec.to;
|
return p.order >= sec.from && p.order <= sec.to;
|
||||||
});
|
});
|
||||||
if (pages && pages.length > 0) {
|
if (pages && pages.length > 0) {
|
||||||
newSections.push({
|
sections.push({
|
||||||
title: sec.title,
|
title: sec.title,
|
||||||
pages: pages
|
pages: pages
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
proj.sections = newSections;
|
proj.sections = sections;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var groups = {};
|
// 全站所有的项目标签
|
||||||
cats.forEach((group_name, i) => {
|
var all_tags = {};
|
||||||
|
tagNames.forEach((tagName, i) => {
|
||||||
var projs = [];
|
var projs = [];
|
||||||
for (let proj_name of Object.keys(wiki.projects)) {
|
for (let id of Object.keys(wiki.projects)) {
|
||||||
let proj = wiki.projects[proj_name];
|
let proj = wiki.projects[id];
|
||||||
if (proj.group === group_name && projs.includes(group_name) === false) {
|
if (proj.tags && proj.tags.includes(tagName) === true && projs.includes(tagName) === false) {
|
||||||
projs.push(proj);
|
projs.push(proj.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
groups[group_name] = {
|
all_tags[tagName] = {
|
||||||
title: group_name,
|
name: tagName,
|
||||||
path: (hexo.config.wiki_dir || 'wiki') + '/categories/' + group_name + '/index.html',
|
path: (hexo.config.wiki_dir || 'wiki') + '/tags/' + tagName + '/index.html',
|
||||||
projects: projs
|
items: projs
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
wiki.groups = groups;
|
|
||||||
|
// 整合相似项目
|
||||||
|
for (let id of Object.keys(wiki.projects)) {
|
||||||
|
let proj = wiki.projects[id];
|
||||||
|
if (proj.tags) {
|
||||||
|
var related = [];
|
||||||
|
proj.tags.forEach((tagName, i) => {
|
||||||
|
let tagObj = all_tags[tagName];
|
||||||
|
related = related.concat(tagObj.items);
|
||||||
|
related = [...new Set(related)];
|
||||||
|
});
|
||||||
|
proj.related = related;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wiki.all_tags = all_tags;
|
||||||
wiki.all_pages = wiki_pages;
|
wiki.all_pages = wiki_pages;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,15 +16,14 @@ hexo.extend.generator.register('wiki', function (locals) {
|
||||||
data: {'filter': false},
|
data: {'filter': false},
|
||||||
layout: ['wiki']
|
layout: ['wiki']
|
||||||
});
|
});
|
||||||
if (hexo.theme.config.wiki && hexo.theme.config.wiki.groups) {
|
if (hexo.theme.config.wiki && hexo.theme.config.wiki.all_tags) {
|
||||||
for (let group_name of Object.keys(hexo.theme.config.wiki.groups)) {
|
for (let id of Object.keys(hexo.theme.config.wiki.all_tags)) {
|
||||||
let group = hexo.theme.config.wiki.groups[group_name];
|
let tag = hexo.theme.config.wiki.all_tags[id];
|
||||||
ret.push({
|
ret.push({
|
||||||
path: group.path,
|
path: tag.path,
|
||||||
data: {
|
data: {
|
||||||
'filter': true,
|
'filter': true,
|
||||||
'title': group.title,
|
'tagName': tag.name
|
||||||
'group': group.title
|
|
||||||
},
|
},
|
||||||
layout: ['wiki']
|
layout: ['wiki']
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,10 +11,7 @@ hexo.extend.helper.register('doc_tree', function(page, args){
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const pages = hexo.locals.get('pages').filter(function (p) {
|
const pages = hexo.locals.get('pages').filter(function (p) {
|
||||||
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki && (p.title || p.seo_title)) {
|
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki) {
|
||||||
if (p.order == undefined) {
|
|
||||||
p.order = 0;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = ctx => function(args, content) {
|
||||||
});
|
});
|
||||||
} else if (tabs.length > 0) {
|
} else if (tabs.length > 0) {
|
||||||
var tab = tabs[tabs.length-1];
|
var tab = tabs[tabs.length-1];
|
||||||
if (tab.body === undefined) {
|
if (tab.body == undefined) {
|
||||||
tab.body = item;
|
tab.body = item;
|
||||||
} else {
|
} else {
|
||||||
tab.body += '\n' + item;
|
tab.body += '\n' + item;
|
||||||
|
@ -52,7 +52,7 @@ module.exports = ctx => function(args, content) {
|
||||||
tabContent = `<div class="tab-content">${tabContent}</div>`;
|
tabContent = `<div class="tab-content">${tabContent}</div>`;
|
||||||
|
|
||||||
el += '<div class="tag-plugin tabs"';
|
el += '<div class="tag-plugin tabs"';
|
||||||
if (args.align !== undefined) {
|
if (args.align != undefined) {
|
||||||
el += ' align="' + args.align + '"';
|
el += ' align="' + args.align + '"';
|
||||||
}
|
}
|
||||||
el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"';
|
el += 'id="' + tabName.toLowerCase().split(' ').join('-') + '"';
|
||||||
|
|
|
@ -39,7 +39,7 @@ function outputNoteBlock(args, content) {
|
||||||
|
|
||||||
hexo.extend.tag.register('note', function(args) {
|
hexo.extend.tag.register('note', function(args) {
|
||||||
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
||||||
if (args.content === undefined || args.content.length <= 0) {
|
if (args.content == undefined || args.content.length <= 0) {
|
||||||
args.content = args.title;
|
args.content = args.title;
|
||||||
args.title = '';
|
args.title = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ function postTimeline(args, content) {
|
||||||
});
|
});
|
||||||
} else if (nodes.length > 0) {
|
} else if (nodes.length > 0) {
|
||||||
var node = nodes[nodes.length-1];
|
var node = nodes[nodes.length-1];
|
||||||
if (node.body === undefined) {
|
if (node.body == undefined) {
|
||||||
node.body = item;
|
node.body = item;
|
||||||
} else {
|
} else {
|
||||||
node.body += '\n' + item;
|
node.body += '\n' + item;
|
||||||
|
|
|
@ -43,7 +43,7 @@ hexo.extend.tag.register('toc', function(args) {
|
||||||
|
|
||||||
if (args.wiki) {
|
if (args.wiki) {
|
||||||
const proj = hexo.theme.config.wiki.projects[args.wiki];
|
const proj = hexo.theme.config.wiki.projects[args.wiki];
|
||||||
if (proj === undefined) {
|
if (proj == undefined) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (proj.sections && proj.sections.length > 1) {
|
if (proj.sections && proj.sections.length > 1) {
|
||||||
|
|
|
@ -58,7 +58,8 @@ $fs-code = $fs-13
|
||||||
|
|
||||||
$border-card = 12px
|
$border-card = 12px
|
||||||
$border-widget = 4px
|
$border-widget = 4px
|
||||||
$border-block = 4px
|
$border-block = 6px
|
||||||
|
$border-image = 6px
|
||||||
|
|
||||||
// 可以动态变化的属性
|
// 可以动态变化的属性
|
||||||
:root
|
:root
|
||||||
|
@ -66,11 +67,9 @@ $border-block = 4px
|
||||||
--width-main: 680px
|
--width-main: 680px
|
||||||
--gap-l: 16px
|
--gap-l: 16px
|
||||||
--gap-p: 1.25rem // gap for paragraph
|
--gap-p: 1.25rem // gap for paragraph
|
||||||
// desktop or larger
|
|
||||||
@media screen and (min-width: $device-desktop)
|
|
||||||
--gap-l: 32px
|
|
||||||
// desktop 2k or larger
|
// desktop 2k or larger
|
||||||
@media screen and (min-width: $device-2k)
|
@media screen and (min-width: $device-2k)
|
||||||
|
--gap-l: 32px
|
||||||
--width-left: 320px
|
--width-left: 320px
|
||||||
--width-main: 740px
|
--width-main: 740px
|
||||||
// desktop 4k or larger
|
// desktop 4k or larger
|
||||||
|
|
|
@ -29,15 +29,23 @@ article.md.content
|
||||||
&:hover
|
&:hover
|
||||||
a.headerlink:before
|
a.headerlink:before
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
||||||
|
.md
|
||||||
|
ul,ol
|
||||||
|
padding-bottom: .5rem
|
||||||
|
margin: 0
|
||||||
blockquote,ul,ol
|
blockquote,ul,ol
|
||||||
p,ul,ol
|
p,ul,ol
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
line-height: 1.5
|
line-height: 1.5
|
||||||
p,blockquote,.tag-plugin,ul,ol,.highlight,table
|
p,blockquote,.tag-plugin,ul,ol,.highlight,table
|
||||||
margin-top: var(--gap-p)
|
|
||||||
margin-bottom: var(--gap-p)
|
|
||||||
*
|
*
|
||||||
--gap-p: .5rem
|
--gap-p: .5rem
|
||||||
|
p,.tag-plugin
|
||||||
|
margin-top: var(--gap-p)
|
||||||
|
margin-bottom: var(--gap-p)
|
||||||
|
.highlight,table
|
||||||
|
--gap-p: 1rem
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
article.md.content
|
article.md.content
|
||||||
|
@ -105,7 +113,7 @@ article.md blockquote
|
||||||
margin-right: 0
|
margin-right: 0
|
||||||
padding: 1rem
|
padding: 1rem
|
||||||
background: var(--card)
|
background: var(--card)
|
||||||
border-left: 4px solid $color-theme
|
border-left: 6px solid $color-theme
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
box-shadow: $boxshadow-card
|
box-shadow: $boxshadow-card
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
align-items: center
|
align-items: center
|
||||||
justify-content: space-between
|
justify-content: space-between
|
||||||
border: 1px solid transparent
|
|
||||||
.badge
|
.badge
|
||||||
color: $color-theme
|
color: $color-theme
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
|
@ -42,7 +41,6 @@
|
||||||
&:hover
|
&:hover
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
color: var(--text-p0)
|
color: var(--text-p0)
|
||||||
border-color: var(--block-border)
|
|
||||||
.badge
|
.badge
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
||||||
|
@ -54,20 +52,18 @@
|
||||||
align-items: center
|
align-items: center
|
||||||
position: relative
|
position: relative
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
padding: 8px
|
margin: 4px 8px
|
||||||
border-radius: $border-block
|
padding: 4px 8px
|
||||||
border: 1px solid transparent
|
border-radius: 64px
|
||||||
span
|
|
||||||
margin: 0 0.25rem
|
|
||||||
.badge
|
.badge
|
||||||
color: $color-theme
|
color: $color-theme
|
||||||
|
margin-left: 4px
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
font-family: $ff-code
|
font-family: $ff-code
|
||||||
opacity: .5
|
opacity: .75
|
||||||
align-self: flex-start
|
align-self: flex-start
|
||||||
&:hover
|
&:hover
|
||||||
color: var(--text-p0)
|
color: var(--text-p0)
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
border-color: var(--block-border)
|
|
||||||
.badge
|
.badge
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
.widget-wrap#repo-info
|
.widget-wrap#repo-info
|
||||||
.widget-body
|
.widget-body
|
||||||
|
>.items
|
||||||
|
margin: 4px 0
|
||||||
border: 1px solid var(--block-border)
|
border: 1px solid var(--block-border)
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
|
|
|
@ -158,8 +158,9 @@ nav.menu
|
||||||
position: -webkit-sticky
|
position: -webkit-sticky
|
||||||
top: -2px
|
top: -2px
|
||||||
background: var(--site-bg)
|
background: var(--site-bg)
|
||||||
padding: 2px 0
|
padding-top: 2px
|
||||||
z-index 1
|
z-index 1
|
||||||
|
line-height: 2.4
|
||||||
&:empty
|
&:empty
|
||||||
display: none
|
display: none
|
||||||
.cap-action
|
.cap-action
|
||||||
|
@ -182,6 +183,8 @@ nav.menu
|
||||||
margin-bottom: 0.5em
|
margin-bottom: 0.5em
|
||||||
>a:hover
|
>a:hover
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
|
.widget-header+.widget-body
|
||||||
|
margin-top: 0
|
||||||
.widget-wrap#recent .widget-body, .widget-wrap#related .widget-body
|
.widget-wrap#recent .widget-body, .widget-wrap#related .widget-body
|
||||||
>a
|
>a
|
||||||
padding 0.5rem
|
padding 0.5rem
|
||||||
|
@ -210,4 +213,4 @@ nav.menu
|
||||||
display: -webkit-box
|
display: -webkit-box
|
||||||
-webkit-box-orient: vertical
|
-webkit-box-orient: vertical
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
-webkit-line-clamp: 3
|
-webkit-line-clamp: 5
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
.widget-wrap#toc .doc-tree:only-child
|
.widget-wrap.single#toc .doc-tree
|
||||||
&.active>.toc
|
&.active>.toc
|
||||||
border-left: 2px solid var(--block-hover)
|
border-left: 2px solid var(--block-hover)
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
// toc padding
|
.widget-wrap#toc .widget-header
|
||||||
|
line-height: 2.4
|
||||||
|
|
||||||
#toc .widget-body
|
#toc .widget-body
|
||||||
line-height: 1.2
|
line-height: 1.2
|
||||||
|
margin-top: 0
|
||||||
ul ul, ul ol
|
ul ul, ul ol
|
||||||
padding-left: 0
|
padding-left: 0
|
||||||
ol ul, ol ol
|
ol ul, ol ol
|
||||||
padding-left: 0
|
padding-left: 0
|
||||||
|
|
||||||
|
.doc-tree
|
||||||
|
margin: 4px 0
|
||||||
.toc
|
.toc
|
||||||
padding: 0
|
padding: 0
|
||||||
margin: 0
|
margin: 0
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
.widget-body+.widget-header
|
.widget-body+.widget-header
|
||||||
margin-top: 1rem
|
margin-top: 1rem
|
||||||
|
|
||||||
|
.widget-wrap.multi#toc .widget-header
|
||||||
|
color: var(--text-p1)
|
||||||
|
font-size: $fs-14
|
||||||
|
|
||||||
|
|
||||||
// 其它分页链接
|
// 其它分页链接
|
||||||
.widget-wrap#toc .multi .doc-tree
|
.widget-wrap.multi#toc .doc-tree
|
||||||
border-radius: 4px
|
border-radius: $border-block
|
||||||
margin: 4px 0
|
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
border: 1px solid var(--block-border)
|
border: 1px solid var(--block-border)
|
||||||
&:first-child
|
|
||||||
margin-top: 0
|
|
||||||
a.doc-tree-link
|
a.doc-tree-link
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
padding: 0.5rem
|
padding: 0.5rem
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
|
|
||||||
|
|
||||||
// 当前分页链接
|
// 当前分页链接
|
||||||
.widget-wrap#toc .multi .doc-tree.active
|
.widget-wrap.multi#toc .doc-tree.active
|
||||||
a.doc-tree-link
|
a.doc-tree-link
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.tag-plugin.about
|
.tag-plugin.about
|
||||||
background: var(--block)
|
background: var(--block)
|
||||||
border-radius: 6px
|
border-radius: $border-block
|
||||||
padding: 2rem
|
padding: 2rem
|
||||||
.about-header
|
.about-header
|
||||||
display flex
|
display flex
|
||||||
|
|
|
@ -15,17 +15,20 @@
|
||||||
|
|
||||||
input.copy-area
|
input.copy-area
|
||||||
display: inline-block
|
display: inline-block
|
||||||
padding: 1em
|
padding: 0
|
||||||
width: 100%
|
width: 100%
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
|
line-height: 3
|
||||||
|
text-indent: 1rem
|
||||||
button.copy-btn
|
button.copy-btn
|
||||||
margin: 0
|
margin: 0
|
||||||
|
line-height: 3
|
||||||
border-left: 1px solid var(--block-border)
|
border-left: 1px solid var(--block-border)
|
||||||
display: inline-block
|
display: inline-block
|
||||||
background: var(--block-hover)
|
background: var(--block-hover)
|
||||||
line-height: 0
|
line-height: 0
|
||||||
font-size: 1rem
|
font-size: 1rem
|
||||||
padding: 0.5rem 1rem
|
padding: 0 .75rem
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
&:hover
|
&:hover
|
||||||
background: var(--card)
|
background: var(--card)
|
||||||
|
|
|
@ -8,7 +8,7 @@ details.folding
|
||||||
border: 1px solid var(--theme)
|
border: 1px solid var(--theme)
|
||||||
summary
|
summary
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
padding: 1rem
|
padding: .75rem 1rem
|
||||||
margin: 0 - 1rem
|
margin: 0 - 1rem
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
.image-bg
|
.image-bg
|
||||||
line-height: 0
|
line-height: 0
|
||||||
text-align: center
|
text-align: center
|
||||||
border-radius: 4px
|
border-radius: $border-image
|
||||||
position: relative
|
position: relative
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
&:hover
|
&:hover
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
opacity: 1 !important
|
opacity: 1 !important
|
||||||
img
|
img
|
||||||
display: inline-block
|
display: inline-block
|
||||||
object-fit: contain
|
object-fit: cover
|
||||||
.image-download
|
.image-download
|
||||||
position: absolute
|
position: absolute
|
||||||
bottom: 8px
|
bottom: 8px
|
||||||
|
@ -37,7 +37,3 @@
|
||||||
color: var(--text-p3)
|
color: var(--text-p3)
|
||||||
&:empty
|
&:empty
|
||||||
display: none
|
display: none
|
||||||
// &.left
|
|
||||||
// text-align: left
|
|
||||||
// &.center
|
|
||||||
// text-align: center
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
@media screen and (max-width: $device-mobile-375)
|
@media screen and (max-width: $device-mobile-375)
|
||||||
width: 100%
|
width: 100%
|
||||||
box-shadow: $boxshadow-card
|
box-shadow: $boxshadow-card
|
||||||
border-radius: $border-widget
|
border-radius: $border-block
|
||||||
trans2: box-shadow transform
|
trans2: box-shadow transform
|
||||||
&:hover
|
&:hover
|
||||||
box-shadow: $boxshadow-card-float
|
box-shadow: $boxshadow-card-float
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.md .tag-plugin.note
|
.md .tag-plugin.note
|
||||||
$border-block = 4px
|
|
||||||
position: relative
|
position: relative
|
||||||
margin-top: 1rem
|
margin-top: 1rem
|
||||||
margin-bottom: 1rem
|
margin-bottom: 1rem
|
||||||
|
@ -41,3 +40,6 @@
|
||||||
margin: 0
|
margin: 0
|
||||||
>.tabs
|
>.tabs
|
||||||
margin-top: .5rem
|
margin-top: .5rem
|
||||||
|
|
||||||
|
.md .tag-plugin .tag-plugin.note
|
||||||
|
--gap-p: 1rem
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
.tab-content
|
.tab-content
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
text-align: justify
|
text-align: justify
|
||||||
|
margin-top: .5rem
|
||||||
.tab-pane
|
.tab-pane
|
||||||
&:not(.active)
|
&:not(.active)
|
||||||
display: none
|
display: none
|
||||||
|
|
Loading…
Reference in New Issue