aboutsummaryrefslogtreecommitdiffstats
path: root/doc/build/builder/util.py
blob: 75a5c72b91710cd503d0a5e2894b4b9a71153bc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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(go, text)