Analysis of Sonnet rendering issues
The two editions of the Sonnet present quite complicated rendering problems for our site, because their page structure and line-group structure overlap. Specifically, we have line-groups running over many pages, and so the conventional way we're handling verse lines for the shorter poems will simply not work (we're using <ul>
and <li>
elements, but the <fw>
tags which appear in between lines at page boundaries are block-level elements and need to be rendered using XHTMKL <div>
tags, which cannot appear between the <li>
elements inside a single <ul>
).
This needs to be carefully handled to avoid disrupting the display of the shorter, simpler poems already on the site. These are my preliminary thoughts on how we might do this:
- Detect the problem when matching
<lg>
and<l>
elements. Specifically, note when<lg>
has a child<fw>
, or<li>
has a parent<lg>
with a child<fw>
. It might even be better to detect this structure's existence anywhere in the document, because that should dictate that all line groups and lines be handled in the same way throughout (we don't want some handled one way and some another, because some accidentally happen not to contain<fw>
tags).
So we could set a single variable at the beginning of the rendering process, based on the existence of an<fw>
tag anywhere in the<text>
element which has a parent<lg>
. - Where this situation is detected, branch the handling of
<lg>
tags and<l>
tags, so that<lg>
becomes a<div class="lineGroup">
, and<l>
becomes a<span class="verseLine">
followed by<br />
. - Provide appropriate CSS so that these render correctly.
I'm going to start work on that today.