]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
for internal link to top render #
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Sep 2010 16:55:51 +0000 (12:55 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Sep 2010 16:55:51 +0000 (12:55 -0400)
doc/build/builder/util.py

index 0ae4de5cd43647dece823d0f51248bb28f59fee1..dc2e27245a292b320cfcd5ce573de55cc13b8bfa 100644 (file)
@@ -3,6 +3,10 @@ import re
 def striptags(text):
     return re.compile(r'<[^>]*>').sub('', text)
 
+def go(m):
+    # .html with no anchor if present, otherwise "#" for top of page
+    return m.group(1) or '#'
+    
 def strip_toplevel_anchors(text):
-    return re.compile(r'\.html#[-\w]+-toplevel').sub('.html', text)
+    return re.compile(r'(\.html)?#[-\w]+-toplevel').sub(go, text)