Skip to content

Commit

Permalink
feat(pdf): add pdf download (#399)
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Mar 17, 2024
1 parent 9a69ea6 commit d96de40
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ MDBOOK_VERSION=0.4.37
MDBOOK_I18N_HELPERS_VERSION=0.3.2
MDBOOK_PANDOC_VERSION=0.6.0
MDBOOK_LAST_CHANGED_VERSION=0.1.4
PANDOC_VERSION=3.1.12.2
5 changes: 3 additions & 2 deletions .github/workflows/install-mdbook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ runs:

- name: Install mdbook-pandoc and related dependencies
run: |
. ./.env
sudo apt-get update
sudo apt-get install -y texlive texlive-latex-extra texlive-luatex texlive-lang-cjk librsvg2-bin fonts-noto
curl -LsSf https://github.com/jgm/pandoc/releases/download/3.1.12.2/pandoc-3.1.12.2-linux-amd64.tar.gz | tar zxf -
echo "$PWD/pandoc-3.1.12.2/bin" >> $GITHUB_PATH
curl -LsSf https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-amd64.tar.gz | tar zxf -
echo "$PWD/pandoc-$PANDOC_VERSION/bin" >> $GITHUB_PATH
shell: bash
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
An open source book about design patterns and idioms in the Rust programming
language that you can read [here](https://rust-unofficial.github.io/patterns/).

You can also download the book in PDF format from
[this link](https://rust-unofficial.github.io/patterns/rust-design-patterns.pdf).

## Contributing

You are missing content in this repository that can be helpful for others, and
Expand Down
2 changes: 1 addition & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ optional = true
hosted-html = "https://rust-unofficial.github.io/patterns/"

[output.pandoc.profile.pdf]
output-file = "patterns.pdf"
output-file = "rust-design-patterns.pdf"
pdf-engine = "lualatex"

[output.pandoc.profile.pdf.variables]
Expand Down
5 changes: 5 additions & 0 deletions src/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
If you are interested in contributing to this book, check out the
[contribution guidelines](https://github.com/rust-unofficial/patterns/blob/master/CONTRIBUTING.md).

## 📯 News

- **2024-03-17**: You can now download the book in PDF format from
[this link](https://rust-unofficial.github.io/patterns/rust-design-patterns.pdf).

## Design patterns

In software development, we often come across problems that share similarities
Expand Down
3 changes: 3 additions & 0 deletions theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@
<a href="{{ path_to_root }}print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="{{ path_to_root }}rust-design-patterns.pdf" title="This book as a PDF" aria-label="This book as a PDF">
<i id="open-pdf-button" class="fa fa-download"></i>
</a>
{{/if}}
{{#if git_repository_url}}
<a href="{{git_repository_url}}" title="Git repository" aria-label="Git repository">
Expand Down

0 comments on commit d96de40

Please sign in to comment.