diff --git a/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts b/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts index 9bc49e13..88183365 100644 --- a/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts +++ b/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts @@ -56,6 +56,21 @@ function cleanText(text: string): string { return text.replace(/\s+/g, " ").trim() } +/** + * JSON-LD descriptions arrive as HTML (schema.org allows it, jobdanmark uses + * it). Render them to the same newline-separated plain text the rendered-HTML + * branch produces, so `detail` emits one description shape whichever page + * layout it hit: tags gone, entities decoded, one line per block element. + */ +function descriptionToText(html: string | undefined): string { + if (!html) return "" + return parse(html) + .structuredText.split("\n") + .map(cleanText) + .filter(Boolean) + .join("\n") +} + function normalizeUrl(value: string | null | undefined): string | null { if (!value) return null const decoded = value.replace(/&/g, "&") @@ -115,7 +130,7 @@ function fromJsonLd(jobPosting: JsonLdJobPosting, slug: string, url: string): De postalCode: address?.postalCode ?? null, addressCountry: address?.addressCountry ?? null, }, - description: jobPosting.description ?? "", + description: descriptionToText(jobPosting.description), applyUrl: null, } } diff --git a/.agents/skills/jobdanmark-search/cli/tests/detail-jsonld.test.ts b/.agents/skills/jobdanmark-search/cli/tests/detail-jsonld.test.ts index 208d82e9..42070c40 100644 --- a/.agents/skills/jobdanmark-search/cli/tests/detail-jsonld.test.ts +++ b/.agents/skills/jobdanmark-search/cli/tests/detail-jsonld.test.ts @@ -50,11 +50,43 @@ describe("parseJobPostingFromHtml JSON-LD", () => { postalCode: "5000", addressCountry: "DK", }, - description: "
Build reliable pipelines.
", + description: "Build reliable pipelines.", applyUrl: null, }); }); + test("renders an HTML description to the rendered-branch text shape", () => { + // add-portal.md Step 4: a detail description is "readable text (entities + // decoded, tags stripped, paragraph breaks preserved)". The rendered-HTML + // fallback already emits one line per/
Vi søger en udvikler til R&D.
Second para
line two
Vi søger en udvikler til R&D.
...
` now + expects the text, plus two new cases; the HTML case fails on master. + - **`job_key.py` no longer gives two postings one key when a title or company is partly non-Latin** (`tools/job_key.py`, `tests/test_job_key.py`) - the hash fallbacks from #487 and #502 fired only when the slug was completely empty, so a mixed-script name kept its