chore: remove summary (#2256)

This commit is contained in:
Libin YANG 2024-01-24 17:29:44 +08:00 committed by GitHub
parent 5d33e36065
commit 6d4c1d4c8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 17 additions and 6504 deletions

View File

@ -62,4 +62,4 @@ jobs:
gitee-username: yanglbme
gitee-password: ${{ secrets.GITEE_PASSWORD }}
gitee-repo: doocs/leetcode
branch: main
branch: gh-pages

View File

@ -20,8 +20,8 @@
## 站点
- Vercel: https://doocs-leetcode.vercel.app
- GitHub Pages: https://doocs.github.io/leetcode
- Gitee Pages: https://doocs.gitee.io/leetcode
## 算法全解

View File

@ -20,8 +20,8 @@ This project contains solutions for problems from LeetCode, "Coding Interviews (
## Sites
- Vercel: https://doocs-leetcode.vercel.app
- GitHub Pages: https://doocs.github.io/leetcode
- Gitee Pages: https://doocs.gitee.io/leetcode
## Solutions

View File

@ -1,64 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LeetCode & Coding Interview Guide - Doocs Open Source Organization</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="keywords" content="doc,docs,doocs,documentation,github,gitee,coding,pages,leetcode,lcof,lcci,lcof2,coding-interview,coding-interview-guide,cracking-the-coding-interview,yanglbme">
<meta name="description" content="LeetCode、剑指Offer、程序员面试金典题解">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify@4.13.0/lib/themes/vue.css">
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/style.min.css">
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/katex@latest/dist/katex.min.css">
<link rel="stylesheet" href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-giscus@1.0.0/dist/giscus.css">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<style>
.markdown-section code {
font-weight: 400;
}
</style>
</head>
<body>
<div id="app">LeetCode & Coding Interview Guide @Doocs</div>
<script src="./main.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify@4.13.0/lib/docsify.min.js"></script>
<!-- components -->
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-c.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-go.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-sql.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-bash.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-cpp.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-java.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-kotlin.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-csharp.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-javascript.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-typescript.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-python.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-swift.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-nim.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-ruby.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-rust.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-copy-code@2.1.1/dist/docsify-copy-code.min.js"></script>
<!-- plugins -->
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify/lib/plugins/search.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-lastmodified/index.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-tabs@1/dist/docsify-tabs@1.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/index.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-contributors@latest/dist/index.min.js"></script>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
</body>
<!--
cdn.jsdelivr.net
test1.jsdelivr.net
testingcf.jsdelivr.net
fastly.jsdelivr.net
gcore.jsdelivr.net
-->
</html>

225
main.js
View File

@ -1,225 +0,0 @@
const isEn = () => location.hash.includes('README_EN');
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
const categories = ['javascript', 'database'];
const getSolutionPrefix = url => {
const res = categories.find(
category =>
url.includes(category + '-solution') ||
url.includes(category.toUpperCase() + '_README'),
);
return res ? res + '-' : '';
};
const sidebar = () => {
if (isRoot()) {
return false;
}
const prefix = getSolutionPrefix(location.hash);
return isEn() ? `${prefix}summary_en.md` : `${prefix}summary.md`;
};
const cleanedHtml = html => {
return html.replace(/<pre>([\s\S]*?)<\/pre>/g, (_, group) => {
return '<pre>' + group.replace(/<code>([\s\S]*?)<\/code>/g, '$1') + '</pre>';
});
};
const replaceHref = html => {
const prefix = getSolutionPrefix(location.hash);
return prefix ? html.replaceAll('(/solution/', '(/' + prefix + 'solution/') : html;
};
const getLang = () => (isEn() ? 'en' : 'zh-CN');
const giscusTheme = () =>
localStorage.getItem('DARK_LIGHT_THEME') === 'light' ? 'light' : 'noborder_dark';
const getTerm = () => {
let path = decodeURI(location.hash.slice(1, location.hash.lastIndexOf('/'))) || '/index';
// restore original path
for (const prefix of categories) {
const s = `${prefix}-solution`;
if (path.includes(s)) {
path = path.replace(s, 'solution');
}
}
return path;
};
window.addEventListener('hashchange', () => {
window.$docsify.loadSidebar = sidebar();
});
window.$docsify = {
name: 'leetcode',
repo: 'doocs/leetcode',
logo: '/images/doocs-leetcode.png',
search: {
depth: 2,
hideOtherSidebarContent: true,
pathNamespaces: ['/', '/solution', '/lcof', '/lcof2', '/lcci', '/lcs', '/lcp', '/basic'],
},
loadSidebar: sidebar(),
auto2top: true,
subMaxLevel: 2,
alias: {
'^/javascript-solution/(.*)': '/solution/$1',
'^/shell-solution/(.*)': '/solution/$1',
'^/database-solution/(.*)': '/solution/$1',
'/lcs/.*/summary.md': '/lcs/summary.md',
'/lcp/.*/summary.md': '/lcp/summary.md',
'/lcci/.*/summary.md': '/lcci/summary.md',
'/lcof/.*/summary.md': '/lcof/summary.md',
'/lcof2/.*/summary.md': '/lcof2/summary.md',
'/solution/.*/summary.md': '/solution/summary.md',
'/basic/.*/summary.md': '/basic/summary.md',
'/lcs/.*/summary_en.md': '/lcs/summary_en.md',
'/lcp/.*/summary_en.md': '/lcp/summary_en.md',
'/lcci/.*/summary_en.md': '/lcci/summary_en.md',
'/lcof/.*/summary_en.md': '/lcof/summary_en.md',
'/lcof2/.*/summary_en.md': '/lcof2/summary_en.md',
'/solution/.*/summary_en.md': '/solution/summary_en.md',
'/basic/.*/summary_en.md': '/basic/summary_en.md',
},
lastModifiedText: {
'/README_EN': 'Last updated: ',
'/': '最近更新时间:',
},
giscus: {
repo: 'doocs/leetcode',
repoId: 'MDEwOlJlcG9zaXRvcnkxNDkwMDEzNjU',
category: 'Announcements',
categoryId: 'DIC_kwDOCOGUlc4CZmhe',
mapping: 'specific',
reactionsEnabled: '0',
strict: '1',
emitMetadata: '0',
inputPosition: 'top',
crossorigin: 'anonymous',
},
contributors: {
repo: 'doocs/leetcode',
ignores: [
'/README.md',
'/README_EN.md',
'/solution/README.md',
'/solution/README_EN.md',
'/summary.md',
],
image: {
margin: '0.2em',
isRound: true,
},
},
darklightTheme: {
defaultTheme: 'light',
siteFont: 'Source Sans Pro,Helvetica Neue,Arial,sans-serif',
codeFontFamily: 'Roboto Mono, Monaco, courier, monospace',
bodyFontSize: '15px',
dark: {
background: '#191919',
highlightColor: '#e96900',
codeBackgroundColor: '#202020',
codeTextColor: '#b4b4b4',
},
light: {
highlightColor: '#e96900',
},
},
pagination: {
previousText: {
'/README_EN': 'PREVIOUS',
'/': '上一题',
},
nextText: {
'/README_EN': 'NEXT',
'/': '下一题',
},
crossChapter: true,
crossChapterText: true,
},
tabs: {
persist: true,
sync: true,
theme: 'classic',
tabComments: true,
tabHeadings: true,
},
plugins: [
(hook, vm) => {
hook.beforeEach(html => {
const { file } = vm.route;
const isUserContent = /githubusercontent\.com/.test(file);
const url = isUserContent
? file
.replace('raw.githubusercontent.com', 'github.com')
.replace(/\/main/, '/blob/main')
: `https://github.com/doocs/leetcode/blob/main/${file}`;
const github = `[GitHub](${url})`;
const gitee = `[Gitee](${url.replace('github', 'gitee')})`;
html = cleanedHtml(html);
html = replaceHref(html);
const editHtml = isEn()
? `:memo: Edit on ${github} / ${gitee}\n`
: `:memo: 在 ${github} / ${gitee} 编辑\n`;
return editHtml + html;
});
hook.afterEach(html => {
const copyright = isEn() ? '. All Rights Reserved' : ' 版权所有';
const currentYear = new Date().getFullYear();
const footer = `<footer>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>${copyright}</footer>`;
return html + footer;
});
hook.doneEach(() => {
const giscusScript = document.createElement('script');
const {
repo,
repoId,
category,
categoryId,
mapping,
reactionsEnabled,
strict,
emitMetadata,
inputPosition,
crossorigin,
} = $docsify.giscus;
giscusScript.type = 'text/javascript';
giscusScript.async = true;
giscusScript.setAttribute('src', 'https://giscus.app/client.js');
giscusScript.setAttribute('data-repo', repo);
giscusScript.setAttribute('data-repo-id', repoId);
giscusScript.setAttribute('data-category', category);
giscusScript.setAttribute('data-category-id', categoryId);
giscusScript.setAttribute('data-mapping', mapping);
giscusScript.setAttribute('data-reactions-enabled', reactionsEnabled);
giscusScript.setAttribute('data-strict', strict);
giscusScript.setAttribute('data-emit-metadata', emitMetadata);
giscusScript.setAttribute('data-input-position', inputPosition);
giscusScript.setAttribute('crossorigin', crossorigin);
giscusScript.setAttribute('data-theme', giscusTheme());
giscusScript.setAttribute('data-term', getTerm());
giscusScript.setAttribute('data-lang', getLang());
document
.getElementById('main')
.insertBefore(giscusScript, document.getElementById('main').lastChild);
document.getElementById('docsify-darklight-theme').addEventListener('click', () => {
const frame = document.querySelector('.giscus-frame');
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme: giscusTheme() } } },
'https://giscus.app',
);
});
});
},
],
};

View File

@ -1,24 +1,24 @@
{% if page.meta.comments %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
<script src="https://giscus.app/client.js"
data-repo="doocs/leetcode"
data-repo-id="MDEwOlJlcG9zaXRvcnkxNDkwMDEzNjU="
data-category="Announcements"
data-category-id="DIC_kwDOCOGUlc4CZmhe"
data-mapping="pathname"
data-strict="1"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
data-lang="zh-CN"
crossorigin="anonymous"
async>
data-repo="doocs/leetcode"
data-repo-id="MDEwOlJlcG9zaXRvcnkxNDkwMDEzNjU="
data-category="Announcements"
data-category-id="DIC_kwDOCOGUlc4CZmhe"
data-mapping="pathname"
data-strict="1"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
data-lang="zh-CN"
crossorigin="anonymous"
async>
</script>
<!-- Synchronize giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")
var giscus = document.querySelector("script[src*=giscus]")
/* Set palette on initial load */
var palette = __md_get("__palette")

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -440,7 +440,6 @@ def run():
ls = load_result()
generate_readme(ls)
generate_question_readme(ls)
generate_summary(ls)
# 生成周赛题目列表
generate_contest_readme(cls)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -176,36 +176,6 @@ def generate_question_readme(result):
)
def generate_summary(result):
"""generate summary files"""
summary_cn = summary_en = ""
m = {int(item["frontend_question_id"]): item for item in result}
for file in sorted(os.listdir("./"), key=lambda x: x.lower()):
if os.path.isdir("./" + file) and file != "__pycache__":
summary_cn += f"\n- {file}\n"
summary_en += f"\n- {file}\n"
for sub in sorted(os.listdir("./" + file), key=lambda x: x.lower()):
sub = sub.replace("`", " ")
enc = quote(sub)
if not sub[:4].isdigit():
continue
data = m.get(int(sub[:4]))
sub_cn = sub
if data:
sub_cn = sub[:5] + data["title_cn"]
summary_cn += f" - [{sub_cn}](/solution/{file}/{enc}/README.md)\n"
summary_en += f" - [{sub}](/solution/{file}/{enc}/README_EN.md)\n"
# generate summary.md
with open("./summary.md", "w", encoding="utf-8") as f:
f.write(summary_cn)
# generate summary_en.md
with open("./summary_en.md", "w", encoding="utf-8") as f:
f.write(summary_en)
def generate_category_summary(result, category=""):
"""generate category summary files"""
summary_cn = (

View File

@ -1,5 +0,0 @@
- 题解速览
- [LeetCode](/solution/README.md)
- [剑指 Offer第 2 版)](/lcof/README.md)
- [剑指 Offer专项突击版](/lcof2/README.md)
- [程序员面试金典(第 6 版)](/lcci/README.md)

View File

@ -1,4 +0,0 @@
- All Solutions
- [LeetCode(Not finished yet)](/solution/README_EN.md)
- [LCOF: _Coding Interviews, 2nd Edition_](/lcof/README_EN.md)
- [LCCI: _Cracking the Coding Interview, 6th Edition_](/lcci/README_EN.md)