From be8cd94afc414fe83a43ae5c86223b85ddd6f487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Mon, 29 May 2023 17:07:21 +0200 Subject: [PATCH] Add live HTML preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Żygowski --- Makefile | 5 ++++- README.md | 16 +++++++++++----- make.bat | 4 ++++ requirements.txt | 3 ++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b7fcd7e..d5f9900 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,10 @@ BUILDDIR = build help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +livehtml: + sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help livehtml Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). diff --git a/README.md b/README.md index 30a1883..eba0b91 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ For more details please refer to the [methodology documentation](docs/methodolog Python requirements: -``` +```bash virtualenv -p $(which python3) venv source venv/bin/activate pip install -r requirements.txt @@ -102,14 +102,20 @@ We use [Python Docstring](https://peps.python.org/pep-0257/) in [Sphinx format](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html) to generate detailed code documentation automatically. -To view the documentation run the following: +To generate the documentation run the following: -``` +```bash (venv) make html -(venv) python -m http.server -d build/html 8080 +python -m http.server 8000 ``` -Open the web browser and type `localhost:8080` as address. Or alternatively +For live preview run: + +```bash +(venv) make livehtml +``` + +Open the web browser and type `localhost:8000` as address. Or alternatively open `build/html/index.html` file in the web browser directly. ## Checking Python style diff --git a/make.bat b/make.bat index 5bbbd44..4844689 100644 --- a/make.bat +++ b/make.bat @@ -24,6 +24,7 @@ if errorlevel 9009 ( ) if "%1" == "" goto help +if "%1" == "livehtml" goto help %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end @@ -31,5 +32,8 @@ goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +:livehtml +sphinx-autobuild %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + :end popd diff --git a/requirements.txt b/requirements.txt index 760a81d..c00c380 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ bluepy sphinx +sphinx-autobuild sphinx-rtd-theme matplotlib -pycodestyle \ No newline at end of file +pycodestyle