Sat Nov 5 10:18:50 UTC 2011 pinterface * Show README in summary view, if it exists Blatantly stealing the idea from Github, but not as fully implemented. diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi --- old-darcsweb/darcsweb.cgi 2014-09-11 07:39:14.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2014-09-11 07:39:14.000000000 +0000 @@ -1222,6 +1222,32 @@ print "" +# FIXME: shell out to github-markup to avoid duplicating that effort here? +def print_readme(): + real = False + for p in ["README", "README.md", "README.markdown"]: + p = realpath(p) + if p and os.path.isfile(p): + real = p + break + if not real: return + + print '
%s
' % os.path.basename(real) + + import re + if re.search('\.(md|markdown)$', real): + import codecs + import markdown + f = codecs.open(real, encoding=config.repoencoding[0]) + str = f.read() + html = markdown.markdown(str, ['extra', 'codehilite(css_class=page_body)']) + print '
%s
' % fixu8(html) + else: + f = open(real) + str = f.read() + print '
%s
' % fixu8(escape(str)) + + def print_log(last = PATCHES_PER_PAGE, topi = 0): ps = get_last_patches(last, topi) @@ -1494,6 +1520,7 @@ print '' print_shortlog(15) + print_readme() print_footer()