Skip to content

Commit

Permalink
Merge branch 'develop' into ftr/shell-to-start-sencha
Browse files Browse the repository at this point in the history
  • Loading branch information
riedde authored Oct 11, 2024
2 parents 78ceff4 + c96595d commit 2a32673
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 88 deletions.
73 changes: 0 additions & 73 deletions add/data/xql/getRendering.xql

This file was deleted.

45 changes: 33 additions & 12 deletions add/data/xqm/util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ declare function eutil:getLocalizedName($node, $lang) {
if($node/edirom:names) then
($name)
else
($name => string-join(' ') => normalize-space())
(eutil:joinAndNormalize($name))

};

Expand All @@ -107,26 +107,26 @@ declare function eutil:getLocalizedTitle($node as node(), $lang as xs:string?) a
let $namespace := eutil:getNamespace($node)

let $titleMEI :=
if ($lang != '' and $lang = $node/mei:title/@xml:lang and not($node/mei:title/mei:titlePart)) then
($node/mei:title[@xml:lang = $lang]//text() => string-join() => normalize-space())
else if ($lang != '' and $lang = $node/mei:title/@xml:lang and $node/mei:title/mei:titlePart) then
($node/mei:title[@xml:lang = $lang]/mei:titlePart[1]//text() => string-join() => normalize-space())
if ($lang != '' and $lang = $node/mei:title[mei:titlePart]/@xml:lang) then
(eutil:joinAndNormalize($node/mei:title[@xml:lang = $lang]/mei:titlePart, '. '))
else if ($lang != '' and $lang = $node/mei:title[not(mei:titlePart)]/@xml:lang) then
(eutil:joinAndNormalize($node/mei:title[@xml:lang = $lang]))
else
(($node//mei:title)[1]//text() => string-join() => normalize-space())
(eutil:joinAndNormalize(($node//mei:title)[1]))

let $titleTEI :=
if ($lang != '' and $lang = $node/tei:title/@xml:lang) then
$node/tei:title[@xml:lang = $lang]/text()
eutil:joinAndNormalize($node/tei:title[@xml:lang = $lang])
else
$node/tei:title[1]/text()
eutil:joinAndNormalize($node/tei:title[1])

return
if ($namespace = 'mei') then
if ($namespace = 'mei' and $titleMEI != '') then
($titleMEI)
else if ($namespace = 'tei') then
else if ($namespace = 'tei' and $titleTEI != '') then
($titleTEI)
else
('unknown')
('[No title found!]')

};
(:~
Expand Down Expand Up @@ -240,7 +240,7 @@ declare function eutil:getPartLabel($measureOrPerfRes as node(), $type as xs:str
upper-case($i)

return
normalize-space(string-join(($label, $numbering),' '))
eutil:joinAndNormalize(($label, $numbering))

};

Expand Down Expand Up @@ -398,3 +398,24 @@ declare function eutil:request-lang-preferred-iso639() as xs:string {
"en"

};

(:~
: Returns one joined and normalized string
:
: @param $strings The string(s) to be processed
: @return The string (joined with whitespace and normalized space)
:)
declare function eutil:joinAndNormalize($strings as xs:string*) as xs:string {
$strings => string-join(' ') => normalize-space()
};

(:~
: Returns one joined and normalized string
:
: @param $strings The string(s) to be processed
: @param $separator One ore more characters as separators for joining the string
: @return The string (joined and normalized space)
:)
declare function eutil:joinAndNormalize($strings as xs:string*, $separator as xs:string) as xs:string {
$strings => string-join($separator) => normalize-space()
};
6 changes: 4 additions & 2 deletions app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ Ext.define('EdiromOnline.Application', {

openStartDocuments: function() {
var me = this;
var uris = me.getController('PreferenceController').getPreference('start_documents_uri');
window.loadLink(uris);
var uris = me.getController('PreferenceController').getPreference('start_documents_uri', true);
if(uris){
window.loadLink(uris);
}
}
});
3 changes: 2 additions & 1 deletion app/controller/PreferenceController.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Ext.define('EdiromOnline.controller.PreferenceController', {
getPreference: function(key, lax) {
var me = this;

// if key does not exist but lax is true, return null
if(!me.preferences[key] && lax)
return null;

Expand All @@ -86,7 +87,7 @@ Ext.define('EdiromOnline.controller.PreferenceController', {
key: key,
level: 'warn' //warn, error, fatal
});

return null;
}

Expand Down

0 comments on commit 2a32673

Please sign in to comment.