oreillymedia/HTMLBook

More robust handling needing for labeling block-element captions

sandersk opened this issue · 0 comments

Right now the label for a caption is generated in a span when the caption element is processed. For example:

<figcaption>Raincoat-wearing penguin</figcaption>

Processed to:

<figcaption><span class="label">Figure 1-1.</span> Raincoat-wearing penguin</figcaption>

But that won't necessarily produce desirable output if the caption contains block elements, e.g.:

<figcaption>
<p>Raincoat-wearing penguin</p>
<p>Doesn't get wet, although she's still cold</p>
</figcaption>

Need to add more robust handling in these cases. Inject the label into the first para?