Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
a48zhang committed Sep 16, 2023
1 parent e77a831 commit e16d11e
Show file tree
Hide file tree
Showing 8 changed files with 949 additions and 11 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
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
10 changes: 10 additions & 0 deletions pandoc/README.md
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` 相关依赖
Loading

0 comments on commit e16d11e

Please sign in to comment.