Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6cd5927
make app:print-context-relatedItem-type()#3 robust
SteffenAstheimer Feb 9, 2026
a71b933
include mei sources in query:context-relatedItems()#1
SteffenAstheimer Feb 9, 2026
51bd470
allow fallback node for sources in query:text-sources()#1
SteffenAstheimer Feb 9, 2026
2b9b5bd
add transformation and basic styling for tei sources
SteffenAstheimer Feb 9, 2026
cbe5427
add proof of concept toc for tei sources
SteffenAstheimer Feb 9, 2026
a289e80
add styling for libretti
SteffenAstheimer Feb 11, 2026
f0c12c8
adjust styling of page breaks for libretti
SteffenAstheimer Feb 11, 2026
ab4b586
create proper toc for sources
SteffenAstheimer Feb 12, 2026
695540b
fix display for mobile screens
SteffenAstheimer Feb 12, 2026
50edf90
fix minor bug with templating rules
SteffenAstheimer Feb 12, 2026
d930f02
styling tweak for speakers
SteffenAstheimer Feb 12, 2026
47a2764
add some inline styling for `.tei_stage`
SteffenAstheimer Feb 14, 2026
7ecc329
switch for default active tab for documents
SteffenAstheimer Feb 14, 2026
d8d6e9e
move context inside of editorial for sources
SteffenAstheimer Feb 14, 2026
bac9179
add styling for (braced) castGroups
SteffenAstheimer Feb 14, 2026
cd44f3f
add styling for braced `spGrp` elements
SteffenAstheimer Feb 14, 2026
3a50e86
refactor layout for libretti
SteffenAstheimer Feb 15, 2026
3729560
improve sources toc
SteffenAstheimer Feb 19, 2026
11d05b3
further improvements of the sources view
SteffenAstheimer Mar 5, 2026
2965e64
make indenting of `<lg>` and `<verseLine>` stack
SteffenAstheimer Mar 6, 2026
d39021e
fix indenting for `<l>` and placement of '-M' and '-F' blocks
SteffenAstheimer Mar 6, 2026
416cb6d
add exception for indenting + line parts
SteffenAstheimer Mar 6, 2026
2603fc5
add value 'source' to link creation for `<rs>`
SteffenAstheimer Mar 24, 2026
44a3129
prohibit indenting on mobile screens
SteffenAstheimer Apr 14, 2026
73bd497
ignore VS Code synchronizer
SteffenAstheimer Apr 14, 2026
1b3b382
Merge branch 'develop' into sources-view
SteffenAstheimer Apr 14, 2026
9d53f53
add apparatus logic for `<del @rend='converted'>`
SteffenAstheimer Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ dist
local.build.properties
node_modules
libs
.existdb.json
.github
**/.DS_Store
2 changes: 2 additions & 0 deletions catalogues/dictionary_de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<entry xml:id="delOverwritten">überschrieben</entry>
<entry xml:id="substDelStrikethrough">durchgestrichen und ersetzt mit</entry>
<entry xml:id="substDelOverwritten">überschrieben mit</entry>
<entry xml:id="substDelConverted">durch Nummerierung der Wörter umgestellt zu</entry>
<entry xml:id="delErased">gelöscht</entry>
<entry xml:id="choiceCorr">in der Vorlage</entry>
<entry xml:id="choiceUnclear">weitere mögliche Lesungen</entry>
Expand Down Expand Up @@ -442,6 +443,7 @@
<entry xml:id="oldBrowser">Diese Seite kann in Ihrem Browser nicht korrekt dargestellt werden.
Zur besseren Darstellung aktualisieren Sie bitte den Browser.</entry>
<entry xml:id="toc">Inhaltsverzeichnis</entry>
<entry xml:id="toc-short">Inhalt</entry>
<entry xml:id="bibliography">Bibliographie</entry>
<entry xml:id="discography">Discographie</entry>
<entry xml:id="literature">Literatur</entry>
Expand Down
2 changes: 2 additions & 0 deletions catalogues/dictionary_en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<entry xml:id="delOverwritten">overwritten</entry>
<entry xml:id="substDelStrikethrough">crossed out and replaced with</entry>
<entry xml:id="substDelOverwritten">overwritten with</entry>
<entry xml:id="substDelConverted">by numbering the words rearranged to</entry>
<entry xml:id="delErased">erased</entry>
<entry xml:id="choiceCorr">in the copy text</entry>
<entry xml:id="choiceUnclear">further possible transcriptions</entry>
Expand Down Expand Up @@ -412,6 +413,7 @@
<entry xml:id="noscript">Your Browser doesn't support JavaScript or it is currently disabled. Since our site heavily relies on it we have to apologize for this inconvenience!</entry>
<entry xml:id="oldBrowser">This Website won't display correctly in your browser. It is necessary to update your browser to display the data correctly.</entry>
<entry xml:id="toc">Table of contents</entry>
<entry xml:id="toc-short">Content</entry>
<entry xml:id="bibliography">Bibliography</entry>
<entry xml:id="discography">Discography</entry>
<entry xml:id="literature">Literature</entry>
Expand Down
81 changes: 70 additions & 11 deletions modules/app.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,28 @@ declare
}
};

(:
: set the active tab in documents, sources, letters etc.
: switch between text and editorial depending on the presence of a transcription
:
: @author Steffen Astheimer
: @return the input node with adapted class attributes ('active' for nav tabs, 'active in' for tab panes)
:)
declare function app:set-tab-state($node as node(), $model as map(*)) as element() {
let $target := if(exists($node/@href)) then substring-after($node/@href, '#') else string($node/@id)
let $isTabPane := exists($node/@id)
let $isActive := ($target = 'transcription' and $model('hasTranscription')) or ($target = 'editorial' and not($model('hasTranscription')))
let $newClass :=
if($isActive) then string-join((($node/@class, if($isTabPane) then 'in' else ()), 'active'), ' ')
else string($node/@class)
return
element {node-name($node)} {
$node/@*[not(name(.) = 'class')],
attribute class {$newClass},
templates:process($node/node(), $model)
}
};

(:~
: set the maximum dates for the IonRangeSlider
~:)
Expand Down Expand Up @@ -1328,17 +1350,31 @@ declare function app:print-external-data-disclaimer($node as node(), $model as m
declare
%templates:wrap
function app:doc-details($node as node(), $model as map(*)) as map(*) {
let $doc := $model('doc')
let $lang := $model('lang')
let $facs := query:facsimile($model?doc)
let $localFacsimiles := $facs[tei:graphic][not(@sameAs)] except $facs[tei:graphic[starts-with(@url, 'http')]]
let $externalIIIFManifestFacsimiles := $facs[@sameAs]
let $IIIFImagesMap := ($localFacsimiles | $externalIIIFManifestFacsimiles) ! app:create-IIIFImagesMap(., $model)
let $docType := $model('docType')
let $textRoot :=
switch($docType)
case 'diaries' return $doc/tei:ab ! app:inject-query(.)
case 'works' return $doc/mei:mei ! app:inject-query(.)
case 'var' case 'addenda' return ($doc//tei:text/tei:body ! app:inject-query(.))/(tei:div[@xml:lang=$lang] | tei:divGen | tei:div[not(@xml:lang)])
case 'thematicCommentaries' return $doc//tei:text/tei:body ! app:inject-query(.) | $doc//tei:text/tei:back
case 'sources' return $doc//tei:text ! app:inject-query(.)
default return $doc//tei:text/tei:body ! app:inject-query(.)
let $hasTranscription := not(functx:all-whitespace(<root>{$textRoot}</root>))
return
map {
'facsimile' : $facs,
'localFacsimiles' : $localFacsimiles,
'externalIIIFManifestFacsimiles' : $externalIIIFManifestFacsimiles,
'IIIFImagesMap': $IIIFImagesMap,
'hasCreation' : exists($model?doc//tei:creation),
'hasTranscription' : $hasTranscription,
'textRoot' : $textRoot,
'xml-download-url' : replace(controller:create-url-for-doc($model('doc'), $model('lang')), '\.html', '.xml'),
'thematicCommentaries' : distinct-values($model('doc')//tei:note[@type='thematicCom']/@target/tokenize(., '\s+')),
'backlinks' : wdt:backlinks(())('filter-by-person')($model?docID)
Expand Down Expand Up @@ -1397,17 +1433,12 @@ declare
case 'works' return doc(concat($config:xsl-collection-path, '/works.xsl'))
case 'writings' case 'documents' return doc(concat($config:xsl-collection-path, '/document.xsl'))
case 'diaries' return doc(concat($config:xsl-collection-path, '/diaries.xsl'))
case 'sources' return doc(concat($config:xsl-collection-path, '/sources.xsl'))
default return doc(concat($config:xsl-collection-path, '/var.xsl'))
let $textRoot :=
switch($docType)
case 'diaries' return $doc/tei:ab ! app:inject-query(.)
case 'works' return $doc/mei:mei ! app:inject-query(.)
case 'var' case 'addenda' return ($doc//tei:text/tei:body ! app:inject-query(.))/(tei:div[@xml:lang=$lang] | tei:divGen | tei:div[not(@xml:lang)])
case 'thematicCommentaries' return $doc//tei:text/tei:body ! app:inject-query(.) | $doc//tei:text/tei:back
default return $doc//tei:text/tei:body ! app:inject-query(.)
let $textRoot := $model('textRoot')
let $body :=
if(functx:all-whitespace(<root>{$textRoot}</root>))
then
if(not($model('hasTranscription')))
then
element xhtml:p {
attribute class {'notAvailable'},
(: revealed correspondence which has backlinks gets a direct link to the backlinks, see https://github.com/Edirom/WeGA-WebApp/issues/304 :)
Expand All @@ -1430,14 +1461,41 @@ declare
let $foot :=
if(config:is-news($docID)) then app:get-news-foot($doc, $lang)
else ()

return
map {
'transcription' : (wega-util:remove-elements-by-class($body, 'apparatus'),$foot),
'apparatus' : $body/descendant-or-self::*[@class='apparatus']
}
};

(:~
: Create a table of contents for nested headers of sources
: based on the sources.xsl transformation from app:prepare-text()#2
:
: @author Steffen Astheimer
: @return an xhtml:ul with a list of anchors, categorized by header nesting level
:)
declare function app:doc-toc($node as node(), $model as map(*)) as element()* {
element xhtml:ul {
for $head in $model('transcription')//xhtml:h2[contains-token(@class, 'srcHeader')]
let $classTokens := tokenize(normalize-space(string($head/@class)), '\s+')
let $levelToken := ($classTokens[starts-with(., 'header-level-')])[1]
let $level := if ($levelToken) then substring-after($levelToken, 'header-level-') else '1'
let $tocClass := 'toc-level-' || $level
let $id := normalize-space(string($head/@id))
let $label := normalize-space(string-join($head//text()[not(ancestor::xhtml:a)], ''))
where $id != '' and $label != ''
return
element xhtml:li {
attribute class { $tocClass },
element xhtml:a {
attribute href { '#' || $id },
$label
}
}
}
};

(:~
: Search and highlight query strings in a document
: Helper function for app:prepare-text()
Expand Down Expand Up @@ -1728,7 +1786,8 @@ declare
%templates:default("lang", "en")
%templates:wrap
function app:print-context-relatedItem-type($node as node(), $model as map(*), $lang as xs:string) as xs:string? {
lang:get-language-string($model?context-relatedItem?context-relatedItem-type, $lang)
let $type := $model?context-relatedItem?context-relatedItem-type
return if(exists($type)) then lang:get-language-string($model?context-relatedItem?context-relatedItem-type, $lang) else ()
};

(:~
Expand Down
14 changes: 12 additions & 2 deletions modules/query.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ declare function query:text-sources($doc as document-node()) as element()* {
<tei:acquisition>Umwandlung der Dauerleihgabe in eine Schenkung durch <tei:persName key="A008831">Hans-Jürgen Freiherr von Weber</tei:persName> am 15. November 1986</tei:acquisition>
</tei:history>
</tei:msDesc>
case 'works' case 'sources' return () (:$model('doc')//mei:sourceDesc:)
case 'works' return () (:$model('doc')//mei:sourceDesc:)
case 'biblio' return $doc/tei:biblStruct
default return $doc//tei:sourceDesc/tei:*
return
Expand Down Expand Up @@ -606,14 +606,24 @@ declare function query:witness-facsimile($source as element()) as element(tei:fa
: The value of this key is a sequence of maps, each containing the keys 'context-relatedItem-type', 'context-relatedItem-doc' and 'context-relatedItem-n'
~:)
declare function query:context-relatedItems($doc as document-node()?) as map(*)? {
let $relatedItems :=
let $teiRelatedItems :=
for $relatedItem in $doc//tei:notesStmt/tei:relatedItem
return
map {
'context-relatedItem-type': data($relatedItem/@type),
'context-relatedItem-doc': crud:doc(substring-after($relatedItem/@target, ':')),
'context-relatedItem-n': data($relatedItem/@n)
}
let $meiWeGAIdentifiers :=
for $WeGAIdentifier in $doc/mei:manifestation/mei:identifier[@type = 'WeGA']
let $key := normalize-space(string($WeGAIdentifier))
return
map {
'context-relatedItem-type': (), (: no equivalent in current data :)
'context-relatedItem-doc': crud:doc($key),
'context-relatedItem-n': () (: no equivalent in current data :)
}
let $relatedItems := ($teiRelatedItems, $meiWeGAIdentifiers)
return
if(exists($relatedItems)) then
map {
Expand Down
Loading
Loading