Commit 4913696b authored by Nils Goroll's avatar Nils Goroll

facilitate url_vcc / url_doc formatting for non-github users

This adds a "branch" attribute to the rev objects.

If an "fmt" object exists with attributes "url_vcc" and/or "url_doc",
those are taken as printf formats (which should contain a single %s) and
used with the branch attributes from the revs.
parent 5573e156
......@@ -51,7 +51,15 @@ class vmod(object):
def url_vcc(self, rev):
r = self.j.get("rev")
if r != None:
return r[rev]["url_vcc"]
if "url_vcc" in r[rev]:
return r[rev]["url_vcc"]
fmt = self.j.get("fmt")
if fmt != None and "url_vcc" in fmt:
fmt = fmt["url_vcc"]
else:
fmt = None
if fmt != None and "branch" in r[rev]:
return fmt % r[rev]["branch"]
g = self.j.get("github")
if g != None:
s = "https://raw.githubusercontent.com/"
......@@ -64,8 +72,16 @@ class vmod(object):
def url_doc(self, rev):
r = self.j.get("rev")
if r != None and "url_doc" in r[rev]:
return r[rev]["url_doc"]
if r != None:
if "url_doc" in r[rev]:
return r[rev]["url_doc"]
fmt = self.j.get("fmt")
if fmt != None and "url_vcc" in fmt:
fmt = fmt["url_doc"]
else:
fmt = None
if fmt != None and "branch" in r[rev]:
return fmt % r[rev]["branch"]
g = self.j.get("github")
if g != None and "doc_path" in g:
s = "https://github.com/"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment