- Электронная версия словаря и перевод III и IV томов выполнены за счёт
- гранта Российского научного фонда №
- 22-28-01639.
-
,
-
-Мы выражаем особую благодарность Амирхану Михайловичу Торчинову, который
-выступил инициатором этого проекта и продолжает оказывать нам неоценимую
-поддержку в нашей работе. Мы также благодарны московской осетинской общине за
-поддержку перевода I–II томов словаря и помощь в печатном издании их английской
-версии, в особенности Александру Тотоонову, Валерию Дзгоеву, Олегу Пухову,
-Владиславу Хаблиеву, Руслану Бестолову, Виталию Даурову, Игорю Дзуцеву, Марине
-Каболовой, Владимиру Туганову, Зоинбеку Абаеву, Виктору Джиоеву, Владимиру
-Бароеву и Борису Базаеву.
-
,
-
-Электронная версия словаря основана на адаптации системы XML-разметки
-TEI P5. Сервер базы данных использует систему
-BaseX. Модель разметки словаря и реализация её
-программного отображения разработаны О. И. Беляевым. Все исходные
-данные доступны в репозиториях
-проекта.
-
,
-
-Дизайн и эмблема сайта выполнены А. А. Осиповой.
-
,
-
-В предыдущей версии электронного словаря использовалась реляционная
-модель представления данных,
-разработанная Ю. Ю. Макаровым (ИЯз РАН, Кембриджский университет)
-на платформе OnLex.
-
,
-
Как ссылаться
,
-
Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 12–19.
-
- The electronic version of the dictionary and the translation of vols. 3 and 4
- have been supported by the Russian Science Foundation, project no.
- 22-28-01639.
-
,
-
-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.
-
,
-
-The electronic edition of the dictionary is based on an adaptation of the
-XML-based TEI P5 markup system. The database
-server runs on BaseX. The markup model and its
-software realization have been developed by Oleg Belyaev. All sources are
-available in our repositories.
-
,
-
-Site design and logo are by Anna Osipova.
-
,
-
-The previous version of the electronic dictionary used a relational
-data model developed by Yury Makarov
-(IL RAS, Cambridge University) using the OnLex platform.
-
,
-
How to cite
,
-
Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 12–19.
-
,
-
Project participants
,
-
-
-
-
Project leader
-
Oleg Belyaev
-
(Lomonosov MSU, IL RAS)
-
-
-
Core team
-
Irina Khomchenkova
-
(Lomonosov MSU, Vinogradov RLI RAS)
-
-
-
-
Julia Sinitsyna
-
(Lomonosov MSU)
-
-
-
Digitization and translation
-
Vadim Dyachkov
-
(IL RAS, LLACAN CNRS)
-
-
-
-
Anna Osipova
-
(Lomonosov MSU)
-
-
-
-
Artyom Badeev
-
(IL RAS, HSE University)
-
-
-
-
Danil Alekseev
-
(Lomonosov MSU)
-
-
-
)
- }
-
-
-
- };
-
-declare %rest:path("home")
- %output:method("html")
- %output:html-version('5')
- function page:home() {
- page:home('en')
- };
-
-(: =============================================================== :)
-(: ======================= THE DICTIONARY ======================== :)
-(: =============================================================== :)
-
-(: If no language defined, default to English :)
-declare %rest:path("dict")
- %output:method("html")
- %output:html-version('5')
- function page:dict() {
- web:forward('/en/dict')
- };
-
-(: The main dictionary view :)
-declare %rest:path("{$lang}/dict")
- %rest:query-param("page","{$p}", 1)
- %rest:query-param("xpath","{$xpath}", '')
- %rest:query-param("entry","{$entry}", '')
- %output:method("html")
- %output:html-version('5')
- function page:dict($lang, $p, $xpath, $entry) {
-
- {page:head('HEDO – Dictionary',
- (,
- ,
- ))}
-
-
- {page:header($lang,`../{page:invert-lang($lang)}/dict`)}
-
-
-
-
-
-
-
-
- {for $doc at $i in $page:sorted
- where $i > ($p - 1) * $page:items and $i <= $p * $page:items
- 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
{(
- (: Block with icons to the left of entry (floating) :)
-
- {
-
-
- ,
- 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
-
- }
,
- $html)}
- }
-
-
-
-
-
-
-
-
-
- {if (exists(session:get('searchData'))) then
- }
-
-
-};
-
-(: == ENTRY BY ID == :)
-(: English as default language :)
-declare %rest:path("dict/{$id}")
- %rest:query-param("xpath", "{$xpath}", '')
- %output:method("html")
- %output:html-version('5')
- function page:by-id($id, $xpath) {
- page:by-id('en', $id, $xpath)
- };
-
-declare %rest:path("{$lang}/dict/{$id}")
- %rest:query-param("xpath", "{$xpath}", '')
- %output:method("html")
- %output:html-version('5')
- function page:by-id($lang, $id, $xpath) {
- (: let $doc-index := index-of($page:sorted, $page:sorted[@xml:id=`{$id}`]) :)
- let $doc-index := index-where($page:sorted, fn { ./@xml:id=$id })
- let $pagenum := ceiling($doc-index div $page:items)
- return web:redirect('../dict',
- map:merge(({'page': $pagenum,
- 'entry': web:decode-url($id)},
- if ($xpath != '') then {'xpath': $xpath})),
- web:decode-url($id))
- };
-
-(: =============================================================== :)
-(: ======================= THE INDEX ============================= :)
-(: =============================================================== :)
-
-(: Mentioned index :)
-declare %rest:path("{$lang}/index")
- %output:method("html")
- %output:html-version('5')
- function page:index($lang) {
-let $mlangs := doc(`abaevdict_index/langnames.xml`)/csv[1]/record
-return
-
-{page:head('HEDO – Index', )}
-
-{page:header($lang, `../{page:invert-lang($lang)}/index`)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- };
-
-(: Default to English :)
-declare %rest:path("index")
- %output:method("html")
- %output:html-version('5')
- function page:index() {
- page:index('en')
- };
\ No newline at end of file
diff --git a/xq/site/components/dictionary.xq b/xq/site/components/dictionary.xq
new file mode 100644
index 0000000..68af40e
--- /dev/null
+++ b/xq/site/components/dictionary.xq
@@ -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) {
+ (
+ ,
+ ,
+
+ )
+};
+
+declare function dict:main-view($lang as xs:string,
+ $p as xs:integer,
+ $xpath as xs:string,
+ $entry as xs:string) {
+ (dict:sidebar($lang),
+
+ {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
{(
+ (: Block with icons to the left of entry (floating) :)
+
+ {
+
+
+ ,
+ 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
+
+ }
,
+ $html)}
+ }
+ ,
+ ,
+ )
+};
\ No newline at end of file
diff --git a/xq/site/components/home.xq b/xq/site/components/home.xq
new file mode 100644
index 0000000..53f73fd
--- /dev/null
+++ b/xq/site/components/home.xq
@@ -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 (
+
+ Электронная версия словаря и перевод III и IV томов выполнены за счёт
+ гранта Российского научного фонда №
+ 22-28-01639.
+
,
+
+Мы выражаем особую благодарность Амирхану Михайловичу Торчинову, который
+выступил инициатором этого проекта и продолжает оказывать нам неоценимую
+поддержку в нашей работе. Мы также благодарны московской осетинской общине за
+поддержку перевода I–II томов словаря и помощь в печатном издании их английской
+версии, в особенности Александру Тотоонову, Валерию Дзгоеву, Олегу Пухову,
+Владиславу Хаблиеву, Руслану Бестолову, Виталию Даурову, Игорю Дзуцеву, Марине
+Каболовой, Владимиру Туганову, Зоинбеку Абаеву, Виктору Джиоеву, Владимиру
+Бароеву и Борису Базаеву.
+
,
+
+Электронная версия словаря основана на адаптации системы XML-разметки
+TEI P5. Сервер базы данных использует систему
+BaseX. Модель разметки словаря и реализация её
+программного отображения разработаны О. И. Беляевым. Все исходные
+данные доступны в репозиториях
+проекта.
+
,
+
+Дизайн и эмблема сайта выполнены А. А. Осиповой.
+
,
+
+В предыдущей версии электронного словаря использовалась реляционная
+модель представления данных,
+разработанная Ю. Ю. Макаровым (ИЯз РАН, Кембриджский университет)
+на платформе OnLex.
+
,
+
Как ссылаться
,
+
Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 12–19.
+
+ The electronic version of the dictionary and the translation of vols. 3 and 4
+ have been supported by the Russian Science Foundation, project no.
+ 22-28-01639.
+
,
+
+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.
+
,
+
+The electronic edition of the dictionary is based on an adaptation of the
+XML-based TEI P5 markup system. The database
+server runs on BaseX. The markup model and its
+software realization have been developed by Oleg Belyaev. All sources are
+available in our repositories.
+
,
+
+Site design and logo are by Anna Osipova.
+
,
+
+The previous version of the electronic dictionary used a relational
+data model developed by Yury Makarov
+(IL RAS, Cambridge University) using the OnLex platform.
+
,
+
How to cite
,
+
Belyaev, Oleg, Irina Khomchenkova, Julia Sinitsyna, Vadim Dyachkov. Digitizing print dictionaries using TEI: The Abaev Dictionary Project // IWCLUL 2021: The Seventh International Workshop on Computational Linguistics of Uralic Languages. Proceedings of the Workshop. Stroudsburg, USA: Association for Computational Linguistics, 2021. P. 12–19.
+
,
+
Project participants
,
+
+
+
+
Project leader
+
Oleg Belyaev
+
(Lomonosov MSU, IL RAS)
+
+
+
Core team
+
Irina Khomchenkova
+
(Lomonosov MSU, Vinogradov RLI RAS)
+
+
+
+
Julia Sinitsyna
+
(Lomonosov MSU)
+
+
+
Digitization and translation
+
Vadim Dyachkov
+
(IL RAS, LLACAN CNRS)
+
+
+
+
Anna Osipova
+
(Lomonosov MSU)
+
+
+
+
Artyom Badeev
+
(IL RAS, HSE University)
+
+
+
+
Danil Alekseev
+
(Lomonosov MSU)
+
+
+
)
+};
\ No newline at end of file
diff --git a/xq/site/components/index.xq b/xq/site/components/index.xq
new file mode 100644
index 0000000..4e7c1ad
--- /dev/null
+++ b/xq/site/components/index.xq
@@ -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
+
+{shared:head('HEDO – Index', )}
+
+{shared:header($lang, `../{shared:invert-lang($lang)}/index`)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+};
\ No newline at end of file
diff --git a/xq/site/components/search.xq b/xq/site/components/search.xq
new file mode 100644
index 0000000..12efccf
--- /dev/null
+++ b/xq/site/components/search.xq
@@ -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
+
+};
\ No newline at end of file
diff --git a/xq/restx_api.xq b/xq/site/restx_api.xq
similarity index 96%
rename from xq/restx_api.xq
rename to xq/site/restx_api.xq
index 6d8cea0..9ea4cb5 100644
--- a/xq/restx_api.xq
+++ b/xq/site/restx_api.xq
@@ -2,7 +2,7 @@ declare namespace api = 'http://ossetic-studies.org/ns/abaevdict-api';
declare namespace tei = "http://www.tei-c.org/ns/1.0";
-import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm';
+import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../abv-mod.xqm';
(: ======================================================= :)
(: ==================== API STUFF ======================== :)
@@ -199,5 +199,12 @@ declare %rest:path("{$db-lang}/api/search")
$query as xs:string) {
abv-m:search($db-lang,$type,$query)
};
+
+(: Get current search results :)
+declare %rest:path("{$db-lang}/api/search/current")
+ %rest:GET
+ function api:search-current($db-lang as xs:string) {
+ session:get('searchData')
+ };
0
\ No newline at end of file
diff --git a/xq/site/restx_dict.xq b/xq/site/restx_dict.xq
new file mode 100644
index 0000000..823e706
--- /dev/null
+++ b/xq/site/restx_dict.xq
@@ -0,0 +1,123 @@
+module namespace page = 'http://ossetic-studies.org/ns/abaevdict-site';
+
+declare namespace tei = "http://www.tei-c.org/ns/1.0";
+
+import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../abv-mod.xqm';
+import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at './shared/shared.xq';
+
+(: COMPONENTS :)
+(: To make the codebase more manageable, components are split into separate
+files included as modules. :)
+import module namespace home = 'http://ossetic-studies.org/ns/abaevdict-site/home' at './components/home.xq';
+import module namespace dict = 'http://ossetic-studies.org/ns/abaevdict-site/dictionary' at './components/dictionary.xq';
+import module namespace index = 'http://ossetic-studies.org/ns/abaevdict-site/index' at './components/index.xq';
+
+(: =============================================================== :)
+(: ============================ FAVICON ========================== :)
+(: =============================================================== :)
+
+declare %rest:path("/favicon.ico")
+ %rest:GET
+ function page:favicon() {
+ fetch:binary('../../static/favicon.ico')
+ };
+
+(: =============================================================== :)
+(: ======================= HOMEPAGE ============================== :)
+(: =============================================================== :)
+
+declare %rest:path("{$lang}")
+ %output:method("html")
+ %output:html-version('5')
+ function page:zero($lang) {
+ page:home($lang)
+ };
+
+declare %rest:path("/")
+ %output:method("html")
+ %output:html-version('5')
+ function page:zero() {
+ page:zero('en')
+ };
+
+declare %rest:path("{$lang}/home")
+ %output:method("html")
+ %output:html-version('5')
+ function page:home($lang) {
+
+ {shared:head(if ($lang='ru') then 'ИЭСОЯ — Главная' else 'Abaevdict — Home',())}
+
+
+ {shared:header($lang,`../{shared:invert-lang($lang)}/home`)}
+
+
+ {
+ home:content($lang)
+ }
+
+
+
+ };
+
+declare %rest:path("home")
+ %output:method("html")
+ %output:html-version('5')
+ function page:home() {
+ page:home('en')
+ };
+
+(: =============================================================== :)
+(: ======================= THE DICTIONARY ======================== :)
+(: =============================================================== :)
+
+(: If no language defined, default to English :)
+declare %rest:path("dict")
+ %output:method("html")
+ %output:html-version('5')
+ function page:dict() {
+ web:forward('/en/dict')
+ };
+
+(: The main dictionary view :)
+declare %rest:path("{$lang}/dict")
+ %rest:query-param("page","{$p}", 1)
+ %rest:query-param("xpath","{$xpath}", '')
+ %rest:query-param("entry","{$entry}", '')
+ %output:method("html")
+ %output:html-version('5')
+ function page:dict($lang, $p, $xpath, $entry) {
+
+ {shared:head('HEDO – Dictionary',
+ (,
+ ,
+ ))}
+
+
+ {(
+ shared:header($lang,`../{shared:invert-lang($lang)}/dict`),
+ dict:main-view($lang, $p, $xpath, $entry)
+ )}
+
+
+};
+
+(: =============================================================== :)
+(: ======================= THE INDEX ============================= :)
+(: =============================================================== :)
+
+(: Mentioned index :)
+declare %rest:path("{$lang}/index")
+ %output:method("html")
+ %output:html-version('5')
+ function page:index($lang) {
+ index:content($lang)
+ };
+
+(: Default to English :)
+declare %rest:path("index")
+ %output:method("html")
+ %output:html-version('5')
+ function page:index() {
+ page:index('en')
+ };
\ No newline at end of file
diff --git a/xq/site/restx_entrypoints.xq b/xq/site/restx_entrypoints.xq
new file mode 100644
index 0000000..3d3b176
--- /dev/null
+++ b/xq/site/restx_entrypoints.xq
@@ -0,0 +1,31 @@
+module namespace entry = 'http://ossetic-studies.org/ns/abaevdict-site/entrypoints';
+
+import module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared' at './shared/shared.xq';
+
+(: This module includes various ways of accessing dictionary resources by
+their identifiers. Right now, this only applies to entries, but may apply to
+other things as well :)
+
+(: == ENTRY BY ID == :)
+(: English as default language :)
+declare %rest:path("dict/{$id}")
+ %rest:query-param("xpath", "{$xpath}", '')
+ %output:method("html")
+ %output:html-version('5')
+ function entry:by-id($id, $xpath) {
+ entry:by-id('en', $id, $xpath)
+ };
+
+declare %rest:path("{$lang}/dict/{$id}")
+ %rest:query-param("xpath", "{$xpath}", '')
+ %output:method("html")
+ %output:html-version('5')
+ function entry:by-id($lang, $id, $xpath) {
+ let $doc-index := index-where($shared:sorted, fn { ./@xml:id=$id })
+ let $pagenum := ceiling($doc-index div $shared:items-per-page)
+ return web:redirect('../dict',
+ map:merge(({'page': $pagenum,
+ 'entry': web:decode-url($id)},
+ if ($xpath != '') then {'xpath': $xpath})),
+ web:decode-url($id))
+ };
\ No newline at end of file
diff --git a/xq/site/restx_search.xq b/xq/site/restx_search.xq
new file mode 100644
index 0000000..e27f8e5
--- /dev/null
+++ b/xq/site/restx_search.xq
@@ -0,0 +1,75 @@
+module namespace search = 'http://ossetic-studies.org/ns/abaevdict-site/search';
+
+import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at '../abv-mod.xqm';
+import module namespace entry = 'http://ossetic-studies.org/ns/abaevdict-site/entrypoints' at './restx_entrypoints.xq';
+
+(: =============================================================== :)
+(: ======================= SEARCH ENTRYPOINT ===================== :)
+(: =============================================================== :)
+
+declare %rest:path("/search/{$path=.+}")
+ %rest:GET
+ function search:search-default($path as xs:string) {
+ web:forward(`/en/search/{$path}`)
+ };
+
+declare %rest:path("{$lang}/search/new")
+ %rest:query-param("searchType", "{$searchType}", 'full')
+ %rest:query-param("searchQuery", "{$searchQuery}")
+ %output:method("html")
+ %output:html-version('5')
+ function search:search($lang, $searchType, $searchQuery) {
+ let $sd := abv-m:search($lang,$searchType,$searchQuery)
+ let $r1 := session:set('searchType', $searchType)
+ let $r2 := session:set('searchQuery', $searchQuery)
+ let $r3 := session:set('searchN', 1)
+ let $r4 := session:set('searchData', $sd)
+ return
+ if(array:size($sd) > 0) then
+ entry:by-id($lang,
+ $sd(1)('entry'),
+ '')
+ else
+ web:redirect('../search/clear')
+ };
+
+declare %rest:path("{$lang}/search/next")
+ %output:method("html")
+ %output:html-version('5')
+ function search:search-next($lang) {
+ let $n as xs:integer := session:get('searchN')+1
+ let $r1 := session:set('searchN', $n)
+ let $sd := session:get('searchData')
+ return entry:by-id($lang, $sd($n)('entry'), ())
+ };
+
+declare %rest:path("{$lang}/search/prev")
+ %output:method("html")
+ %output:html-version('5')
+ function search:search-prev($lang) {
+ let $n as xs:integer := session:get('searchN')-1
+ let $r1 := session:set('searchN', $n)
+ let $sd := session:get('searchData')
+ return entry:by-id($lang, $sd($n)('entry'), ())
+ };
+
+declare %rest:path("{$lang}/search/position")
+ %rest:query-param("p", "{$p}")
+ %output:method("html")
+ %output:html-version('5')
+ function search:search-position($lang, $p as xs:integer) {
+ let $r1 := session:set('searchN', $p)
+ let $sd := session:get('searchData')
+ return entry:by-id($lang, $sd($p)('entry'), ())
+ };
+
+declare %rest:path("{$lang}/search/clear")
+ %output:method("html")
+ %output:html-version('5')
+ function search:clearSearch($lang) {
+ let $r1 := session:delete('searchType')
+ let $r2 := session:delete('searchQuery')
+ let $r3 := session:delete('searchN')
+ let $r4 := session:delete('searchData')
+ return web:redirect('../dict')
+ };
\ No newline at end of file
diff --git a/xq/site/shared/shared.xq b/xq/site/shared/shared.xq
new file mode 100644
index 0000000..05efd96
--- /dev/null
+++ b/xq/site/shared/shared.xq
@@ -0,0 +1,165 @@
+module namespace shared = 'http://ossetic-studies.org/ns/abaevdict-site/shared';
+
+declare namespace tei = "http://www.tei-c.org/ns/1.0";
+import module namespace search = 'http://ossetic-studies.org/ns/abaevdict-site/search-modal' at '../components/search.xq';
+
+(: =========================================================== :)
+(: ================== GLOBAL VARIABLES ======================= :)
+(: =========================================================== :)
+
+(: Number of items per page :)
+declare variable $shared:items-per-page as xs:integer := 20;
+
+(: These variables are declared in module scope because they are needed in
+different places, but they are still dynamically evaluated :)
+declare variable $shared:lookup := doc('abaevdict_index/lookup.xml')/tei:table/tei:entry;
+declare variable $shared:lookup-all := doc('abaevdict_index/lookup.xml')/tei:table/*;
+
+declare variable $shared:total := ceiling(count($shared:lookup) div $shared:items-per-page);
+(: This is still called sorted, because I haven't changed the code.
+But it's now equal to lookup, because the lookup itself is now sorted. :)
+declare variable $shared:sorted := $shared:lookup;
+
+(: =============================================================== :)
+(: ======================= COMMON STUFF ========================== :)
+(: =============================================================== :)
+
+declare function shared:head($title as xs:string, $script as node()* := ()) {
+
+
+
+
+
+
+
+
+ {$script}
+
+ {$title}
+
+};
+
+(: Navigation header and search dialog :)
+declare function shared:header($lang as xs:string, $href-other as xs:string) {
+ (
+
+
+ ,
+ search:content($lang)
+ )
+};
+
+declare function shared:invert-lang($lang as xs:string) as xs:string {
+ if($lang = 'en') then 'ru' else 'en'
+};
\ No newline at end of file