Skip to content

Commit

Permalink
utils: fix add HTML module man page Source code section for all modul…
Browse files Browse the repository at this point in the history
…e HTML files (#3248)

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

* Source code section start on the new line
  • Loading branch information
tmszi committed Nov 19, 2023
1 parent 97da922 commit b3ef90b
Showing 1 changed file with 31 additions and 27 deletions.
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

0 comments on commit b3ef90b

Please sign in to comment.