From 39cfb14592a64e1f731b06c516ccfe1b5606ac32 Mon Sep 17 00:00:00 2001 From: KaiserY Date: Sun, 17 Dec 2023 22:01:48 +0800 Subject: [PATCH] fix ci --- .github/workflows/main.yml | 31 +++++++++++++++++++++--- book.toml | 1 + template.typ | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 template.typ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6556fa..5635667 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,9 +35,34 @@ jobs: - name: Install font run: | echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections - sudo apt-get -y install msttcorefonts fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core - sudo apt-get -y install ttf-wqy* - fc-cache -f -v + sudo apt-get -y install msttcorefonts + mkdir fonts + mkdir -p ~/.local/share/fonts + curl -sL -o Noto_Sans.zip https://fonts.google.com/download?family=Noto%20Sans + unzip Noto_Sans.zip -d fonts/Noto_Sans + curl -sL -o Noto_Sans_SC.zip https://fonts.google.com/download?family=Noto%20Sans%20SC + unzip Noto_Sans_SC.zip -d fonts/Noto_Sans_SC + curl -sL -o Noto_Sans_Mono.zip https://fonts.google.com/download?family=Noto%20Sans%20Mono + unzip Noto_Sans_Mono.zip -d fonts/Noto_Sans_Mono + rm -fv fonts/Noto_Sans_Mono/NotoSansMono-VariableFont_wdth,wght.ttf + curl -sL -o Noto_Sans_KR.zip https://fonts.google.com/download?family=Noto%20Sans%20KR + unzip Noto_Sans_KR.zip -d fonts/Noto_Sans_KR + curl -sL -o Noto_Sans_Thai.zip https://fonts.google.com/download?family=Noto%20Sans%20Thai + unzip Noto_Sans_Thai.zip -d fonts/Noto_Sans_Thai + rm -fv fonts/Noto_Sans_Thai/NotoSansThai-VariableFont_wdth,wght.ttf + curl -sL -o Noto_Sans_Arabic.zip https://fonts.google.com/download?family=Noto%20Sans%20Arabic + unzip Noto_Sans_Arabic.zip -d fonts/Noto_Sans_Arabic + curl -sL -o Noto_Sans_Hebrew.zip https://fonts.google.com/download?family=Noto%20Sans%20Hebrew + unzip Noto_Sans_Hebrew.zip -d fonts/Noto_Sans_Hebrew + curl -sL -o Noto_Sans_Devanagari.zip https://fonts.google.com/download?family=Noto%20Sans%20Devanagari + unzip Noto_Sans_Devanagari.zip -d fonts/Noto_Sans_Devanagari + rm -fv fonts/Noto_Sans_Devanagari/NotoSansDevanagari-VariableFont_wdth,wght.ttf + curl -sL -o Noto_Emoji.zip https://fonts.google.com/download?family=Noto%20Emoji + unzip Noto_Emoji.zip -d fonts/Noto_Emoji + curl -sL -o times_sans_serif.zip https://dl.dafont.com/dl/?f=times_sans_serif + unzip times_sans_serif.zip -d fonts/times_sans_serif + mv fonts/* ~/.local/share/fonts/ + fc-cache -rv - name: Report versions run: | rustup --version diff --git a/book.toml b/book.toml index 626a10c..7eb7df2 100644 --- a/book.toml +++ b/book.toml @@ -11,4 +11,5 @@ git-repository-url = "https://github.com/KaiserY/trpl-zh-cn/tree/main" edit-url-template = "https://github.com/KaiserY/trpl-zh-cn/edit/main/{path}" [output.typst-pdf] +custom-template = "template.typ" pdf = true diff --git a/template.typ b/template.typ new file mode 100644 index 0000000..f0407b4 --- /dev/null +++ b/template.typ @@ -0,0 +1,48 @@ +#set text( + lang: "zh", + font: ( + "Noto Sans", + "Noto Sans SC", + "Noto Sans Arabic", + ), +) + +#show link: underline + +#show raw.where(block: true): block.with( + fill: luma(240), + inset: 10pt, + radius: 4pt, +) + +#show quote.where(block: true): block.with( + fill: rgb("#f1f6f9"), + inset: 10pt, + radius: 4pt, +) + +#set page( + header: locate(loc => { + if counter(page).at(loc).first() > 1 [ + MDBOOK_TYPST_PDF_TITLE + ] + }), + footer: locate(loc => { + if counter(page).at(loc).first() > 1 [ + #counter(page).display( + "1/1", + both: true, + ) + ] + }), +) + +#align(center, text(17pt)[ + *MDBOOK_TYPST_PDF_TITLE* +]) + +#pagebreak() +#outline(depth: 2, indent: 1em) +#pagebreak() + +/**** MDBOOK_TYPST_PDF_PLACEHOLDER ****/