]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Include the '()' in the links to the libpq functions
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 2 Aug 2021 12:29:42 +0000 (14:29 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 3 Aug 2021 10:57:53 +0000 (11:57 +0100)
This is more consistent with the rest of the documentation.

docs/lib/libpq_docs.py

index 03830fd402bcd20dd0dac866ba0ed61f0adeb975..0831b2a56e05887a92f1ffe3da512e9ef820dffc 100644 (file)
@@ -137,10 +137,13 @@ def get_reader():
 
 
 def pq_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
+    text = utils.unescape(text)
+
     reader = get_reader()
     if "(" in text:
         func, noise = text.split("(", 1)
         noise = "(" + noise
+
     else:
         func = text
         noise = ""
@@ -154,7 +157,10 @@ def pq_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
         prb = inliner.problematic(rawtext, rawtext, msg)
         return [prb], [msg]
 
-    text = utils.unescape(text)
+    # For a function f(), include the () in the signature for consistency
+    # with a normal `thing()`
+    if noise == "()":
+        func, noise = func + noise, ""
 
     the_nodes = []
     the_nodes.append(nodes.reference(func, func, refuri=url))