IUBLibTech / newton_chymistry

New version of 'The Chymistry of Isaac Newton', using XProc pipelines to generate a website based on TEI XML encodings of Newton's alchemical manuscripts, and Apache Solr as a search engine.
2 stars 0 forks source link

Italic rendering in the <note type="biblio"> #98

Closed tubesoft closed 2 years ago

tubesoft commented 3 years ago

Currently, Alex's demo xml file uses the same tagging as authoritative bibliography for italicizing. That is, it is <hi rendition="#i">. However, I am not sure if we should code in this way. For example, the cited title of the work in the popup is italicized by <cite> whose tag is added in the xslt file. I think the coding rule should be clarified.

mdalmau commented 3 years ago

According to the CSS (https://github.com/IUBLibTech/newton_chymistry/blob/master/static/css/tei.css), the TEI should contain a rendition value of "rend-i" so <hi rendition="#rend-i"> should work.

tubesoft commented 3 years ago

It is sure that CSS has an italic rendition part, but the XSLT code that can transform <hi> part into HTML to be applied to the CSS only exists in the XSLT code for the authoritative bibliography page.

Of course I can copy the same XSLT code to the XSLT for manuscripts, but I am not really sure it is good idea to hardcode the same thing at the two separate place, which might not be good for the maintainability.

mdalmau commented 3 years ago

I checked the P5 to HTML XSL (https://github.com/IUBLibTech/newton_chymistry/blob/master/xslt/p5-to-html.xsl) and I see a template match for the <hi> element (go to line 171). I don't think you need to replicate the XSL template match from the bibliography. Replicating the template match isn't the issue, but the inconsistency in the rendition value would be, IMO.

tubesoft commented 3 years ago

I've got a new clue. We could not see any tags on the rendered HTML because I used xsl:value of on XSLT. When I changed from this to xsl:apply templates, <span class="tei-hi"> appeared on the rendered HTML. So, in this state, the attribute rendition="#i" won't be loaded.

tubesoft commented 3 years ago

When I copied line 77-82 of bibliography-to-html.xsl to p5-to-html.xsl, that is:

    <xsl:template match="hi">
        <xsl:element name="span">
            <xsl:attribute name="class" select=" replace(@rendition,'#', 'rendition-') "/>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

then the text is properly italicized.

tubesoft commented 3 years ago

Finally, I think problem solved! TEI code should be <hi rend="i">, which is converted into the class rend-i defined in the CSS file.

mdalmau commented 3 years ago

After going over this with @jawalsh he pointed out that we would need to add a rendition for '' in the TEI Header: /TEI/teiHeader/encodingDesc/tagsDecl and that the XSLT appends the "rend" to the "I" as you discovered. I think using the XSLT from the bibliography works and I would stick to that since it's using the CSS span to create the italics.

mdalmau commented 3 years ago

Hi @tubesoft is this working and ready for testing by @wehooper ? I don't see any pull requests from issues you have worked on. If any are pending testing, could you update the issue to reflect the "pending review" label. this signals that the fix needs to be tested. Thank you!

tubesoft commented 3 years ago

Oh, sorry. I already committed to the rendition_issues branch (link). Now it is ready to test the code.

wehooper commented 3 years ago

This feature appears to work as desired. I looked at Keynes 60 (ALCH00049) which has this note type. The bibl popups contain the added citation features and the italics is working nicely.

I'm going to close this issue. (I hope there's an override somewhere, in case.)

mdalmau commented 3 years ago

@tubesoft I believe this issues is addressed by this commit. Correct?

tubesoft commented 3 years ago

Yes. I included it in #99. I just confirmed in my local environment.

mdalmau commented 3 years ago

This has been updated in Carbon. Looks good.

tubesoft commented 2 years ago

I realized that the comments in pop-ups are not applied to the rend formats. What I know so far is that the XSLT does not seem to process <hi> elements (maybe other elements too) in rendering comments, and the comment is rendered as plain text. I will investigate and find a fix for it.

In the following case on Carbon, the title on the top is italicized, but "Novum lumen chymicum" in the comment is not though it is tagged with <hi rend="i"> in the P5 file.

image
tubesoft commented 2 years ago

I thought the existing tei code transformed the rend attribute properly, but it did not apply to pop-ups. By adding the following code to p5-to-html.xsl, I managed to render italic fonts:

    <xsl:template match="hi" mode="citation-popup">
        <xsl:element name="span">
            <xsl:attribute name="class" select="replace(@rend,'(.+)','rend-$1')"/>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

And output is: ALCH00063 - 4.1r

image
wehooper commented 2 years ago

The italics are appearing as requested.