From c37f727e2df1fb0cc661278779c613b20ed53e1c Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 24 Dec 2024 12:20:34 +0100 Subject: [PATCH] Workaround 2 - % sign in a filename. --- .github/workflows/LaTeXDocumentation.yml | 3 +-- .github/workflows/SphinxDocumentation.yml | 33 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/LaTeXDocumentation.yml b/.github/workflows/LaTeXDocumentation.yml index 96074b8..9027bc2 100644 --- a/.github/workflows/LaTeXDocumentation.yml +++ b/.github/workflows/LaTeXDocumentation.yml @@ -59,7 +59,6 @@ jobs: run: | tree -pash . - - name: Build LaTeX document using 'pytooling/miktex:sphinx' uses: addnab/docker-run-action@v3 with: @@ -70,7 +69,7 @@ jobs: pwd ls -lAh - latexmk ${{ inputs.document }}.tex + latexmk -xelatex ${{ inputs.document }}.tex - name: 📤 Upload 'PDF Documentation' artifact uses: pyTooling/upload-artifact@v4 diff --git a/.github/workflows/SphinxDocumentation.yml b/.github/workflows/SphinxDocumentation.yml index 8a6e730..ae55707 100644 --- a/.github/workflows/SphinxDocumentation.yml +++ b/.github/workflows/SphinxDocumentation.yml @@ -180,6 +180,39 @@ jobs: sphinx-build -v -n -b latex -d _build/doctrees -j $(nproc) -w _build/latex.log . _build/latex # --builder html --doctree-dir _build/doctrees --verbose --fresh-env --write-all --nitpicky --warning-file _build/html.log . _build/html + - name: Workaround II - https://github.com/sphinx-doc/sphinx/issues/13189 + if: inputs.latex_artifact != '' + run: | + printf "Changing directory to 'doc/_build/latex' ...\n" + cd doc/_build/latex + + printf "Searching for downloaded images, that need normalization ...\n" + for imageExt in png svg jpg jpeg; do + printf " Processing '%s' ...\n" "${imageExt}" + while IFS=$'\n' read -r imageFile; do + newFile="${imageFile//%/_}"; + + printf " %s\n" "$imageFile"; + if [[ "${imageFile}" != "${newFile}" ]]; then + printf " Rename file to '%s' " "${newFile}" + mv "${imageFile}" "${newFile}" + if [[ $? -eq 0 ]]; then + printf "[OK]\n" + else + printf "[FAILED]\n" + fi + + printf " Patching LaTeX file for '%s' " "${newFile}" + sed -i "s:\{\{${imageFile%.*}\}\.${imageFile##*.}\}:{{${newFile%.*}}.${newFile##*.}}:g" *.tex + if [[ $? -eq 0 ]]; then + printf "[OK]\n" + else + printf "[FAILED]\n" + fi + fi + done <<<$(find . -type f -iname "*.$imageExt" | sed 's:./::') + done + - name: 📤 Upload 'LaTeX Documentation' artifact if: inputs.latex_artifact != '' continue-on-error: true