fix: make dependency source use superscript tag

Avoid using special characters and use '<sup>' HTML tag instead.
To not rely on user's fonts Unicode coverage.

Closes: #490
Signed-off-by: Hanabishi <1722-hanabishi@users.noreply.gitlab.archlinux.org>
This commit is contained in:
Hanabishi 2023-10-18 16:19:58 +00:00
parent 27c51430fb
commit 2b8c8fc92a
3 changed files with 4 additions and 4 deletions

View file

@ -85,7 +85,7 @@ def package_link(package: Union[Package, OfficialProvider]) -> str:
def provides_markup(provides: Providers) -> str: def provides_markup(provides: Providers) -> str:
links = [] links = []
for pkg in provides: for pkg in provides:
aur = "ᴬᵁᴿ" if not pkg.is_official else "" aur = "<sup><small>AUR</small></sup>" if not pkg.is_official else ""
links.append(f'<a href="{package_link(pkg)}">{pkg.Name}</a>{aur}') links.append(f'<a href="{package_link(pkg)}">{pkg.Name}</a>{aur}')
return ", ".join(links) return ", ".join(links)

View file

@ -21,7 +21,7 @@
{% else -%} {% else -%}
</a> </a>
{%- if dep.is_aur_package() -%} {%- if dep.is_aur_package() -%}
ᴬᵁᴿ <sup><small>AUR</small></sup>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -176,9 +176,9 @@ def test_provides_markup(package: Package):
RelTypeID=PROVIDES_ID, RelTypeID=PROVIDES_ID,
) )
# AUR provider links should end with ᴬᵁᴿ # AUR provider links should end with <sup><small>AUR</small></sup>
link = util.provides_markup(dep.provides()) link = util.provides_markup(dep.provides())
assert link.endswith("</a>ᴬᵁᴿ") assert link.endswith("</a><sup><small>AUR</small></sup>")
assert OFFICIAL_BASE not in link assert OFFICIAL_BASE not in link
# Remove AUR provider and add official one # Remove AUR provider and add official one