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:
1 parent
17e7615599
commit
c497fe965d
44 files changed
+300
-147
No files matched your search
@@ -14,16 +14,14 @@ filled, so the period's spelling is a guess.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import html
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from desk.sources import strip_html
|
||||
|
||||
from ._contract import Ask, Fields, Reads, Row
|
||||
from ._shared import Get, Page, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
|
||||
from ._shared import Get, Page, html_text, label_slug_ok, num, only, parse_dt, pay_line, yearly_amount
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -98,7 +96,8 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
country = str(ad.get("country") or "").strip()
|
||||
location = f"{site}, {country}" if site and country and country.lower() not in site.lower() \
|
||||
else site or country
|
||||
text = " ".join(strip_html(str(ad.get(key) or "")) for key in _SECTIONS)
|
||||
text = "\n".join(part for key in _SECTIONS
|
||||
if (part := html_text(ad.get(key))))
|
||||
lo, hi = num(ad.get("payTransparencyMinSalary")), num(ad.get("payTransparencyMaxSalary"))
|
||||
currency = ad.get("payTransparencySalaryCurrency")
|
||||
period = _PERIODS.get(str(ad.get("payTransparencySalaryPayPeriod") or "").strip().lower(), "")
|
||||
@@ -114,7 +113,7 @@ def rows(data: dict[str, Any], slug: str) -> list[Row]:
|
||||
"url": f"https://{_host(slug)}/jobs/{ad_id}",
|
||||
"posted": parse_dt(ad.get("publishedAt")),
|
||||
"department": str(ad.get("department") or "").strip(),
|
||||
"description": " ".join(html.unescape(text).split()),
|
||||
"description": text,
|
||||
"remote": str(ad.get("workspaceTypeId") or "").strip() or None,
|
||||
"salary_text": pay_line(lo, hi, currency, period),
|
||||
"salary_min": salary_min,
|
||||
|
||||
Reference in new issue
Block a user