Skip to content

Commit

Permalink
rework getReferences function
Browse files Browse the repository at this point in the history
  • Loading branch information
riedde committed Aug 12, 2024
1 parent d1b6679 commit 84060d8
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions modules/baudiShared.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -547,32 +547,32 @@ declare function baudiShared:getReferences($id) {
let $entryGroups := for $doc in $collectionReference
let $docID := $doc/@xml:id
let $docIDStart := substring($docID,1,8)
let $docInfo := if(starts-with($doc/@xml:id,'baudi-01-'))
let $docInfo := if($docIDStart = 'baudi-01')
then(baudiShared:translate('baudi.registry.persons.references.sources.music'))
else if (starts-with($doc/@xml:id,'baudi-02-') or starts-with($doc/@xml:id,'baudi-13-'))
else if ($docIDStart = 'baudi-02' or $docIDStart = 'baudi-13')
then (baudiShared:translate('baudi.registry.persons.references.works'))
else if(starts-with($doc/@xml:id,'baudi-04-'))
else if($docIDStart = 'baudi-04')
then(baudiShared:translate('baudi.registry.persons.references.persons'))
else if(starts-with($doc/@xml:id,'baudi-05-'))
else if($docIDStart = 'baudi-05')
then(baudiShared:translate('baudi.registry.persons.references.institutions'))
else if(starts-with($doc/@xml:id,'baudi-06-'))
else if($docIDStart = 'baudi-06')
then(baudiShared:translate('baudi.registry.persons.references.loci'))
else if(starts-with($doc/@xml:id,'baudi-07-'))
else if($docIDStart = 'baudi-07')
then(baudiShared:translate('baudi.registry.persons.references.sources.text'))
else if(starts-with($doc/@xml:id,'baudi-09-'))
else if($docIDStart = 'baudi-09')
then(baudiShared:translate('baudi.registry.persons.references.periodicals'))
else(baudiShared:translate('baudi.registry.persons.references.other'))
let $entryOrder := if(starts-with($doc/@xml:id,'baudi-02-') or starts-with($doc/@xml:id,'baudi-13-'))
let $entryOrder := if($docIDStart = 'baudi-02' or $docIDStart = 'baudi-13')
then('002')
else if (starts-with($doc/@xml:id,'baudi-01'))
else if ($docIDStart = 'baudi-01')
then ('001')
else if(starts-with($doc/@xml:id,'baudi-07'))
else if($docIDStart = 'baudi-07')
then('003')
else if(starts-with($doc/@xml:id,'baudi-04'))
else if($docIDStart = 'baudi-04')
then('004')
else if(starts-with($doc/@xml:id,'baudi-05'))
else if($docIDStart = 'baudi-05')
then('005')
else if(starts-with($doc/@xml:id,'baudi-06'))
else if($docIDStart = 'baudi-06')
then('006')
else('007')
let $correspActionSent := $doc//tei:correspAction[@type="sent"]
Expand All @@ -584,28 +584,29 @@ declare function baudiShared:getReferences($id) {
else(<br/>)
let $docTitle := if($correspActionSent)
then($correspSentTurned,' an ',$correspReceivedTurned)
else if(starts-with($doc/@xml:id,'baudi-02-') or starts-with($doc/@xml:id,'baudi-13-'))
else if($docIDStart = 'baudi-02' or $docIDStart = 'baudi-13')
then($doc//(mei:work//mei:titlePart[@type="main"])[1]/text())
else if(starts-with($doc/@xml:id,'baudi-01-'))
else if($docIDStart = 'baudi-01')
then($doc//(mei:manifestation//mei:titlePart[@type="main"])[1]/text())
else if(starts-with($doc/@xml:id,'baudi-04-'))
then($doc//(tei:persName)[1]/text())
else if(starts-with($doc/@xml:id,'baudi-05-'))
then($doc//(tei:orgName)[1]/text())
else if(starts-with($doc/@xml:id,'baudi-06-'))
then($doc//(tei:placeName)[1]/text())
else if($docIDStart = 'baudi-04')
then($doc/tei:persName[1]//text())
else if($docIDStart = 'baudi-05')
then($doc/tei:orgName[1]//text())
else if($docIDStart = 'baudi-06')
then($doc/tei:placeName[1]//text())
else if($doc/name()='TEI')
then($doc//tei:titleStmt/tei:title/string())
else('noTitle')
let $docTitle := $docTitle => string-join('') => normalize-space()
let $workSortValue := string-join($docTitle,' ') => replace('»','') => replace('«','')
let $entry := <div class="row RegisterEntry" xmlns="http://www.w3.org/1999/xhtml">
<div class="col-3" dateToSort="{$docDate}" workSort="{$workSortValue}">
{$docInfo}
{if($docDate and starts-with($doc/@xml:id,'A'))
{if($docDate and starts-with($docID,'A'))
then(' vom ','DATUM')
else()}
</div>
<div class="col" docTitle="{normalize-space($docTitle[1])}">{$docTitle}</div>
<div class="col" docTitle="{$docTitle}">{$docTitle}</div>
<div class="col-3" docID="{$docID}"><a href="/{$docID}">{$docID/string()}</a></div>
</div>
group by $docIDStart
Expand Down

0 comments on commit 84060d8

Please sign in to comment.