diff --git a/.gitignore b/.gitignore index 3389182..9a5b22a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ tmp* vendor/bundle *.zip mkdocs.yml +.aider* +.env diff --git a/docker/Dockerfile b/docker/Dockerfile index b48f34c..86d42a9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM node:18-bookworm-slim LABEL maintainer="Glenn ROLLAND glenux@glenux.net" RUN apt-get update \ - && apt-get install -y --no-install-recommends python3 python3-pip pipenv \ + && apt-get install -y --no-install-recommends python3 python3-pip pipenv python3-pypandoc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && truncate -s 0 /var/log/*log @@ -16,7 +16,7 @@ RUN apt-get update \ # Tools for building pdfs RUN apt-get update \ - && apt-get install -y --no-install-recommends make pdftk m4 chromium \ + && apt-get install -y --no-install-recommends make m4 chromium pandoc ghc libghc-pandoc-dev lmodern texlive-latex-recommended texlive-latex-base texlive-latex-extra \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && truncate -s 0 /var/log/*log @@ -24,7 +24,7 @@ RUN apt-get update \ # External tools # yq => manage YML RUN curl -sSL -o /usr/local/bin/yq \ - https://github.com/mikefarah/yq/releases/download/v4.18.1/yq_linux_amd64 \ + https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_linux_amd64 \ && chmod +x /usr/local/bin/yq COPY . /app diff --git a/tasks/docs.mk b/tasks/docs.mk index a8ddcf4..370ca0a 100644 --- a/tasks/docs.mk +++ b/tasks/docs.mk @@ -22,6 +22,7 @@ clean: clean-docs build-docs-pdf: ## build pdf docs only mkdir -p $(BUILD_DOCS_DIR) mkdir -p $(CACHE_DOCS_DIR) + rm -f $(BUILD_DOCS_DIR)/docs.pdf ./utils/docs/build_combined.sh $(DOCS_DIR) $(CACHE_DOCS_DIR)/combined.md ./utils/docs/build_metadata.sh mkdocs.yml $(CACHE_DOCS_DIR)/metadata.yml ./utils/docs/build_pdf.py $(CACHE_DOCS_DIR)/metadata.yml $(CACHE_DOCS_DIR)/combined.md $(BUILD_DOCS_DIR)/docs.pdf diff --git a/utils/docs/build_pdf.py b/utils/docs/build_pdf.py index c497be5..efc732f 100755 --- a/utils/docs/build_pdf.py +++ b/utils/docs/build_pdf.py @@ -33,6 +33,10 @@ if os.path.exists(output_file): print(f"Output file already exists: {output_file}") sys.exit(1) +print(f"Metadata: {metadata_file}") +print(f"Input: {input_file}") +print(f"Output: {output_file}") + # Build the pandoc options as a string pandoc_cmd = [ "--toc", @@ -45,7 +49,8 @@ pandoc_cmd = [ "-V", "mainfont=DejaVu Serif", "-V", "monofont=SauceCodePro Nerd Font", "--pdf-engine=pdflatex", - "--filter=utils/docs/filter-nobg.hs", + "--resource-path=utils/docs", + "--filter=./utils/docs/filter-nobg.hs", ] # from glob import glob @@ -54,7 +59,7 @@ pandoc_cmd = [ # Convert all markdown files in the chapters/ subdirectory. pypandoc.convert_file( - [input_file], + input_file, "pdf", outputfile=output_file, extra_args=pandoc_cmd, diff --git a/utils/docs/main.tex b/utils/docs/main.tex index a477538..d0802c6 100644 --- a/utils/docs/main.tex +++ b/utils/docs/main.tex @@ -20,9 +20,9 @@ % Include additional settings from external files % \input{inline_code.tex} % \input{bullet_styling.tex} -\input{chapter_breaks.tex} -\input{blockquote.tex} -\input{hyperref_setup.tex} +\input{utils/docs/chapter_breaks.tex} +\input{utils/docs/blockquote.tex} +\input{utils/docs/hyperref_setup.tex} % Font settings using fontspec % \usepackage{fontspec}