Skip to content

Commit

Permalink
Merge pull request #137 from karl-kraus/elda/third-column
Browse files Browse the repository at this point in the history
feat:improved text structure for notes in facsimile/surface #136
  • Loading branch information
linxOD authored Nov 27, 2024
2 parents 2cd2daf + 7b9afa5 commit b2fd18b
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
10 changes: 8 additions & 2 deletions py/remove_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import tqdm
from acdh_tei_pyutils.tei import TeiReader
from lxml import etree as ET


SOURCE_DIR = 'data/editions'
Expand Down Expand Up @@ -42,25 +43,30 @@ def handle_pb_with_lb_break(file):

def add_graphic_url(file):
doc = TeiReader(file)
surface = doc.any_xpath('//tei:facsimile//tei:surface')
surface = doc.any_xpath('//tei:facsimile[@corresp="#DWkonJer"]/tei:surface')
count = 0
for i, s in enumerate(surface):
id = s.get('{http://www.w3.org/XML/1998/namespace}id')
if id is not None and '_' in id:
if "F" in id or "-" in id or "266_a" in id:
continue
# count is only required for special cases when sequence needs to be adjusted
count += 1
idInteger = id.replace('idfacs', '').split('_')[0]
if idInteger is not None:
s.attrib["n"] = str(i + 1)
new_id = int(idInteger) + count
url = f'iiif/images/wpn/{new_id:04d}'
graphic = s.find('tei:graphic', namespaces=NSMAP)
if graphic is not None:
graphic.set('url', url)
else:
print(f'No graphic found for surface {i}')
print(f'No graphic found for surface {i}. Creating one.')
graphic = ET.Element('graphic', attrib={'url': url})
s.append(graphic)
else:
print(f'No id found for surface {i}')

doc.tree_to_file(file)


Expand Down
30 changes: 24 additions & 6 deletions scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,22 @@ wpn-detail-view:has(span[data-bs-toggle="popover"]:hover) details:not([open]) .s
margin-bottom: $spacer * 0.5;
}

#textcontent-pb .longQuoteVerse,
#textcontent-pb .inkLongQuoteVerse,
#textcontent-pb .typescriptLongQuoteVerse,
#textcontent-pb .typescriptLongQuoteVerseLeading,
#textcontent-pb .longQuoteVerseStart,
#textcontent-pb .longQuoteVerseEnd,
#textcontent-pb .longQuoteVerseMiddle {
#textcontent-pb .longQuoteVerseMiddle,
#textcontent-pb .inkLongQuoteVerse,
#textcontent-pb .typescriptLongQuoteVerse,
#textcontent-pb .typescriptLongQuoteVerseLeading {
text-align-last: left;
text-align: left;
text-indent: 30px;
}

#textcontent-pb .longQuoteVerse {
text-align-last: left;
text-align: left;
}

#textcontent-pb .longQuoteVerse {
word-spacing: .2rem;
}
Expand All @@ -638,7 +642,6 @@ wpn-detail-view:has(span[data-bs-toggle="popover"]:hover) details:not([open]) .s
}

#textcontent-pb .longQuoteMiddleCenter,
#textcontent-pb .longQuoteVerseCenter,
#textcontent-pb .typescriptLongQuoteTitle,
#textcontent-pb .typescriptLongQuoteTitle2,
#textcontent-pb .typescriptLongQuoteAdvInsert,
Expand All @@ -648,6 +651,21 @@ wpn-detail-view:has(span[data-bs-toggle="popover"]:hover) details:not([open]) .s
text-align: center;
}

#textcontent-pb .longQuoteVerseCenter {
margin-left: $spacer * 7 !important;
text-align: left;
text-align-last: left;
}

#textcontent-pb .longQuoteVerseCenter .l {
width:100%;
margin: 0;
}

// #textcontent-pb .longQuoteVerseStart .l,
// #textcontent-pb .longQuoteVerseEnd .l,
// #textcontent-pb .longQuoteVerseMiddle .l

#edition-view #sub_grid_pb {
display:grid;
grid-template-columns: calc(100% * 0.4) calc(100% * 0.4) calc(100% * 0.2);
Expand Down
6 changes: 6 additions & 0 deletions wpn-utils/wpn-typo-infobox-dropdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const btn = document.getElementById("btn_more_text_layers");

btn?.addEventListener("click", () => {
const dropdown = document.getElementById("list_more_text_layers");
dropdown?.classList.toggle("fade");
});
27 changes: 25 additions & 2 deletions xslt/editions_typo.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,32 @@
</div>
<div id="infocolumn" class="bg-white px-0 border-start border-light-grey">
<div id="infocontent-pb">
<xsl:for-each select="//tei:TEI/tei:facsimile[1]/tei:surface/tei:note">
<xsl:for-each select="//tei:TEI/tei:facsimile[@corresp='#DWkonJer']/tei:surface">
<xsl:variable name="corresp" select="substring-after(@corresp, '#')"/>
<div class="note m-2 {replace(@corresp, '#', '')}">
<xsl:apply-templates/>
<h4><xsl:text>Jerusalemer Konvolut, fol. [</xsl:text><xsl:value-of select="@n"/><xsl:text>] recto</xsl:text></h4>
<xsl:for-each select="./tei:note[@type='pagination']">
<p><xsl:value-of select="concat('Pagination ', ./text(), ' ', @corresp)"/></p>
</xsl:for-each>
<h5>Textträger</h5>
<p><xsl:text>Standort, Signatur: </xsl:text></p>
<p><xsl:text>Grundschicht, Material: </xsl:text><xsl:value-of select="ancestor::tei:TEI/tei:teiHeader//tei:item[@xml:id=$corresp]/text()"/></p>
<h5>Zustand</h5>
<p><xsl:value-of select="./tei:note[@type='stamp']/text()"/></p>
<xsl:if test="./tei:note[@type='change'] or ./tei:note[@type='printInstruction']">
<h5>Weitere Textschichten</h5>
<a id="btn_more_text_layers">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-black-grey stroke-wpn-red-hover align-baseline ms-2" width="10" height="10" viewBox="0 0 8 8"><g transform="translate(0.53 0.75)"><path style="fill:none;stroke-width:1.5px;stroke-linejoin:round;" d="M0,6V0H6" transform="translate(6) rotate(90)"></path><line style="fill:none;stroke-width:1.5px;" y1="6" x2="6"></line></g></svg>
</a>
<ul id="list_more_text_layers" class="fade">
<xsl:for-each select="./tei:note[@type='change']">
<li data-link="{@corresp}"><xsl:value-of select="@corresp"/></li>
</xsl:for-each>
<xsl:for-each select="./tei:note[@type='printInstruction']">
<li data-link="{@corresp}">Markierung für den Druck der Fackel Nr. 890: <xsl:value-of select="./text()"/></li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</xsl:for-each>
</div>
Expand Down
7 changes: 4 additions & 3 deletions xslt/partials/add-header-pb.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
</xsl:template>

<xsl:template match="tei:TEI">
<xsl:variable name="doc" select="doc('../../data/editions/Gesamt.xml')"/>
<xsl:copy>
<xsl:copy-of select="doc('../../data/editions/Gesamt.xml')//tei:teiHeader"/>
<facsimile xmlns="http://www.tei-c.org/ns/1.0">
<xsl:copy-of select="doc('../../data/editions/Gesamt.xml')//tei:facsimile/tei:surface[@xml:id = $facsimile]"/>
<xsl:copy-of select="$doc//tei:teiHeader"/>
<facsimile xmlns="http://www.tei-c.org/ns/1.0" corresp="{$doc//tei:facsimile/tei:surface[@xml:id = $facsimile]/parent::tei:facsimile/@corresp}">
<xsl:copy-of select="$doc//tei:facsimile/tei:surface[@xml:id = $facsimile]"/>
</facsimile>
<xsl:apply-templates />
</xsl:copy>
Expand Down
2 changes: 1 addition & 1 deletion xslt/partials/scripts.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<xsl:map-entry key="'eventindex_updated.xml'" select="('wpn-header','wpn-detail-view','wpn-reg-entry','wpn-timeline','timeline-helpers')"/>
<xsl:map-entry key="'suche.xml'" select="('wpn-header','wpn-detail-view','init-typesense')"/>
<xsl:for-each select="collection('../../data/editions?select=idPb*.xml')">
<xsl:map-entry key="tokenize(base-uri(current()),'/')[last()]" select="('wpn-header','wpn-page-view','wpn-entity', 'init-openseadragon', 'wpn-hf-height', 'wpn-typo-connections')"/>
<xsl:map-entry key="tokenize(base-uri(current()),'/')[last()]" select="('wpn-header','wpn-page-view','wpn-entity', 'init-openseadragon', 'wpn-hf-height', 'wpn-typo-connections', 'wpn-typo-infobox-dropdown')"/>
</xsl:for-each>
</xsl:map>
</xsl:variable>
Expand Down

0 comments on commit b2fd18b

Please sign in to comment.