Skip to content

Commit

Permalink
Another attempt to number notes, more robustly
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Oct 3, 2022
1 parent 6595d53 commit 355f070
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
7 changes: 3 additions & 4 deletions helpers/editions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
</func:result>
</func:function>


<!-- template 'join' accepts valueList and separator -->
<xsl:template name="join-meta">
<xsl:param name="valueList" select="/.."/>
Expand Down Expand Up @@ -331,6 +330,7 @@
</div>
</xsl:if>
</xsl:template>

<xsl:template match="tei:q" name="quote">
<q>
<xsl:apply-templates/>
Expand Down Expand Up @@ -392,12 +392,11 @@
</xsl:template>

<xsl:template match="tei:note" name="notes">
<xsl:variable name="num" select="count(..//preceding-sibling::*/tei:note) + count(preceding-sibling::tei:note) + 1"/>
<span class="tei-note-ref">
<xsl:value-of select="$num"/>
<xsl:number level="any" count="tei:body//tei:note" />
</span>
<span class="tei-note">
<span class="tei-note-num">Note <xsl:value-of select="$num"/>:
<span class="tei-note-num">Note <xsl:number level="any" count="tei:body//tei:note" /> :
</span>
<xsl:value-of select="."/>
</span>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tei-editions",
"description": "An Omeka plugin for importing and rendering structured TEI files for EHRI digital editions.",
"version": "1.0.0-pre6",
"version": "1.0.0-pre7",
"devDependencies": {
"grunt": "^1.3.0",
"grunt-cli": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ link="https://github.com/EHRI/TeiEditions"
support_link="https://github.com/EHRI/TeiEditions/issues"
omeka_minimum_version="2.6"
omeka_target_version="2.6"
version="1.0.0-pre6"
version="1.0.0-pre7"
29 changes: 11 additions & 18 deletions test/resources/test-notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,17 @@
</teiHeader>
<text>
<body>
<p>This is a test TEI file.</p>
<p>It contains two references to places: <placeName ref="https://www.geonames.org/2643743/">London</placeName> and
<placeName ref="http://www.geonames.org/6559171/">Munich</placeName>
<note type="gloss">Munchen</note>
and one without a reference: <placeName>Tartu</placeName>.</p>

<p>This is an organisation: <orgName ref="https://portal.ehri-project.eu/authorities/ehri_cb-001408">Czechoslovak Government-in-Exile</orgName></p>
<pb n="1" facs="EHRI-DC-044_03.png"/>

<p>It contains a reference to an image of the Memorial of the Murdered Jews of Europe, Berlin. <figure><graphic url="memorial.jpg" /><head>Figure 1: Memorial to the Murdered Jews of Europe.</head>
<figDesc>Image of the Memorial to the Murdered Jews of Europe, Berlin by Flickr user Tomasz Przechlewski under the Creative Commons license.</figDesc></figure></p>
<p>It also contains a reference to the Slovak Nationalist politician <persName ref="https://portal.ehri-project.eu/authorities/ehri_pers-000261">Mach Alexander</persName> and the subject term
<term type="subject" ref="https://portal.ehri-project.eu/keywords/ehri_terms-585">Confiscation of Property</term>.</p>
<p>Also an invalid URL: <placeName ref="http://www.geonames.org/INVALID">Invalid</placeName>
<note type="gloss">Not valid</note>
<persName>Test</persName>
<note type="gloss">Another name</note>

<p>A <note>a</note></p>
<p>
B <note>b</note>
C <note>c</note>
</p>
<p>
D <note>d</note>
<q>E <note>e</note></q>
</p>
<p>
F <note>f</note>
</p>
</body>
</text>
Expand Down
6 changes: 4 additions & 2 deletions test/unit/TeiEditions_DocumentProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ public function testAsHtmlWithNotes()
{
$doc = TeiEditions_Helpers_DocumentProxy::fromUriOrPath(TEI_EDITIONS_TEST_DIR . "/resources/test-notes.xml");
$html = $doc->asHtml();
$this->assertThat($html["html"], self::stringContains('Note 3',
'does not contain correct number of notes'));
for ($i = 1; $i <= 6; $i++) {
$this->assertThat($html["html"], self::stringContains("Note $i",
'does not contain correct number of notes'));
}
}

public function testAsSimpleHtml()
Expand Down

0 comments on commit 355f070

Please sign in to comment.