Skip to content

Commit 6b1ee62

Browse files
authored
Make doc link references version dependent. (#1864)
1 parent 5e9a3ca commit 6b1ee62

File tree

5 files changed

+49
-41
lines changed

5 files changed

+49
-41
lines changed

doc/conf.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,28 @@
1414
from pymodbus import __version__ as pymodbus_version
1515

1616

17-
parent_dir = os.path.abspath(os.pardir)
18-
sys.path.insert(0, parent_dir)
19-
sys.path.append(os.path.join(parent_dir, "examples"))
20-
github_doc_root = "https://github.com/pymodbus-dev/pymodbus/tree/master/doc/"
21-
2217
# -- General configuration ------------------------------------------------
23-
extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme", "sphinx.ext.autosectionlabel"]
18+
extensions = [
19+
"sphinx.ext.autodoc",
20+
"sphinx.ext.extlinks",
21+
"sphinx_rtd_theme",
22+
"sphinx.ext.autosectionlabel"
23+
]
2424
source_suffix = [".rst"]
25-
master_doc = "index"
25+
root_doc = "index"
2626
project = "PyModbus"
2727
copyright = "See license"
2828
author = "Open Source volunteers"
29-
version = pymodbus_version
29+
if "dev" in pymodbus_version:
30+
version = "dev"
31+
else:
32+
version = "v" + pymodbus_version
3033
release = pymodbus_version
3134
language = "en"
3235
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]
3336
pygments_style = "sphinx"
3437
todo_include_todos = False
3538

36-
3739
# -- Options for HTML output ----------------------------------------------
3840
html_theme = "sphinx_rtd_theme"
3941
html_static_path = []
@@ -44,13 +46,19 @@
4446
]
4547
}
4648

49+
# -- Specials ----------------------------------------------
50+
parent_dir = os.path.abspath(os.pardir)
51+
sys.path.insert(0, parent_dir)
52+
sys.path.append(os.path.join(parent_dir, "examples"))
53+
github = f"https://github.com/pymodbus-dev/pymodbus/blob/{version}/"
54+
extlinks = {'github': (github + '%s', '%s')}
4755

4856
def setup(app):
4957
"""Do setup."""
5058
app.add_config_value(
5159
"recommonmark_config",
5260
{
53-
"url_resolver": lambda url: github_doc_root + url,
61+
"url_resolver": lambda url: github + "doc/" + url,
5462
"auto_toc_tree_section": "Contents",
5563
},
5664
True,

doc/source/REPL.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Pymodbus REPL comes with many handy features such as payload decoder
346346
to directly retrieve the values in desired format and supports all
347347
the diagnostic function codes directly .
348348

349-
For more info on REPL Client refer `Pymodbus REPL Client <https://github.com/pymodbus-dev/pymodbus/blob/dev/pymodbus/repl/client/README.rst>`_
349+
For more info on REPL Client refer :github:`pymodbus/repl/client/README.rst`
350350

351351
.. image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
352352
:target: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o
@@ -357,7 +357,7 @@ Pymodbus REPL Server
357357

358358
Pymodbus also comes with a REPL server to quickly run an asynchronous server with additional capabilities out of the box like simulating errors, delay, mangled messages etc.
359359

360-
For more info on REPL Server refer `Pymodbus REPL Server <https://github.com/pymodbus-dev/pymodbus/blob/dev/pymodbus/repl/server/README.rst>`_
360+
For more info on REPL Server refer :github:`pymodbus/repl/server/README.rst`
361361

362362
.. image:: https://img.youtube.com/vi/OutaVz0JkWg/maxresdefault.jpg
363363
:target: https://youtu.be/OutaVz0JkWg

doc/source/client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It is allowed to have multiple client objects that e.g. each communicate with a
1616
Client performance
1717
------------------
1818
There are currently a big performance gab between the 2 clients
19-
(try it on your computer `performance test <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_performance.py>`_).
19+
(try it on your computer :github:`examples/client_performance.py`).
2020
This is due to a rather old implementation of the synchronous client, we are currently working to update the client code.
2121
Our aim is to achieve a similar data rate with both clients and at least double the data rate while keeping the stability.
2222
Table below is a test with 1000 calls each reading 10 registers.

doc/source/examples.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ You need to modify the code to adapt it to your situation.
2020

2121
Simple asynchronous client
2222
^^^^^^^^^^^^^^^^^^^^^^^^^^
23-
Source: `examples/simple_async_client.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/simple_async_client.py>`_
23+
Source: :github:`examples/simple_async_client.py`
2424

2525
.. literalinclude:: ../../examples/simple_async_client.py
2626

2727
Simple synchronous client
2828
^^^^^^^^^^^^^^^^^^^^^^^^^^
29-
Source: `examples/simple_sync_client.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/simple_sync_client.py>`_
29+
Source: :github:`examples/simple_sync_client.py`
3030

3131
.. literalinclude:: ../../examples/simple_sync_client.py
3232

3333

3434
Client performance sync vs async
3535
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36-
Source: `examples/client_performance.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_performance.py>`_
36+
Source: :github:`examples/client_performance.py`
3737

3838
.. literalinclude:: ../../examples/client_performance.py
3939

@@ -54,7 +54,7 @@ because they are tested automatilly with each dev branch commit using CI.
5454

5555
Client asynchronous calls
5656
^^^^^^^^^^^^^^^^^^^^^^^^^
57-
Source: `examples/client_async_calls.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_async_calls.py>`_
57+
Source: :github:`examples/client_async_calls.py`
5858

5959
.. automodule:: examples.client_async_calls
6060
:undoc-members:
@@ -63,7 +63,7 @@ Source: `examples/client_async_calls.py <https://github.com/pymodbus-dev/pymodbu
6363

6464
Client asynchronous
6565
^^^^^^^^^^^^^^^^^^^
66-
Source: `examples/client_async.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_async.py>`_
66+
Source: :github:`examples/client_async.py`
6767

6868
.. automodule:: examples.client_async
6969
:undoc-members:
@@ -72,7 +72,7 @@ Source: `examples/client_async.py <https://github.com/pymodbus-dev/pymodbus/blob
7272

7373
Client calls
7474
^^^^^^^^^^^^
75-
Source: `examples/client_calls.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_calls.py>`_
75+
Source: :github:`examples/client_calls.py`
7676

7777
.. automodule:: examples.client_calls
7878
:undoc-members:
@@ -81,7 +81,7 @@ Source: `examples/client_calls.py <https://github.com/pymodbus-dev/pymodbus/blob
8181

8282
Client custom message
8383
^^^^^^^^^^^^^^^^^^^^^
84-
Source: `examples/client_custom_msg.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_custom_msg.py>`_
84+
Source: :github:`examples/client_custom_msg.py`
8585

8686
.. automodule:: examples.client_custom_msg
8787
:undoc-members:
@@ -90,15 +90,15 @@ Source: `examples/client_custom_msg.py <https://github.com/pymodbus-dev/pymodbus
9090

9191
Client payload
9292
^^^^^^^^^^^^^^
93-
Source: `examples/client_payload.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_payload.py>`_
93+
Source: :github:`examples/client_payload.py`
9494

9595
.. automodule:: examples.client_payload
9696
:undoc-members:
9797
:noindex:
9898

9999
Client synchronous
100100
^^^^^^^^^^^^^^^^^^
101-
Source: `examples/client_sync.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/client_sync.py>`_
101+
Source: :github:`examples/client_sync.py`
102102

103103
.. automodule:: examples.client_sync
104104
:undoc-members:
@@ -107,7 +107,7 @@ Source: `examples/client_sync.py <https://github.com/pymodbus-dev/pymodbus/blob/
107107

108108
Server asynchronous
109109
^^^^^^^^^^^^^^^^^^^
110-
Source: `examples/server_async.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_async.py>`_
110+
Source: :github:`examples/server_async.py`
111111

112112
.. automodule:: examples.server_async
113113
:undoc-members:
@@ -116,7 +116,7 @@ Source: `examples/server_async.py <https://github.com/pymodbus-dev/pymodbus/blob
116116

117117
Server callback
118118
^^^^^^^^^^^^^^^
119-
Source: `examples/server_callback.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_callback.py>`_
119+
Source: :github:`examples/server_callback.py`
120120

121121
.. automodule:: examples.server_callback
122122
:undoc-members:
@@ -125,7 +125,7 @@ Source: `examples/server_callback.py <https://github.com/pymodbus-dev/pymodbus/b
125125

126126
Server tracer
127127
^^^^^^^^^^^^^
128-
Source: `examples/server_hook.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_hook.py>`_
128+
Source: :github:`examples/server_hook.py`
129129

130130
.. automodule:: examples.server_hook
131131
:undoc-members:
@@ -134,7 +134,7 @@ Source: `examples/server_hook.py <https://github.com/pymodbus-dev/pymodbus/blob/
134134

135135
Server payload
136136
^^^^^^^^^^^^^^
137-
Source: `examples/server_payload.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_payload.py>`_
137+
Source: :github:`examples/server_payload.py`
138138

139139
.. automodule:: examples.server_payload
140140
:undoc-members:
@@ -143,7 +143,7 @@ Source: `examples/server_payload.py <https://github.com/pymodbus-dev/pymodbus/bl
143143

144144
Server synchronous
145145
^^^^^^^^^^^^^^^^^^
146-
Source: `examples/server_sync.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_sync.py>`_
146+
Source: :github:`examples/server_sync.py`
147147

148148
.. automodule:: examples.server_sync
149149
:undoc-members:
@@ -152,7 +152,7 @@ Source: `examples/server_sync.py <https://github.com/pymodbus-dev/pymodbus/blob/
152152

153153
Server updating
154154
^^^^^^^^^^^^^^^
155-
Source: `examples/server_updating.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/server_updating.py>`_
155+
Source: :github:`examples/server_updating.py`
156156

157157
.. automodule:: examples.server_updating
158158
:undoc-members:
@@ -161,7 +161,7 @@ Source: `examples/server_updating.py <https://github.com/pymodbus-dev/pymodbus/b
161161

162162
Simulator example
163163
^^^^^^^^^^^^^^^^^
164-
Source: `examples/simulator.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/simulator.py>`_
164+
Source: :github:`examples/simulator.py`
165165

166166
.. automodule:: examples.simulator
167167
:undoc-members:
@@ -170,7 +170,7 @@ Source: `examples/simulator.py <https://github.com/pymodbus-dev/pymodbus/blob/de
170170

171171
Simulator datastore example
172172
^^^^^^^^^^^^^^^^^^^^^^^^^^^
173-
Source: `examples/datastore_simulator.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/datastore_simulator.py>`_
173+
Source: :github:`examples/datastore_simulator.py`
174174

175175
.. automodule:: examples.datastore_simulator
176176
:undoc-members:
@@ -179,7 +179,7 @@ Source: `examples/datastore_simulator.py <https://github.com/pymodbus-dev/pymodb
179179

180180
Message generator
181181
^^^^^^^^^^^^^^^^^
182-
Source: `examples/message_generator.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/message_generator.py>`_
182+
Source: :github:`examples/message_generator.py`
183183

184184
.. automodule:: examples.message_generator
185185
:undoc-members:
@@ -188,7 +188,7 @@ Source: `examples/message_generator.py <https://github.com/pymodbus-dev/pymodbus
188188

189189
Message Parser
190190
^^^^^^^^^^^^^^
191-
Source: `examples/message_parser.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/message_parser.py>`_
191+
Source: :github:`examples/message_parser.py`
192192

193193
.. automodule:: examples.message_parser
194194
:undoc-members:
@@ -197,7 +197,7 @@ Source: `examples/message_parser.py <https://github.com/pymodbus-dev/pymodbus/bl
197197

198198
Modbus forwarder
199199
^^^^^^^^^^^^^^^^
200-
Source: `examples/modbus_forwarder.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/modbus_forwarder.py>`_
200+
Source: :github:`examples/modbus_forwarder.py`
201201

202202
.. automodule:: examples.modbus_forwarder
203203
:undoc-members:
@@ -212,7 +212,7 @@ The pymodbus team thanks for sharing the examples.
212212

213213
Solar
214214
^^^^^
215-
Source: :`examples/contrib/solar.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/contrib/solar.py>`_
215+
Source: :github:`examples/contrib/solar.py`
216216

217217
.. automodule:: examples.contrib.solar
218218
:undoc-members:
@@ -221,7 +221,7 @@ Source: :`examples/contrib/solar.py <https://github.com/pymodbus-dev/pymodbus/bl
221221

222222
Redis datastore
223223
^^^^^^^^^^^^^^^
224-
Source: `examples/contrib/redis_datastore.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/contrib/redis_datastore.py>`_
224+
Source: :github:`examples/contrib/redis_datastore.py`
225225

226226
.. automodule:: examples.contrib.redis_datastore
227227
:undoc-members:
@@ -230,7 +230,7 @@ Source: `examples/contrib/redis_datastore.py <https://github.com/pymodbus-dev/py
230230

231231
Serial Forwarder
232232
^^^^^^^^^^^^^^^^
233-
Source: `examples/contrib/serial_forwarder.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/contrib/serial_forwarder.py>`_
233+
Source: :github:`examples/contrib/serial_forwarder.py`
234234

235235
.. automodule:: examples.contrib.serial_forwarder
236236
:undoc-members:
@@ -239,7 +239,7 @@ Source: `examples/contrib/serial_forwarder.py <https://github.com/pymodbus-dev/p
239239

240240
Sqlalchemy datastore
241241
^^^^^^^^^^^^^^^^^^^^
242-
Source: `examples/contrib/sql_datastore.py <https://github.com/pymodbus-dev/pymodbus/blob/dev/examples/contrib/sql_datastore.py>`_
242+
Source: :github:`examples/contrib/sql_datastore.py`
243243

244244
.. automodule:: examples.contrib.sql_datastore
245245
:undoc-members:

doc/source/library/simulator/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Server configuration examples
9090
"identity": {
9191
"VendorName": "pymodbus",
9292
"ProductCode": "PM",
93-
"VendorUrl": "https://github.com/riptideio/pymodbus/",
93+
"VendorUrl": "https://github.com/pymodbus-dev/pymodbus",
9494
"ProductName": "pymodbus Server",
9595
"ModelName": "pymodbus Server",
9696
"MajorMinorRevision": "3.1.0"
@@ -109,7 +109,7 @@ Server configuration examples
109109
"identity": {
110110
"VendorName": "pymodbus",
111111
"ProductCode": "PM",
112-
"VendorUrl": "https://github.com/riptideio/pymodbus/",
112+
"VendorUrl": "https://github.com/pymodbus-dev/pymodbus",
113113
"ProductName": "pymodbus Server",
114114
"ModelName": "pymodbus Server",
115115
"MajorMinorRevision": "3.1.0"
@@ -126,7 +126,7 @@ Server configuration examples
126126
"identity": {
127127
"VendorName": "pymodbus",
128128
"ProductCode": "PM",
129-
"VendorUrl": "https://github.com/riptideio/pymodbus/",
129+
"VendorUrl": "https://github.com/pymodbus-dev/pymodbus",
130130
"ProductName": "pymodbus Server",
131131
"ModelName": "pymodbus Server",
132132
"MajorMinorRevision": "3.1.0"
@@ -141,7 +141,7 @@ Server configuration examples
141141
"identity": {
142142
"VendorName": "pymodbus",
143143
"ProductCode": "PM",
144-
"VendorUrl": "https://github.com/riptideio/pymodbus/",
144+
"VendorUrl": "https://github.com/pymodbus-dev/pymodbus",
145145
"ProductName": "pymodbus Server",
146146
"ModelName": "pymodbus Server",
147147
"MajorMinorRevision": "3.1.0"

0 commit comments

Comments
 (0)