Turn one item's HTML description into a { fields, imageUrls, images } structure.
The description is a flat run of <img …/> tags and <b>Label:</b> value
pairs joined by <br/>. We:
collect every <img src="…"> URL, resolved against baseUrl when given (a
relative src is otherwise useless outside the portal's page);
let each bold label (<b> or <strong>, with or without attributes) own the
text up to the next bold label, dropping the residual tags from that value. The
value keeps its line breaks (the notice's own newlines, and a <br> or block tag
inside it) as \n; other whitespace is collapsed and each line trimmed. A bold run is a label only at the start of a
line — the start of the description, or after a <br>, a block tag or an image,
with only whitespace between (every label in the live feed is). A bold run
inside a value (L-1111 <b>sowie</b> L-2222, <b>Grund der Meldung:</b> <b>Achtung:</b> Fremdkörper) is emphasis: its text stays in the value instead of
cutting it off and starting a field named after the bold word.
A label the description repeats keeps every distinct non-empty value, in order, joined
with REPEATED_LABEL_SEPARATOR: a notice for two products lists a product name
and a lot number per product, and keeping only the last one dropped the first
product's batch from lotNumbers and from fields. The image credit ("Bildquelle",
one per image) repeats too, so images also pairs each image with the credit that
follows it. The raw description stays available on the item for anyone who needs more.
One forward scan over the fragment, so the cost is linear in its length.
Turn one item's HTML description into a
{ fields, imageUrls, images }structure.The description is a flat run of
<img …/>tags and<b>Label:</b> valuepairs joined by<br/>. We:<img src="…">URL, resolved againstbaseUrlwhen given (a relativesrcis otherwise useless outside the portal's page);<b>or<strong>, with or without attributes) own the text up to the next bold label, dropping the residual tags from that value. The value keeps its line breaks (the notice's own newlines, and a<br>or block tag inside it) as\n; other whitespace is collapsed and each line trimmed. A bold run is a label only at the start of a line — the start of the description, or after a<br>, a block tag or an image, with only whitespace between (every label in the live feed is). A bold run inside a value (L-1111 <b>sowie</b> L-2222,<b>Grund der Meldung:</b> <b>Achtung:</b> Fremdkörper) is emphasis: its text stays in the value instead of cutting it off and starting a field named after the bold word.A label the description repeats keeps every distinct non-empty value, in order, joined with REPEATED_LABEL_SEPARATOR: a notice for two products lists a product name and a lot number per product, and keeping only the last one dropped the first product's batch from
lotNumbersand fromfields. The image credit ("Bildquelle", one per image) repeats too, soimagesalso pairs each image with the credit that follows it. The raw description stays available on the item for anyone who needs more.One forward scan over the fragment, so the cost is linear in its length.