zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #25902
[Merge] lp:~zorba-coders/zorba/remove-xqdoc-modules into lp:zorba
Chris Hillery has proposed merging lp:~zorba-coders/zorba/remove-xqdoc-modules into lp:zorba.
Commit message:
Remove obsolete XQDoc batch, menu, and html modules.
Requested reviews:
Chris Hillery (ceejatec)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/remove-xqdoc-modules/+merge/187670
--
https://code.launchpad.net/~zorba-coders/zorba/remove-xqdoc-modules/+merge/187670
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-09-02 20:43:22 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-09-26 06:07:24 +0000
@@ -54,12 +54,6 @@
URI "http://www.zorba-xquery.com/modules/store/static/integrity_constraints/ddl";)
DECLARE_ZORBA_MODULE(FILE store/static/integrity_constraints/dml.xq VERSION 2.0
URI "http://www.zorba-xquery.com/modules/store/static/integrity_constraints/dml";)
-DECLARE_ZORBA_MODULE(FILE xqdoc/batch.xq VERSION 2.0
- URI "http://www.zorba-xquery.com/modules/xqdoc/batch";)
-DECLARE_ZORBA_MODULE(FILE xqdoc/html.xq VERSION 2.0
- URI "http://www.zorba-xquery.com/modules/xqdoc/html";)
-DECLARE_ZORBA_MODULE(FILE xqdoc/menu.xq VERSION 2.0
- URI "http://www.zorba-xquery.com/modules/xqdoc/menu";)
# debugger client DBGP message handler module
IF (ZORBA_WITH_DEBUGGER)
=== removed directory 'modules/com/zorba-xquery/www/modules/xqdoc'
=== removed file 'modules/com/zorba-xquery/www/modules/xqdoc/batch.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc/batch.xq 2013-08-09 08:27:30 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc/batch.xq 1970-01-01 00:00:00 +0000
@@ -1,249 +0,0 @@
-xquery version "3.0";
-
-(:
- : Copyright 2008-2011 The FLWOR Foundation.
- :
- : Licensed under the Apache License, Version 2.0 (the "License");
- : you may not use this file except in compliance with the License.
- : You may obtain a copy of the License at
- :
- : http://www.apache.org/licenses/LICENSE-2.0
- :
- : Unless required by applicable law or agreed to in writing, software
- : distributed under the License is distributed on an "AS IS" BASIS,
- : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- : See the License for the specific language governing permissions and
- : limitations under the License.
-:)
-
-(:~
- : Process XQDoc batches.
- : This module generates XQDoc HTML documentation from multiple
- : XQuery modules.
- :
- : @author William Candillon <a href="#">wcandillon at gmail dot com</a>
- : @project Zorba/XQDoc/Batch
- :)
-module namespace batch = "http://www.zorba-xquery.com/modules/xqdoc/batch";;
-
-import module namespace functx = "http://www.functx.com";;
-
-import module namespace file = "http://expath.org/ns/file";;
-
-import module namespace xqdoc = "http://www.zorba-xquery.com/modules/xqdoc";;
-import module namespace menu = "http://www.zorba-xquery.com/modules/xqdoc/menu";;
-import module namespace html = "http://www.zorba-xquery.com/modules/xqdoc/html";;
-
-declare namespace an = "http://zorba.io/annotations";;
-declare namespace out = "http://www.w3.org/2010/xslt-xquery-serialization";;
-declare namespace xq = "http://www.xqdoc.org/1.0";;
-declare namespace h = "http://www.w3.org/1999/xhtml";;
-declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-
-declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "2.0";
-
-(:~
- : Run an XQDoc batch.
- :
- : @param $output-folder Where to write the generated files.
- : @param $static-folders Where to copy the static files from.
- : @param $template HTML layout of the generated files. The layount can contains different variables.
- : For instance: <pre class="ace-static" ace-mode="xml"><body><var name="page" /></body></pre> is a valid example.
- : Three variable names are available: <code>page</code>, <code>title</code>, and <code>menu</code>.
- : @param $modules Document describing the documentation project. For instance:
- : <pre class="ace-static" ace-mode="xml">
- : <modules>
- : <namespace prefix="ann" uri="http://zorba.io/annotations"; />
- : <section id="modules" label="My Modules">
- : <!-- Location hints are optionnals -->
- : <module ns="http://example.com/mymodule"; label="My Module" id="module" file="module.xq" />
- : </section>
- : </modules>
- : </pre>
- :
- :)
-declare %an:sequential function batch:build-xqdoc($output-folder as xs:string, $static-folders as xs:string*, $template as element(), $modules as element(modules))
-{
- variable $output-xml-folder := concat($output-folder, file:directory-separator(), "xml", file:directory-separator());
- batch:create-xml-folder($output-xml-folder);
- batch:copy-static-folders($output-folder, $static-folders);
- for $page in $modules//*[local-name(.) = "section" or local-name(.) = "module"]
- let $menu := menu:menu($page, "")
- let $page-name := menu:item-uri($page)
- return {
- variable $p := batch:page($template, $menu, $page);
- trace($page-name, "Create Page");
- batch:create-page($output-folder, $page-name, $p);
- if(exists($page/@ns)) then {
- variable $doc-name := $page/@ns/string(.);
- $doc-name := substring-after($doc-name, "http://";);
- $doc-name := replace($doc-name, "/", "_");
- $doc-name := concat($doc-name, ".xml");
- variable $output-xml := concat($output-xml-folder, $doc-name);
- trace($doc-name, "Save XML");
- batch:save-xml($output-xml, $page)
- } else { () }
- }
-};
-
-declare %an:sequential function batch:create-xml-folder($folder as xs:string)
-{
- if(not(file:is-directory($folder))) then
- file:create-directory($folder);
- else ();
-};
-
-declare %an:sequential function batch:save-xml($output-file, $page)
-{
- if($page instance of element(module)) then
- file:write-text($output-file, serialize(batch:xqdoc($page)));
- else
- ();
- (:
- variable $xqdoc := batch:xqdoc($page);
- :)
-};
-
-declare %an:nondeterministic function batch:page($template as element(), $menu as element(ul), $section as element())
-as element(h:html)
-{
- let $page :=
- typeswitch($section)
- case element(module)
- return html:convert(batch:xqdoc($section))
-
- case element(section)
- return batch:section($section)
-
- default return error(xs:QName('batch:UNKNOWN-ELEMENT'), "Element is neither an instance of section or module")
- let $title :=
- typeswitch($section)
- case element(module)
- return concat(functx:capitalize-first(batch:xqdoc($section)/xq:module/xq:name/text()), " Module")
-
- case element(section)
- return concat($section/@label, " Modules")
-
- default return ""
- return
- copy $tpl := $template
- modify (
- batch:process-variable($tpl, "page", $page),
- batch:process-variable($tpl, "title", $title),
- batch:process-variable($tpl, "menu", $menu)
- )
- return $tpl
-};
-
-declare %an:sequential function batch:create-page($output-folder as xs:string, $page-name as xs:string, $page as element(h:html))
-{
- let $output-folder := batch:add-trailing-slash($output-folder)
- let $output := concat($output-folder, $page-name)
- return
- file:write-text(
- $output,
- serialize(
- $page,
- <out:serialization-parameters>
- <out:method value="xhtml" />
- <out:doctype-system value="about:legacy-compat" />
- </out:serialization-parameters>
- )
- )
-};
-
-declare %an:sequential function batch:copy-static-folders($output-folder as xs:string, $static-folders as xs:string*)
-{
- for $folder in $static-folders
- let $folder-name := file:base-name($folder)
- let $output-folder := batch:add-trailing-slash($output-folder)
- let $output := concat($output-folder, $folder-name)
- return {
- if(file:is-directory($output)) then
- file:delete($output);
- else ();
- file:copy($folder, $output)
- }
-};
-
-declare function batch:section($sections as element(section)+)
-as element(section)+
-{
- batch:section($sections, 1)
-};
-
-declare function batch:section($sections as element(section)+, $level as xs:integer)
-as element(section)+
-{
- for $section in $sections
- return <section>
- {element {concat("h", $level)} { string($section/@label) }}
- <ul>
- {
- for $child in $section/*
- return <li>{
- if($child instance of element(module)) then
- <span><a href="{menu:item-uri($child)}">{string($child/@label)}</a> - {string($child/@ns)}</span>
- else
- batch:section($child, $level + 1)
- }</li>
-
- }
- </ul>
- </section>
-};
-
-declare %an:nondeterministic function batch:xqdoc($module as element(module))
-as element(xq:xqdoc)
-{
- try {
- let $xqdoc := if(exists($module/@file)) then
- xqdoc:xqdoc-content(file:read-text($module/@file))
- else
- xqdoc:xqdoc($module/@ns)
- let $namespaces := $module//ancestor::*[empty(..)]/namespace
- return batch:add-predeclared-namespaces($xqdoc, $namespaces)
- } catch err:XQST0046 {
- error(xs:QName('batch:MODULE-NOT-FOUND'), concat("Module ", $module/@ns, " wasn't found. Maybe there is a typo in the namespace URI or the module isn't installed."))
- }
-};
-
-declare function batch:add-predeclared-namespaces($xqdoc as element(xq:xqdoc), $namespaces as element(namespace)*)
-as element(xq:xqdoc)
-{
- copy $doc := $xqdoc
- modify (
- for $namespace in $namespaces
- let $prefix := string($namespace/@prefix)
- let $uri := string($namespace/@uri)
- return
- (
- for $declared-namespace in $doc/xq:module/xq:custom[@tag="namespaces"]/xq:namespace[@uri = "" and @prefix = $prefix]
- return
- replace value of node $declared-namespace/@uri with $uri
- ,
- for $annotation in $doc//xq:annotation[@prefix = $prefix]
- return
- replace value of node $annotation/@namespace with $uri
- )
- )
- return $doc
-};
-
-declare function batch:add-trailing-slash($path as xs:string)
-as xs:string
-{
- if(ends-with($path, file:directory-separator())) then
- $path
- else
- concat($path, file:directory-separator())
-};
-
-declare %private updating function batch:process-variable($source as element(), $varname as xs:string, $value as item())
-{
- let $vars := $source//h:var[@name=$varname]
- for $var in $vars
- return
- replace node $var with $value
-};
=== removed file 'modules/com/zorba-xquery/www/modules/xqdoc/html.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc/html.xq 2013-08-09 08:27:30 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc/html.xq 1970-01-01 00:00:00 +0000
@@ -1,506 +0,0 @@
-xquery version "3.0";
-
-(:
- : Copyright 2008-2011 The FLWOR Foundation.
- :
- : Licensed under the Apache License, Version 2.0 (the "License");
- : you may not use this file except in compliance with the License.
- : You may obtain a copy of the License at
- :
- : http://www.apache.org/licenses/LICENSE-2.0
- :
- : Unless required by applicable law or agreed to in writing, software
- : distributed under the License is distributed on an "AS IS" BASIS,
- : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- : See the License for the specific language governing permissions and
- : limitations under the License.
-:)
-
-(:~
- : Convert an XQDoc document into an HTML document.
- :
- : This module contains a single <code>convert()</code> function
- : that transform an XQDoc document into an HTML document.
- : Usage:
- : <pre class="ace-static" ace-mode="xquery">
- : let $xqdoc := xqdoc:xqdoc("http://expath.org/ns/file";)
- : return html:convert($xqdoc)
- : </pre>
- :
- : @author William Candillon <a href="#">wcandillon at gmail dot com</a>
- : @project Zorba/XQDoc/HTML
- :)
-
-module namespace html = "http://www.zorba-xquery.com/modules/xqdoc/html";;
-
-declare namespace xq = "http://www.xqdoc.org/1.0";;
-declare namespace o = "http://www.w3.org/2010/xslt-xquery-serialization";;
-
-declare copy-namespaces no-preserve, inherit;
-
-declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "2.0";
-
-declare %private variable $html:empty-tags-to-delete := ("tt");
-
-declare function html:convert($xqdoc as element(xq:xqdoc))
-as element(div)
-{
-let $module := $xqdoc/xq:module
-let $ns := normalize-space($module/xq:uri/text())
-let $comment := $module/xq:comment
-let $namespaces := $module/xq:custom[@tag = "namespaces"]/xq:namespace
-let $prefix := $xqdoc/xq:functions/xq:function[1]/xq:name/text()/substring-before(., ":")
-let $prefix := if(exists($prefix)) then $prefix else $xqdoc/xq:variables/xq:variable[1]/xq:uri/text()/substring-before(., ":")
-let $variables := for $variable in $xqdoc/xq:variables/xq:variable order by $variable/xq:name/text() ascending return $variable
-let $functions := for $function in $xqdoc/xq:functions/xq:function[not(html:is-function-private(.))] order by concat($function/xq:name/text(), $function/@arity) ascending return $function
-let $description := $comment/xq:description/node()
-return
-html:normalize(
-<div>
- <h1>{$ns}</h1>
- <section id="description">
- <h2>Description</h2>
- <p>Before using any of the functions below please remember to import the module namespace:</p>
- <pre class="ace-static" ace-mode="xquery">import module namespace {$prefix} = "{$ns}";</pre>
- {
- if($description instance of text()) then
- <p>{$description}</p>
- else
- $comment/xq:description/node()
- }
- {
- let $schemas := $xqdoc/xq:imports//xq:import[@type = "schema"]
- return
- if(exists($schemas)) then
- <section>
- <h4>Imported Schemas</h4>
- <ul>
- {
- for $schema in $schemas
- let $uri := $schema/xq:uri/text()
- let $href := replace(replace($uri, "http://";, ""), "/", "_") || ".xsd"
- return <li>
- <a href="schemas/{$href}" class="schema-link">{$uri}</a>
- </li>
- }
- </ul>
- <p>Please note that the schemas are not automatically imported in the modules that import this module.</p>
- <p>In order to import and use the schemas, please add:</p>
- <pre class="ace-static" ace-mode="xquery">{
- let $namespaces := $xqdoc/xq:module//xq:custom[@tag = "namespaces"]
- return
- string-join(
- for $import in $xqdoc/xq:imports//xq:import[@type = "schema"]
- return
- concat('import schema namespace ',
- $namespaces//xq:namespace[(@uri = $import/xq:uri/text()) and (@isSchema = "true")]/@prefix,
- ' = "',
- string($import/xq:uri/text()),'";'),"
- ")
- }</pre>
- </section>
- else
- ()
- }
- {
- let $sees := $comment/xq:see
- return
- if(exists($sees)) then
- <section>
- <h4>See also</h4>
- {
- for $see in $sees
- let $see := if(exists($see/a) and exists($see/text())) then $see/node() else if(exists($see/node())) then <a href="{$see/node()}">{$see/node()}</a> else ""
- return <p>{$see}</p>
- }
- </section>
- else ()
- }
- {
- let $authors := $comment/xq:author
- return
- if(exists($authors)) then
- <section>
- <h4>{concat("Author", if(count($authors) gt 1) then "s" else "")}</h4>
- {
- for $author in $authors
- return <p>{$author/node()}</p>
- }
- </section>
- else ()
- }
- {
- let $version := $comment/xq:custom[@tag = "XQuery version"]/text()
- let $encoding := $comment/xq:custom[@tag = "encoding"]/text()
- return
- if(exists($version)) then
- <section>
- <h4>XQuery version and encoding</h4>
- <pre class="ace-static" ace-mode="xquery">xquery version "{$version}"{if(exists($encoding)) then concat(' encoding "', $encoding, '"') else ()};</pre>
- </section>
- else ()
- }
- </section>
- {
- let $examples := $module//xq:custom[@tag="example"]/text()
- let $module-name := tokenize($module/xq:uri/text(),"/")[last()]
- return
- if(exists($examples)) then
- <section class="examples">
- <h4>Examples</h4>
- <ul>
- {
- for $example in $examples
- let $example-name := tokenize($example,"/")[last()]
- return <li><a href="{concat("examples/",$module-name,"_",$example-name)}" class="example-link">{$example-name}</a></li>
- }
- </ul>
- </section>
- else ()
- }
- {
- if(exists($namespaces)) then
- <section id="namespaces">
- <div>
- <h2>Namespaces</h2>
- <table>
- {
- for $ns in $namespaces
- return
- <tr>
- <td>{string($ns/@prefix)}</td>
- <td>{string($ns/@uri)}</td>
- </tr>
- }
- </table>
- </div>
- </section>
- else ()
- }
- {
- if(exists($variables)) then
- <section id="variable-summary">
- <div>
- <h2>Variable Summary</h2>
- <dl>
- {
- for $variable in $variables
- let $varname := $variable/xq:uri/text()
- return <dd>
- <a href="#{$varname}">{$varname}</a>
- </dd>
- }
- </dl>
- </div>
- </section>
- else()
- }
- {
- if(exists($functions)) then
- <section id="function-summary">
- <div>
- <h2>Function Summary</h2>
- <table>
- {
- for $function in $functions
- let $name := $function/xq:name/text()/substring-after(., ":")
- let $arity := number($function/@arity)
- return <tr>
- <td>{html:function-properties($function)}</td>
- <td>
- <code>
- {if(exists($function//xq:deprecated)) then attribute class { "deprecated" } else ()}
- <a href="#{$name}-{$arity}">{$name}</a>{substring-after($function/xq:signature/text(), $function/xq:name/text())}</code>
- {
- let $description := $function/xq:comment/xq:description
- return
- if(exists($description)) then
- html:description-summary($description)
- else ()
- }
- </td>
- </tr>
- }
- </table>
- </div>
- </section>
- else ()
- }
- {
- if(exists($variables)) then
- <section id="variables">
- <div class="variables">
- <h2>Variables</h2>
- {
- for $variable at $i in $variables
- let $name := $variable/xq:uri/text()
- let $type := $variable/xq:comment/xq:custom[@tag = "type"]/text()
- return <section id="{$name}" class="variable var-{$i}">
- <h3>${$name}{if(exists($type)) then concat(" as ", $type) else ()}</h3>
- <p>{$variable/xq:comment/xq:description/node()}</p>
- </section>
- }
- </div>
- </section>
- else ()
- }
- {
- if(exists($functions)) then
- <section id="functions">
- <div class="functions">
- <h2>Functions</h2>
- {
- for $function at $i in $functions
- let $qname := $function/xq:name/text()
- let $name := $qname/substring-after(., ":")
- let $arity := string($function/@arity)
- let $params := $function/xq:parameters/xq:parameter
- let $return := $function/xq:return
- let $errors := $function/xq:comment/xq:error
- return <section class="function fn-{$i}">
- <h3 id="{$name}-{$arity}">{$name}#{$arity}</h3>
- <pre class="ace-static{if(exists($function//xq:deprecated)) then " deprecated" else ()}" ace-mode="xquery">{concat("declare", html:serialize-annotations($function/xq:annotations), if(html:is-function-updating($function)) then " updating " else " ")}function {$qname}({html:serialize-params($function/xq:parameters)}) as {let $return := $function/xq:return/xq:type/text() return if(empty($return)) then "item()*" else $return}{if(html:is-function-external($function)) then " external" else ()}</pre>
- {if(exists($function//xq:deprecated)) then <h4>This function is deprecated</h4> else ()}
- <p>{$function/xq:comment/xq:description/node()}</p>
- {
- if(exists($params)) then
- <section class="parameters-section">
- <h4>Parameters</h4>
- <ul class="parameters">
- {
- for $param in $params
- return <li>
- <code>{concat("$", $param/xq:name/text())} as {concat($param/xq:type/text(), $param/xq:type/@occurence)}</code>
- {
- let $variable := concat('$', $param/xq:name/text())
- let $description := $function/xq:comment/xq:param[starts-with(./text()[1], $variable)][1]
- let $description := if(exists($description)) then
- copy $d := $description
- modify (
- rename node $d as "div",
- let $text-node := $d/text()[starts-with(., $variable)]
- return
- replace value of node $text-node with replace($text-node, concat("\$", $param/xq:name/text()), "")
- )
- return $d
- else ()
- return $description
- }
- </li>
- }
- </ul>
- </section>
- else ()
- }
- {
- if(exists($return)) then
- <section class="returns-section">
- <h4>Returns</h4>
- <ul class="returns">
- <li>
- <code>{$return/xq:type/text()}</code>
- <p>{$function/xq:comment/xq:return/node()}</p>
- </li>
- </ul>
- </section>
- else ()
- }
- {
- if(exists($errors)) then
- <section class="errors-section">
- <h4>Errors</h4>
- <ul class="errors">
- {
- for $error in $errors
- return <li>
- {$error/node()}
- </li>
- }
- </ul>
- </section>
- else ()
- }
- {
- let $examples := $function//xq:custom[@tag="example"]/text()
- let $module-name := tokenize($module/xq:uri/text(),"/")[last()]
- return
- if(exists($examples)) then
- <section class="examples">
- <h4>Examples</h4>
- <ul>
- {
- for $example in $examples
- let $example-name := tokenize($example,"/")[last()]
- return <li><a href="{concat("examples/",$module-name,"_",$example-name)}" class="example-link">{$example-name}</a></li>
- }
- </ul>
- </section>
- else ()
- }
- {
- let $sees := $function/xq:comment/xq:see
- return
- if(exists($sees)) then
- <section>
- <h4>See also</h4>
- {
- for $see in $sees
- let $see := if(exists($see/a) and exists($see/text())) then $see/node() else if(exists($see/node())) then <a href="{$see/node()}">{$see/node()}</a> else ""
- return <p>{$see}</p>
- }
- </section>
- else ()
- }
- </section>
- }
- </div>
- </section>
- else ()
- }
-</div>)
-};
-
-declare %private function html:normalize-pre($pre as element(pre))
-as element(pre)
-{
- <pre>
- {$pre/attribute()}
- {serialize($pre/node(), <o:serialization-parameters></o:serialization-parameters>)}
- </pre>
-};
-
-declare %private function html:normalize($nodes as node()*)
-as item()*
-{
- copy $html := $nodes
- modify (
- for $node in $html//*[empty(./node()[not(. instance of attribute())]) and local-name(.) = $html:empty-tags-to-delete]
- return delete node $node,
- for $pre in $html//pre[exists(*)]
- return replace node $pre with html:normalize-pre($pre)
- )
- return $html
-};
-
-declare %private function html:text($nodes as node()*)
-as xs:string?
-{
- string-join(
- for $node in $nodes
- return
- if($node instance of text()) then
- $node
- else
- html:text($node/node())
- , " ")
-};
-
-declare %private function html:description-summary($description as element(xq:description))
-as element(p)
-{
- let $text := html:text($description)
- let $text := if(contains($text, ".")) then concat(substring-before($text, "."), ".") else $text
- return
- <p>{$text}</p>
-};
-
-declare %private function html:serialize-params($params as element(xq:parameters)?)
-as xs:string*
-{
- let $params :=
- for $param in $params/xq:parameter
- return
- concat("$", $param/xq:name/text(), " as ", $param/xq:type/text(), $param/xq:type/@occurrence)
- return
- if(exists($params)) then
- concat("
- ", string-join($params, ",
- "), "
-")
- else ()
-};
-
-declare %private function html:serialize-annotations($annotations as element(xq:annotations)?)
-as xs:string?
-{
- let $result :=
- string-join(
- let $namespaces := $annotations/ancestor::*[empty(..)]//xq:module/xq:custom[@tag = "namespaces"]/xq:namespace
- for $annotation in $annotations/xq:annotation
- let $ns := $annotation/@namespace/string(.)
- let $prefix := $annotation/@prefix/string(.)
- return
- concat("%", if(exists($prefix)) then concat($prefix, ":") else (), $annotation/@localname)
- , " ")
- return
- if($result != "") then
- concat(" ", $result)
- else
- $result
-};
-
-declare %private function html:function-properties($function as element(xq:function))
-as element(span)*
-{
- if(html:is-function-external($function)) then
- <span class="external"> </span>
- else(),
- if(html:is-function-sequential($function)) then
- <span class="sequential"> </span>
- else(),
- if(html:is-function-updating($function)) then
- <span class="updating"> </span>
- else (),
- if(html:is-function-variadic($function)) then
- <span class="variadic"> </span>
- else (),
- if(html:is-function-streamable($function)) then
- <span class="streamable"> </span>
- else (),
- if(html:is-function-nondeterministic($function)) then
- <span class="nondeterministic"> </span>
- else ()
-};
-
-declare %private function html:is-function-updating($function as element(xq:function))
-as xs:boolean
-{
- $function/xq:signature/text()/contains(substring-before(., $function/xq:name/text()), " updating ")
-};
-
-declare %private function html:is-function-private($function as element(xq:function))
-as xs:boolean
-{
- exists($function/xq:annotations/xq:annotation[@localname = "private" and @namespace = "http://www.w3.org/2005/xpath-functions";])
-};
-
-declare %private function html:is-function-nondeterministic($function as element(xq:function))
-as xs:boolean
-{
- exists($function//xq:annotation[@namespace = "http://zorba.io/annotations"; and @localname = "nondeterministic"])
-};
-
-declare %private function html:is-function-streamable($function as element(xq:function))
-as xs:boolean
-{
- exists($function//xq:annotation[@namespace = "http://zorba.io/annotations"; and @localname = "streamable"])
-};
-
-declare %private function html:is-function-variadic($function as element(xq:function))
-as xs:boolean
-{
- exists($function//xq:annotation[@namespace = "http://zorba.io/annotations"; and @localname = "variadic"])
-};
-
-declare %private function html:is-function-sequential($function as element(xq:function))
-as xs:boolean
-{
- exists($function//xq:annotation[@namespace = "http://zorba.io/annotations"; and @localname = "sequential"])
-};
-
-declare %private function html:is-function-external($function as element(xq:function))
-as xs:boolean
-{
- $function/xq:signature/text()/ends-with(., " external")
-};
=== removed file 'modules/com/zorba-xquery/www/modules/xqdoc/menu.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc/menu.xq 2013-08-09 08:27:30 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc/menu.xq 1970-01-01 00:00:00 +0000
@@ -1,133 +0,0 @@
-(:~
- : Generate navigation for XQDoc batches.
- :
- : @author William Candillon
- : @project Zorba/XQDoc/Menu
- :)
-module namespace menu = "http://www.zorba-xquery.com/modules/xqdoc/menu";;
-
-declare namespace ver = "http://zorba.io/options/versioning";;
-declare option ver:module-version "2.0";
-
-declare variable $menu:not-found as xs:QName := xs:QName('menu:not-found');
-
-declare function menu:categories-as-js($url-prefix as xs:string, $cats as element())
-as xs:string
-{
- concat("URLPrefix = '", $url-prefix, "';categories = { children: [", string-join(menu:categories($cats), ","), "]};")
-};
-
-declare function menu:categories($top as element()) as xs:string* {
- for $child in $top/*
- return
- typeswitch($child)
- case element(module) return
- concat(
- "{ type: 'module', label: '",
- $child/@label,
- "', id: '",
- $child/@id,
- "', ns: '",
- $child/@ns,
- "'}"
- )
- case element(section) return
- concat(
- "{type: 'section', label: '",
- $child/@label,
- "', id: '",
- $child/@id,
- "', children: [",
- string-join(menu:categories($child), ", "),
- "]}"
- )
- default return ""
-};
-
-(: Fetch an item from the category tree according to it's path. The path is split as a sequence of items :)
-declare function menu:item($ctx as element()?, $path as xs:string*)
-as element()?
-{
- if(empty($ctx)) then
- error($menu:not-found)
- else if(empty($path)) then
- $ctx
- else
- menu:item($ctx/*[@id = $path[1]], subsequence($path, 2))
-};
-
-declare function menu:item-uri($item as element())
-as xs:string
-{
- let $path := menu:item-uri($item, ())
- return concat(string-join($path, "_"), ".html")
-};
-
-declare function menu:item-uri($item as element()?, $result as xs:string*)
-as xs:string+
-{
- if(empty($item)) then
- $result
- else
- menu:item-uri($item/parent::*, ($item/@id, $result))
-};
-
-declare function menu:closed-tabs($item as element(section), $url-prefix as xs:string)
-as element(li)*
-{
- menu:closed-tabs($item, (), $url-prefix)
-};
-
-declare function menu:closed-tabs($item as element()?, $result as element()*, $url-prefix as xs:string)
-as element(li)*
-{
- if(empty($item)) then
- $result
- else
- let $li := <li class="tab">
- <div class="button">
- <div class="holder">
- <a href="{concat($url-prefix, menu:item-uri($item))}" class="closed-tab">{string($item/@label)}</a>
- </div>
- </div>
- </li>
- return
- menu:closed-tabs($item/parent::section, ($li, $result), $url-prefix)
-};
-
-declare function menu:menu($item as element(), $url-prefix as xs:string)
-{
-<ul class="sub-menu" id="xqdoc-menu">
-{
- let $parent := if($item instance of element(module)) then $item/parent::section/parent::section else $item/parent::section
- return
- if(exists($parent)) then
- menu:closed-tabs($parent, $url-prefix)
- else ()
-}
-{
- let $section := if($item instance of element(section)) then $item else $item/parent::section
- return
- <li class="tab active">
- <div class="button opened">
- <div class="holder">
- <a href="{concat($url-prefix, menu:item-uri($section))}" class="opened-tab">{string($section/@label)}</a>
- </div>
- </div>
- <ul>
- {
- for $element in $section/*
- return
- <li>
- {if($element/@id = $item/@id) then attribute class { "active" } else ()}
- <a href="{concat($url-prefix, menu:item-uri($element))}">
- {if($element instance of element(section)) then attribute class { "subsection" } else ()}
- {string($element/@label)}
- </a>
- </li>
- }
- </ul>
- </li>
-}
-</ul>
-};
References