diff --git a/README.md b/README.md index 4c04c50..1506e37 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,6 @@ Plain HTML and CSS in `site/`, with no build step and no dependencies. - Test: `python3 -I -m unittest discover -s tests -v` - Deploy: every push to `main` publishes `site/` to GitHub Pages (`.github/workflows/ci.yml`). -`site/shark-ng-table/` redirects the old demo URL to `https://quantas.github.io/shark-ng-table/`. +Project Pages sites under the `Quantas` account used to live at `www.quantasnet.com//`. Each one keeps its old address through a redirect page at `site//index.html` pointing to `https://quantas.github.io//`; add one (and an entry in `PROJECT_REDIRECTS` in the tests) for any new project site. Licensed under Apache-2.0. diff --git a/site/shark-ng-table-samples/index.html b/site/shark-ng-table-samples/index.html new file mode 100644 index 0000000..e1e8bea --- /dev/null +++ b/site/shark-ng-table-samples/index.html @@ -0,0 +1,14 @@ + + + + + + The shark-ng-table samples site has moved + + + + + +

The shark-ng-table samples site is now at quantas.github.io/shark-ng-table-samples.

+ + diff --git a/site/wow-forever-atlas/index.html b/site/wow-forever-atlas/index.html new file mode 100644 index 0000000..1a649ab --- /dev/null +++ b/site/wow-forever-atlas/index.html @@ -0,0 +1,14 @@ + + + + + + WoW Forever Atlas has moved + + + + + +

WoW Forever Atlas is now at quantas.github.io/wow-forever-atlas.

+ + diff --git a/tests/test_site.py b/tests/test_site.py index 97c76cc..f889556 100644 --- a/tests/test_site.py +++ b/tests/test_site.py @@ -25,6 +25,14 @@ ] FORBIDDEN_TEXT = ["Nelnet", "gitshark", "QLAN", "shark-ci-server", "dbUnit", "QuantasNet"] SHARK_NG_TABLE_DEMO = "https://quantas.github.io/shark-ng-table/" +# Project Pages sites under the Quantas account used to be served at +# www.quantasnet.com// through the old user site's custom domain. Each +# old path keeps working through a redirect stub to the site's github.io URL. +PROJECT_REDIRECTS = { + "shark-ng-table": SHARK_NG_TABLE_DEMO, + "shark-ng-table-samples": "https://quantas.github.io/shark-ng-table-samples/", + "wow-forever-atlas": "https://quantas.github.io/wow-forever-atlas/", +} # (tag, attribute) pairs that make the browser fetch something. RESOURCE_ATTRS = {("link", "href"), ("script", "src"), ("img", "src"), ("source", "src")} @@ -205,15 +213,17 @@ def test_colors_only_in_tokens(self): leftover = COLOR_LITERAL.findall(strip_token_blocks(f.read_text(encoding="utf-8"))) self.assertEqual(leftover, [], f.relative_to(SITE)) - def test_shark_ng_table_redirect(self): - path = SITE / "shark-ng-table" / "index.html" - self.assertTrue(path.is_file()) - page = parse(path) - refresh = [a for a in page.find("meta") if (a.get("http-equiv") or "").lower() == "refresh"] - self.assertEqual(refresh[0].get("content"), f"0; url={SHARK_NG_TABLE_DEMO}") - canonical = [a for a in page.find("link") if a.get("rel") == "canonical"] - self.assertEqual(canonical[0].get("href"), SHARK_NG_TABLE_DEMO) - self.assertIn(SHARK_NG_TABLE_DEMO, {a.get("href") for a in page.find("a")}) + def test_project_redirects(self): + for name, target in PROJECT_REDIRECTS.items(): + with self.subTest(name=name): + path = SITE / name / "index.html" + self.assertTrue(path.is_file()) + page = parse(path) + refresh = [a for a in page.find("meta") if (a.get("http-equiv") or "").lower() == "refresh"] + self.assertEqual(refresh[0].get("content"), f"0; url={target}") + canonical = [a for a in page.find("link") if a.get("rel") == "canonical"] + self.assertEqual(canonical[0].get("href"), target) + self.assertIn(target, {a.get("href") for a in page.find("a")}) def test_404(self): path = SITE / "404.html"