Ian Bicking: the old part of his blog

Purple Bookmarklet

Recent talk about Purple Numbers (e.g.) reminds me of this bookmarklet which makes named anchors visible (reflexively, it was useful when finding that very anchor). Then all you need is blogging tools that put in named anchors automatically (which should be easy enough). That would be a nice addition to the restructured text HTML writer, for instance. Or a simple regex like (in Python, untested):
def anchor_html(html):
    return re.sub(
      r'<[pP][ >]', 
      lambda m: anchor_subber(m, c=[0]),

def anchor_subber(match, count_list):
    count = count_list[0]
    count_list[0] += 1
    return '<a name="link_%i"></a>%s' \
        % (count, match.group(0))
Created 30 May '04
Modified 14 Dec '04