mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 04:01:40 +01:00
[mod] hex engine: normalize (some of) the linked terms
The names of the links are rather tags than real names, and they sometimes vary greatly in their spelling: - GitHub: github, Github - Source code: Repository, SCM, Project Source Code - Documentation: docs, Documentation It was standardized to terms such as 'Source code' and 'Documentation', as translations already exist for these terms. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
cc8b537e34
commit
949a73103f
@ -22,6 +22,29 @@ categories = ["it", "packages"]
|
||||
paging = True
|
||||
search_url = "https://hex.pm/api/packages/"
|
||||
|
||||
linked_terms = {
|
||||
# lower-case : replacement
|
||||
"author": "Author",
|
||||
"bitbucket": "Bitbucket",
|
||||
"bug tracker": "Issue tracker",
|
||||
"changelog": "Changelog",
|
||||
"doc": "Documentation",
|
||||
"docs": "Documentation",
|
||||
"documentation": "Documentation",
|
||||
"github repository": "GitHub",
|
||||
"github": "GitHub",
|
||||
"gitlab": "GitLab",
|
||||
"issues": "Issue tracker",
|
||||
"project source code": "Source code",
|
||||
"repository": "Source code",
|
||||
"scm": "Source code",
|
||||
"sourcehut": "SourceHut",
|
||||
"sources": "Source code",
|
||||
"sponsor": "Sponsors",
|
||||
"sponsors": "Sponsors",
|
||||
"website": "Homepage",
|
||||
}
|
||||
|
||||
|
||||
def request(query: str, params):
|
||||
args = urlencode({"page": params["pageno"], "search": query})
|
||||
@ -35,7 +58,7 @@ def response(resp):
|
||||
meta = package["meta"]
|
||||
published_date = package.get("updated_at")
|
||||
published_date = parser.parse(published_date)
|
||||
links = meta.get("links")
|
||||
links = {linked_terms.get(k.lower(), k): v for k, v in meta.get("links").items()}
|
||||
results.append(
|
||||
{
|
||||
"template": "packages.html",
|
||||
|
Loading…
Reference in New Issue
Block a user