Loading fixtures/config.xml +1 −1 Changes for fixtures/config.xml: 1 added line, 1 removed line. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://certic.unicaen.fr/max/ns/1.0" env="dev" vocabulary-bundle="max-tei-bundle"> <configuration xmlns="http://certic.unicaen.fr/max/ns/1.0" env="dev" vocabulary-bundle="max-dumb-bundle"> <languages> <language>fr</language> <language>en</language> Loading src/main/bundles/max-tei-bundle/autoroute/tdm.xq→src/main/bundles/max-dumb-bundle/autoroute/tdm.xq +1 −1 Changes for src/main/bundles/max-dumb-bundle/autoroute/tdm.xq: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ let $tdm := } </ul> <p> Générée par <code>max-tei-bundle/autoroute/tdm.xq</code> Générée par <code>max-dumb-bundle/autoroute/tdm.xq</code> </p> </div> Loading src/main/bundles/max-dumb-bundle/dumb/dumb.xqm +54 Changes for src/main/bundles/max-dumb-bundle/dumb/dumb.xqm: 54 added lines, 0 removed lines. Original line number Diff line number Diff line xquery version "3.0"; (:~ : MaX "dumb" bundle :) module namespace dumb = "https://certic.unicaen.fr/max/bundles/dumb"; import module namespace templating = "https://certic.unicaen.fr/max/templating" at '../../../core/templating.xqm'; import module namespace database = "https://certic.unicaen.fr/max/database" at '../../../core/database.xqm'; import module namespace errors = "https://certic.unicaen.fr/max/errors" at '../../../core/errors.xqm'; declare function dumb:doc-to-html($document as document-node(), $lang as xs:string){ (:generate random http link to an identified node in $document:) let $identifiers:= $document//*/@xml:id/string() let $n := count($identifiers) let $r := random:integer($n) + 1 let $target := $identifiers[$r] let $href := fn:replace(request:path(),'.html', '') || '/id/' || $target || '.html' let $content := <div> <h2>{templating:translate('raw', $lang)} | {fn:replace(fn:base-uri($document), '/' || $database:max-db || '/', '')}</h2> {$document} <nav> <h3><a href="{$href}">{templating:translate('random-link', $lang)} ({$target})</a></h3> </nav> </div> return templating:render('page.html', map {'content': $content, 'lang': $lang}) }; (:~ : @return an identified node as dumb html :) declare %rest:GET %output:method("html") %output:html-version("5.0") %output:encoding("UTF-8") %rest:path("/{$lang=[a-z]{2}}/{$docPath=.+}/id/{$id}.html") function dumb:id-to-html($lang as xs:string, $docPath as xs:string, $id as xs:string){ try { let $node := database:get-element-by-id($docPath || '.xml', $id) let $content := <div> <h1>id: {$id}</h1> { if($node) then $node else 'Node with id "' || $id || '" was not found' } </div> return templating:render('page.html', map {'content': $content, 'lang': $lang}) } catch * { errors:error($err:code, $err:description, $err:line-number, $lang) } }; src/main/bundles/max-tei-bundle/expath-pkg.xml→src/main/bundles/max-dumb-bundle/expath-pkg.xml +4 −4 Changes for src/main/bundles/max-dumb-bundle/expath-pkg.xml: 4 added lines, 4 removed lines. Original line number Diff line number Diff line <package xmlns="http://expath.org/ns/pkg" name="max-tei-bundle" abbrev="tei" name="max-dumb-bundle" abbrev="dumb" version="0.0.1" spec="1.0"> <dependency package="max"/> <title>MaX TEI bundle</title> <home>https://gitlab.unicaen.fr/max-tei</home> <xquery> <namespace>https://certic.unicaen.fr/max/bundles/tei</namespace> <file>tei.xqm</file> <namespace>https://certic.unicaen.fr/max/bundles/dumb</namespace> <file>dumb.xqm</file> </xquery> </package> No newline at end of file src/main/bundles/max-tei-bundle/locales/en.json→src/main/bundles/max-dumb-bundle/locales/en.json +3 −1 Changes for src/main/bundles/max-dumb-bundle/locales/en.json: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,5 +2,7 @@ "about": "About", "not-found": "Page not found - 404", "server-error": "Serveur error - 500", "tdm": "Table of contents" "tdm": "Table of contents", "raw" : "Raw XML", "random-link" : "Random link" } No newline at end of file Loading
fixtures/config.xml +1 −1 Changes for fixtures/config.xml: 1 added line, 1 removed line. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://certic.unicaen.fr/max/ns/1.0" env="dev" vocabulary-bundle="max-tei-bundle"> <configuration xmlns="http://certic.unicaen.fr/max/ns/1.0" env="dev" vocabulary-bundle="max-dumb-bundle"> <languages> <language>fr</language> <language>en</language> Loading
src/main/bundles/max-tei-bundle/autoroute/tdm.xq→src/main/bundles/max-dumb-bundle/autoroute/tdm.xq +1 −1 Changes for src/main/bundles/max-dumb-bundle/autoroute/tdm.xq: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ let $tdm := } </ul> <p> Générée par <code>max-tei-bundle/autoroute/tdm.xq</code> Générée par <code>max-dumb-bundle/autoroute/tdm.xq</code> </p> </div> Loading
src/main/bundles/max-dumb-bundle/dumb/dumb.xqm +54 Changes for src/main/bundles/max-dumb-bundle/dumb/dumb.xqm: 54 added lines, 0 removed lines. Original line number Diff line number Diff line xquery version "3.0"; (:~ : MaX "dumb" bundle :) module namespace dumb = "https://certic.unicaen.fr/max/bundles/dumb"; import module namespace templating = "https://certic.unicaen.fr/max/templating" at '../../../core/templating.xqm'; import module namespace database = "https://certic.unicaen.fr/max/database" at '../../../core/database.xqm'; import module namespace errors = "https://certic.unicaen.fr/max/errors" at '../../../core/errors.xqm'; declare function dumb:doc-to-html($document as document-node(), $lang as xs:string){ (:generate random http link to an identified node in $document:) let $identifiers:= $document//*/@xml:id/string() let $n := count($identifiers) let $r := random:integer($n) + 1 let $target := $identifiers[$r] let $href := fn:replace(request:path(),'.html', '') || '/id/' || $target || '.html' let $content := <div> <h2>{templating:translate('raw', $lang)} | {fn:replace(fn:base-uri($document), '/' || $database:max-db || '/', '')}</h2> {$document} <nav> <h3><a href="{$href}">{templating:translate('random-link', $lang)} ({$target})</a></h3> </nav> </div> return templating:render('page.html', map {'content': $content, 'lang': $lang}) }; (:~ : @return an identified node as dumb html :) declare %rest:GET %output:method("html") %output:html-version("5.0") %output:encoding("UTF-8") %rest:path("/{$lang=[a-z]{2}}/{$docPath=.+}/id/{$id}.html") function dumb:id-to-html($lang as xs:string, $docPath as xs:string, $id as xs:string){ try { let $node := database:get-element-by-id($docPath || '.xml', $id) let $content := <div> <h1>id: {$id}</h1> { if($node) then $node else 'Node with id "' || $id || '" was not found' } </div> return templating:render('page.html', map {'content': $content, 'lang': $lang}) } catch * { errors:error($err:code, $err:description, $err:line-number, $lang) } };
src/main/bundles/max-tei-bundle/expath-pkg.xml→src/main/bundles/max-dumb-bundle/expath-pkg.xml +4 −4 Changes for src/main/bundles/max-dumb-bundle/expath-pkg.xml: 4 added lines, 4 removed lines. Original line number Diff line number Diff line <package xmlns="http://expath.org/ns/pkg" name="max-tei-bundle" abbrev="tei" name="max-dumb-bundle" abbrev="dumb" version="0.0.1" spec="1.0"> <dependency package="max"/> <title>MaX TEI bundle</title> <home>https://gitlab.unicaen.fr/max-tei</home> <xquery> <namespace>https://certic.unicaen.fr/max/bundles/tei</namespace> <file>tei.xqm</file> <namespace>https://certic.unicaen.fr/max/bundles/dumb</namespace> <file>dumb.xqm</file> </xquery> </package> No newline at end of file
src/main/bundles/max-tei-bundle/locales/en.json→src/main/bundles/max-dumb-bundle/locales/en.json +3 −1 Changes for src/main/bundles/max-dumb-bundle/locales/en.json: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,5 +2,7 @@ "about": "About", "not-found": "Page not found - 404", "server-error": "Serveur error - 500", "tdm": "Table of contents" "tdm": "Table of contents", "raw" : "Raw XML", "random-link" : "Random link" } No newline at end of file