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') };