Package: debian-policy Severity: wishlist Hi.
It would be useful to have a copy of the HTML version of upgrading-checklist somewhere on the web. This could, for example, be linked from the PTS when some package's Standards-Version has to be upgraded. In #485085 the problem of the links from upgrading-checklist to the policy has been discussed, but not solved. I've come up with a pair of hacks that should do the trick (although they don't qualify as "solution" at all). I'm attaching them in case you're interested. You have to do something like that: $ ./build_section_mapping.sh < /usr/share/doc/debian-policy/policy-1.html > sect_map $ ./patch_checklist.py < /usr/share/doc/debian-policy/upgrading-checklist-1.html > upgrading-checklist-1-links.html You'll probably want also want to change paths in patch_checklist.py. Also, to usefully link upgrading-checklist from other services, it would be helpful to have section anchors named with the relevant policy version number instead of section number (otherwise some other hack like build_section_mappings.sh should be used). Thanks, Giovanni. -- Giovanni Mascellani <[email protected]> Pisa, Italy Web: http://poisson.phc.unipi.it/~mascellani Jabber: [email protected] / [email protected]
build_section_mapping.sh
Description: Bourne shell script
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, re
POLICY_URL = 'file:///usr/share/doc/debian-policy/policy-1.html'
SECT_MAP_FILE = './sect_map'
dt_re = re.compile('^<dt>(.*)</dt>$')
dt_template = '<dt>%s</dt>\n'
sect_map = {}
def build_sect_map():
with open(SECT_MAP_FILE) as sect_map_file:
for line in sect_map_file:
sect, anchor = line.strip().split(' ', 1)
sect_map[sect] = anchor
def make_line(sect):
if sect in sect_map:
return '<a href="%s#%s">%s</a>' % (POLICY_URL, sect_map[sect], sect)
else:
return sect
def main():
build_sect_map()
for line in sys.stdin:
match = dt_re.match(line)
if match is not None:
line = dt_template % ', '.join([make_line(x.strip()) for x in match.group(1).split(',')])
sys.stdout.write(line)
if __name__ == '__main__':
main()
signature.asc
Description: OpenPGP digital signature

