declare namespace site = '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 home = 'http://ossetic-studies.org/ns/abaevdict-site/home' at './components/home.xqm';
import module namespace entries = 'http://ossetic-studies.org/ns/abaevdict-site/entries' at './components/entries.xqm';
import module namespace index = 'http://ossetic-studies.org/ns/abaevdict-site/index' at './components/index.xqm';
import module namespace search = 'http://ossetic-studies.org/ns/abaevdict-site/search' at './components/search.xqm';
(: =============================================================== :)
(: ============================ FAVICON ========================== :)
(: =============================================================== :)
declare %rest:path("/favicon.ico")
%rest:GET
function site:favicon() {
fetch:binary('../../static/favicon.ico')
};
(: HTML HEAD :)
declare function site:head($title as xs:string) {
{$title}
};
(: HEADER :)
declare function site:header($lang as xs:string, $href-other as xs:string) {
};
(: PATHS :)
(: ZERO PATH :)
declare %rest:path("{$lang}")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:null($lang as xs:string) {
site:home($lang)
};
declare %rest:path("/")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:null() {
site:null('en')
};
(: HOME PAGE :)
declare %rest:path("{$lang}/home")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:home($lang as xs:string) {
{
site:head(if ($lang = 'ru') then 'ИЭСОЯ В.И. Абаева — Главная'
else 'Abaevdict — Main'),
{site:header($lang,`/{abv-m:invert-lang($lang)}/home`)}
{home:content($lang)}
}
};
declare %rest:path("/home")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:home() {
site:home('en')
};
(: DICTIONARY INTERFACE :)
declare %rest:path("{$lang}/dictionary")
%rest:query-param("query", "{$query}")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:dictionary($lang as xs:string, $query as xs:string?) {
{
site:head(if($lang = 'ru') then 'ИЭСОЯ В.И. Абаева — Просмотр'
else 'Abaevdict — Browse'),
{site:header($lang,`/{abv-m:invert-lang($lang)}/dictionary`)}
{entries:sidebar($lang)}
{entries:entries($lang,20,$query)}
}
};
declare %rest:path("dictionary")
%rest:query-param("query", "{$query}")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:dictionary($query as xs:string?) {
site:dictionary('en', $query)
};
(: INDEX INTERFACE :)
declare %rest:path("{$lang}/index")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:index($lang as xs:string) {
{
site:head(if ($lang = 'ru') then 'ИЭСОЯ В.И. Абаева — Указатель'
else 'Abaevdict — Index'),
{site:header($lang,`/{abv-m:invert-lang($lang)}/index`)}
{index:content($lang)}
}
};
declare %rest:path("index")
%rest:GET
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:index() {
site:index('en')
};
(: SEARCH INTERFACE :)
declare %rest:path("{$lang}/search")
%rest:form-param("pattern", "{$pattern}")
%rest:form-param("text", "{$text}")
%rest:GET
%rest:POST
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:search($lang as xs:string,
$pattern as xs:string?,
$text as xs:string?) {
{
site:head(if ($lang = 'ru') then 'ИЭСОЯ В.И. Абаева — Поиск'
else 'Abaevdict — Search'),
{site:header($lang,`/{abv-m:invert-lang($lang)}/search`)}
{search:content($lang,$pattern,$text)}
}
};
declare %rest:path("search")
%rest:form-param("pattern", "{$pattern}")
%rest:form-param("text", "{$text}")
%rest:GET
%rest:POST
%rest:produces("text/html")
%output:method("html")
%output:html-version('5')
function site:search($pattern as xs:string?,
$text as xs:string?) {
site:index('en')
};
0