Add support for `url' to add a `hg clone <url>' link in menu - stahg-gopher - Static Mercurial page generator for gopher HTML hg clone https://bitbucket.org/iamleot/stahg-gopher DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR changeset ed1ce8cb40899fbf91ae58ed9e2e1c20709a8850 DIR parent 1614c33a9710f589494b5916d530a0388afb2144 HTML Author: Leonardo Taccari <iamleot@gmail.com> Date: Mon, 13 May 2019 18:31:26 Add support for `url' to add a `hg clone <url>' link in menu If `[web]' category `url' field is present in .hg/hgrc its value is used as an URL added as a `[h|...]' entry similar to stagit-gopher for .git/url file. Diffstat: stahg-gopher.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) --- diff -r 1614c33a9710 -r ed1ce8cb4089 stahg-gopher.py --- a/stahg-gopher.py Mon May 13 17:50:22 2019 +0200 +++ b/stahg-gopher.py Mon May 13 18:31:26 2019 +0200 @@ -120,7 +120,8 @@ for _, k, value in self.client.config([b'web']): if k.decode() == 'description': self.description = value.decode() - break + elif k.decode() == 'url': + self.url = value.decode() except: self.description = \ "Unnamed repository, adjust .hg/hgrc `[web]' section, `description' key" @@ -149,7 +150,14 @@ """Generate menu for .gph files""" bp = gph_escape_entry(self.base_prefix) - m = '[1|Log|' + bp + '/log.gph|server|port]\n' + \ + m = '' + + if self.url: + m += '[h|{desc}|{path}|server|port]\n'.format( + desc=gph_escape_entry('hg clone {url}'.format(url=self.url)), + path='URL:{url}'.format(url=self.url)) + + m += '[1|Log|' + bp + '/log.gph|server|port]\n' + \ '[1|Files|' + bp + '/files.gph|server|port]\n' + \ '[1|Refs|' + bp + '/refs.gph|server|port]'