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

modification des routes : ajout extension .html pour faciliter la statification

parent 5b7dcb3b
Loading
Loading
Loading
Loading
+13 −13
Changes for max.xq: 13 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ declare
%output:method("html")
%output:html-version("5.0")
%output:encoding("UTF-8")
%rest:path( "/max")
%rest:path( "/max.html")
function max:home(){
 <html>
    <head>
@@ -47,14 +47,14 @@ declare
%output:method("html")
%output:html-version("5.0")
%output:encoding("UTF-8")
%rest:path( "/{$project}")
%rest:path( "/{$project}.html")
function max:projectHome($project){
    let $redirection :=
    if(ends-with(request:uri(),'/'))
    then
        request:uri() || 'accueil'
        request:uri() || 'accueil.html'
    else
        request:uri() || '/accueil'
        request:uri() || '/accueil.html'
    return
        web:redirect($redirection)
};
@@ -66,7 +66,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path( "/{$project}/{$page=[a-zA-Z0-9_]+}")
%rest:path( "/{$project}/{$page=[a-zA-Z0-9_]+}.html")
function max:page($project, $page){
    try {
        switch ($page)
@@ -108,9 +108,9 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/sommaire/{$doc=.*\.xml|.*\.svg}")
%rest:path("/{$project}/sommaire/{$doc=.*}.html")
function max:documentTOC($project, $doc){
    let $content := max.toc:getDocumentTOC($project, $doc)
    let $content := max.toc:getDocumentTOC($project, $doc||'.xml')
    return max.html:render($project, "sommaire", $content, ())
};

@@ -121,7 +121,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}.html")
function max:fragmentToHTMLPage($project, $routeDoc, $id){
    let $dbPath := max.config:getProjectDBPath($project)
    return
@@ -160,7 +160,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}/target/{$targetId}/{$search}")
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}/target/{$targetId}/{$search}.html")
function max:HighlightedSearchToHTMLPage($project, $routeDoc, $id, $targetId, $search){

    copy $c := max:fragmentToHTMLPage($project, $routeDoc, $id)
@@ -180,7 +180,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/checkplugins")
%rest:path("/{$project}/checkplugins.html")
function max:checkPlugin($project){
    let $plugins := max.config:getPluginNameList($project)
    return
@@ -213,7 +213,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/fragment/{$id}")
%rest:path("/{$project}/fragment/{$id}.html")
function max:getXMLByID($project, $id){
    max.api:getXMLByID(max.config:getProjectDBPath($project), $id)
};
@@ -228,7 +228,7 @@ declare
%rest:query-param("xsl", "{$xsl}")
%rest:query-param("xslparams", "{$xslparams}")
%rest:query-param("wrap", "{$wrap}")
%rest:path("/{$project}/fragment_html/{$id}")
%rest:path("/{$project}/fragment_html/{$id}.html")
function max:getHTMLByID($project, $id, $xsl, $xslparams as xs:string *, $wrap as xs:string ?) as element(){
    let $xml := max.api:getXMLByID(max.config:getProjectDBPath($project), $id)
    let $xslAddons := (max.config:getXSLTAddons($project,()),if ($xsl) then file:parent(static-base-uri()) || string("editions/" || $project || "/ui/xsl/" || $xsl) else ())
@@ -260,7 +260,7 @@ declare
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/doc/{$doc=.*\.xml|.*\.svg}")
%rest:path("/{$project}/doc/{$doc=.*}.html")
function max:getFullDocument($project, $doc){
    let $xmlDoc := (doc(max.config:getProjectDBPath($project) || "/" || $doc)/*)[1]
    return
+2 −2
Changes for plugins-available/default/breadcrumb/breadcrumb.xq: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ let $transformedTitle := xslt:transform($title,$xsl)
return
    <div id="breadcrumb">
        <ol class="breadcrumb">
            <li><a href = "{$baseURI || $project}/sommaire">{$projectPrettyName}</a></li>
            <li><a href = "{$baseURI  ||$project}/sommaire/{$doc}">{$transformedTitle}</a></li>
            <li><a href = "{$baseURI || $project}/sommaire.html">{$projectPrettyName}</a></li>
            <li><a href = "{$baseURI  ||$project}/sommaire/{replace($doc,'.xml','.html')}">{$transformedTitle}</a></li>
            {
                if($id)then <li>{
                    xslt:transform(
+2 −41
Changes for plugins-available/default/search/search.xqm: 2 added lines, 41 removed lines.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ declare variable $max.plugin.search:BACK_TO_TEXT_ID_PARAMETER := "backToTextID";
declare
%rest:GET
%output:method("html")
%rest:path("/{$project}/search")
%rest:path("/{$project}/search.html")
function max.plugin.search:searchPage($project){
  let $routeList := for $d in collection( max.config:getProjectDBPath($project)) return base-uri($d) (:max.route:HTMLRouteList($project)//a/@href :)
  let $routeSelect := <select class='form-control' id='searchSelect' multiple='true'>{
@@ -61,7 +61,7 @@ function max.plugin.search:searchPage($project){
declare
%rest:GET
%output:method("html")
%rest:path("/{$project}/search/report")
%rest:path("/{$project}/search/report.html")
function max.plugin.search:check($project){
  let $pluginConfig := max.config:getPluginByName($project, $max.plugin.search:PLUGIN_ID)
  
@@ -132,42 +132,3 @@ function max.plugin.search:search($project,$search, $docs as item()*){
};

declare
%rest:GET
%output:method("html")
%rest:POST
%rest:query-param("search", "{$search}")
%rest:query-param("docs", "{$docs}")
%rest:query-param("transform", "{$transform}", "no")
%rest:path("/{$project}/deprecatedsearch")
function max.plugin.search:search($project, $search as xs:string, $docs as item()+, $transform as xs:string){
  
  let $dbPath := max.config:getProjectDBPath($project)
  let $plugin := max.config:getPluginByName($project, $max.plugin.search:PLUGIN_ID)
  let $tag := string($plugin//parameter[@key=$max.plugin.search:TAG_PARAMETER]/@value)
  let $docTargets := if($docs = $max.plugin.search:ALL_TXT) 
        then for $a in collection($dbPath)
              let $docName := tokenize(base-uri($a),'/')[last()]

              return
                if(max.config:isIgnored($docName, $project))
                then ()
                else $docName                     
        else $docs
        
  for $d in $docTargets
    let $xsltDoc := max.util:buildXSLTDoc(max.util:getDefaultTextXSL($project),())
    return <div><h3>{$d}</h3>{
    for $h in doc($d)//*[local-name(.)=$tag]
     return if($h//text() contains text {$search})
      then
       xslt:transform(
         <div class='hit'>
           <h5>{string($h/@xml:id)}</h5>
           {ft:mark($h//*[text() contains text {$search}])}
          </div>, $xsltDoc, ())
      else()
    }</div>
  
};
+38 −26
Changes for rxq/ead/document_toc.xq: 38 added lines, 26 removed lines.
Original line number Diff line number Diff line
@@ -20,50 +20,62 @@ declare function local:buildEADDocumentTOC($projectId, $docPath){
                            {$c/@id}
                            {$c/*:did/*:unittitle[1]//text()}
                        </summary>
                        {local:getComponentChildren($c, $projectId, $docPath)}
                        {local:childrenToc($c, $projectId, $docPath)}
                    </details>
            }
        </nav>
};

declare function local:hasComponentChildren($component){
    0
};

declare function local:getComponentChildren($component, $projectId, $docPath){
    for $c in $component/*:dsc/*:c
    return
        <details  id="details_{$c/@id}">
            <summary>
                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}">
                    {$c/@id}
                    {$c/*:did/*:unitid[1]//text()}
                    –
                    {$c/*:did/*:unittitle[1]//text()}
                </a>
            </summary>
            {local:getComponentGrandChildren($c, $projectId, $docPath)}
        </details>
};
(:declare function local:getComponentChildren($component, $projectId, $docPath){:)
(:    for $c in $component/*:dsc/*:c:)
(:    return:)
(:        <details  id="details_{$c/@id}">:)
(:            <summary>:)
(:                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}.html">:)
(:                    {$c/@id}:)
(:                    {$c/*:did/*:unitid[1]//text()}:)
(:                    –:)
(:                    {$c/*:did/*:unittitle[1]//text()}:)
(:                </a>:)
(:            </summary>:)
(:            {local:childrenToc($c, $projectId, $docPath)}:)
(:        </details>:)
(:};:)

declare function local:hasComponentGrandChildren($component){
    0
};
(:declare function local:getComponentGrandChildren($component, $projectId, $docPath){:)
(:    for $c in $component/*:c:)
(:    return:)
(:        <details  id="details_{$c/@id}">:)
(:            <summary>:)
(:                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}">:)
(:                    {$c/@id}:)
(:                    {$c/*:did/*:unitid[1]//text()}:)
(:                    –:)
(:                    {$c/*:did/*:unittitle[1]//text()}:)
(:                </a>:)
(:            </summary>:)
(:            {local:getComponentGrandChildren($c, $projectId, $docPath)}:)
(:        </details>:)
(:};:)

declare function local:getComponentGrandChildren($component, $projectId, $docPath){
    for $c in $component/*:c
declare function local:childrenToc($component, $projectId, $docPath){
    for $c in $component/*
    return
        if(local-name($c) = 'c')
        then
        <details  id="details_{$c/@id}">
            <summary>
                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}">
                <a href="{$baseURI}{$projectId}/{$docPath}/{$c/@id}.html">
                    {$c/@id}
                    {$c/*:did/*:unitid[1]//text()}
                    –
                    {$c/*:did/*:unittitle[1]//text()}
                </a>
            </summary>
            {local:getComponentGrandChildren($c, $projectId, $docPath)}
            {local:childrenToc($c, $projectId, $docPath)}
        </details>
        else local:childrenToc($c, $projectId, $docPath)
};

local:buildEADDocumentTOC($project, $doc)
+1 −1
Changes for rxq/html.xqm: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ declare function max.html:render(
                    'projectId' : $projectId,
                    'prettyName' : max.config:getProjectPrettyName($projectId),
                    'baseURI' : max.config:getBaseURI(),
                    'home' :  max.config:getBaseURI() || $projectId || '/',
                    'home' :  max.config:getBaseURI() || $projectId || '/accueil.html',
                    'menu' : $menu,
                    'navigationSelect' : $navigationSelect,
                    'textOptions' : $textOptions,
Loading