Skip to content

Commit abf9b4e

Browse files
committed
[doc] Use the dedicated cmake variable to set the version directly
1 parent ff37b57 commit abf9b4e

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ cmake_policy(VERSION ${CMAKE_VERSION})
2727
project(app4triqs VERSION 4.0.0 LANGUAGES CXX)
2828
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
2929

30+
# version displayed in the documentation
31+
set(BRANCH_FOR_DOC ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.x)
32+
3033
# ############
3134
# Load TRIQS
3235
find_package(TRIQS 4.0 REQUIRED)

doc/conf.py.in

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ autosummary_generate = True
4848
autosummary_imported_members = False
4949

5050
project = '@PROJECT_NAME@'
51-
version = '@PROJECT_VERSION@'
52-
version_suffix = '@VERSION_SUFFIX@'
51+
version = '@BRANCH_FOR_DOC@'
5352

5453
# this makes the current project version available as var in every rst file
5554
rst_epilog = """
@@ -100,9 +99,7 @@ html_context = {
10099
# Version switcher flyout (rendered by _templates/versions.html, which
101100
# overrides the empty versions.html shipped by sphinx_rtd_theme 3.x). The
102101
# list is static -- update it when a new release line is published.
103-
# current_version is the "v: <x>" label: "unstable" on the dev branch (set
104-
# via VERSION_SUFFIX in the top-level CMakeLists.txt), else this release line.
105-
'current_version': '@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.x' if version_suffix == '' else 'unstable',
102+
'current_version': version,
106103
'versions': [
107104
['unstable', 'https://triqs.github.io/@PROJECT_NAME@/unstable/'],
108105
['4.0.x', 'https://triqs.github.io/@PROJECT_NAME@/4.0.x/'],
@@ -180,7 +177,7 @@ def mark_autosummary_sources(app, docname, source):
180177
Sphinx hook to mark rst files that contain an autosummary directive.
181178

182179
This is needed in the processing hook to identify files with autosummary
183-
directives.
180+
directives.
184181

185182
Parameters
186183
----------
@@ -222,7 +219,7 @@ def process_docstring(app, what, name, obj, options, lines):
222219
"""
223220
if not lines:
224221
return
225-
222+
226223
# process doc string only for autosummary tables
227224
docname = app.env.temp_data.get('docname') or getattr(app.env, 'docname', None)
228225
if docname in getattr(app.env, "_docs_with_autosummary", set()):
@@ -233,7 +230,7 @@ def process_docstring(app, what, name, obj, options, lines):
233230
first_line = lines[first_idx] if first_idx is not None else None
234231
if not first_line:
235232
return
236-
233+
237234
# handle wrapped classes with no description
238235
if first_line == 'Dispatched C++ constructor(s).' or first_line == 'Synthesized constructor with the following keyword arguments:':
239236
# somehow this not only changes the table but also the actual documentation page
@@ -258,7 +255,7 @@ def process_docstring(app, what, name, obj, options, lines):
258255
match = _dispatched_desc_re.match(doc_str)
259256

260257
# we only care about lines[0] since autosummary uses it for the function table
261-
lines[0] = match.group(2) if match.group(1) else doc_str
258+
lines[0] = match.group(2) if match.group(1) else doc_str
262259
lines[1] = ''
263260

264261

doc/doxygen/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = TRIQS/@PROJECT_NAME@
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = @PROJECT_VERSION@
51+
PROJECT_NUMBER = @BRANCH_FOR_DOC@
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewers a

0 commit comments

Comments
 (0)