Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: fix add HTML module man page Source code section for all module HTML files #3248

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions utils/mkhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ def get_last_git_commit(src_dir, addon_path, is_addon):
"""

sourcecode = string.Template(
"""<h2>SOURCE CODE</h2>
"""
<h2>SOURCE CODE</h2>
<p>
Available at:
<a href="${URL_SOURCE}">${PGM} source code</a>
Expand Down Expand Up @@ -905,36 +906,39 @@ def to_title(name):
if sys.platform == "win32":
url_source = url_source.replace(os.path.sep, "/")

if index_name:
branches = "branches"
tree = "tree"
commits = "commits"
# Process Source code section
branches = "branches"
tree = "tree"
commits = "commits"

if branches in url_source:
url_log = url_source.replace(branches, commits)
url_source = url_source.replace(branches, tree)
else:
url_log = url_source.replace(tree, commits)
if branches in url_source:
url_log = url_source.replace(branches, commits)
url_source = url_source.replace(branches, tree)
else:
url_log = url_source.replace(tree, commits)

git_commit = get_last_git_commit(
src_dir=curdir,
addon_path=addon_path if addon_path else None,
is_addon=True if addon_path else False,
git_commit = get_last_git_commit(
src_dir=curdir,
addon_path=addon_path if addon_path else None,
is_addon=True if addon_path else False,
)
if git_commit["commit"] == "unknown":
date_tag = "Accessed: {date}".format(date=git_commit["date"])
else:
date_tag = "Latest change: {date} in commit: {commit}".format(
date=git_commit["date"], commit=git_commit["commit"]
)
if git_commit["commit"] == "unknown":
date_tag = "Accessed: {date}".format(date=git_commit["date"])
else:
date_tag = "Latest change: {date} in commit: {commit}".format(
date=git_commit["date"], commit=git_commit["commit"]
)
sys.stdout.write(
sourcecode.substitute(
URL_SOURCE=url_source,
PGM=pgm,
URL_LOG=url_log,
DATE_TAG=date_tag,
)
sys.stdout.write(
sourcecode.substitute(
URL_SOURCE=url_source,
PGM=pgm,
URL_LOG=url_log,
DATE_TAG=date_tag,
)
)

# Process footer
if index_name:
sys.stdout.write(
footer_index.substitute(
INDEXNAME=index_name,
Expand Down