Skip to content

Commit

Permalink
feat(at): convert event boundaries to popvers.
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffroy-noel-ddh committed Jul 19, 2024
1 parent da1cf5b commit ae5b350
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
51 changes: 51 additions & 0 deletions responses/at-tei-to-tei.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<xsl:variable name="places" select="document('places.xml')"/>
<xsl:key name="places" match="//tei:place" use="concat('place:', @xml:id)"/>

<xsl:variable name="events" select="document('events.xml')"/>
<xsl:key name="events" match="//tei:ptr" use="@target"/>

<xsl:variable name="glosses" select="document(tokenize('glossary.xml;glossary_book_one.xml;glossary_book_two.xml;glossary_book_three.xml', ';'))"/>
<xsl:key name="glosses" match="//tei:item" use="concat('gloss:', @xml:id)"/>

Expand Down Expand Up @@ -152,4 +155,52 @@
</xsl:copy>
</xsl:template>

<xsl:template match="(tei:milestone[@unit='event']|tei:anchor[@type='event'])">
<!--
book_of_remembrances.xml:
<milestone spanTo="#ev10-end" xml:id="ev10-start" n="ev10" unit="event"/>
<anchor xml:id="ev10-end" n="ev10" type="event"/>
===
event.xml:
<event xml:id="aow1_1639_illness" type="sgl" when-custom="1639-04">
<desc>Thornton and Alice Wandesford went to England for her mother to be treated for 'the stone'</desc>
<label>illness/medical</label>
<linkGrp type="sgl">
<ptr target="bookrem:ev10" type="book" subtype="bookrem"/>
<ptr target="book1:ev11" type="book" subtype="book1"/>
</linkGrp>
</event>
-->
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates />
<span>
<xsl:choose>
<xsl:when test="name() = 'milestone'">[EVENT: </xsl:when>
<xsl:when test="name() = 'anchor'"> :EVENT]</xsl:when>
</xsl:choose>
</span>
<xsl:variable name="bookkey">
<xsl:choose>
<xsl:when test="/tei:TEI/@xml:id = 'atb-book-of-remembrances'">bookrem:</xsl:when>
<xsl:when test="/tei:TEI/@xml:id = 'atb-book-one'">book1:</xsl:when>
<xsl:when test="/tei:TEI/@xml:id = 'atb-book-two'">book2:</xsl:when>
<xsl:when test="/tei:TEI/@xml:id = 'atb-book-three'">book3:</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="event" select="$events/key('events', concat($bookkey, current()/@n))/../.."/>
<note type="event">
<p>
<xsl:attribute name="ref"><xsl:value-of select="$event/@xml:id"/></xsl:attribute>
<xsl:apply-templates select="$event/tei:desc"/>
</p>
</note>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
14 changes: 13 additions & 1 deletion responses/tei-to-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@

<xsl:template match="tei:figure">
<div class="tei-figure-wrapper">
<a href="#" class="btn-figure">&#x1f4f7;</a>
<a href="#" class="btn-figure"><i class="fas fa-image"></i><span class="is-sr-only">Photograph of the manuscript page</span></a>
<figure class="tei-figure hidden" data-tei="figure">
<xsl:apply-templates select="tei:head" />
<!-- graphic can use .jpg or .tif format, we normalise into tif here -->
Expand Down Expand Up @@ -275,4 +275,16 @@
</span>
</xsl:template>

<!-- EVENTS -->

<xsl:template match="tei:milestone[@unit='event']">
<xsl:call-template name="lossless-span"><xsl:with-param name="class" select="'event event-start has-info-box'"/></xsl:call-template>
</xsl:template>

<xsl:template match="tei:anchor[@type='event']">
<xsl:call-template name="lossless-span"><xsl:with-param name="class" select="'event event-end has-info-box'"/></xsl:call-template>
</xsl:template>

<!-- ============================================ -->

</xsl:stylesheet>
1 change: 1 addition & 0 deletions tests/settings-at.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"preTransformPath": "../responses/at-tei-to-tei.xsl",
"resources": [
"https://raw.githubusercontent.com/kingsdigitallab/alice-thornton/develop/frontend/assets/img/books/viewer/zoomify/images.xml",
"https://raw.githubusercontent.com/kingsdigitallab/alice-thornton/edition/entities/events.xml",
"https://raw.githubusercontent.com/kingsdigitallab/alice-thornton/edition/entities/people.xml",
"https://raw.githubusercontent.com/kingsdigitallab/alice-thornton/edition/entities/places.xml",
"https://raw.githubusercontent.com/kingsdigitallab/alice-thornton/edition/entities/glossary.xml",
Expand Down

0 comments on commit ae5b350

Please sign in to comment.