| 109 |
text = doc.createTextNode(m[tag]) |
text = doc.createTextNode(m[tag]) |
| 110 |
child.appendChild(text) |
child.appendChild(text) |
| 111 |
# now compute derived information and store it in the xml |
# now compute derived information and store it in the xml |
| 112 |
if tag[:6] == 'x-vcs-': # add 'parsed' version of VCS info |
# add 'parsed' version of VCS info |
| 113 |
# e.g. tag[6:] would be 'svn' for 'x-vcs-svn' |
if tag[:6] == 'x-vcs-' or tag[:4] == 'vcs': |
| 114 |
if vcs_table.has_key(tag[6:]): |
if tag[0] == 'x': |
| 115 |
|
prefix_len = 6 |
| 116 |
|
else: |
| 117 |
|
prefix_len = 4 |
| 118 |
|
# e.g. tag[prefix_len:] would be 'svn' for 'x-vcs-svn'/'vcs-svn' |
| 119 |
|
if vcs_table.has_key(tag[prefix_len:]): |
| 120 |
repos_elt = doc.createElement('repository') |
repos_elt = doc.createElement('repository') |
| 121 |
root.appendChild(repos_elt) |
root.appendChild(repos_elt) |
| 122 |
kind_elt = doc.createElement('kind') |
kind_elt = doc.createElement('kind') |
| 123 |
repos_elt.appendChild(kind_elt) |
repos_elt.appendChild(kind_elt) |
| 124 |
(name, vcsurl) = vcs_table[tag[6:]] |
(name, vcsurl) = vcs_table[tag[prefix_len:]] |
| 125 |
kind_elt.setAttribute('href', vcsurl) |
kind_elt.setAttribute('href', vcsurl) |
| 126 |
name_txt = doc.createTextNode(name) |
name_txt = doc.createTextNode(name) |
| 127 |
kind_elt.appendChild(name_txt) |
kind_elt.appendChild(name_txt) |