mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 12:33:53 -06:00
chore: merge origin/main
This commit is contained in:
commit
df7c923fcf
2 files changed
+17
-1
No files matched your search
@@ -842,7 +842,8 @@ def redirects(profiles: dict, present: set[str],
|
||||
|
||||
A page that moved, once its source is gone, and each name a profile's
|
||||
`cores:` gives the emulator (the buildbot's `mednafen_psx` for
|
||||
beetle_psx), to the profile's page. A name two profiles claim, or one
|
||||
beetle_psx), to the profile's page, and an alias profile's own name to
|
||||
the page of the profile it is an alias of. A name two profiles claim, or one
|
||||
that is already a page's address, is left out. Addresses are written
|
||||
under the site root, without its base. ``moved`` adds pages that moved
|
||||
by generation, old page to new page, the new one with an optional
|
||||
@@ -863,6 +864,13 @@ def redirects(profiles: dict, present: set[str],
|
||||
name = str(name)
|
||||
if _CORE_NAME.fullmatch(name) and name != key:
|
||||
claims.setdefault(name, set()).add(key)
|
||||
# An alias profile has no page of its own: its name is the address of
|
||||
# the profile it designates (emulators/vba_m/ is VBA-M's, under vbam).
|
||||
for key, profile in profiles.items():
|
||||
target = str(profile.get("alias_of") or "")
|
||||
if (profile.get("type") == "alias" and _CORE_NAME.fullmatch(key)
|
||||
and f"emulators/{target}.md" in present):
|
||||
claims.setdefault(key, set()).add(target)
|
||||
for name, keys in sorted(claims.items()):
|
||||
if len(keys) == 1 and f"emulators/{name}.md".casefold() not in pages:
|
||||
out[address(f"emulators/{name}.md")] = address(f"emulators/{next(iter(keys))}.md")
|
||||
|
||||
@@ -281,6 +281,14 @@ class Redirects(unittest.TestCase):
|
||||
"/wiki/getting-started/": "/which-pack/",
|
||||
})
|
||||
|
||||
def test_an_alias_profile_leads_to_the_profile_it_names(self):
|
||||
# Search Console found emulators/vba_m/ gone: vba_m is an alias of vbam.
|
||||
profiles = {"vba_m": {"type": "alias", "alias_of": "vbam"}, "vbam": {"cores": []},
|
||||
"orphan": {"type": "alias", "alias_of": "nowhere"}}
|
||||
present = {"emulators/vbam.md", "which-pack.md", "wiki/getting-started.md"}
|
||||
self.assertEqual(sitestarlight.redirects(profiles, present),
|
||||
{"/emulators/vba_m/": "/emulators/vbam/"})
|
||||
|
||||
def test_a_moved_page_redirects_only_once_its_source_is_gone(self):
|
||||
present = {"wiki/getting-started.md", "which-pack.md"}
|
||||
self.assertEqual(sitestarlight.redirects({}, present), {})
|
||||
|
||||
Reference in new issue
Block a user