From: Denis Laxalde Date: Tue, 2 Apr 2024 09:35:23 +0000 (+0200) Subject: docs: let the 'pq' role possibly link to "devel" PostgreSQL docs X-Git-Tag: 3.2.0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cae87c4cf6223cc278f36759ea8709cc628ac7f6;p=thirdparty%2Fpsycopg.git docs: let the 'pq' role possibly link to "devel" PostgreSQL docs If we now set libpq_docs_version to 'devel', the pq Sphinx role will use the master branch when looking libpq.sgml and the 'devel' URL component when linking to libpq online documentation. --- diff --git a/docs/lib/libpq_docs.py b/docs/lib/libpq_docs.py index b8e01f0d0..2868916f5 100644 --- a/docs/lib/libpq_docs.py +++ b/docs/lib/libpq_docs.py @@ -89,7 +89,7 @@ class LibpqReader: app = None _url_pattern = ( - "https://raw.githubusercontent.com/postgres/postgres/REL_{ver}_STABLE" + "https://raw.githubusercontent.com/postgres/postgres/{branch}" "/doc/src/sgml/libpq.sgml" ) @@ -130,7 +130,13 @@ class LibpqReader: @property def sgml_url(self): - return self._url_pattern.format(ver=self.version) + return self._url_pattern.format(branch=self.branch) + + @property + def branch(self): + if self.version == "devel": + return "master" + return f"REL_{self.version}_STABLE" @property def version(self):