Keep a description's headings, bullets and paragraphs, and draw them in the reader

The readers flattened a posting's HTML into one line with strip_html, so
sections and bullets ran together. _shared.html_text gives a line per
paragraph, '• ' before a list item and '## ' before a heading; every
reader's description goes through it, sections read per role get their
own headings, and the reader pane draws the lines as h3, ul and p.
Excerpts leave the marks out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 21:40:12 +02:00
1 parent 17e7615599
commit c497fe965d
44 files changed
+300 -147

No files matched your search

+5 -5
View File
@@ -317,7 +317,7 @@ def _detail(name: str, url: str = "https://careers.vestas.com/job/x/1431772533/"
def test_detail_reads_the_description_the_date_and_the_places_of_an_address() -> None:
got = _detail("successfactors-job.html")
assert got["description"].startswith("Senior Management | Full-Time | Commercial Are you")
assert got["description"].startswith("## Senior Management | Full-Time | Commercial\nAre you")
assert "<" not in got["description"]
# `datePosted` is a Java date, "Tue Sep 29 02:00:00 UTC 2026".
assert got["posted"] == datetime(2026, 9, 29, 2, tzinfo=UTC)
@@ -347,14 +347,14 @@ def test_detail_reads_the_place_from_a_street_address() -> None:
got = _detail("successfactors-job-street.html")
assert got["location"] == "Bern, Switzerland"
assert got["posted"] == datetime(2026, 9, 28, 2, tzinfo=UTC)
assert got["description"].startswith("Senior Solution Engineer Defence")
assert got["description"].startswith("## Senior Solution Engineer Defence")
def test_detail_of_a_page_without_microdata_gives_the_description_only() -> None:
"""Novo Nordisk: the listing's date and location stand."""
got = _detail("successfactors-job-plain.html")
assert set(got) == {"description"}
assert got["description"].startswith("Process Supporter, Koriyama Factory")
assert got["description"].startswith("## Process Supporter, Koriyama Factory\n")
assert "Your new role" in got["description"]
@@ -364,7 +364,7 @@ def test_detail_leaves_a_style_block_out_of_the_description() -> None:
'<span>Nested</span></span></span></div><p>Footer</p>')
got = successfactors.detail(lambda url, **kw: page.encode(), "careers.acme.com",
{"url": "https://careers.acme.com/job/x/1/"})
assert got == {"description": "Build things. Nested"}
assert got == {"description": "Build things.\nNested"}
def test_detail_of_a_page_that_is_not_a_role_is_empty() -> None:
@@ -385,7 +385,7 @@ def test_detail_is_read_through_the_shared_code_for_the_roles_not_read(
assert done == {f"successfactors:careers.vestas.com:{r['source_id']}" for r in rows}
assert not failed
assert out[0]["location"] == "Seoul, South Korea"
assert out[0]["description"].startswith("Senior Management")
assert out[0]["description"].startswith("## Senior Management")
assert out[0]["title"] == rows[0]["title"]