Skip to content

Commit b43a83b

Browse files
authored
Initial commit
0 parents  commit b43a83b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4032
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
# Build the site
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: typst-community/setup-typst@v4
20+
- run: make build
21+
- uses: actions/configure-pages@v4
22+
- uses: actions/upload-pages-artifact@v4
23+
with:
24+
path: _site
25+
26+
# Publish to GitHub Pages
27+
deploy:
28+
runs-on: ubuntu-latest
29+
needs: build
30+
permissions:
31+
pages: write
32+
id-token: write
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- uses: actions/deploy-pages@v4
38+
id: deployment

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
*.egg-info/
8+
dist/
9+
build/
10+
11+
# uv
12+
.venv/
13+
uv.lock
14+
15+
# IDE
16+
.vscode/
17+
*.swp
18+
*.swo
19+
20+
# build outputs
21+
_site/
22+
target/
23+
24+
# temp files
25+
*.tmp
26+
*.bak
27+
.DS_Store
28+
Thumbs.db
29+
30+
# Logs
31+
*.log
32+
33+
# todo
34+
TODO.md

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Yousa-Mirage
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Find all .typ files in content/ that don't start with an underscore in their path
2+
TYP_FILES := $(shell find content -name '*.typ' -not -path '*/_*')
3+
4+
# Identify PDF files: .typ files whose name contains "PDF" (case-insensitive)
5+
PDF_TYP_FILES := $(shell find content -name '*.typ' -not -path '*/_*' | grep -i "PDF")
6+
7+
# Filter out PDF files from TYP_FILES to get HTML-only files
8+
HTML_TYP_FILES := $(filter-out $(PDF_TYP_FILES),$(TYP_FILES))
9+
10+
# Generate corresponding HTML file paths in _site/ (excluding PDF files)
11+
HTML_FILES := $(patsubst content/%.typ,_site/%.html,$(HTML_TYP_FILES))
12+
13+
# Generate corresponding PDF file paths in _site/
14+
PDF_FILES := $(patsubst content/%.typ,_site/%.pdf,$(PDF_TYP_FILES))
15+
16+
# ============================================================================
17+
# Main Targets
18+
# ============================================================================
19+
20+
# Default target
21+
default: build
22+
23+
# Full build (HTML + PDF + assets)
24+
build: html pdf assets
25+
26+
# Build HTML files only
27+
html: $(HTML_FILES)
28+
@echo "✓ HTML 构建完成。"
29+
30+
# Build PDF files only
31+
pdf: $(PDF_FILES)
32+
@echo "✓ PDF 构建完成。"
33+
34+
# Copy assets to _site only
35+
assets:
36+
@mkdir -p _site/assets
37+
@cp -r assets/* _site/assets/
38+
39+
# Clean all generated files
40+
clean:
41+
@echo "清理生成的文件..."
42+
rm -rf _site/*
43+
@echo "✓ 清理完成。"
44+
45+
.PHONY: build html pdf clean default assets
46+
47+
# ============================================================================
48+
# Build Rules
49+
# ============================================================================
50+
51+
# Pattern rule to compile .typ files to .html files
52+
_site/%.html: content/%.typ
53+
@mkdir -p $(@D)
54+
typst compile --root .. --font-path assets --features html --format html $< $@
55+
56+
# Pattern rule to compile .typ files to .pdf files
57+
_site/%.pdf: content/%.typ
58+
@mkdir -p $(@D)
59+
typst compile --root .. --font-path assets $< $@

0 commit comments

Comments
 (0)