mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
add branch name in the helper template
This commit is contained in:
parent
fe6333d2d2
commit
bbb68e8ef9
2 changed files with 12 additions and 4 deletions
|
@ -4,9 +4,17 @@ import os
|
|||
import glob
|
||||
import datetime
|
||||
|
||||
def get_current_git_branch():
|
||||
with open("../.git/HEAD", "r") as f:
|
||||
head_file = f.readlines()
|
||||
current_branch = head_file[0].split()[1].split("refs/heads/")[1]
|
||||
|
||||
return current_branch
|
||||
|
||||
def render(helpers):
|
||||
|
||||
current_branch = get_current_git_branch()
|
||||
|
||||
data = {"helpers": helpers,
|
||||
"date": datetime.datetime.now().strftime("%m/%d/%Y"),
|
||||
"version": open("../debian/changelog").readlines()[0].split()[1].strip("()")
|
||||
|
@ -25,7 +33,7 @@ def render(helpers):
|
|||
template = open("helper_doc_template.html", "r").read()
|
||||
t = Template(template)
|
||||
t.globals['now'] = datetime.datetime.utcnow
|
||||
result = t.render(data=data, convert=shell_to_html, shell_css=shell_css)
|
||||
result = t.render(current_branch=current_branch, data=data, convert=shell_to_html, shell_css=shell_css)
|
||||
open("helpers.html", "w").write(result)
|
||||
|
||||
##############################################################################
|
||||
|
@ -197,7 +205,7 @@ def main():
|
|||
|
||||
for helper_file in helper_files:
|
||||
category_name = os.path.basename(helper_file)
|
||||
print "Parsing %s ..." % category_name
|
||||
print("Parsing %s ..." % category_name)
|
||||
p = Parser(helper_file)
|
||||
p.parse_blocks()
|
||||
for b in p.blocks:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<h1>App helpers</h1>
|
||||
|
||||
<p>Doc auto-generated by <a href="https://github.com/YunoHost/yunohost/blob/stretch-unstable/doc/generate_helper_doc.py">this script</a> on {{data.date}} (Yunohost version {{data.version}})</p>
|
||||
<p>Doc auto-generated by <a href="https://github.com/YunoHost/yunohost/blob/{{ current_branch }}/doc/generate_helper_doc.py">this script</a> on {{data.date}} (Yunohost version {{data.version}})</p>
|
||||
|
||||
{% for category, helpers in data.helpers %}
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
|||
</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<a href="https://github.com/YunoHost/yunohost/blob/stretch-stable/data/helpers.d/{{ category }}#L{{ h.line + 1 }}">Dude, show me the code !</a>
|
||||
<a href="https://github.com/YunoHost/yunohost/blob/{{ current_branch }}/data/helpers.d/{{ category }}#L{{ h.line + 1 }}">Dude, show me the code !</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue