fixed quick filter

This commit is contained in:
Oleg Belyaev 2025-03-23 22:31:58 +03:00
parent e808e2877c
commit 7b35bf2e83
3 changed files with 52 additions and 42 deletions

View file

@ -23,9 +23,11 @@ declare function api:ment-index($db-lang as xs:string) {
some Unicode characters very well in this system :)
declare function api:entry-info-short($n as node())
as map(xs:string, item()) {
map{'id': string(hash($n/@xml:id)),
'xmlid': string($n/@xml:id),
'form': $n/text()
let $id := if (name($n) = 're') then string($n/@corresp) else string($n/@xml:id)
return map{'id': hash($id),
'xmlid': $id,
'form': $n/text(),
'subentry': if (name($n) = 're') then true() else false()
}
};
@ -173,7 +175,7 @@ declare %rest:path("{$db-lang}/api/entries")
%rest:GET
function api:entries($db-lang as xs:string) {
array:build(
$lookup/tei:table[1]/tei:entry,
$lookup/tei:table[1]/*,
api:entry-info-short#1
)
};
@ -183,7 +185,7 @@ declare %rest:path("{$db-lang}/api/entries/{$entry-id}")
function api:entries($db-lang as xs:string,
$entry-id as xs:string) {
api:entry-info-long(
$lookup/tei:table[1]/tei:entry[string(hash(@xml:id))=$entry-id],
$lookup/tei:table[1]/*[string(hash(@xml:id))=$entry-id],
$db-lang)
};

View file

@ -503,23 +503,7 @@ declare %rest:path("{$lang}/dict")
{if ($lang = 'ru') then 'Производные' else 'Show subentries'}
</label>
</fieldset>
<nav id="entrylist">
<ul>
{for $doc in $page:lookup-all
let $id := if ($doc/name() = 'entry') then $doc/@xml:id
else $doc/@corresp
return element li {
if ($doc/name() = 're') then
(attribute hidden {'true'},
attribute class {'abv-menu-re'}) else (),
attribute id {`link_{$id}`},
<a href="./dict/{$id}">
{$doc/text()}
</a>
}
}
</ul>
</nav>
<nav id="entrylist"></nav> <!-- To be filled dynamically in js -->
</aside>
<!-- The dictionary itself. The entries are displayed as articles retrieved