Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tubesoft opened this issue Oct 18, 2020 · 16 comments
Closed

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

tubesoft opened this issue Oct 18, 2020 · 16 comments
Labels
rendering Rendering of TEI markup

Comments

@tubesoft
Copy link
Collaborator

tubesoft commented Oct 18, 2020

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.

@tubesoft tubesoft added the rendering Rendering of TEI markup label Oct 18, 2020
@mdalmau
Copy link
Collaborator

mdalmau commented Oct 27, 2020

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
Copy link
Collaborator Author

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
Copy link
Collaborator

mdalmau commented Oct 27, 2020

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
Copy link
Collaborator Author

tubesoft commented Oct 27, 2020

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Collaborator

mdalmau commented Nov 3, 2020

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
Copy link
Collaborator

mdalmau commented Dec 11, 2020

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
Copy link
Collaborator Author

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

@tubesoft tubesoft added the awaiting signoff Fix has been attempted and needs confirmation that it's done label Dec 13, 2020
@wehooper
Copy link
Collaborator

wehooper commented Feb 1, 2021

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.)

@wehooper wehooper closed this as completed Feb 1, 2021
@mdalmau
Copy link
Collaborator

mdalmau commented Feb 3, 2021

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

@tubesoft
Copy link
Collaborator Author

tubesoft commented Feb 4, 2021

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

@mdalmau
Copy link
Collaborator

mdalmau commented Feb 10, 2021

This has been updated in Carbon. Looks good.

@tubesoft
Copy link
Collaborator Author

tubesoft commented Dec 7, 2021

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 tubesoft reopened this Dec 7, 2021
@tubesoft tubesoft removed the awaiting signoff Fix has been attempted and needs confirmation that it's done label Dec 7, 2021
@tubesoft
Copy link
Collaborator Author

tubesoft commented Dec 9, 2021

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

tubesoft pushed a commit that referenced this issue Feb 28, 2022
tubesoft pushed a commit that referenced this issue Mar 8, 2022
@wehooper
Copy link
Collaborator

The italics are appearing as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rendering Rendering of TEI markup
Projects
None yet
Development

No branches or pull requests

3 participants