Skip to content

Commit 9373a70

Browse files
authored
chore: update site config (#2232)
1 parent 1bd9081 commit 9373a70

File tree

5 files changed

+93
-38
lines changed

5 files changed

+93
-38
lines changed

.github/workflows/deploy.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Configure Git Credentials
17+
run: |
18+
git config user.name github-actions[bot]
19+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
20+
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.x
24+
25+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
26+
27+
- uses: actions/cache@v3
28+
with:
29+
key: mkdocs-material-${{ env.cache_id }}
30+
path: .cache
31+
restore-keys: |
32+
mkdocs-material-
33+
34+
- name: Install dependencies
35+
run: |
36+
python3 -m pip install --upgrade pip
37+
python3 -m pip install -r requirements.txt
38+
39+
- run: |
40+
python3 main.py
41+
mkdocs build -f mkdocs.yml
42+
mkdocs build -f mkdocs-en.yml
43+
44+
- name: Deploy
45+
uses: peaceiris/actions-gh-pages@v3
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_dir: ./site

.prettierignore

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
.idea/
2-
.github/
3-
node_modules/
4-
/solution/CONTEST_README.md
5-
/solution/CONTEST_README_EN.md
6-
/solution/summary.md
7-
/solution/summary_en.md
8-
/solution/README.md
9-
/solution/README_EN.md
10-
/solution/readme_template.md
11-
/solution/readme_template_en.md
12-
/solution/problem_readme_template.md
13-
/solution/problem_readme_template_en.md
14-
/solution/bash_problem_readme_template.md
15-
/solution/bash_problem_readme_template_en.md
16-
/solution/0100-0199/0177.Nth Highest Salary/Solution.sql
17-
/solution/0100-0199/0178.Rank Scores/Solution2.sql
18-
/solution/0500-0599/0586.Customer Placing the Largest Number of Orders/Solution2.sql
19-
/solution/1400-1499/1454.Active Users/Solution.sql
20-
/solution/1600-1699/1635.Hopper Company Queries I/Solution.sql
21-
/solution/2100-2199/2118.Build the Equation/Solution.sql
22-
/solution/2100-2199/2175.The Change in Global Rankings/Solution.sql
23-
/solution/2200-2299/2205.The Number of Users That Are Eligible for Discount/Solution.sql
24-
/solution/2200-2299/2230.The Users That Are Eligible for Discount/Solution.sql
25-
/solution/2200-2299/2252.Dynamic Pivoting of a Table/Solution.sql
26-
/solution/2200-2299/2253.Dynamic Unpivoting of a Table/Solution.sql
2+
.DS_Store
3+
.vscode
4+
.temp
5+
.cache
6+
/node_modules
7+
/solution/result.json
8+
/solution/contest.json
9+
/solution/contest_list.json
10+
/solution/raw.json
11+
/lcof/lcof.json
12+
/lcof/lcof_list.json
13+
/lcci/lcci.json
14+
/solution/__pycache__
15+
/solution/.env
16+
*.iml
17+
18+
site
19+
/docs/lc
20+
/docs/lcof
21+
/docs/lcci
22+
/docs/lcof2
23+
/docs/lcp
24+
/docs/lcs
25+
/docs-en/lc
26+
/docs-en/lcci

main.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666

6767

6868
def get_paths(dirs: str, m: int):
69-
dirs = 'main' + os.sep + dirs
7069
paths = []
7170
for root, _, files in os.walk(dirs):
7271
for file in files:
@@ -77,12 +76,12 @@ def get_paths(dirs: str, m: int):
7776

7877

7978
dirs_mapping = {
80-
"solution": ("lc", 5),
81-
"lcof": ("lcof", 4),
82-
"lcof2": ("lcof2", 4),
83-
"lcci": ("lcci", 4),
84-
"lcp": ("lcp", 4),
85-
"lcs": ("lcs", 4),
79+
"solution": ("lc", 4),
80+
"lcof": ("lcof", 3),
81+
"lcof2": ("lcof2", 3),
82+
"lcci": ("lcci", 3),
83+
"lcp": ("lcp", 3),
84+
"lcs": ("lcs", 3),
8685
}
8786

8887
dirs = ["solution", "lcof", "lcof2", "lcci", "lcp", "lcs"]
@@ -102,6 +101,12 @@ def get_paths(dirs: str, m: int):
102101
for p in sorted(get_paths(dir, m)):
103102
with open(p, "r", encoding="utf-8") as f:
104103
content = f.read()
104+
105+
# [中文文档](/lcci/01.01.Is%20Unique/README.md)
106+
# 正则匹配 [中文文档](xxx) 并且移除
107+
content = re.sub(r"\[中文文档]\((.*?)\)", "", content)
108+
content = re.sub(r"\[English Version]\((.*?)\)", "", content)
109+
105110
title = content[content.find("[") + 1 : content.find("]")]
106111
dot = title.find(".") if dir != "lcci" else title.rfind(".")
107112
num = (

mkdocs-en.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
INHERIT: mkdocs.yml
22
site_description: LeetCode solutions in any programming language
3+
site_dir: site/en
34
docs_dir: docs-en
4-
5-
6-
5+
theme:
6+
language: en
7+
font:
8+
text: Roboto
9+
code: Roboto Mono
710

811
nav:
912
- LeetCode:

mkdocs.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ site_name: LeetCode Wiki
22
site_url: https://doocs.github.io/leetcode
33
site_description: 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解
44
site_author: yanglbme
5+
site_dir: site
56
docs_dir: docs
67
repo_name: doocs/leetcode
78
repo_url: https://github.com/doocs/leetcode
@@ -59,7 +60,7 @@ theme:
5960

6061
plugins:
6162
- search:
62-
separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
63+
separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
6364

6465
markdown_extensions:
6566
- pymdownx.superfences
@@ -91,8 +92,6 @@ extra:
9192
lang: zh
9293

9394

94-
95-
9695
nav:
9796
- LeetCode:
9897
- 1. 两数之和: lc/1.md

0 commit comments

Comments
 (0)