mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-16 23:18:14 +00:00
With Google Books as the metadata provider, every description shows its
HTML, starting with a literal `<p>`. The API returns HTML,
`_parse_volume` passes it on with the comment "leave as-is for UI to
sanitize", and the UI renders `{book.description}` as text in both
`ReleaseModal.tsx` and `DetailsModal.tsx`.
This turns the description into plain text in the provider: `<br>`
becomes a line break, the end of a block element a blank line, other
tags are dropped and entities decoded. The details modal uses
`whitespace-pre-line`, so the breaks survive there. Text that only looks
like a tag is left alone (`2 < 3 and a > b`).
Tests are in `tests/metadata/test_googlebooks_parse.py`. With the source
change reverted all three fail. `make python-checks` is clean and
`tests/metadata` passes.
I did not reuse `_blurb_to_text` from the DNB provider: it is specific
to DNB blurb pages.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Bug Fixes**
* Google Books descriptions are cleaned up for display: HTML formatting
is removed, entities are decoded, and paragraph breaks are preserved.
Empty descriptions are treated as missing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->