Commit e0aa5013 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

style-guide 3.4

parent f0aba474
......@@ -88,7 +88,7 @@ else if($exist:resource = "sitemap.xml") then
where not( contains($html, "_") )
return
<url>
<loc>{request:get-url() => substring-before("sitemap.xml")}{$html}</loc>
<loc>{ request:get-url() => substring-before("sitemap.xml") }{ $html }</loc>
</url>}
</urlset>
else
......
......@@ -222,7 +222,7 @@ declare
function app:list-docs($node as node(), $model as map(*)) {
for $item in xmldb:get-child-resources( $config:app-root || "/docs" )
return
<li>{$item}</li>
<li>{ $item }</li>
};
(:~
......@@ -316,7 +316,7 @@ declare function app:xqdocs-functionparam($node as node(), $model as map(*)) {
{$name}
{if($desc = "") then () else
<ul>
<li>{$desc}</li>
<li>{ $desc }</li>
</ul>
}
</li>
......
......@@ -17,9 +17,9 @@ declare function local:download($app-collection as xs:string, $expathConf as ele
else
<entry type="collection" name="{$collection-relative-path}"/>
else if (util:binary-doc-available($resource)) then
<entry type="uri" name="{$resource-relative-path}">{$resource}</entry>
<entry type="uri" name="{ $resource-relative-path }">{ $resource }</entry>
else
<entry type="xml" name="{$resource-relative-path}">{
<entry type="xml" name="{ $resource-relative-path }">{
util:declare-option("exist:serialize", "expand-xincludes=" || (if ($expand-xincludes) then "yes" else "no")),
doc($resource)
}</entry>
......
......@@ -153,7 +153,7 @@ declare function fsearch:result-source($node as node(), $model as map(*)) {
let $docloc := config:get("data-dir") || "/xml/data/" || util:document-name($model("hit"))
return
<a href="/exist/rest{$docloc}">{$node/@class, $node/* }</a>
<a href="/exist/rest{$docloc}">{ $node/@class, $node/* }</a>
};
declare
......@@ -176,7 +176,7 @@ declare function fsearch:list-facets($node as node(), $model as map(*)) as map(*
declare
function fsearch:facet-title($node as node(), $model as map(*)) {
<li>{map:keys($model("facet"))}</li>
<li>{ map:keys($model("facet")) }</li>
};
declare function fsearch:facet($node as node(), $model as map(*)) as item()* {
......@@ -185,8 +185,8 @@ declare function fsearch:facet($node as node(), $model as map(*)) as item()* {
(: hide facet-categories with less than one entry :)
where (count($model("facets")($facet/string(@key))) > 0)
return
<li><strong>{xs:string($facet/@title)}</strong>
<ul class="hideMore">{local:deselected-for-key($model, xs:string($facet/@key))}{$model("facets")(xs:string($facet/@key))}</ul>
<li><strong>{ xs:string($facet/@title) }</strong>
<ul class="hideMore">{ local:deselected-for-key($model, xs:string($facet/@key)) }{ $model("facets")(xs:string($facet/@key)) }</ul>
</li>
};
......@@ -212,7 +212,7 @@ declare function local:facet($model as map(*), $hits as node()*, $key as xs:stri
(:let $norms := normalize-space($x):)
let $norms := xs:string($x)
return if (string-length($norms) >= 1) then
<un>{$norms}</un>
<un>{ $norms }</un>
else
()
......@@ -227,13 +227,13 @@ declare function local:facet($model as map(*), $hits as node()*, $key as xs:stri
let $facetRemoveQuery := replace($facetReq, $key || ":" || xmldb:encode($facet) || "," , "")
return
<li class="facetSelected">
<a class="facet-minus" href="{$search-html}?q={$query}&amp;facet={$facetRemoveQuery}&amp;order={$order}&amp;order-by={$order-by}">-</a>
{$facet} ({$freq})
<a class="facet-minus" href="{ $search-html }?q={ $query }&amp;facet={ $facetRemoveQuery }&amp;order={ $order }&amp;order-by={ $order-by }">-</a>
{ $facet } ({ $freq })
</li>
else
<li>
<a class="facet-minus" href="{$search-html}?q={$query}&amp;facet={$key}:!{xmldb:encode($facet)},{$facetReq}&amp;order={$order}&amp;order-by={$order-by}">-</a>
<a href="{$search-html}?q={$query}&amp;facet={$key}:{xmldb:encode($facet)},{$facetReq}&amp;order={$order}&amp;order-by={$order-by}">{$facet}</a> ({$freq})
<a class="facet-minus" href="{ $search-html }?q={ $query }&amp;facet={ $key }:!{ xmldb:encode($facet) },{ $facetReq }&amp;order={ $order }&amp;order-by={ $order-by }">-</a>
<a href="{ $search-html }?q={ $query }&amp;facet={ $key }:{ xmldb:encode($facet) },{ $facetReq }&amp;order={ $order }&amp;order-by={ $order-by }">{ $facet }</a> ({ $freq })
</li>
};
......
......@@ -21,15 +21,15 @@ declare variable $referer := request:get-header("Referer");
declare variable $dry-run := request:get-parameter("dry", "false");
declare variable $expathConf :=
<package xmlns="http://expath.org/ns/pkg" name="https://sade.textgrid.de/ns/SADE/{$target}" abbrev="SADE-{$target}" version="0.1" spec="1.0">
<title>{$target}</title>
<package xmlns="http://expath.org/ns/pkg" name="https://sade.textgrid.de/ns/SADE/{ $target }" abbrev="SADE-{ $target }" version="0.1" spec="1.0">
<title>{ $target }</title>
<dependency package="http://exist-db.org/apps/shared"/>
<dependency package="https://sade.textgrid.de/ns/assets"/>
</package>;
declare variable $repoConf :=
<meta xmlns="http://exist-db.org/xquery/repo">
<description>{$target}. A Fork of TextGrid: SADE.</description>
<description>{ $target }. A Fork of TextGrid: SADE.</description>
<author>Johannes Biermann</author>
<author>Mathias Göbel</author>
<author>Markus Matoni</author>
......@@ -39,11 +39,11 @@ declare variable $repoConf :=
<license>GNU-LGPL</license>
<copyright>true</copyright>
<type>application</type>
<target>sade-{$target}</target>
<permissions password="sade{$target}" user="{$target}" group="sade{$target}" mode="rw-r--r--"/>
<target>sade-{ $target }</target>
<permissions password="sade{ $target }" user="{ $target }" group="sade{ $target }" mode="rw-r--r--"/>
<prepare>pre-install.xq</prepare>
<finish>post-install.xq</finish>
<deployed>{current-dateTime()}</deployed>
<deployed>{ current-dateTime() }</deployed>
</meta>;
......@@ -60,7 +60,7 @@ declare function local:xar($app-collection as xs:string, $expand-xincludes as xs
else
<entry type="collection" name="{$collection-relative-path}"/>
else if (util:binary-doc-available($resource)) then
<entry type="uri" name="{$resource-relative-path}">{$resource}</entry>
<entry type="uri" name="{$resource-relative-path}">{ $resource }</entry>
else
<entry type="xml" name="{$resource-relative-path}">{
util:declare-option("exist:serialize", "expand-xincludes=" || (if ($expand-xincludes) then "yes" else "no")),
......
......@@ -39,7 +39,7 @@ declare function nav:head($node as node(), $model as map(*)) {
else string($model("item")/@*[local-name( . ) = "label-" || $nav:lang])
}
default return
<b>not defined: {node-name($model("item"))}</b>
<b>not defined: { node-name($model("item")) }</b>
};
declare
......
......@@ -42,9 +42,9 @@ declare function tgclient:getMeta($id as xs:string, $tgcrud-url as xs:string, $s
</headers>
let $result :=
try { httpclient:get($reqUrl, false(), $headers)//httpclient:body/node() }
catch * { <error>URI:{$id} {$err:code}: {$err:description}</error> }
catch * { <error>URI:{ $id } { $err:code }: { $err:description }</error> }
return
if( count($result) != 1 ) then <error> {$id} </error> else $result
if( count($result) != 1 ) then <error> { $id } </error> else $result
};
(:~ Get TextGrid Data Object :)
......@@ -103,8 +103,8 @@ let $objectMetadata := <ns3:tgObjectMetadata
<ns3:object>
<ns3:generic>
<ns3:provided>
<ns3:title>{$title}</ns3:title>
<ns3:format>{$format}</ns3:format>
<ns3:title>{ $title }</ns3:title>
<ns3:format>{ $format }</ns3:format>
</ns3:provided>
</ns3:generic>
<ns3:item />
......@@ -119,11 +119,11 @@ let $request :=
<http:header name="Content-Disposition" value='form-data; name="tgObjectMetadata";'/>
<http:header name="Content-Type" value="text/xml"/>
<http:body media-type="application/xml">{$objectMetadata}</http:body>
<http:body media-type="application/xml">{ $objectMetadata }</http:body>
<http:header name="Content-Disposition" value='form-data; name="tgObjectData";'/>
<http:header name="Content-Type" value="application/octet-stream"/>
<http:body media-type="{$format}">{$objectData}</http:body>
<http:body media-type="{$format}">{ $objectData }</http:body>
</http:multipart>
</http:request>
......@@ -132,7 +132,7 @@ let $response := http:send-request($request)
return
if( $response/@status = "200" )
then $response//tgmd:MetadataContainerType
else <error> <status>{$response/@status}</status> <message>{$response/@message}</message> </error>
else <error> <status>{ $response/@status }</status> <message>{ $response/@message }</message> </error>
};
(:~ A wrapper for getData that will not return Image data :)
......
......@@ -297,7 +297,7 @@ declare function local:progress($uri as xs:string, $page as xs:string, $value as
declare function local:copy-filter-elements($element, $element-name as xs:string*) as item() {
(: untyped variables only: PI is not an element, element is not PI, ... :)
if($element instance of processing-instruction()) then
let $wrapper := <wrap>{$element}</wrap>
let $wrapper := <wrap>{ $element }</wrap>
return
$wrapper/processing-instruction()
else
......
......@@ -21,5 +21,5 @@ return
<div>{
for $i in tgconnect:publish($uri,$sid,$target,$user,$password,$project,$surface,$login)
return
<ok>{$uri} » {$i}</ok>
<ok>{ $uri } » { $i }</ok>
}</div>
......@@ -50,7 +50,7 @@ if( $revisionInWiki = $lastRevinDb )
let $result := '<ac:confluence xmlns:ac="http://www.atlassian.com/schema/confluence/4/ac/" xmlns:ri="http://www.atlassian.com/schema/confluence/4/ri/" xmlns="http://www.atlassian.com/schema/confluence/4/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.atlassian.com/schema/confluence/4/ac/ ">' || $result || "</ac:confluence>"
let $result as element() := parse-xml( $result )/*
let $result := local:remove-element-ns-deep( $result )
let $result := <div id="wiki">{local:confluenceparser($result, $id)}</div>
let $result := <div id="wiki">{ local:confluenceparser($result, $id) }</div>
let $allLanguages := app:getAllLanguages()
let $forLoop := map:new(
......@@ -129,12 +129,12 @@ for $node in $nodes return
case element ( h1 ) return
element xhtml:h1 {
attribute class {"block-header"},
<span>{$node/text()}</span>
<span>{ $node/text() }</span>
}
case element ( h2 ) return
element xhtml:h2 {
attribute class {"block-header alt"},
<span>{$node/text()}</span>
<span>{ $node/text() }</span>
}
(: Structured Macros of Confluence needs to be transformed :)
case element ( structured-macro ) return
......
......@@ -30,14 +30,14 @@ let $doc :=
let $export := ( httpclient:get($url, $persist, $request-headers, $options)//div[@class="dokuwiki export"]
, httpclient:get($url, $persist, $request-headers, $options)//DIV[@class="dokuwiki export"] )
let $result := if( $export//DIV ) then local:HTML2html($export) else $export
let $result := <div>{local:dokuwikiparser( $result/*[not(@id='dw__toc')] )}</div>
let $result := <div>{ local:dokuwikiparser( $result/*[not(@id='dw__toc')] ) }</div>
let $login := xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('sade.user') , config:get("sade.password"))
let $store := xmldb:store( '/sade-projects/textgrid/data/xml/doku/', $id || '.rev' || $revisionInWiki || '.xml' , $result )
let $imageReload := local:dokuwikiImageReload($id, $model)
return
$result
return
<div id="dokuwiki">{$doc}</div>
<div id="dokuwiki">{ $doc }</div>
};
declare function local:dokuwikiGetLastRevInDb($id) {
......@@ -81,7 +81,7 @@ for $node in $nodes return
return
element xhtml:h2 {
<div class="block-header">
<h2><span class="title">{local:dokuwikiparser($node/text(), $char)}</span><span class="decoration"></span><span class="decoration"></span><span class="decoration"></span></h2>
<h2><span class="title">{ local:dokuwikiparser($node/text(), $char) }</span><span class="decoration"></span><span class="decoration"></span><span class="decoration"></span></h2>
<div id="toggleToc"><i class="fas fa-caret-down" aria-hidden="true"></i></div>
<div id="dokuToc">
{ local:dokuwikiTOC( $node/parent::div/div[@id="dw__toc"]/div/ul/li/ul) }
......
......@@ -38,7 +38,7 @@ then
let $tests := util:eval(xs:anyURI('test.xq'))
let $print := util:log-system-out( $tests )
let $file-name := system:get-exist-home()||"/../sade_job-"||string($jobId)||".log.xml"
let $file := file:serialize(<tests time="{current-dateTime()}">{$tests}</tests>, $file-name, ())
let $file := file:serialize(<tests time="{current-dateTime()}">{ $tests }</tests>, $file-name, ())
return
( util:log-system-out("Hey! I am taken captive in this Docker! Let me out!"),
util:log-system-out("They forced me to say: "||$file || " for " || $file-name),
......
......@@ -154,7 +154,7 @@ return
<div>{
for $i in util:eval("tgconnect:publish($uri,$sid,$target,$user,$password,$project,$surface,$login)")
return
<ok>{$uri} » {$i}</ok>
<ok>{ $uri } » { $i }</ok>
}</div>
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment