weblate/docs/Makefile
Gersona 725bd96349
feat(docs): Automatically generate format features docmentation (#18106)
* initial implementation suggestion

* basic supported features snippets generation

* Add API identifiers, read-only strings and common extensions to features table

* generate doc features snippet files

* autogenerated snippets cleanup

* changelog update

* delete one file to test auto-update

* replace SUPPORTS_FUZZY with file format additional_states flag

* docs: Documentation snippets update

* fix include statetement typo

* fix incorrect monolingual attributes

* minor styling change

* docs: Documentation snippets update

* exclude snippets from being treated as standalone documents

* Set YAMLFormat as both mono/bilingual

* docs: Documentation snippets update

* fix duplicate format IDs

* only use backwards quotes for literals

---------

Co-authored-by: gersona <6675010+gersona@users.noreply.github.com>
Co-authored-by: Michal Čihař <michal@weblate.org>
2026-04-01 15:41:20 +00:00

58 lines
2.1 KiB
Makefile

# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command-line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile update-screenshots update-schemas update-openapi update-docs run-selenium
run-selenium:
@rm -rf ../data-test ../test-images
@cd .. && \
. scripts/test-database.sh && \
pytest -n 3 weblate/trans/tests/test_selenium.py
SCREENSHOTS = $(wildcard screenshots/*.webp)
../test-images/%.png: run-selenium
@true
screenshots/%.webp: ../test-images/%.png run-selenium
@echo "Processing $@"
@convert $< $@
update-screenshots: $(SCREENSHOTS)
@echo $(SCREENSHOTS)
update-schemas:
@cp $$(uv run --no-sync ../scripts/get-schemas-dir.py)/schemas/* specs/schemas/
update-openapi:
@WEBLATE_HIDE_VERSION=1 uv run --no-sync ../manage.py spectacular --skip-checks --fail-on-warn --validate > specs/openapi.yaml
update-docs:
@uv run --no-sync ../manage.py list_addons -o snippets/addons-autogenerated.rst
@uv run --no-sync ../manage.py list_machinery -o snippets/machines-autogenerated.rst
@uv run --no-sync ../manage.py list_file_format_params > snippets/file-format-parameters.rst
@uv run --no-sync ../manage.py list_permissions --sections perms > snippets/permissions.rst
@uv run --no-sync ../manage.py list_permissions --sections roles > snippets/roles.rst
@uv run --no-sync ../manage.py list_checks -s checks -o snippets/checks-autogenerated.rst
@uv run --no-sync ../manage.py list_checks -s flags -o snippets/check-flags-autogenerated.rst
@uv run --no-sync ../manage.py list_format_features -o snippets/format-features
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)