From 2793a4e4af55ab99f20e494f542172c67aca937b Mon Sep 17 00:00:00 2001 From: Rick van de Loo Date: Sun, 14 Jan 2024 14:38:39 +0100 Subject: [PATCH] add bin/ entrypoint for building PDF To export the docs as a PDF --- .gitignore | 1 + README.md | 9 +++++++++ bin/build_pdf | 8 ++++++++ docs/conf.py | 4 +++- requirements/base.txt | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 bin/build_pdf diff --git a/.gitignore b/.gitignore index ca98c103..8d778373 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ pub *.css.map deployment-report.json build/ +venv/ diff --git a/README.md b/README.md index 793b792d..5c27e9a4 100644 --- a/README.md +++ b/README.md @@ -115,3 +115,12 @@ To inspect the contents of the deb archive you can run: /usr/share/doc/hndocsnext/README.md /usr/share/doc/hndocsnext/changelog.gz ``` + +## Build as PDF + +To build the documentation as a single PDF file, run the following command: +``` +bin/build_pdf +``` + +The built PDF will then be in `docs/_build/pdf/`. diff --git a/bin/build_pdf b/bin/build_pdf new file mode 100755 index 00000000..8051d7b0 --- /dev/null +++ b/bin/build_pdf @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +pushd docs +make pdf +echo "pdf located at $(realpath _build/pdf/Python.pdf)" +popd diff --git a/docs/conf.py b/docs/conf.py index 3e119e29..637854ed 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,8 +21,9 @@ # -- Project information ----------------------------------------------------- project = "Docs" -copyright = "2023, Hypernode" +copyright = "2024, Hypernode" author = "Hypernode" +version = "https://docs.hypernode.com/" # The full version, including alpha/beta/rc tags release = "dev" @@ -47,6 +48,7 @@ "hypernode.sphinx.extensions.meta_robots", "hypernode.sphinx.extensions.github_actions_logging", "sphinxcontrib.mermaid", + "rst2pdf.pdfbuilder", ] # Add any paths that contain templates here, relative to this directory. diff --git a/requirements/base.txt b/requirements/base.txt index e961ec16..3726e246 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -11,6 +11,7 @@ sphinx-notfound-page==0.8.3 sphinx-sitemap==2.4.0 GitPython==3.1.30 sphinxcontrib-mermaid==0.7.1 +rst2pdf==0.99 # hypernode/ requirements beautifulsoup4==4.11.1