summaryrefslogtreecommitdiff
path: root/doc/doxygen-link.py
blob: fda193c4005f7ba6e25b581808daf8c687aa0e95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python

import fileinput
import re
import sys

links = {}

for line in open(sys.argv[1], 'r'):
	m = re.match('^([^=]+)=([^\n]+)$', line);
	if m:
		link = "<a href=\"" + m.group(2) + "\" class=\"dg\">" + m.group(1) + "</a>"
		links[m.group(1)] = link

def translate(match):
	return links[match.group(0)]

rc = re.compile('|'.join(map(re.escape, sorted(links, reverse=True))))
for line in open(sys.argv[2], 'r'):
	print rc.sub(translate, line),