gutenbergtools / ebookmaker

The Project Gutenberg tool to generate EPUBs and other ebook formats.
GNU General Public License v3.0
84 stars 18 forks source link

many figures in backfile books could be upgraded to HTML5 figure elements #178

Closed eshellman closed 1 year ago

eshellman commented 1 year ago

this would improve accessibility. In many cases we could add semantic linkages from corresponing references in text.

for example, a book with this markup:

<div class="figcenter id003">
<img src="images/i_060.jpg" alt="" class="ig001">
<div class="ic001 caption">
<p>Fig. 5</p>
</div>
</div>

could be converted to

<figure id="figure_5" class="figcenter id003">
<img src="images/i_060.jpg" alt="" class="ig001">
<figcaption class="ic001 caption">
<p>Fig. 5</p>
</figcaption>
</figure>

by looking at classnames.

eshellman commented 1 year ago

This seems too difficult because changing the elements messes with the formatting. Instead, I will apply the appropriate aria roles and attributes. So instead:

<div class="figcenter id003" role="figure" aria-labelledby="caption_001">
<img src="images/i_060.jpg" alt="" class="ig001">
<div class="ic001 caption"  id="caption_001">
<p>Fig. 5</p>
</div>
</div>

note that this should not be done for new submissions - those should use figure and figcaption elements.