# HG changeset patch # User Edouard Gomez # Date 1158866666 -7200 # Node ID d7d53e3d9590c9bed4e8439e29251ebad4619dca # Parent 325278542ea8f645bf37251f29ab440b968c92af Add style support to hgwebdir diff -r 325278542ea8 -r d7d53e3d9590 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Sat Sep 30 21:32:29 2006 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Sep 21 21:24:26 2006 +0200 @@ -21,6 +21,7 @@ return [(name.strip(os.sep), path) for name, path in items] self.motd = "" + self.style = "" self.repos_sorted = ('name', False) if isinstance(config, (list, tuple)): self.repos = cleannames(config) @@ -32,8 +33,11 @@ cp = ConfigParser.SafeConfigParser() cp.read(config) self.repos = [] - if cp.has_section('web') and cp.has_option('web', 'motd'): - self.motd = cp.get('web', 'motd') + if cp.has_section('web'): + if cp.has_option('web', 'motd'): + self.motd = cp.get('web', 'motd') + if cp.has_option('web', 'style'): + self.style = cp.get('web', 'style') if cp.has_section('paths'): self.repos.extend(cleannames(cp.items('paths'))) if cp.has_section('collections'): @@ -66,6 +70,15 @@ yield tmpl("footer", motd=self.motd, **map) m = os.path.join(templater.templatepath(), "map") + style = self.style + if req.form.has_key('style'): + style = req.form['style'][0] + if style != "": + b = os.path.basename("map-" + style) + p = os.path.join(templater.templatepath(), b) + if os.path.isfile(p): + m = p + tmpl = templater.templater(m, templater.common_filters, defaults={"header": header, "footer": footer})