Loading CHANGELOG.md +4 −0 Original line number Diff line number Diff line # Changelog MaX-V2 ## v0.0.6 - replace const `$conf:default-lang` by `conf:get-default-lang()` function ## v0.0.5 - MaX core as xquery modules (no more absolute paths for imports) - Update to BaseX 12.3 and saxon 12.9 (add xml resolver dependency) src/main/core/conf.xqm +14 −3 Original line number Diff line number Diff line Loading @@ -19,14 +19,12 @@ declare variable $conf:config-file := 'config.xml'; (:~ package file name:) declare variable $conf:package-file := 'expath-pkg.xml'; (:~ default lang:) declare variable $conf:default-lang := 'fr'; (:~ dev mode name:) declare variable $conf:dev-mode := 'dev'; (: =========================================== :) (:~ : Returns MaX configuration : @return element Loading Loading @@ -84,6 +82,19 @@ declare function conf:get-languages() as xs:string*{ }; (:~ : Returns default language : @return element :) declare function conf:get-default-lang() as xs:string{ if(conf:get-configuration()//*:languages/*:language[@default="true"]) then conf:get-configuration()//*:languages/*:language[@default="true"]/text() else if (count(conf:get-configuration()//*:languages/*:language) > 0) then (conf:get-configuration()//*:languages/*:language)[1]/text() else 'fr' }; (:~ : Returns the corpus title : @return corpus title Loading src/main/webapp/max/bundles/max-dev/max-dev.xqm +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ function max-dev:index() as element(){ </head> <body> <h1> <a href="/{$conf:default-lang}/pages/index.html">MaX</a></h1> <h1> <a href="/{conf:get-default-lang()}/pages/index.html">MaX</a></h1> <h2>Version <code>{conf:get-max-version()}</code></h2> <h3>BaseX {db:system()//*:version}</h3> <section> Loading Loading @@ -96,7 +96,7 @@ function max-dev:index() as element(){ </section> </body> </html> else errors:not-found('', $conf:default-lang) else errors:not-found('', conf:get-default-lang()) }; Loading @@ -121,7 +121,7 @@ function max-dev:functions-documentation(){ </div> return xslt:transform($xqDocs, doc(utils:get-bundles-path() || 'max-dev/doc-2-html.xsl')) else errors:not-found('', $conf:default-lang) else errors:not-found('', conf:get-default-lang()) }; Loading src/main/webapp/max/routes.xqm +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ declare %output:encoding("UTF-8") %rest:path("/{$path=(index.html)?") function routes:index($path as xs:string?){ routes:page($conf:default-lang, 'index') routes:page(conf:get-default-lang(), 'index') }; (:~ Returns the main index page for a specific language Loading Loading
CHANGELOG.md +4 −0 Original line number Diff line number Diff line # Changelog MaX-V2 ## v0.0.6 - replace const `$conf:default-lang` by `conf:get-default-lang()` function ## v0.0.5 - MaX core as xquery modules (no more absolute paths for imports) - Update to BaseX 12.3 and saxon 12.9 (add xml resolver dependency)
src/main/core/conf.xqm +14 −3 Original line number Diff line number Diff line Loading @@ -19,14 +19,12 @@ declare variable $conf:config-file := 'config.xml'; (:~ package file name:) declare variable $conf:package-file := 'expath-pkg.xml'; (:~ default lang:) declare variable $conf:default-lang := 'fr'; (:~ dev mode name:) declare variable $conf:dev-mode := 'dev'; (: =========================================== :) (:~ : Returns MaX configuration : @return element Loading Loading @@ -84,6 +82,19 @@ declare function conf:get-languages() as xs:string*{ }; (:~ : Returns default language : @return element :) declare function conf:get-default-lang() as xs:string{ if(conf:get-configuration()//*:languages/*:language[@default="true"]) then conf:get-configuration()//*:languages/*:language[@default="true"]/text() else if (count(conf:get-configuration()//*:languages/*:language) > 0) then (conf:get-configuration()//*:languages/*:language)[1]/text() else 'fr' }; (:~ : Returns the corpus title : @return corpus title Loading
src/main/webapp/max/bundles/max-dev/max-dev.xqm +3 −3 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ function max-dev:index() as element(){ </head> <body> <h1> <a href="/{$conf:default-lang}/pages/index.html">MaX</a></h1> <h1> <a href="/{conf:get-default-lang()}/pages/index.html">MaX</a></h1> <h2>Version <code>{conf:get-max-version()}</code></h2> <h3>BaseX {db:system()//*:version}</h3> <section> Loading Loading @@ -96,7 +96,7 @@ function max-dev:index() as element(){ </section> </body> </html> else errors:not-found('', $conf:default-lang) else errors:not-found('', conf:get-default-lang()) }; Loading @@ -121,7 +121,7 @@ function max-dev:functions-documentation(){ </div> return xslt:transform($xqDocs, doc(utils:get-bundles-path() || 'max-dev/doc-2-html.xsl')) else errors:not-found('', $conf:default-lang) else errors:not-found('', conf:get-default-lang()) }; Loading
src/main/webapp/max/routes.xqm +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ declare %output:encoding("UTF-8") %rest:path("/{$path=(index.html)?") function routes:index($path as xs:string?){ routes:page($conf:default-lang, 'index') routes:page(conf:get-default-lang(), 'index') }; (:~ Returns the main index page for a specific language Loading