Skip to content

Commit

Permalink
remove spaces from capability ids
Browse files Browse the repository at this point in the history
  • Loading branch information
allisonrobbins committed Feb 20, 2024
1 parent 5b2866c commit 39a4023
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mappings_explorer/site_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def build_external_capability(
breadcrumbs: the navigation tree above the page being built in this function
previous_link: link to go to in order to "change versions" on banner or badges
"""
dir = parent_dir / capability.id
dir = parent_dir / capability.id.replace(" ", "_")

Check warning on line 810 in src/mappings_explorer/site_builder.py

View check run for this annotation

Codecov / codecov/patch

src/mappings_explorer/site_builder.py#L810

Added line #L810 was not covered by tests
dir.mkdir(parents=True, exist_ok=True)
output_path = dir / "index.html"
template = load_template("capability.html.j2")
Expand Down
3 changes: 2 additions & 1 deletion src/mappings_explorer/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def build_capability_url(mapping: dict, url_prefix: str, id: str):
"""
return (
f"{url_prefix}external/{mapping['project']}/attack-{mapping['attack_version']}/"
f"domain-{mapping['attack_domain'].lower()}/{mapping['project']}-{mapping['project_version']}/{id}/"
f"domain-{mapping['attack_domain'].lower()}/{mapping['project']}-"
f"{mapping['project_version']}/{id.replace(' ', '_')}/"
)


Expand Down
2 changes: 1 addition & 1 deletion src/mappings_explorer/templates/macros.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<tr>
{%- for header in headers -%}
{% if header[2] and header[3] %}
<td><a href="{{header[3]}}{{mapping[header[2]]}}/">{{mapping[header[0]]}}</a></td>
<td><a href="{{header[3]}}{{mapping[header[2]] | replace(' ', '_') }}/">{{mapping[header[0]]}}</a></td>
{% endif %}
{% if header[2] and not header[3] %}
<td><a href="{{mapping | build_capability_url(url_prefix, mapping[header[2]])}}">{{mapping[header[0]]}}</a></td>
Expand Down

0 comments on commit 39a4023

Please sign in to comment.