Revision 6836
Added by Aaron Marcuse-Kubitza about 12 years ago
dict2redmine | ||
---|---|---|
44 | 44 |
|
45 | 45 |
def redmine_pad(text): return sp+text+sp |
46 | 46 |
|
47 |
def redmine_url(text, url):
|
|
47 |
def redmine_link(text, url):
|
|
48 | 48 |
if not url: return text |
49 | 49 |
elif url.find('://') >= 0: return '"'+text+'":'+url # external link |
50 | 50 |
else: return '[['+url+'|'+text+']]' # internal link |
51 | 51 |
|
52 |
def source2redmine_url(url):
|
|
53 |
if url: return redmine_url(url_term(url), simplify_url(url))
|
|
52 |
def source2redmine_link(url):
|
|
53 |
if url: return redmine_link(url_term(url), simplify_url(url))
|
|
54 | 54 |
else: return '' |
55 | 55 |
|
56 | 56 |
def redmine_add_links(page_name, text): |
57 | 57 |
# Link citations to entry in sources list |
58 | 58 |
text = re.sub(r'(?<!\[)\[([^\[\]]*)\](?!\])', |
59 |
redmine_bold(redmine_url(r'(\1)', page_name+r'#\1')), text)
|
|
59 |
redmine_bold(redmine_link(r'(\1)', page_name+r'#\1')), text)
|
|
60 | 60 |
return text |
61 | 61 |
|
62 | 62 |
redmine_table_sep = '|' |
... | ... | |
117 | 117 |
term = row[term_col] |
118 | 118 |
sources = row[sources_col].split(source_sep) |
119 | 119 |
|
120 |
row[term_col] = redmine_url(term, page_name+'#'+term)
|
|
121 |
row[sources_col] = source_sep.join(map(source2redmine_url, sources))
|
|
120 |
row[term_col] = redmine_link(term, page_name+'#'+term)
|
|
121 |
row[sources_col] = source_sep.join(map(source2redmine_link, sources))
|
|
122 | 122 |
|
123 | 123 |
writer.writerow(row) |
124 | 124 |
|
Also available in: Unified diff
dict2redmine: Renamed redmine_url() to redmine_link() because it generates links, not URLs