]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
docs: let the 'pq' role possibly link to "devel" PostgreSQL docs
authorDenis Laxalde <denis.laxalde@dalibo.com>
Tue, 2 Apr 2024 09:35:23 +0000 (11:35 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 2 Apr 2024 13:18:20 +0000 (14:18 +0100)
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.

docs/lib/libpq_docs.py

index b8e01f0d0cd6b665294b956075fe91c8671d4308..2868916f5e89c9893ee3f6b33dc1f2fb1a622010 100644 (file)
@@ -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):