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

Adding notes to citation pop-ups #79

Closed mdalmau closed 3 years ago

mdalmau commented 4 years ago

We have decided to display notes in the citation pop-ups. This is a two-part task:

  1. update the XSL: https://github.com/IUBLibTech/newton_chymistry/blob/master/xslt/p5-to-html.xsl (scroll down to comment: bibliographic citation popups)
  1. add to the CSS: (probably the TEI.css?) -- PROBABLY OPTIONAL (currently not explicit CSS for the citations. If we want to make font-size slightly smaller for the certainty and note, then we would have to add new css for this, using relative values for accessibility)

This task is pending an updated encoding by Alex Wingate so that there's a test manuscript that can be used for implementing these changes.

mdalmau commented 4 years ago

Certainty Display Logic: @corresp=”value”, no @cert (perfect case) → Verified @corresp=”value”, @cert=”high” → High Likelihood @corresp=”value”, @cert=”unknown” → Unknown Likelihood No @corresp, no @cert → Ambiguous

As part of looping through for the various conditions for certainty value, the XSLT will need to print a static label:

Citation certainty:

The XSLT may need to replace the paragraph tags to include all the info -- the citation, links, certainty label, and note -- in one paragraph and use HTML break tags for the line break needed so that the pop-ups will display as:

Haeredes Eberhardi Zetzneri, 1661. [View Full Citation] [View Full Text] Citation certainty: Verified The information referenced is on pp. 383-384.

mdalmau commented 4 years ago

We may not need to make the note font smaller or tweak the indentation. It's likely no additional CSS will be needed. We would want to review a citation with a longer note to see if we still feel the same.

tubesoft commented 3 years ago

It has been implemented at this commit.

wehooper commented 3 years ago

These features are all present. Looks good.

mdalmau commented 3 years ago

@aewingate, could you verify this one on Carbon. I can't seem to find (just by random looking at mss that I know have lots of citations) one with a note. I know you added these in more recent mss you have been researching (and I suppose I could look in Xubmit to see your most recent commits ...) :-) BUT could you check quickly and just confirm that the fix is on Carbon? Thank you!

aewingate commented 3 years ago

@mdalmau I'm looking at ALCH00049 right now (http://carbon.dlib.indiana.edu:8220/text/ALCH00049/diplomatic). The notes are showing up in the pop-up. However, any notes also show up outside of the pop-up inline with the text too (so we've got double notes). image

Also, the citations that are cert="high" need to say "High Likelihood". They just say "Likelihood" right now, but all the other parts look great!. image

For future reference, ALCH00049, 52-53, 61-62, and 63.04 are all up to date with the new citation encoding guidelines and have bibls in them!.

mdalmau commented 3 years ago

Ack! Good catch, @aewingate. I have reopened the issue and tagged @tubesoft and @wehooper.

tubesoft commented 3 years ago

I will go over this issue soon!

Conal-Tuohy commented 3 years ago

I will go over this issue soon!

I think this may be what you need to add, @tubesoft :

<xsl:template match="bibl/note"/>

Here's how it works:

In general, in that stylesheet, there are templates which match every TEI element (in the default, unnamed, mode), and those templates normally create a new HTML element to represent the TEI element, and then within that HTML element they apply templates to the TEI element again, first in "create-attributes" mode (which adds HTML attribute to the new HTML element), and then in "create-content" mode (which adds child elements to the HTML element). There's a generic template in the "create-content" mode which just applies templates (in the default mode) to the element's children.

In this case, the bibl/note is rendered as the content of an HTML title attribute, by this template:

<xsl:template match="bibl" mode="create-attributes">
    <xsl:variable name="id" select="substring-after(@corresp, '#')"/>
    <xsl:variable name="full-citation" select="key('citation-by-id', $id)"/>
    <xsl:variable name="formatted-citation">
        <div class="citation-popup">
            <xsl:apply-templates mode="citation-popup" select="$full-citation"/>
            <xsl:apply-templates mode="citation-popup" select="."/>
        </div>
    </xsl:variable>
    <xsl:attribute name="title">
        <xsl:apply-templates mode="citation-popup" select="serialize($formatted-citation)"/>
    </xsl:attribute>
    <xsl:attribute name="href" select="concat('/bibliography#', $id)"/>
    <xsl:next-match/>
</xsl:template>

... but NB when templates are also applied to the bibl in the create-content mode, it's handled again by this template:

<!-- populate an HTML element's content -->
<xsl:template mode="create-content" match="*">
    <!-- The content of an HTML element which represents a TEI element is normally produced by applying templates to the children of a TEI element. -->
    <!-- This can be over-ridden for specific TEI elements, e.g. <tei:space/> is an empty element, but it should produce an actual space character in the HTML -->
    <xsl:apply-templates/>
</xsl:template>

... and that applies templates to the children of the bibl, including the bibl/note (in the default mode). If you have a template which matches bibl/note and does nothing, the duplication should disappear.

Hope that helps!

I realise this stylesheet needs better documentation: I am working on some for @jawalsh's Swinburne project, which should be helpful here too.

tubesoft commented 3 years ago

Thank you Con!

However, I found that <note> in the part Alex indicated was outside of <bibl>. It is line 337 of ALCH00049.xml: <bibl corresp="CHYM000001.xml#Vaughan_1650"><persName>Eugenio</persName> in Magia Adamica <add place="infralinear">(p 69.)</add></bibl><note type="editorial" resp="alewinga">The only publicly available digital facsimile of this edition of the Magia Adamica is missing pages, including the one Newton cites here. Therefore, we have linked to a transcription instead of a digital facsimile. The Text Creation Partnership (TCP) transcription is based off of an Early English Books Online (EEBO) digital facsimile contributed by the British Library.</note>

I am not sure that whether Alex is supposed to encode <note> inside the <bibl> or outside. I will ask this at the next meeting.

tubesoft commented 3 years ago

Oops, I was looking at an old P5 code! I updated local environment from Xubmit. I guess <note> is supposed to be inside <bibl>. I will make sure at the next meeting.

tubesoft commented 3 years ago

@Conal-Tuohy So far, on my local environment, adding <xsl:template match="bibl/note"/> suppresses rendering of the contents of both at the main text and the pop-up.

I am still searching for some workaround, but in the mean time, I am letting you know.

Conal-Tuohy commented 3 years ago

ahh OK perhaps a simpler fix would be to drop that template (matching bibl/note) and change the template which matches bibl so that it applies templates to all its children except note e.g. change <xsl:apply-templates/> to <xsl:apply-templates select="node() except note"/>?

tubesoft commented 3 years ago

Thanks, @Conal-Tuohy ! I also just found a fix for that. I found that I needed mode attributes I added <xsl:template mode="create-content" match="bibl/note"/> instead of <xsl:template match="bibl/note"/> This was not enough. I also needed to add a mode attribute for rendering on the pop-up: <xsl:apply-templates mode="citation-popup" select="note[@type='biblio']"/> instead of <xsl:apply-templates select="note[@type='biblio']"/>

Then, the suppressing the rendering is only applied for the original text, and rendering for the pop-up remains.

tubesoft commented 3 years ago

Fixed at #104

wehooper commented 3 years ago

This issue has been resolved. Looks good.