Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
a8a4d116
Commit
a8a4d116
authored
Aug 29, 2018
by
Mathias Goebel
Browse files
new test setup
parent
76cc540a
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
modules/config/config.xqm
View file @
a8a4d116
...
...
@@ -143,13 +143,29 @@ declare function config:list-projects() as xs:string+ {
xmldb:get-child-collections($config-params:projects-dir)
};
(:~
: STATUS: UNCLEAR! COMES FROM OLDE SADE! -- Returns the scripts and links
: required by the modules as configured in the project-config either put code
: directly into `<container key="html-head">` or if a module is mentioned in
: the config, its config is checked for <container key="html-head" >
:)
declare function config:html-head($node as node(), $model as map(*)) {
let $head := $model("config")//container[./@key='html-head']
return $head/*
declare function local:mkcol-recursive($collection, $components) {
if (exists($components)) then
let $newColl := concat($collection, "/", $components[1])
return
if(xmldb:collection-available($newColl))
then local:mkcol-recursive($newColl, subsequence($components, 2))
else (
xmldb:create-collection($collection, $components[1]),
local:mkcol-recursive($newColl, subsequence($components, 2))
)
else
()
};
(: Helper function to recursively create a collection hierarchy. :)
declare function app:mkcol($path) {
if(not(starts-with($path, "/")))
then error(QName("error", "path"), "Invalid path. Absolute path required.")
else
if($path => matches("[^a-zA-Z0-9\-\.\+]"))
then error(QName("error", "charset"), "Invalid path. use characters that match [a-zA-Z0-9\-\.\+] only.")
else
let $components := tokenize($path, "/")
return
local:mkcol-recursive($components[1], subsequence($components, 2))
};
modules/fontane/index-viewer.xqm
View file @
a8a4d116
...
...
@@ -23,7 +23,7 @@ if( xmldb:collection-available("/db/sade-projects/textgrid") )
then true()
else
(: read test config :)
let $testconfig := doc("tests.xml")
let $testconfig := doc("tests.xml")
//testdata[@module="f-indexviewer"]
(: prepare the collections :)
let $prepare-collections :=
for $create in $testconfig//create/collection
...
...
modules/fontane/misc.xqm
View file @
a8a4d116
...
...
@@ -11,12 +11,30 @@ declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare variable $f-misc:metadata-collection := collection("/db/sade-projects/textgrid/data/xml/meta");
declare
%test:arg("baseUri","textgrid:16b00") %test:assertEquals("Notizbuch C7")
%test:arg("baseUri","") %test:assertEquals("")
function f-misc:get-title-by-baseUri($baseUri as xs:string) as xs:string? {
if($baseUri = "") then () else
$f-misc:metadata-collection//tgmd:textgridUri[starts-with(string(.), $baseUri)]/ancestor::tgmd:object//tgmd:title/string()
=> replace("([A-E])0(\d)", "$1$2")
%test:setUp
function f-misc:setup(){
let $testconfig := doc("tests.xml")//testdata[@module="f-misc"]
(: prepare the collections :)
let $prepare-collections :=
for $create in $testconfig//create/collection
return
config:mkcol($create/@path)
(: prepare documents :)
let $prepare-documents :=
for $create in $testconfig//create/document
return
xmldb:store($create/@collection, $create/@name, $create/*)
return true()
};
declare
%test:arg("baseUri","textgrid:16b00") %test:assertEquals("Notizbuch C7")
%test:arg("baseUri","") %test:assertEquals("")
function f-misc:get-title-by-baseUri($baseUri as xs:string)
as xs:string? {
if($baseUri = "") then () else
$f-misc:metadata-collection//tgmd:textgridUri[starts-with(string(.), $baseUri)]/ancestor::tgmd:object//tgmd:title/string()
=> replace("([A-E])0(\d)", "$1$2")
};
declare function f-misc:nb-param-to-title($node as node(), $model as map(*), $nb as xs:string?)
...
...
modules/fontane/tests.xml
View file @
a8a4d116
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment