-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
949 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
python_version: "3.9" | ||
pandoc_version: "3.1.2" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.python_version }} | ||
|
||
- name: Install Pandoc | ||
run: | | ||
mkdir -p /tmp/pandoc | ||
cd /tmp/pandoc | ||
python -m pip --no-cache-dir install setuptools wheel | ||
python -m pip --no-cache-dir install pandocfilters Pygments | ||
sudo apt install -y texlive texlive-xetex texlive-lang-chinese latexmk wget | ||
wget -q "https://github.com/jgm/pandoc/releases/download/${{ env.pandoc_version }}/pandoc-${{ env.pandoc_version }}-1-amd64.deb" | ||
sudo dpkg -i pandoc-${{ env.pandoc_version }}-1-amd64.deb | ||
rm -rf *.deb | ||
- name: Install Fonts | ||
run: | | ||
mkdir -p /tmp/adodefont | ||
cd /tmp/adodefont | ||
wget -q -O source-code-pro.zip https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip | ||
wget -q -O source-han-serif.zip https://github.com/adobe-fonts/source-han-serif/archive/1.001R.zip | ||
wget -q -O source-han-sans.zip https://github.com/adobe-fonts/source-han-sans/archive/2.001R.zip | ||
unzip -q source-code-pro.zip -d source-code-pro | ||
unzip -q source-han-serif.zip -d source-han-serif | ||
unzip -q source-han-sans.zip -d source-han-sans | ||
mkdir -p ~/.fonts | ||
cp -v source-code-pro/*/OTF/*.otf ~/.fonts/ | ||
cp -v source-han-serif/*/SubsetOTF/*/*.otf ~/.fonts/ | ||
cp -v source-han-sans/*/SubsetOTF/*/*.otf ~/.fonts/ | ||
fc-cache -f | ||
rm -rf source-code-pro{,.zip} source-han-serif{,.zip} source-han-sans{,.zip} | ||
- name: Generate PDF | ||
run: | | ||
mkdir -p ~/.pandoc/templates | ||
cp pandoc/algo.latex ~/.pandoc/templates/ | ||
bash pandoc/gen.sh | ||
mkdir build | ||
cp template.pdf build/template.pdf | ||
- name: Release | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: build | ||
branch: gh-pages | ||
clean: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Pandoc 生成 PDF 流程(以 Linux 为例): | ||
|
||
+ 确保 `algo.latex` 文件置于 `~/.pandoc/templates/` 下 | ||
+ 在项目目录下运行 `sh pandoc/gen.sh` | ||
|
||
注: | ||
|
||
+ 字体选择放在了 `gen.sh` 中,请根据需要自行替换 | ||
+ 封面放在了 `algo.latex` 中,可自行修改 | ||
+ 需要安装 `pandoc`, `latex`, `python` 相关依赖 |
Oops, something went wrong.