From acd3234a19720c4ad26de92e37430cada30ce6f6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Dec 2022 10:16:38 -0500 Subject: Fix version in documentation --- doc/conf.py | 95 -------------------------------------------------------- doc/conf.py.in | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/meson.build | 14 +++++++-- 3 files changed, 108 insertions(+), 97 deletions(-) delete mode 100644 doc/conf.py create mode 100644 doc/conf.py.in diff --git a/doc/conf.py b/doc/conf.py deleted file mode 100644 index e8a057c..0000000 --- a/doc/conf.py +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2021-2022 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -# Project information - -project = "Zix" -copyright = "2011-2022, David Robillard" -author = "David Robillard" -release = "dev" -desc = "A lightweight C library of portability wrappers and data structures" - -# General configuration - -exclude_patterns = ["xml"] -language = "en" -nitpicky = True -pygments_style = "friendly" - -# Ignore everything opaque or external for nitpicky mode -_opaque = [ - "FILE", - "ZixAllocator", - "ZixAllocatorImpl", - "ZixBTree", - "ZixBTreeImpl", - "ZixBTreeNode", - "ZixBTreeNodeImpl", - "ZixHash", - "ZixHashImpl", - "ZixRing", - "ZixRingImpl", - "ZixSem", - "ZixSemImpl", - "ZixTree", - "ZixTreeImpl", - "ZixTreeIter", - "ZixTreeNode", - "ZixTreeNodeImpl", - "int64_t", - "pthread_t", - "ptrdiff_t", - "size_t", - "uint16_t", - "uint32_t", - "uint64_t", - "uint8_t", -] - -_c_nitpick_ignore = map(lambda x: ("c:identifier", x), _opaque) -_cpp_nitpick_ignore = map(lambda x: ("cpp:identifier", x), _opaque) -nitpick_ignore = list(_c_nitpick_ignore) + list(_cpp_nitpick_ignore) - -# HTML output - -html_copy_source = False -html_short_title = "Zix" -html_theme = "sphinx_lv2_theme" - -if tags.has("singlehtml"): - html_sidebars = { - "**": [ - "globaltoc.html", - ] - } - - html_theme_options = { - "body_max_width": "48em", - "body_min_width": "48em", - "description": desc, - "show_footer_version": True, - "show_logo_version": True, - "logo_name": True, - "logo_width": "8em", - "nosidebar": False, - "page_width": "80em", - "sidebar_width": "18em", - "globaltoc_maxdepth": 3, - "globaltoc_collapse": False, - } - -else: - html_theme_options = { - "body_max_width": "60em", - "body_min_width": "40em", - "description": desc, - "show_footer_version": True, - "show_logo_version": True, - "logo_name": True, - "logo_width": "8em", - "nosidebar": True, - "page_width": "60em", - "sidebar_width": "14em", - "globaltoc_maxdepth": 1, - "globaltoc_collapse": True, - } diff --git a/doc/conf.py.in b/doc/conf.py.in new file mode 100644 index 0000000..d6994ec --- /dev/null +++ b/doc/conf.py.in @@ -0,0 +1,96 @@ +# Copyright 2021-2022 David Robillard +# SPDX-License-Identifier: 0BSD OR ISC + +# Project information + +project = "Zix" +copyright = "2011-2022, David Robillard" +author = "David Robillard" +release = "@ZIX_VERSION@" +version = "@ZIX_VERSION@" +desc = "A lightweight C library of portability wrappers and data structures" + +# General configuration + +exclude_patterns = ["xml"] +language = "en" +nitpicky = True +pygments_style = "friendly" + +# Ignore everything opaque or external for nitpicky mode +_opaque = [ + "FILE", + "ZixAllocator", + "ZixAllocatorImpl", + "ZixBTree", + "ZixBTreeImpl", + "ZixBTreeNode", + "ZixBTreeNodeImpl", + "ZixHash", + "ZixHashImpl", + "ZixRing", + "ZixRingImpl", + "ZixSem", + "ZixSemImpl", + "ZixTree", + "ZixTreeImpl", + "ZixTreeIter", + "ZixTreeNode", + "ZixTreeNodeImpl", + "int64_t", + "pthread_t", + "ptrdiff_t", + "size_t", + "uint16_t", + "uint32_t", + "uint64_t", + "uint8_t", +] + +_c_nitpick_ignore = map(lambda x: ("c:identifier", x), _opaque) +_cpp_nitpick_ignore = map(lambda x: ("cpp:identifier", x), _opaque) +nitpick_ignore = list(_c_nitpick_ignore) + list(_cpp_nitpick_ignore) + +# HTML output + +html_copy_source = False +html_short_title = "@ZIX_TITLE@" +html_theme = "sphinx_lv2_theme" + +if tags.has("singlehtml"): + html_sidebars = { + "**": [ + "globaltoc.html", + ] + } + + html_theme_options = { + "body_max_width": "48em", + "body_min_width": "48em", + "description": desc, + "show_footer_version": True, + "show_logo_version": True, + "logo_name": True, + "logo_width": "8em", + "nosidebar": False, + "page_width": "80em", + "sidebar_width": "18em", + "globaltoc_maxdepth": 3, + "globaltoc_collapse": False, + } + +else: + html_theme_options = { + "body_max_width": "60em", + "body_min_width": "40em", + "description": desc, + "show_footer_version": True, + "show_logo_version": True, + "logo_name": True, + "logo_width": "8em", + "nosidebar": True, + "page_width": "60em", + "sidebar_width": "14em", + "globaltoc_maxdepth": 1, + "globaltoc_collapse": True, + } diff --git a/doc/meson.build b/doc/meson.build index e08de60..74c66f2 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -42,7 +42,6 @@ if build_docs ) c_doc_files = c_rst_files + files( - 'conf.py', 'overview_code.c', ) @@ -50,6 +49,17 @@ if build_docs configure_file(copy: true, input: f, output: '@PLAINNAME@') endforeach + config = configuration_data() + config.set('ZIX_VERSION', meson.project_version()) + config.set('ZIX_SRCDIR', zix_src_root) + config.set('ZIX_TITLE', get_option('title')) + + conf_py = configure_file( + configuration: config, + input: files('conf.py.in'), + output: 'conf.py', + ) + subdir('xml') subdir('api') @@ -61,7 +71,7 @@ if build_docs '-q', ] - doc_inputs = c_rst_files + [c_zix_rst, c_index_xml] + doc_inputs = c_rst_files + [conf_py, c_zix_rst, c_index_xml] custom_target( 'singlehtml', -- cgit v1.2.1