Show README in summary view, if it exists
Sat Nov 5 10:18:50 UTC 2011 pinterface <pix@kepibu.org>
* 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 2013-06-28 02:29:37.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-06-28 02:29:37.000000000 +0000
@@ -1222,6 +1222,32 @@
print "</table>"
+# 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 '<div class="title">%s</div>' % 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 '<section>%s</section>' % fixu8(html)
+ else:
+ f = open(real)
+ str = f.read()
+ print '<section><pre>%s</pre></section>' % fixu8(escape(str))
+
+
def print_log(last = PATCHES_PER_PAGE, topi = 0):
ps = get_last_patches(last, topi)
@@ -1494,6 +1520,7 @@
print '</table>'
print_shortlog(15)
+ print_readme()
print_footer()