Thu Feb 1 17:30:50 UTC 2007 VMiklos <vmiklos@frugalware.org>
* new optional config varuable: author_links
it is disabled by default and an example for cia is included
diff -rN -u old-darcsweb/config.py.sample new-darcsweb/config.py.sample
--- old-darcsweb/config.py.sample 2016-01-20 13:26:16.000000000 +0000
+++ new-darcsweb/config.py.sample 2016-01-20 13:26:16.000000000 +0000
@@ -75,6 +75,11 @@
# r'<a href="%(myreponame)s;a=commit;h=\1">\1</a>'),
#)
+ # If you want to generate links from patch author names, define the url
+ # here. Example for CIA:
+ #author_links = "http://cia.navi.cx/stats/author/%(author)s"
+
+
#
# From now on, every class is a repo configuration, with the same format
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2016-01-20 13:26:16.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2016-01-20 13:26:16.000000000 +0000
@@ -484,6 +484,15 @@
print "Content-Disposition:attachment;filename=%s" % fname
print
+def gen_authorlink(author, shortauthor=None):
+ if not config.author_links:
+ if shortauthor:
+ return shortauthor
+ else:
+ return author
+ if not shortauthor:
+ shortauthor = author
+ return '<a href="' + config.author_links % { 'author': author } + '">%s</a>' % shortauthor
#
# basic caching
@@ -1137,7 +1146,7 @@
</td>
""" % {
'age': how_old(p.local_date),
- 'author': shorten_str(p.shortauthor, 26),
+ 'author': gen_authorlink(p.author, shorten_str(p.shortauthor, 26)),
'myrname': config.myreponame,
'hash': p.hash,
'name': escape(shorten_str(p.name)),
@@ -1197,7 +1206,7 @@
'myreponame': config.myreponame,
'age': how_old(p.local_date),
'date': p.local_date_str,
- 'author': p.shortauthor,
+ 'author': gen_authorlink(p.author, p.shortauthor),
'hash': p.hash,
'desc': escape(p.name),
'comment': fmt_comment
@@ -1607,7 +1616,7 @@
</div>
""" % {
'myreponame': config.myreponame,
- 'author': p.author,
+ 'author': gen_authorlink(p.author),
'local_date': p.local_date_str,
'date': p.date_str,
'hash': p.hash,
@@ -2070,7 +2079,7 @@
</td>
""" % {
'age': how_old(p.local_date),
- 'author': shorten_str(p.shortauthor, 26),
+ 'author': gen_authorlink(p.author, shorten_str(p.shortauthor, 26)),
'myrname': config.myreponame,
'hash': p.hash,
'name': escape(shorten_str(p.name)),
@@ -2358,6 +2367,10 @@
else:
config.footer = "Crece desde el pueblo el futuro / " \
+ "crece desde el pie"
+ if "author_links" in dir(base):
+ config.author_links = base.author_links
+ else:
+ config.author_links = None