for internal link to top render #

This commit is contained in:
Mike Bayer
2010-09-26 12:55:51 -04:00
parent 1ff666ffdf
commit 6b911a5267
+6 -2
View File
@@ -3,6 +3,10 @@ import re
def striptags(text):
return re.compile(r'<[^>]*>').sub('', text)
def strip_toplevel_anchors(text):
return re.compile(r'\.html#[-\w]+-toplevel').sub('.html', 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(go, text)