Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
fb1124b5
Commit
fb1124b5
authored
Sep 18, 2018
by
Mathias Goebel
Browse files
better performance on former_or_current_location
parent
ac5d025e
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/fontane/index-processor.xqm
View file @
fb1124b5
...
...
@@ -89,6 +89,19 @@ switch ( $entity/local-name() )
$list/local-name() || "-" || string($list/@type)
};
declare function local:get-icon-by-entity($entity as node())
as xs:string {
switch ( $entity/local-name() )
case "event" return "fa-flag"
case "org" return "fa-university"
case "person" return "fa-user"
case "personGrp" return "fa-users"
case "place" return "fa-map-marker"
case "item" return "fa-book"
default return
"fa-exclamation-triangle"
};
(:~
: Helper function to use an efficient map data type to store the model.
:)
...
...
@@ -404,17 +417,21 @@ element xhtml:li {
}
};
(: -> A (irgendein Ding) hat_derzeitigen_Aufbewahrungsort B (irgendein Ort) :)
declare function local:has-former-or-current-location($links as element(tei:link)*)
as element(xhtml:li)* {
for $link in $links
let $id := $link/@target => substring-after(" ") => substring-after(":")
let $thisId := string($link/parent::tei:linkGrp/parent::tei:*/@xml:id)
let $id := ($link/@target => replace("#|\w{3}:", "") => tokenize(" "))[. != $thisId]
let $targetNode := $f-indexproc:dataCollection/id($id)
let $list := local:get-list-by-entity($targetNode)
let $icon := local:get-icon-by-entity($targetNode)
return
element xhtml:li {
attribute class { "former-or-current-location" },
element xhtml:a {
attribute href { "register-
listPlace
.html?e=" || $id },
<xhtml:i class="fa
fa-map-marker
" aria-hidden="true"></xhtml:i>,
attribute href { "register-
" || $list || "
.html?e=" || $id },
<xhtml:i class="fa
{$icon}
" aria-hidden="true"></xhtml:i>,
" ",
$targetNode/*[1]/string(),
let $ancestors := $targetNode/ancestor::tei:place
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment