diff --git a/meshterm/ui/markdown.py b/meshterm/ui/markdown.py index 90112c0..d39816e 100644 --- a/meshterm/ui/markdown.py +++ b/meshterm/ui/markdown.py @@ -447,13 +447,19 @@ def _append_link( def _display_url(href: str) -> str: - """A link target as a page shows it: no scheme, no trailing slash, no in-page anchor.""" + """A link target as a page shows it: no scheme, no ``www.``, no trailing slash. + + An in-page anchor shows nothing at all — it names a place in the page the reader is + already on. + """ if not href or href.startswith("#"): return "" for noise in _URL_NOISE: if href.lower().startswith(noise): href = href[len(noise):] break + if href.lower().startswith("www."): + href = href[4:] return href.rstrip("/") diff --git a/tests/test_about.py b/tests/test_about.py index 0d83877..7c0acd3 100644 --- a/tests/test_about.py +++ b/tests/test_about.py @@ -66,12 +66,13 @@ def test_each_page_shows_its_sections(builder, headings) -> None: # noqa: ANN00 assert at == sorted(at), f"{headings} are out of order in the rendered page" -@pytest.mark.parametrize("builder", [about_meshterm, about_author, support_project]) +@pytest.mark.parametrize("builder", [about_author, support_project]) def test_unwritten_sections_speak_the_empty_state_voice(builder) -> None: # noqa: ANN001 """Placeholders read as deliberately unwritten: lowercase, em-dashed, unparenthesized. The app's empty-state rule (see the UX standards in ``CLAUDE.md``) is what keeps a - scaffolded page from looking like a screen that failed to load. + scaffolded page from looking like a screen that failed to load. *About MeshTerm* is + written now and so has none; these two are still scaffolding. """ text = _page(builder) placeholders = [line for line in text.splitlines() if "placeholder" in line] @@ -112,6 +113,19 @@ def test_page_is_a_full_screen_not_a_floating_view() -> None: assert AboutPage("About MeshTerm", about_meshterm()).floating is False +def test_the_licence_section_states_the_terms_and_the_credit_it_owes() -> None: + """This page is where a reader with no shell finds them. + + The terms MeshTerm ships under, the project it stands on, and the map data it draws + with — the ODbL asks for that credit by name, and a page nobody can read it on is no + credit at all. + """ + prose = " ".join(_page(about_meshterm).split()) + + for owed in ("MIT licence", "MeshCore", "OpenStreetMap contributors", "ODbL"): + assert owed in prose, owed + + def test_pages_are_written_markdown_that_ships_with_the_package() -> None: """Filling a page in is editing its ``.md`` file — no Python has to follow.""" from meshterm.ui.about import _PAGES diff --git a/tests/test_markdown.py b/tests/test_markdown.py index 84715d6..88d91fd 100644 --- a/tests/test_markdown.py +++ b/tests/test_markdown.py @@ -214,7 +214,7 @@ def test_each_inline_mark_takes_its_own_style() -> None: def test_a_link_shows_where_it_goes() -> None: """Nothing is clickable on a framebuffer console, so a link that reads "the repo" has to name the repo or it says nothing at all — scheme stripped, it is noise.""" - text = _texts("see [the repo](https://github.com/example/meshterm)\n")[0] + text = _texts("see [the repo](https://www.github.com/example/meshterm/)\n")[0] assert text.plain == "see the repo github.com/example/meshterm"