Skip to content
Snippets Groups Projects
Commit 05df5d55 authored by Timo Koch's avatar Timo Koch Committed by Leon Keim
Browse files

[doxygen] Adds and edit button to markdown file on GitLab

parent 491621b0
No related branches found
No related tags found
1 merge request!3994[doxygen] Adds an edit button to markdown file on GitLab
Pipeline #56146 passed
+3
...@@ -24,6 +24,21 @@ ...@@ -24,6 +24,21 @@
height:60px; height:60px;
margin-bottom:-4px margin-bottom:-4px
} }
.edit-button {
display: inline-block;
padding: 5px 10px 5px 10px;
background: #ffaa16;
border-radius: 10px;
color: black;
vertical-align: middle;
}
.edit-button:hover {
background: #ffcc1d;
}
a.edit-button{
text-decoration: none !important;
color: black !important;
}
.cls-r-1{ .cls-r-1{
fill:#dd1f26 fill:#dd1f26
} }
......
...@@ -16,6 +16,19 @@ MAIN_README = abspath(join(TOP_LEVEL_DIR, "README.md")) ...@@ -16,6 +16,19 @@ MAIN_README = abspath(join(TOP_LEVEL_DIR, "README.md"))
assert exists(MAIN_README) assert exists(MAIN_README)
def _get_file_gitlab_url(path: str) -> str:
return (
"https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/"
"-/blob/master/"
f"{path}"
"?ref_type=heads"
)
def _file_path_relative_to_top_level(path: str) -> str:
return path.replace(TOP_LEVEL_DIR, "").lstrip("/")
def _filter_characters(text: str) -> str: def _filter_characters(text: str) -> str:
return "".join(filter(lambda c: c not in string.punctuation and c not in string.digits, text)) return "".join(filter(lambda c: c not in string.punctuation and c not in string.digits, text))
...@@ -69,5 +82,17 @@ for line in result.split("\n"): ...@@ -69,5 +82,17 @@ for line in result.split("\n"):
line if verbatim_environment else _enable_doxygen_only_content(_add_header_label(line)) line if verbatim_environment else _enable_doxygen_only_content(_add_header_label(line))
) )
# Tell readers that they can edit the markdown content on GitLab
markdown_file_path = _file_path_relative_to_top_level(filePath)
file_url = _get_file_gitlab_url(markdown_file_path)
result_lines.extend(
[
"\n----\n",
f'<a class="edit-button" href="{file_url}">' "🛠 Edit above doc on GitLab" "</a>\n",
]
)
# Print the final result for Doxygen to pick it up # Print the final result for Doxygen to pick it up
print("\n".join(result_lines)) print("\n".join(result_lines))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment