Commit eeb57040 authored by Jérôme Chauveau's avatar Jérôme Chauveau
Browse files

accept '-' in autoroute path. #8

parent 4ff0e8b3
Loading
Loading
Loading
Loading
+7 −2
Changes for src/main/core/routes.xqm: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ declare
%rest:GET
%output:method("html")
%output:html-version('5')
%rest:path("/{$lang=[a-z]{2}}/{$page=[a-zA-Z0-9_]+}.html")
%rest:path("/{$lang=[a-z]{2}}/{$page=[a-zA-Z0-9_\-]+}.html")
function routes:autoroute($lang as xs:string, $page as xs:string){
    try {
        let $xqueryFile := utils:get-autoroute-file-path($page || '.xq')
@@ -106,7 +106,12 @@ function routes:autoroute($lang as xs:string, $page as xs:string){
                let $content := utils:doc-to-html((), $page, $lang)
                return $content
            }
            catch err:max-database { errors:error($err:code, $err:description, $err:line-number, $lang) }
            catch err:max-database {
                errors:error($err:code, $err:description, $err:line-number, $lang)
            }
            catch err:XPTY0004 {
                errors:not-found($page || ".xq autoroute file not found"  ,$lang)
            }
            catch * {errors:error($err:code, $err:description, $err:line-number, $lang)}
    }
};