Skip to content

Commit 752796d

Browse files
committed
Workaround 1 - missing file extensions.
1 parent c37f727 commit 752796d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/SphinxDocumentation.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,46 @@ jobs:
180180
sphinx-build -v -n -b latex -d _build/doctrees -j $(nproc) -w _build/latex.log . _build/latex
181181
# --builder html --doctree-dir _build/doctrees --verbose --fresh-env --write-all --nitpicky --warning-file _build/html.log . _build/html
182182

183+
- name: Workaround I - https://github.com/sphinx-doc/sphinx/issues/13190
184+
if: inputs.latex_artifact != ''
185+
run: |
186+
printf "Changing directory to 'doc/_build/latex' ...\n"
187+
cd doc/_build/latex
188+
189+
printf "Changing file extension according to MIME type ...\n"
190+
while IFS=$'\n' read -r file; do
191+
printf " Checking '%s' ... " "${file}"
192+
mime="$(file --mime-type -b "${file}")"
193+
printf "[%s]\n" "${mime}"
194+
case "${mime}" in
195+
image/png)
196+
ext="png"
197+
if [[ "${file##*.}" != "${ext}" ]]; then
198+
printf " Rename file to '%s' " "${file}.${ext}"
199+
mv "${file}" "${file}.${ext}"
200+
if [[ $? -eq 0 ]]; then
201+
printf "[OK]\n"
202+
else
203+
printf "[FAILED]\n"
204+
fi
205+
206+
printf " Patching LaTeX file for '%s' " "${file}"
207+
printf " %s\n" "sed -i \"s:\{\{${file%.*}\}\.${file##*.}\}:{{${file}}.${ext}}:g\" *.tex"
208+
sed -i "s:\{\{${file%.*}\}\.${file##*.}\}:{{${file}}.${ext}}:g" *.tex
209+
if [[ $? -eq 0 ]]; then
210+
printf "[OK]\n"
211+
else
212+
printf "[FAILED]\n"
213+
fi
214+
else
215+
printf "unchanged\n"
216+
fi
217+
;;
218+
*)
219+
;;
220+
esac
221+
done <<<$(find . -type f -not -iname "*.cls" -not -iname "*.sty" -not -iname "*.xdy" -not -iname "*.svg" -not -iname "*.png" -not -iname "*.jpg" | sed 's:./::')
222+
183223
- name: Workaround II - https://github.com/sphinx-doc/sphinx/issues/13189
184224
if: inputs.latex_artifact != ''
185225
run: |

0 commit comments

Comments
 (0)