diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e88593e..9458d57 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,50 +20,22 @@ jobs: - name: Install Rust run: | rustup set profile minimal - rustup toolchain install 1.62 -c rust-docs - rustup default 1.62 + rustup toolchain install 1.74.1 -c rust-docs + rustup default 1.74.1 - name: Install mdbook run: | mkdir bin - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin echo "$(pwd)/bin" >> ${GITHUB_PATH} - - name: Install mdbook-latex-pdf + - name: Install mdbook-typst-pdf run: | - curl -sL -o bin/mdbook-latex-pdf https://github.com/KaiserY/mdbook-latex-pdf/releases/download/0.1.1/mdbook-latex-pdf-x86_64-unknown-linux-gnu - chmod +x bin/mdbook-latex-pdf + curl -sL -o bin/mdbook-typst-pdf https://github.com/KaiserY/mdbook-typst-pdf/releases/download/0.1.0/mdbook-typst-pdf-x86_64-unknown-linux-gnu + chmod +x bin/mdbook-typst-pdf echo "$(pwd)/bin" >> ${GITHUB_PATH} - pip install --upgrade --force-reinstall Pygments - name: Install font run: | echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections 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 @@ -73,9 +45,9 @@ jobs: run: | mdbook build mv book/html/* book/ - mv "book/latex-pdf/Rust 程序设计语言 简体中文版.pdf" book/ + mv "book/typst-pdf/Rust 程序设计语言 简体中文版.pdf" book/ rm -r book/html/ - rm -rf book/latex-pdf/ + rm -rf book/typst-pdf/ - name: Deploy gh-pages if: ${{ github.ref == 'refs/heads/main' }} uses: peaceiris/actions-gh-pages@v3 diff --git a/book.toml b/book.toml index 4eddbb0..626a10c 100644 --- a/book.toml +++ b/book.toml @@ -10,6 +10,5 @@ additional-js = ["ferris.js"] 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.latex-pdf] -latex = false +[output.typst-pdf] pdf = true diff --git a/src/ch12-01-accepting-command-line-arguments.md b/src/ch12-01-accepting-command-line-arguments.md index 2b86ccf..69c8322 100644 --- a/src/ch12-01-accepting-command-line-arguments.md +++ b/src/ch12-01-accepting-command-line-arguments.md @@ -1,4 +1,4 @@ -### 接受命令行参数 +## 接受命令行参数 > [ch12-01-accepting-command-line-arguments.md](https://github.com/rust-lang/book/blob/main/src/ch12-01-accepting-command-line-arguments.md) >
diff --git a/src/ch12-02-reading-a-file.md b/src/ch12-02-reading-a-file.md index 7c48b33..73bc8b3 100644 --- a/src/ch12-02-reading-a-file.md +++ b/src/ch12-02-reading-a-file.md @@ -1,4 +1,4 @@ -### 读取文件 +## 读取文件 > [ch12-02-reading-a-file.md](https://github.com/rust-lang/book/blob/main/src/ch12-02-reading-a-file.md) >
diff --git a/src/ch13-01-closures.md b/src/ch13-01-closures.md index 77f4204..36e9c88 100644 --- a/src/ch13-01-closures.md +++ b/src/ch13-01-closures.md @@ -217,4 +217,4 @@ impl Option { 当定义或使用用到闭包的函数或类型时,`Fn` trait 十分重要。在下个小节中,我们将会讨论迭代器。许多迭代器方法都接收闭包参数,因而在继续前先记住这些闭包的细节! -[unwrap-or-else]: ../std/option/enum.Option.html#method.unwrap_or_else +[unwrap-or-else]: https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap_or_else