|
1 | | -@ECHO OFF |
| 1 | +@echo off |
2 | 2 |
|
3 | | -pushd %~dp0 |
| 3 | +REM Minimal makefile for Sphinx documentation |
4 | 4 |
|
5 | | -REM Command file for Sphinx documentation |
| 5 | +REM Set default options and commands |
| 6 | +set SPHINXOPTS=-nWT --keep-going |
| 7 | +set SPHINXBUILD=sphinx-build |
6 | 8 |
|
7 | | -if "%SPHINXBUILD%" == "" ( |
8 | | - set SPHINXBUILD=sphinx-build |
9 | | -) |
10 | | -set SOURCEDIR=. |
11 | | -set BUILDDIR=_build |
12 | | - |
13 | | -%SPHINXBUILD% >NUL 2>NUL |
14 | | -if errorlevel 9009 ( |
15 | | - echo. |
16 | | - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx |
17 | | - echo.installed, then set the SPHINXBUILD environment variable to point |
18 | | - echo.to the full path of the 'sphinx-build' executable. Alternatively you |
19 | | - echo.may add the Sphinx directory to PATH. |
20 | | - echo. |
21 | | - echo.If you don't have Sphinx installed, grab it from |
22 | | - echo.https://www.sphinx-doc.org/ |
23 | | - exit /b 1 |
24 | | -) |
25 | | - |
26 | | -if "%1" == "" goto help |
27 | | - |
28 | | -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% |
29 | | -goto end |
| 9 | +if "%1" == "html" goto html |
| 10 | +if "%1" == "html-noplot" goto html-noplot |
| 11 | +if "%1" == "clean" goto clean |
| 12 | +if "%1" == "linkcheck" goto linkcheck |
| 13 | +if "%1" == "linkcheck-grep" goto linkcheck-grep |
| 14 | +if "%1" == "view" goto view |
30 | 15 |
|
| 16 | +REM Define targets |
31 | 17 | :help |
32 | | -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% |
| 18 | +echo Please use `make ^<target^>` where ^<target^> is one of |
| 19 | +echo html to make standalone HTML files |
| 20 | +echo html-noplot to make standalone HTML files without plotting |
| 21 | +echo clean to clean HTML files |
| 22 | +echo linkcheck to check all external links for integrity |
| 23 | +echo linkcheck-grep to grep the linkcheck result |
| 24 | +echo view to view the built HTML |
| 25 | +goto :eof |
| 26 | + |
| 27 | +:html |
| 28 | +%SPHINXBUILD% . _build\html -b html %SPHINXOPTS% |
| 29 | +goto :eof |
| 30 | + |
| 31 | +:html-noplot |
| 32 | +%SPHINXBUILD% . _build\html -b html %SPHINXOPTS% -D plot_gallery=0 |
| 33 | +goto :eof |
| 34 | + |
| 35 | +:clean |
| 36 | +rmdir /s /q _build generated |
| 37 | +goto :eof |
| 38 | + |
| 39 | +:linkcheck |
| 40 | +%SPHINXBUILD% . _build\linkcheck -b linkcheck -D plot_gallery=0 |
| 41 | +goto :eof |
| 42 | + |
| 43 | +:linkcheck-grep |
| 44 | +findstr /C:"[broken]" _build\linkcheck\output.txt > nul |
| 45 | +if %errorlevel% equ 0 ( |
| 46 | + echo Lines with [broken]: |
| 47 | + findstr /C:"[broken]" _build\linkcheck\output.txt |
| 48 | +) else ( |
| 49 | + echo No lines with [broken] found. |
| 50 | +) |
| 51 | +goto :eof |
33 | 52 |
|
34 | | -:end |
35 | | -popd |
| 53 | +:view |
| 54 | +python -c "import webbrowser; webbrowser.open_new_tab(r'file:///%cd%\_build\html\index.html')" |
| 55 | +goto :eof |
0 commit comments