json/docs/docset/Makefile
Niels Lohmann 26cfec34be
Some checks failed
Code scanning - action / CodeQL-Build (push) Waiting to run
macOS / macos-13 (14.1) (push) Waiting to run
macOS / macos-13 (14.2) (push) Waiting to run
macOS / macos-13 (14.3) (push) Waiting to run
macOS / macos-13 (14.3.1) (push) Waiting to run
macOS / macos-13 (15.0.1) (push) Waiting to run
macOS / macos-13 (15.1) (push) Waiting to run
macOS / macos-13 (15.2) (push) Waiting to run
macOS / macos-14 (15.3) (push) Waiting to run
macOS / macos-14 (15.4) (push) Waiting to run
macOS / macos-15 (16.0) (push) Waiting to run
macOS / macos-15 (16.1) (push) Waiting to run
macOS / macos-15 (16.2) (push) Waiting to run
macOS / xcode_standards (11) (push) Waiting to run
macOS / xcode_standards (14) (push) Waiting to run
macOS / xcode_standards (17) (push) Waiting to run
macOS / xcode_standards (20) (push) Waiting to run
macOS / xcode_standards (23) (push) Waiting to run
macOS / xcode_standards (26) (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Ubuntu / ci_test_gcc (push) Waiting to run
Ubuntu / ci_infer (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_cppcheck) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_cpplint) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_non_git_tests) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_offline_testdata) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_reproducible_tests) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_reuse_compliance) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_test_amalgamation) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_test_single_header) (push) Waiting to run
Ubuntu / ci_static_analysis_ubuntu (ci_test_valgrind) (push) Waiting to run
Ubuntu / ci_static_analysis_clang (ci_clang_analyze) (push) Waiting to run
Ubuntu / ci_static_analysis_clang (ci_clang_tidy) (push) Waiting to run
Ubuntu / ci_static_analysis_clang (ci_single_binaries) (push) Waiting to run
Ubuntu / ci_static_analysis_clang (ci_test_clang) (push) Waiting to run
Ubuntu / ci_static_analysis_clang (ci_test_clang_sanitizer) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_cmake_flags) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_diagnostic_positions) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_diagnostics) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_legacycomparison) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_noexceptions) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_noglobaludls) (push) Waiting to run
Ubuntu / ci_cmake_options (ci_test_noimplicitconversions) (push) Waiting to run
Ubuntu / ci_test_coverage (push) Waiting to run
Ubuntu / ci_test_compilers_gcc_old (4.8) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc_old (4.9) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc_old (5) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc_old (6) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (10) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (11) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (12) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (13) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (14) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (7) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (8) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (9) (push) Waiting to run
Ubuntu / ci_test_compilers_gcc (latest) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (10) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (11) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (12) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (13) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (14) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (15-bullseye) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (16) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (17) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (18) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (19) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.4) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.5) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.6) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.7) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.8) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (3.9) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (4) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (5) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (6) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (7) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (8) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (9) (push) Waiting to run
Ubuntu / ci_test_compilers_clang (latest) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (11) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (14) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (17) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (20) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (23) (push) Waiting to run
Ubuntu / ci_test_standards_gcc (26) (push) Waiting to run
Ubuntu / ci_test_standards_clang (11, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (11, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (14, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (14, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (17, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (17, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (20, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (23, libstdcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (26, libcxx) (push) Waiting to run
Ubuntu / ci_test_standards_clang (26, libstdcxx) (push) Waiting to run
Ubuntu / ci_cuda_example (push) Waiting to run
Ubuntu / ci_icpc (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_build_documentation) (push) Waiting to run
Ubuntu / ci_test_documentation (ci_test_examples) (push) Waiting to run
Windows / mingw (x64) (push) Waiting to run
Windows / mingw (x86) (push) Waiting to run
Windows / msvc2019 (Win32, Debug) (push) Waiting to run
Windows / msvc2019 (Win32, Release) (push) Waiting to run
Windows / msvc2019 (x64, Debug) (push) Waiting to run
Windows / msvc2019 (x64, Release) (push) Waiting to run
Windows / msvc2019_latest (push) Waiting to run
Windows / msvc2022 (Win32, Debug) (push) Waiting to run
Windows / msvc2022 (Win32, Release) (push) Waiting to run
Windows / msvc2022 (x64, Debug) (push) Waiting to run
Windows / msvc2022 (x64, Release) (push) Waiting to run
Windows / msvc2022_latest (push) Waiting to run
Windows / clang (11) (push) Waiting to run
Windows / clang (12) (push) Waiting to run
Windows / clang (13) (push) Waiting to run
Windows / clang (14) (push) Waiting to run
Windows / clang (15) (push) Waiting to run
Windows / clang-cl-11 (Win32) (push) Waiting to run
Windows / clang-cl-11 (x64) (push) Waiting to run
Publish documentation / publish_documentation (push) Has been cancelled
Clean up and document project files (#4560)
2025-01-17 06:53:35 +01:00

89 lines
3.6 KiB
Makefile

SHELL=/usr/bin/env bash
SED ?= $(shell which gsed 2>/dev/null || which sed)
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
.PHONY: all
all: JSON_for_Modern_C++.tgz
docSet.dsidx: docSet.sql
# generate index
sqlite3 docSet.dsidx <docSet.sql
JSON_for_Modern_C++.docset: Info.plist docSet.dsidx
rm -fr JSON_for_Modern_C++.docset JSON_for_Modern_C++.tgz
mkdir -p JSON_for_Modern_C++.docset/Contents/Resources/Documents/
cp icon*.png JSON_for_Modern_C++.docset
cp Info.plist JSON_for_Modern_C++.docset/Contents
# build and copy documentation
$(MAKE) install_venv -C ../mkdocs
$(MAKE) build -C ../mkdocs
cp -r ../mkdocs/site/* JSON_for_Modern_C++.docset/Contents/Resources/Documents
# patch CSS to hide navigation items
echo -e "\n\nheader, footer, nav.md-tabs, nav.md-tabs--active, div.md-sidebar--primary, a.md-content__button { display: none; }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)"
# fix spacing
echo -e "\n\ndiv.md-sidebar div.md-sidebar--secondary, div.md-main__inner { top: 0; margin-top: 0 }" >> "$$(ls JSON_for_Modern_C++.docset/Contents/Resources/Documents/assets/stylesheets/main.*.min.css)"
# remove "JSON for Modern C++" from page titles (fallback)
find JSON_for_Modern_C++.docset/Contents/Resources/Documents -type f -exec $(SED) -i 's| - JSON for Modern C++</title>|</title>|' {} +
# replace page titles with name from index, if available
for page in $(MKDOCS_PAGES); do \
case "$$page" in \
*/index.md) path=$${page/\/index.md/} ;; \
*) path=$${page/.md/} ;; \
esac; \
title=$$(sqlite3 docSet.dsidx "SELECT name FROM searchIndex WHERE path='$$path/index.html'" | tr '\n' ',' | $(SED) -e 's/,/, /g' -e 's/, $$/\n/'); \
if [ "x$$title" != "x" ]; then \
$(SED) -i "s%<title>.*</title>%<title>$$title</title>%" "JSON_for_Modern_C++.docset/Contents/Resources/Documents/$$path/index.html"; \
fi \
done
# clean up
rm JSON_for_Modern_C++.docset/Contents/Resources/Documents/sitemap.*
# copy index
cp docSet.dsidx JSON_for_Modern_C++.docset/Contents/Resources/
JSON_for_Modern_C++.tgz: JSON_for_Modern_C++.docset
tar --exclude='.DS_Store' -cvzf JSON_for_Modern_C++.tgz JSON_for_Modern_C++.docset
# install docset for Zeal documentation browser (https://zealdocs.org/)
.PHONY: install_docset_zeal
install_docset_zeal: JSON_for_Modern_C++.docset
docset_root=$${XDG_DATA_HOME:-$$HOME/.local/share}/Zeal/Zeal/docsets; \
rm -rf $$docset_root/JSON_for_Modern_C++.docset; \
mkdir -p $$docset_root; \
cp -r JSON_for_Modern_C++.docset $$docset_root/
# list mkdocs pages missing from the docset index
.PHONY: list_missing_pages
list_missing_pages: docSet.dsidx
@for page in $(MKDOCS_PAGES); do \
case "$$page" in \
*/index.md) path=$${page/\/index.md/} ;; \
*) path=$${page/.md/} ;; \
esac; \
if [ "x$$page" != "xindex.md" -a "x$$(sqlite3 docSet.dsidx "SELECT COUNT(*) FROM searchIndex WHERE path='$$path/index.html'")" = "x0" ]; then \
echo $$page; \
fi \
done
# list paths in the docset index without a corresponding mkdocs page
.PHONY: list_removed_paths
list_removed_paths: docSet.dsidx
@for path in $$(sqlite3 docSet.dsidx "SELECT path FROM searchIndex"); do \
page=$${path/\/index.html/.md}; \
page_index=$${path/index.html/index.md}; \
page_found=0; \
for p in $(MKDOCS_PAGES); do \
if [ "x$$p" = "x$$page" -o "x$$p" = "x$$page_index" ]; then \
page_found=1; \
fi \
done; \
if [ "x$$page_found" = "x0" ]; then \
echo $$path; \
fi \
done
.PHONY: clean
clean:
rm -f docSet.dsidx
rm -fr JSON_for_Modern_C++.docset JSON_for_Modern_C++.tgz