Sun Nov 13 11:23:24 UTC 2011  pinterface <pix@kepibu.org>
  * Add support for calling an external program to generate README markup
{
hunk ./config.py.sample 87
+	# If you'd like a wider range of README file types than darcsweb
+	# provides, set readme_converter to a program which takes a single
+	# argument--the name of the readme file--and outputs HTML.
+	#readme_converter = 'ruby -rubygems /var/lib/gems/1.8/gems/github-markup-0.5.3/bin/github-markup'
hunk ./darcsweb.cgi 1094
+def get_readme():
+	import glob
+	readmes = glob.glob("README*")
+	if len(readmes) == 0: return False, False
+	import re
+	for p in readmes:
+		file = os.path.basename(p)
+		if re.search('\.(md|markdown)$', p):
+			import codecs
+			import markdown
+			f = codecs.open(p, encoding=config.repoencoding[0])
+			str = f.read()
+			html = markdown.markdown(str, ['extra', 'codehilite(css_class=page_body)'])
+			return file, fixu8(html)
+		elif re.search('README$', p):
+			f = open(p)
+			str = f.read()
+			return file, '<pre>%s</pre>' % fixu8(escape(str))
+	# We can't handle this ourselves, try shelling out
+	if not config.readme_converter: return False, False
+	cmd = '%s "%s"' % (config.readme_converter, readmes[0])
+	inf, outf = os.popen2(cmd, 't')
+	return os.path.basename(readmes[0]), fixu8(outf.read())
hunk ./darcsweb.cgi 1248
-# FIXME: shell out to github-markup to avoid duplicating that effort here?
hunk ./darcsweb.cgi 1249
-	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))
+	head, body = get_readme()
+	if not head: return False
+	print '<div class="title">%s</div>' % head
+	print '<section>%s</section' % body
hunk ./darcsweb.cgi 2566
+	if "readme_converter" in dir(base):
+		config.readme_converter = base.readme_converter
+	else:
+		config.readme_converter = False
+
}
Sun Nov 13 11:07:41 UTC 2011  pinterface <pix@kepibu.org>
  * minidom chokes on form feed character
hunk ./darcsweb.cgi 1002
-		s += fixu8(i)
+		s += fixu8(i).replace('[_^L_]', '^L')
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.
{
hunk ./darcsweb.cgi 1225
+# 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))
+
+
hunk ./darcsweb.cgi 1523
+	print_readme()
}
Tue Nov  1 10:19:57 UTC 2011  pinterface <pix@kepibu.org>
  * Add Owner and Last Change columns to repo listing
  This is a little ugly due to the global config object.  Boo.
{
hunk ./darcsweb.cgi 2247
+<th>Owner</th>
+<th>Last Change</th>
hunk ./darcsweb.cgi 2273
+		try: orig_repodir = config.repodir
+		except: orig_repodir = None
+		config.repodir = c.repodir
hunk ./darcsweb.cgi 2279
+<td>%(owner)s</td>
+<td>%(lastchange)s</td>
hunk ./darcsweb.cgi 2291
-			'desc': shorten_str(desc, 60)
+			'desc': shorten_str(desc, 60),
+			'owner': escape(repo_get_owner() or ''),
+			'lastchange': how_old(os.stat(c.repodir + '/_darcs/patches').st_mtime),
hunk ./darcsweb.cgi 2295
+		config.repodir = orig_repodir
}
Tue Nov  1 09:54:21 UTC 2011  pinterface <pix@kepibu.org>
  * Skip comments and blank lines in the author file
{
hunk ./darcsweb.cgi 634
-		author = fd.readlines()[0].strip()
+		for line in fd:
+			line = line.strip()
+			if line != "" and line[0] != "#":
+				return line.strip()
hunk ./darcsweb.cgi 639
-		author = None
-	return author
+		return None
}