File: sphinx-multiversion.1

package info (click to toggle)
sphinx-multiversion 0.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 228 kB
  • sloc: python: 767; makefile: 12
file content (228 lines) | stat: -rw-r--r-- 6,994 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
.nh
.TH SPHINX-MULTIVERSION 1  "AGO 2022" "User Manuals"
.SH NAME
.PP
sphinx-multiversion - add support for multiple version to sphinx

.PP
.SH SYNOPSIS
   sphinx‐multiversion [POSITION] [argument]

.PP
.SH DESCRIPTION
   sphinx‐multiversion  ‐ Sphinx extension for building self‐hosted versioned documenta‐
   tion. Aims to provide a clean implementation that tries to avoid messing with Sphinx
   internals as much as possible.

.PP
.SH USAGE

.PP
a) sphinx‐multiversion [‐h] [‐d]

.PP
b) sphinx‐multiversion [‐c PATCH] [‐C]

.PP
c) sphinx‐multiversion [‐D setting=value][‐‐dump‐metadata]

.PP
d) sphinx‐multiversion [sourcedir] [outputdir] [filenames ...]

.PP
.SH OPTIONS

.PP
a) sphinx‐multiversion ‐h
   show this help message and exit

.PP
b) sphinx‐multiversion ‐c PATH
   path where configuration file (conf.py) is located (default: same as SOURCEDIR)

.PP
c) sphinx‐multiversion ‐C
   use no config file at all, only ‐D options

.PP
d) sphinx‐multiversion ‐D setting=value
   override a setting in configuration file

.PP
e) sphinx‐multiversion ‐‐dump‐metadata
   dump generated metadata and exit

.PP
.SH CONFIGURATION
   sphinx‐multiversion reads your Sphinx conf.py file for configuration. As usual,
   you can also override certain options by using ‐D var=value on the command line.
   his is what the default configuration looks like:

.PP
a) Whitelist pattern for tags (set to None to ignore all tags)
   smv_tag_whitelist = \\r\\/’\\^.*\\$\\/’

.PP
b) Whitelist pattern for branches (set to None to  ignore  all branches)
   smv_branch_whitelist = r\\/’\\^.*\\$\\/’

.PP
c)  Whitelist pattern for remotes (set to None to use local branches only)
    smv_remote_whitelist = None

.PP
d) Pattern for released versions
   smv_released_pattern = r\\/’\\^tags/.*\\$\\/’

.PP
e) Format for versioned output directories  inside  the  build directory
   smv_outputdir_format = \\/’{ref.name}\\/’

.PP
f) etermines whether remote  or local git branches/tags are preferred if their output dirs conflict
   smv_prefer_remote_refs = False

.PP
   Note:
   You can check which tags/branches are matched by running sphinx‐multiversion with
   the ‐‐dump‐metadata flag. Branches or tags that don’t contain both the sphinx source
   directory and the conf.py file will be skipped automatically. You can override all of
   these values inside your conf.py.

.PP
.SH EXAMPLES

Tag/Branch/Remote whitelists

.PP
Tags, Branches and Remotes are included by Regular Expressions
Here are  some  exam‐ ples:

.PP
a) smv_tag_whitelist = r\\/’\\^.*\\$\\/’ #Include all tags

.PP
b) smv_tag_whitelist = r\\/’\\^v+.+\\$\\/’ # Include tags like \\"v2.1\\"

.PP
c) smv_branch_whitelist = r\\/’\\^.*\\$\\/’ #Include all branches

.PP
d) smv_branch_whitelist = r\\/’\\^(?!master).*\\$\\/’ #Include all branches except \\"master\\"

.PP
e) smv_remote_whitelist = None Only #use local branches

.PP
f) smv_remote_whitelist = r\\/’\\^.*\\$\\/’  #Use branches from all remotes

.PP
g) smv_remote_whitelist = r\\/’\\^(origin|upstream)\\$\\/’ #Use branches from origin and upstream

.PP
Note:
   To list values to match, you can use git branch, git  tag  and git remote

Release Pattern

.PP
A  Regular Expression is used to determine if a version of the
   documentation has been released or if it’s  a  development  version. To allow more
   flexibility, the regex is evaluated over the full refname.

.PP
   Here are some examples:

.PP
a) smv_released_pattern = \\r\\/’\\^tags/.*\\$\\/’ #Tags only

.PP
b) smv_released_pattern = \\r\\/’\\^heads/+.+\\$\\/’ #Branches like \\"2.1\\"

.PP
c) smv_released_pattern = \\r\\/’\\^(tags/.*|heads/+.+)\\$\\/’ # Branches like \\"2.1\\" and all tags

.PP
d) smv_released_pattern = \\r\\/’\\^(heads|remotes/[\\^/]+)/(?!:master).*\\$\\/’
      Everything except master branch

.PP
   Note:
   To list all refnames, you can use:
   git for‐each‐ref ‐‐format \\"%(refname)\\" | sed \\/’s/\\^refs//g\\/’

.PP
   Output Directory Format

.PP
   Each version  will  be built into a separate subdirectory of the Sphinx output direc‐
   tory. The smv_outputdir_format setting determines the directory  structure for the
   subdirectories.  It  is  a  new‐style Python formatting string with two parameters 
   ‐ ref and config.

.PP
   Here are some examples:
.PP
a) smv_outputdir_format = \\/’{ref.name}\\/’ #Use the branch/tag name

.PP
b) smv_outputdir_format = \\/’{ref.commit}\\/’ # Use the commit hash

.PP
c) smv_outputdir_format = \\/’{ref.commit:.7s}\\/’ # Use the commit hash truncated to 7 characters

.PP
d)  smv_outputdir_format = \\/’{ref.refname}\\/’ #Use the full refname

.PP
e) smv_outputdir_format = \\/’{ref.source}/{ref.name}\\/’ # Equivalent to the previous example

.PP
f) smv_outputdir_format = \\/’versions/{config.release}\\/’ #Use \\"versions\\" as parent directory
   and the \\"release\\" variable from conf.py

.PP
g) smv_outputdir_format = \\/’{config.version}/{ref.name}\\/’ #Use  the  version  from conf.py as
   parent directory and the branch/tag name as subdirectory

.PP
   Overriding Configuration Variables

.PP 
   You can override configuration variables the  same  way as you’re used to with sphinx‐
   build. Since sphinx‐multiversion copies the branch data into a temporary directory and
   builds them there while leaving the current working directory unchanged, relative
   paths in your conf.py will refer to the path of the version you’re building from,
   not the path of the version you are trying to build documentation for.

.PP
   Sometimes it might be necessary to override the configured path via a command line
   override. sphinx‐multiversion allows you to insert placeholders into your override
   strings that will automatically be replaced with the correct value for  the  version
   you’re building the documentation for.

.PP
   Here’s an example for the exhale  extension:   sphinx‐multiversion docs build/html ‐D
   \\exhale_args.containmentFolder=\\$
    Note:

.PP
   Make sure to enclose  the  override string in single quotes (\\/’) to prevent the shell
   from  treating it as an environment variable and replacing it before it’s passed to
   sphinx‐multiversion. To  see a list of available placeholder names and their values
   for each version  you can use the ‐‐dump‐metadata flag.

.PP
.SH SEE ALSO
   Have a look at PyFormat for information how to use  new‐style Python formatting.

.PP
.SH AUTHOR
   Jan Holthuis jan.holthuis@ruhr‐uni‐bochum.de ⟨mailto:jan.holthuis@ruhr‐uni‐
   bochum.de⟩ Based on https://github.com/Holzhaus/sphinx‐ multiversion/blob/mas‐
   ter/README.md.

.PP
   Josenilson Ferreira da Silva  nilsonfsilva@hotmail.com ⟨mailto:nilsonfsilva@hot‐
   mail.com⟩ Created this man‐page on markdown, and used go‐md2man to generate the man‐
   ual file.