TEIC / Stylesheets

TEI XSL Stylesheets
231 stars 124 forks source link

tei-to-markdown.xsl needs a template to handle images #511

Closed martindholmes closed 2 years ago

martindholmes commented 3 years ago

The Stylesheets Working Group, looking at issue #444, found that the tei-to-markdown.xsl lib has no template for tei:graphic, so graphic elements are being output as nonsense. This should be a simple template to add.

martindholmes commented 3 years ago

I'm presuming that we're aiming to implement CommonMark, rather than any of the various other flavours. Our task is to go from a TEI <graphic> element to this:

![alt text](thing.png "title text")

and the main question is where we get the alt text/title text. They can perfectly well be identical, but for valid HTML5 we'll need at least the alt text. I think the place to look first would be first in a parent <figure> element: if there's <figDesc> and <head> there, use <figDesc> for the title and <head> for the alt; if there's only one, use it for both; and if neither, or no parent <figure> element, then check for a <desc> child of the <graphic> element (yes, that exists), or as a last resort, @n on the <graphic> element itself.