reworked file structure; changed search results to be faster

This commit is contained in:
Oleg Belyaev 2025-03-26 14:37:06 +03:00
parent a0fa864475
commit a65037f8ea
15 changed files with 880 additions and 853 deletions

View file

@ -0,0 +1,96 @@
module namespace dict = 'http://ossetic-studies.org/ns/abaevdict-site/dictionary';
import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at '../shared/shared.xq';
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../../abv-mod.xqm';
(: Sidebar with entry list. Requires abaev.js to be loaded. :)
declare function dict:sidebar($lang as xs:string) {
(
<button id="open-leftbar">
{html:doc('../../../static/chevron-right.svg')}
</button>,
<button id="close-leftbar">
{html:doc('../../../static/chevron-left.svg')}
</button>,
<aside id="leftbar">
<fieldset>
<input type="text" id="filter-entries"
placeholder="{if ($lang = 'ru') then 'Быстрый фильтр' else 'Quick filter…'}"/>
<label>
<input id="show-re" type="checkbox" role="switch"></input>
{if ($lang = 'ru') then 'Производные' else 'Show subentries'}
</label>
</fieldset>
<nav id="entrylist"></nav> <!-- To be filled dynamically in js -->
</aside>
)
};
declare function dict:main-view($lang as xs:string,
$p as xs:integer,
$xpath as xs:string,
$entry as xs:string) {
(dict:sidebar($lang),
<main>
{for $doc at $i in $shared:sorted
where $i > ($p - 1) * $shared:items-per-page and $i <= $p * $shared:items-per-page
let $html := if ($xpath != '' and $entry = $doc/@xml:id)
then abv-m:mark-element(
doc(`abaevdict_{$lang}/xml/{$doc/@xml:id}.xml`),
$xpath) => abv-m:make-html($lang)
else
let $sd := session:get('searchData')
let $sn := session:get('searchN')
return if (exists($sd) and $sd($sn)('entry') = $doc/@xml:id)
then abv-m:make-html($sd($sn)('tei'), $lang)
else doc(`abaevdict_{$lang}/html/{$doc/@xml:id}.html`)
return <div class="abv-lex">{(
(: Block with icons to the left of entry (floating) :)
<div class="icons">
{
<a href="dict/{$doc/@xml:id}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16">
<path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/>
<path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/>
</svg>
</a>,
if (doc('abaevdict_index/mentioned_en.xml')/lang-index
/lang[@id != 'os' and
not(starts-with(@id,'os-'))]/word/entry[@id=string($doc/@xml:id)])
then <a class="abv-map" data-abv-entry="{$doc/@xml:id}">
<img src="/static/map.png"></img>
</a>}</div>,
$html)}</div>
}
</main>,
<footer>
<nav class="pagination">
<ul>
<li>
{if ($p > 1) then <a href="?page={$p - 1}">Previous page</a> else ()}
</li>
</ul>
<!-- <ul><li>Page {$p} of {$page:total}</li></ul> -->
<ul class="abv-nextpage">
<li>
{if ($p < $shared:total) then
<a class="pagination__next" href="?page={$p + 1}">Next page</a> else ()}
</li>
</ul>
</nav>
</footer>,
<dialog id="modal_map">
<article>
<header>
<button class="abv-close-map" aria-label="Close" rel="prev">
</button>
<p>{if ($lang = 'ru') then 'Карта' else 'Map'}</p>
</header>
<p>
<div id="map_display" style="width:100%;height:80%;"></div>
</p>
<footer><button class="abv-close-map">{if ($lang = 'ru') then 'Закрыть' else 'Close'}</button></footer>
</article>
</dialog>)
};

178
xq/site/components/home.xq Normal file
View file

@ -0,0 +1,178 @@
module namespace home = 'http://ossetic-studies.org/ns/abaevdict-site/home';
declare function home:content($lang as xs:string) {
switch($lang)
case "ru" return (
<p>
Вы находитесь на сайте электронной двуязычной версии
<a href="https://ironau.ru/iesoja.html">Историко-этимологического
словаря осетинского языка</a> (ИЭСОЯ) В.&#160;И.&#160;Абаева.
Оцифровка и перевод словаря выполнены группой сотрудников, студентов и аспирантов
<a href="https://tipl.philol.msu.ru/">отделения теоретической и
прикладной лингвистики</a> МГУ имени М.&#160;В.&#160;Ломоносова и
<a href="https://iling-ran.ru/web/ru/departments/indo-european/iranian">
сектора иранских языков</a> Института языкознания РАН.
</p>,
<p>
Электронная версия словаря и перевод III и IV томов выполнены за счёт
гранта Российского научного фонда №
<a href="https://rscf.ru/project/22-28-01639/">22-28-01639</a>.
</p>,
<p>
Мы выражаем особую благодарность Амирхану Михайловичу Торчинову, который
выступил инициатором этого проекта и продолжает оказывать нам неоценимую
поддержку в нашей работе. Мы также благодарны московской осетинской общине за
поддержку перевода III томов словаря и помощь в печатном издании их английской
версии, в особенности Александру Тотоонову, Валерию Дзгоеву, Олегу Пухову,
Владиславу Хаблиеву, Руслану Бестолову, Виталию Даурову, Игорю Дзуцеву, Марине
Каболовой, Владимиру Туганову, Зоинбеку Абаеву, Виктору Джиоеву, Владимиру
Бароеву и Борису Базаеву.
</p>,
<p>
Электронная версия словаря основана на адаптации системы XML-разметки
<a href="https://tei-c.org/">TEI P5</a>. Сервер базы данных использует систему
<a href="https://basex.org">BaseX</a>. Модель разметки словаря и реализация её
программного отображения разработаны О.&#160;И.&#160;Беляевым. Все исходные
данные доступны в <a href="https://code.cucurri.ru/abaevdict">репозиториях</a>
проекта.
</p>,
<p>
Дизайн и эмблема сайта выполнены А.&#160;А.&#160;Осиповой.
</p>,
<p>
В предыдущей версии электронного словаря использовалась реляционная
<a href="https://ossetic.iranic.space">модель</a> представления данных,
разработанная Ю.&#160;Ю.&#160;Макаровым (ИЯз РАН, Кембриджский университет)
на платформе OnLex.
</p>,
<h5>Как ссылаться</h5>,
<blockquote>Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // <i>IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop</i>. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 1219.
</blockquote>,
<h5>Участники проекта</h5>,
<table>
<tbody>
<tr>
<th scope="row">Научный руководитель</th>
<td>О.&#160;И.&#160;Беляев</td>
<td>(МГУ имени
М.&#160;В.&#160;Ломоносова, ИЯз РАН)</td>
</tr>
<tr>
<th scope="row">Основные участники</th>
<td>Ю.&#160;В.&#160;Синицына</td>
<td>(МГУ имени
М.&#160;В.&#160;Ломоносова)</td>
</tr>
<tr>
<td></td>
<td>И.&#160;А.&#160;Хомченкова</td>
<td>(МГУ имени М.&#160;В.&#160;Ломоносова, ИРЯ РАН)</td>
</tr>
<tr>
<th>Оцифровка и перевод</th>
<td>В.&#160;В.&#160;Дьячков</td>
<td>(ИЯз РАН)</td>
</tr>
<tr>
<td></td>
<td>А.&#160;А.&#160;Осипова</td>
<td>(МГУ имени М.&#160;В.&#160;Ломоносова)</td>
</tr>
<tr>
<td></td>
<td>А.&#160;О.&#160;Бадеев</td>
<td>(ИЯз РАН, НИУ ВШЭ)</td>
</tr>
<tr>
<td></td>
<td>Д.&#160;А.&#160;Алексеев</td>
<td>(МГУ имени М.&#160;В.&#160;Ломоносова)</td>
</tr>
</tbody>
</table>)
default return
(
<p>
This is the website of the electronic version of V.&#160;I.&#160;Abaev&#39;s
<a href="https://ironau.ru/iesoja.html">Historical-Etymological Dictionary
of Ossetic</a> (HEDO). Its digitization and English translation have been
carried out by staff members and students of the
<a href="https://tipl.philol.msu.ru/">department of theoretical and applied
linguistics</a>, Lomonosov Moscow State University, and the <a
href="https://iling-ran.ru/web/ru/departments/indo-european/iranian">
Department of Iranian languages</a>, Institute of Linguistics RAS.
</p>,
<p>
The electronic version of the dictionary and the translation of vols. 3 and 4
have been supported by the Russian Science Foundation, project no.
<a href="https://rscf.ru/project/22-28-01639/">22-28-01639</a>.
</p>,
<p>
We are deeply grateful to Amirkhan Torchinov, who has been the initiator of this
project and is still providing us with invaluable support in our work. We are
also grateful to the Ossetian community of Moscow for their support of the
translation of vols. 1 and 2 and the help in publishing its preliminary English
version; in particular, to Alexander Totoonov, Valery Dzgoev, Oleg Pukhov,
Vladislav Khabliev, Ruslan Bestolov, Vitaly Daurov, Igor Dzutsev, Marina
Kabolova, Vladimir Tuganov, Zoinbek Abaev, Viktor Dzhioev, Vladimir
Baroev and Boris Bazaev.
</p>,
<p>
The electronic edition of the dictionary is based on an adaptation of the
XML-based <a href="https://tei-c.org/">TEI P5</a> markup system. The database
server runs on <a href="https://basex.org">BaseX</a>. The markup model and its
software realization have been developed by Oleg Belyaev. All sources are
available in our <a href="https://code.cucurri.ru/abaevdict">repositories</a>.
</p>,
<p>
Site design and logo are by Anna Osipova.
</p>,
<p>
The previous version of the electronic dictionary used a relational
data <a href="https://ossetic.iranic.space">model</a> developed by Yury Makarov
(IL RAS, Cambridge University) using the OnLex platform.
</p>,
<h5>How to cite</h5>,
<blockquote>Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // <i>IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop</i>. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 1219.
</blockquote>,
<h5>Project participants</h5>,
<table>
<tbody>
<tr>
<th scope="row">Project leader</th>
<td>Oleg Belyaev</td>
<td>(Lomonosov MSU, IL RAS)</td>
</tr>
<tr>
<th scope="row">Core team</th>
<td>Irina Khomchenkova</td>
<td>(Lomonosov MSU, Vinogradov RLI RAS)</td>
</tr>
<tr>
<td></td>
<td>Julia Sinitsyna</td>
<td>(Lomonosov MSU)</td>
</tr>
<tr>
<th>Digitization and translation</th>
<td>Vadim Dyachkov</td>
<td>(IL RAS, LLACAN CNRS)</td>
</tr>
<tr>
<td></td>
<td>Anna Osipova</td>
<td>(Lomonosov MSU)</td>
</tr>
<tr>
<td></td>
<td>Artyom Badeev</td>
<td>(IL RAS, HSE University)</td>
</tr>
<tr>
<td></td>
<td>Danil Alekseev</td>
<td>(Lomonosov MSU)</td>
</tr>
</tbody>
</table>)
};

View file

@ -0,0 +1,49 @@
module namespace index = 'http://ossetic-studies.org/ns/abaevdict-site/index';
import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at '../shared/shared.xq';
declare function index:content($lang as xs:string) {
let $mlangs := doc(`abaevdict_index/langnames.xml`)/csv[1]/record
return
<html>
{shared:head('HEDO Index', <script src="/static/abaev-index.js"></script>)}
<body>
{shared:header($lang, `../{shared:invert-lang($lang)}/index`)}
<main>
<div class="index">
<div class="langs">
<label>{if ($lang = 'ru') then 'Языки' else 'Languages'}</label>
<select id="abv-select-lang" size="99999">
{
for $mlang in $mlangs
let $mlang-id := $mlang/code/text()
let $mlang-name := if ($lang = 'ru') then $mlang/ru/text() else $mlang/en/text()
where $mlang-name != ''
order by $mlang-name
return
<option value="{$mlang-id}">
{
$mlang-name
}
</option>
}
</select>
</div>
<div class="forms">
<Label>{if ($lang = 'ru') then 'Формы' else 'Forms'}</Label>
<select id="abv-select-word" size="99999">
</select>
</div>
<div class="entries">
<Label>{if ($lang = 'ru') then 'Лексемы' else 'Lexemes'}</Label>
<select id="abv-select-entry" size="99999">
</select>
</div>
</div>
<div class="index-submit">
<button id="btn-index-submit" hidden="1">{if ($lang = 'ru') then 'К форме' else 'Go to form'}</button>
</div>
</main>
</body>
</html>
};

View file

@ -0,0 +1,31 @@
module namespace search = 'http://ossetic-studies.org/ns/abaevdict-site/search-modal';
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../../abv-mod.xqm';
(: Modal that appears on all pages, with search results :)
declare function search:content($lang as xs:string) {
if (exists(session:get('searchData'))) then
<dialog id="modal_searchResults">
<article>
<header>
<button class="abv-close-search" aria-label="Close" rel="prev"/>
<p>{if ($lang = 'ru') then 'Результаты поиска'
else 'Search results'}</p>
</header>
<table>
<thead>
<tr>
<td>{if ($lang = 'ru') then '№' else 'No.'}</td>
<td>{if ($lang = 'ru') then 'Лемма' else 'Lemma'}</td>
<td>{if ($lang = 'ru') then 'Фрагмент' else 'Fragment'}</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
<footer>
<button class="abv-close-search">{if ($lang = 'ru') then 'Закрыть' else 'Close'}</button>
</footer>
</article>
</dialog>
};