[mod] xqdoc

This commit is contained in:
Andy Bunce 2019-04-11 22:50:22 +01:00
parent 5fe9b6ab18
commit 9fc8fe4a46
10 changed files with 440 additions and 111 deletions

View file

@ -4,6 +4,14 @@
<v-toolbar dense > <v-toolbar dense >
<v-toolbar-title>documentation</v-toolbar-title> <v-toolbar-title>documentation</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn
icon
:loading="loading"
@click="get()"
:disabled="loading"
>
<v-icon>refresh</v-icon>
</v-btn>
<a href="/vue-poc/api/xqdocjob" target="doc">json</a> <a href="/vue-poc/api/xqdocjob" target="doc">json</a>
</v-toolbar> </v-toolbar>
@ -15,8 +23,11 @@
:key="item.id" :key="item.id"
> >
<v-card :hover="true" > <v-card :hover="true" >
<v-card-title>{{ item.id }}</v-card-title> <v-card-title color="#26c6da">{{ item.id }}</v-card-title>
<v-card-text>{{ item.name }}</v-card-text> <v-card-text>{{ item.name }}</v-card-text>
<v-card-actions>
<a :href="item.href" target="_new">go</a>
</v-card-actions>
</v-card> </v-card>
</v-flex> </v-flex>
</v-layout> </v-layout>
@ -29,7 +40,8 @@
data: function(){ data: function(){
return { return {
message: 'Hello Vue.js!', message: 'Hello Vue.js!',
items:[] items:[],
loading: false
} }
}, },
methods:{ methods:{
@ -37,7 +49,6 @@
HTTP.get('xqdocjob') HTTP.get('xqdocjob')
.then((res) => { .then((res) => {
this.items = res.data; this.items = res.data;
console.log("items",this.items)
}); });
}, },
doEdit(item){ doEdit(item){

View file

@ -14,12 +14,13 @@ declare
function j:list() function j:list()
as element(json) as element(json)
{ {
let $jlist:=(279,280) let $jlist:=file:list(db:option("webpath") || "/static/xqdoc/")
return <json type="array"> return <json type="array">
{for $j in $jlist {for $j in reverse($jlist)
return <_ type="object"> return <_ type="object">
<id>{ $j }</id> <id>{ $j }</id>
<name>todo</name> <name>todo</name>
<href>/static/xqdoc/{ $j }index.html</href>
</_> </_>
}</json> }</json>
}; };

View file

@ -13,8 +13,8 @@
<v-flex xs12 sm6> <v-flex xs12 sm6>
<v-combobox <v-combobox
v-model="url" v-model="url"
:items="urls" :items="entities" item-text="name"
label="Select target" label="Select target" clearable open-on-clear
></v-combobox> ></v-combobox>
</v-flex> </v-flex>
@ -22,6 +22,7 @@
<table class="v-table"> <table class="v-table">
<thead> <thead>
<tr> <tr>
<th xs1>url</th>
<th xs1>Action</th> <th xs1>Action</th>
<th xs1>Repeat</th> <th xs1>Repeat</th>
<th xs1>Last</th> <th xs1>Last</th>
@ -37,10 +38,12 @@
<tr> <tr>
<td> <td>
<v-btn @click="get()" > {{ url && url.name }}
</td>
<td>
<v-btn @click="get()" :disabled="!url" >
Read <v-icon right>compare_arrows</v-icon> Read <v-icon right>compare_arrows</v-icon>
</v-btn> </v-btn>
</td> </td>
<td> <td>
<v-switch v-on:change="gchange" v-model="repeat.get"></v-switch> <v-switch v-on:change="gchange" v-model="repeat.get"></v-switch>
@ -84,17 +87,18 @@
return { return {
getValues: new perfStat(), getValues: new perfStat(),
repeat: {get:false}, repeat: {get:false},
url: "data/entity", url: null,
urls: ["data/entity","data/taskhistory"],
counter: 0, counter: 0,
result: null result: null,
entities: null
} }
}, },
methods:{ methods:{
get(){ get(){
var _start = performance.now(); var _start = performance.now();
HTTP.get(this.url,axios_json) console.log("FFFFF"," "+ this.url.parentlink)
HTTP.get(this.url.parentlink,axios_json)
.then(r=>{ .then(r=>{
var elapsed=Math.floor(performance.now() - _start); var elapsed=Math.floor(performance.now() - _start);
this.counter++; this.counter++;
@ -113,8 +117,19 @@
reset(){ reset(){
Object.assign(this.getValues,this.getValues.clear()); Object.assign(this.getValues,this.getValues.clear());
this.$forceUpdate() this.$forceUpdate()
},
getentities(){
HTTP.get("data/entity",axios_json)
.then(r=>{
console.log("entities: ",r.data);
this.entities=r.data.items
})
} }
}, },
created(){
console.log("GET entities: ");
this.getentities()
},
beforeRouteLeave(to, from, next){ beforeRouteLeave(to, from, next){
var on=this.repeat.get var on=this.repeat.get

View file

@ -29,7 +29,7 @@
<v-card-text> <v-card-text>
<v-container fluid> <v-container fluid>
<v-layout row wrap> <v-layout row wrap>
<v-flex xs12> <v-flex xs12 v-if="!loading">
<vp-paramform ref="params" :endpoint="'tasks/'+task"></vp-paramform> <vp-paramform ref="params" :endpoint="'tasks/'+task"></vp-paramform>
</v-flex> </v-flex>
</v-layout> </v-layout>

View file

@ -4,9 +4,11 @@
:) :)
import module namespace xqd = 'quodatum:build.xqdoc' at "../../../lib/xqdoc/xqdoc-proj.xqm"; import module namespace xqd = 'quodatum:build.xqdoc' at "../../../lib/xqdoc/xqdoc-proj.xqm";
import module namespace xqhtml = 'quodatum:build.xqdoc-html' at "../../../lib/xqdoc/xqdoc-html.xqm";
import module namespace store = 'quodatum.store' at "../../../lib/store.xqm"; import module namespace store = 'quodatum.store' at "../../../lib/store.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step";
declare namespace xqdoc="http://www.xqdoc.org/1.0";
(:~ URL of the root folder to document (:~ URL of the root folder to document
: @default C:/Users/andy/git/vue-poc/src/vue-poc : @default C:/Users/andy/git/vue-poc/src/vue-poc
:) :)
@ -15,51 +17,55 @@ declare variable $efolder as xs:anyURI external := xs:anyURI("C:/Users/andy/git
declare variable $id as element(last-id):=db:open("vue-poc","/state.xml")/state/last-id; declare variable $id as element(last-id):=db:open("vue-poc","/state.xml")/state/last-id;
let $target:="file:///" || db:option("webpath") || "/static/xqdoc/" || $id || "/" let $target:="file:///" || db:option("webpath") || "/static/xqdoc/" || $id || "/"
let $project:=tokenize($efolder,"[/\\]")[last()]
let $state:=xqd:read($efolder)=>trace("READ: ")
let $opts:=map{ let $opts:=map{
"src-folder": $efolder, "src-folder": $efolder,
"project": $project, "project": $state?project,
"ext-id": $id/string() "ext-id": $id/string(),
"resources": "resources/"
} }
let $state:=xqd:read($efolder)=>trace("READ: ")
let $imports:= xqd:imports($state)?xqdoc=>head()
(: generate o/ps per source file :)
let $modmap:=for $file at $pos in $state?files let $modmap:=for $file at $pos in $state?files
let $params:=map:merge((map{ let $params:=map:merge((map{
"source": "** source**", "source": $file?xqparse/string(),
"filename": "**FILE**", "filename": $file?path,
"cache": $xqd:cache, "cache": $xqd:cache,
"show-private": true(), "show-private": true(),
"root": "../", "root": "../../",
"resources": "resources/"}, "resources": "resources/"},
$opts)) $opts))
return ( return (
map{ map{
"uri": ``[f`{ $pos}`/xqdoc.xml]``,
"document": $file?xqdoc, "document": $file?xqdoc,
"opts": $xqd:XML "uri": $file?href || "/xqdoc.xml", "opts": $xqd:XML
}, },
map{ map{
"uri": ``[f`{ $pos}`/xqparse.xml]``,
"document": $file?xqparse, "document": $file?xqparse,
"opts": $xqd:XML "uri": $file?href || "xqparse.xml", "opts": $xqd:XML
}, },
map{ map{
"uri": ``[f`{ $pos}`/index.html]``,
"document": xqd:xqdoc-html($file?xqdoc,$params), "document": xqd:xqdoc-html($file?xqdoc,$params),
"opts": $xqd:HTML5 "uri": $file?href || "index.html", "opts": $xqd:HTML5
} }
) )
let $indexmap:=
map{ let $index:= map{
"uri": ``[index.html]``, "document": xqhtml:index-html2($state,$opts),
"document": <html><title>todo</title></html>, "uri": ``[index.html]``, "opts": $xqd:HTML5
"opts": $xqd:HTML5
} }
let $restxq:= map{
"document": xqhtml:restxq($state, xqd:rxq-paths($state),$opts),
"uri": ``[restxq.html]``, "opts": $xqd:HTML5
}
let $imports:=map{
"document": xqhtml:imports($state,xqd:imports($state),$opts),
"uri": ``[imports.html]``, "opts": $xqd:HTML5
}
return ( return (
store:store(($indexmap,$modmap),$target), store:store(($index,$restxq,$imports,$modmap),$target),
xqd:export-resources2($target), xqd:export-resources2($target),
replace value of node $id with 1+$id, replace value of node $id with 1+$id,
update:output( update:output(

View file

@ -11,7 +11,7 @@
Source not available Source not available
</xsl:param> </xsl:param>
<xsl:param name="filename" as="xs:string" select="'?file'" /> <xsl:param name="filename" as="xs:string" select="'?file'" />
<xsl:param name="ext-id" as="xs:string"></xsl:param>
<xsl:param name="show-private" as="xs:boolean" select="false()" /> <xsl:param name="show-private" as="xs:boolean" select="false()" />
<xsl:param name="resources" as="xs:string" select="'resources/'" /> <xsl:param name="resources" as="xs:string" select="'resources/'" />
<xsl:param name="root" as="xs:string" select="'../../'" /> <xsl:param name="root" as="xs:string" select="'../../'" />
@ -36,7 +36,6 @@
<title> <title>
<xsl:value-of select="$docuri" /> <xsl:value-of select="$docuri" />
- xqDoc - xqDoc
<xsl:value-of select="$ext-id" />
</title> </title>
<xsl:call-template name="resources"> <xsl:call-template name="resources">
<xsl:with-param name="path" select="concat($root,$resources)" /> <xsl:with-param name="path" select="concat($root,$resources)" />
@ -56,11 +55,7 @@
mode="restxq" /> mode="restxq" />
<div> <div>
<h3 id="source">Original Source Code</h3> <h3 id="source">Original Source Code</h3>
<pre> <pre><code class="language-xquery"><xsl:value-of select="$source" /></code></pre>
<code class="language-xquery">
<xsl:value-of select="$source" />
</code>
</pre>
</div> </div>
<br /> <br />
@ -71,7 +66,7 @@
<a href="xqdoc.xml" target="xqdoc"> <a href="xqdoc.xml" target="xqdoc">
xqdoc xqdoc
</a> </a>
<a href="xparse.xml" target="xparse"> <a href="xqparse.xml" target="xqparse">
xparse xparse
</a> </a>
</i> </i>
@ -96,26 +91,29 @@
<xsl:value-of select="@type" /> <xsl:value-of select="@type" />
module module
</small> </small>
<xsl:if test="count($restxq)">
<span title="RestXQ" class="tag tag-success" style="float:right">R</span>
</xsl:if>
<xsl:if test=".//doc:annotations/doc:annotation[@name='updating']">
<div class="tag tag-danger" title="Updating" style="float:right">U
</div>
</xsl:if>
</h1> </h1>
<dl> <dl>
<xsl:apply-templates select="doc:comment/doc:description" /> <xsl:apply-templates select="doc:comment/doc:description" />
<dt>Tags</dt> <dt>Tags</dt>
<dd> <dd>
<xsl:if test="count($restxq)">
<span class="tag tag-success">RESTXQ</span>
</xsl:if>
<xsl:apply-templates <xsl:apply-templates
select="doc:comment/* except doc:comment/doc:description" /> select="doc:comment/* except doc:comment/doc:description" />
</dd> </dd>
</dl> </dl>
<div> Imported by <a href="{ $root }imports.html#{ doc:uri }">*</a></div>
</xsl:template> </xsl:template>
<xsl:template match="doc:imports[doc:import]"> <xsl:template match="doc:imports[doc:import]">
<div id="imports"> <div id="imports">
<h3> <details>
<a href="#imports">Imports</a> <summary><a href="#imports">Imports</a></summary>
</h3>
<table class="data" style="float:none"> <table class="data" style="float:none">
<thead> <thead>
<tr> <tr>
@ -137,6 +135,7 @@
</xsl:for-each> </xsl:for-each>
</tbody> </tbody>
</table> </table>
</details>
</div> </div>
</xsl:template> </xsl:template>
@ -238,9 +237,10 @@
<div id="{$id}"> <div id="{$id}">
<h4> <h4>
<a href="#{$id}">
<xsl:value-of select="$id" /> <xsl:value-of select="$id" />
</a> <div style="float:right">
<a href="#{$id}" >#</a>
</div>
</h4> </h4>
<xsl:apply-templates select="$fun/doc:comment/doc:description[1]" /> <xsl:apply-templates select="$fun/doc:comment/doc:description[1]" />
@ -251,7 +251,15 @@
<xsl:apply-templates select="$fun[1]/doc:parameters" /> <xsl:apply-templates select="$fun[1]/doc:parameters" />
<xsl:apply-templates select="$fun[1]/doc:return" /> <xsl:apply-templates select="$fun[1]/doc:return" />
<xsl:apply-templates select="$fun[1]/doc:comment/doc:error" /> <xsl:apply-templates select="$fun[1]/doc:comment/doc:error" />
<xsl:apply-templates select="doc:annotations" />
<details>
<summary>External functions that invoke this function</summary>
todo
</details>
<details>
<summary>Internal functions used by this function</summary>
todo
</details>
</div> </div>
</xsl:template> </xsl:template>
@ -281,7 +289,7 @@
<xsl:value-of select="doc:return/doc:type/@occurrence/string()" /> <xsl:value-of select="doc:return/doc:type/@occurrence/string()" />
</code> </code>
</div> </div>
<xsl:apply-templates select="doc:annotations" />
</xsl:template> </xsl:template>
<xsl:template match="doc:functions[doc:function]" mode="restxq"> <xsl:template match="doc:functions[doc:function]" mode="restxq">
@ -458,32 +466,36 @@
<xsl:template name="toc"> <xsl:template name="toc">
<nav id="toc"> <nav id="toc">
<div>
<a href="{$index}">
&#8624;
<xsl:value-of select="$project" />
:id=
<xsl:value-of select="$ext-id" />
</a>
</div>
<h2> <h2>
<a href="{ $index }" class="tag tag-success">
<xsl:value-of select="$project" />
</a>
/ Module
</h2>
<h3>
<a id="contents"></a> <a id="contents"></a>
<span class=""> <span class="">
<xsl:value-of select="$docuri" /> <xsl:value-of select="$docuri" />
</span> </span>
</h2> </h3>
<ol class="toc"> <ol class="toc">
<li> <li>
<a href="#main"> <a href="#main">
<span class="secno">1 </span> <span class="secno">1 </span>
<span class="content">Introduction</span> <span class="content">Introduction</span>
</a> </a>
</li>
<li>
<a href="#imports">
<span class="secno">2 </span>
<span class="content">Imports</span>
</a>
</li> </li>
<li> <li>
<ol class="toc"> <ol class="toc">
<li> <li>
<a href="#variables"> <a href="#variables">
<span class="secno">2 </span> <span class="secno">3 </span>
<span class="content">Variables</span> <span class="content">Variables</span>
</a> </a>
<ol class="toc"> <ol class="toc">
@ -509,7 +521,7 @@
<ol class="toc"> <ol class="toc">
<li> <li>
<a href="#functions"> <a href="#functions">
<span class="secno">3 </span> <span class="secno">4 </span>
<span class="content">Functions</span> <span class="content">Functions</span>
</a> </a>
<ol class="toc"> <ol class="toc">
@ -517,7 +529,7 @@
<xsl:sort select="lower-case(doc:name)" /> <xsl:sort select="lower-case(doc:name)" />
<xsl:variable name="id" select="current-grouping-key()" /> <xsl:variable name="id" select="current-grouping-key()" />
<li> <li>
<a href="#{$id}#0"> <a href="#{$id}">
<span class="secno"> <span class="secno">
<xsl:value-of select="concat('3.',position())" /> <xsl:value-of select="concat('3.',position())" />
</span> </span>
@ -544,7 +556,7 @@
</li> </li>
<li> <li>
<a href="#namespaces"> <a href="#namespaces">
<span class="secno">4 </span> <span class="secno">5 </span>
<span class="content">Namespaces</span> <span class="content">Namespaces</span>
</a> </a>
</li> </li>
@ -552,7 +564,7 @@
<ol class="toc"> <ol class="toc">
<li> <li>
<a href="#restxq"> <a href="#restxq">
<span class="secno">5 </span> <span class="secno">6 </span>
<span class="content">Restxq</span> <span class="content">Restxq</span>
</a> </a>
<ol class="toc"> <ol class="toc">
@ -576,6 +588,12 @@
</ol> </ol>
</li> </li>
<li>
<a href="#source">
<span class="secno">7 </span>
<span class="content">Source</span>
</a>
</li>
</ol> </ol>
</nav> </nav>
</xsl:template> </xsl:template>

View file

@ -5,6 +5,7 @@
: $target:="file:///C:/Users/andy/workspace/app-doc/src/doc/generated/models.xqm" : $target:="file:///C:/Users/andy/workspace/app-doc/src/doc/generated/models.xqm"
:) :)
module namespace xqhtml = 'quodatum:build.xqdoc-html'; module namespace xqhtml = 'quodatum:build.xqdoc-html';
import module namespace tree = 'quodatum.data.tree' at "../tree.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace c="http://www.w3.org/ns/xproc-step";
declare namespace xqdoc="http://www.xqdoc.org/1.0"; declare namespace xqdoc="http://www.xqdoc.org/1.0";
@ -15,6 +16,81 @@ declare namespace xqdoc="http://www.xqdoc.org/1.0";
: "src-folder": "C:/Users/andy/git/vue-poc/src/vue-poc", : "src-folder": "C:/Users/andy/git/vue-poc/src/vue-poc",
: "project": "vue-poc" : "project": "vue-poc"
:) :)
declare function xqhtml:index-html2($state as map(*),
$params as map(*)
)
as document-node()
{
let $d:=<div>
<h1>
<span class="tag tag-success">
{ $params?project }
</span>
XQuery module Documentation
</h1>
{ xqhtml:toc($params) }
<dl>
<dt><a href="restxq.html">RestXQ</a></dt>
<dd>Summary of RESTXQ usage</dd>
<dt> <a href="imports.html">Imports</a></dt>
<dd>Summary of all imports</dd>
</dl>
<div>src: { $params?src-folder }</div>
<div id="ns">
<h1>Module Uris</h1>
<table>
<thead>
<tr>
<th>Uri</th>
<th>parsed</th>
</tr>
</thead>
<tbody>
{ for $file at $pos in $state?files
let $ns:=$file?xqdoc/xqdoc:module/xqdoc:uri/string()
order by $ns
return <tr>
<td>
<a href="{ $file?href }index.html" title="{ $file?path }">
{$ns}
</a>
</td>
<td>
{ $file?xqparse/name() }
</td>
</tr>
}
</tbody>
</table>
</div>
<div id="file">
<h1>Files</h1>
<ul>
{ for $file at $pos in $state?files
return <li>
<a href="{ $file?href }index.html">
{ $file?path }
</a>
{ $pos }
</li>
}
</ul>
</div>
</div>
return document{ xqhtml:page($d, $params ) }
};
(:~ transform files to html using c:files
: @param $params keys: resources
: "ext-id": "299",
: "src-folder": "C:/Users/andy/git/vue-poc/src/vue-poc",
: "project": "vue-poc",
: "resources"
:)
declare function xqhtml:index-html($files, declare function xqhtml:index-html($files,
$params as map(*) $params as map(*)
) )
@ -62,10 +138,13 @@ let $d:=<div>
</ul> </ul>
</div> </div>
</div> </div>
let $params:= map:merge(($params,map:entry("resources","resources/")))
return document{ xqhtml:page($d, $params ) } return document{ xqhtml:page($d, $params ) }
}; };
(:~
: build toc
: params: map{"project":..}
:)
declare function xqhtml:toc($params) declare function xqhtml:toc($params)
as element() as element()
{ {
@ -86,7 +165,7 @@ as element()
<li> <li>
<a href="#ns"> <a href="#ns">
<span class="secno">2 </span> <span class="secno">2 </span>
<span class="content">Namespaces</span> <span class="content">Module uris</span>
</a> </a>
</li> </li>
<li> <li>
@ -99,8 +178,141 @@ as element()
</nav> </nav>
}; };
(:~ tree to list :)
declare function xqhtml:tree-list($tree as element(*),$seq as xs:integer*){
typeswitch ($tree )
case element(directory)
return <li>
<span class="secno">{string-join($seq,'.')}</span>
<span class="content">{$tree/@name/string()}/</span>
<ol class="toc">{$tree/*!xqhtml:tree-list(.,($seq,position()))}</ol>
</li>
case element(file)
return <li>{if($tree/@target) then
<a href="#{$tree/@target}">
<span class="secno">{string-join($seq,'.')}</span>
<span class="content" title="{$tree/@target}">{ $tree/@name/string() }</span>
<div class="tag tag-success"
title="RESTXQ: {$tree/@target}">GET
</div>
<div class="tag tag-danger" style="float:right"
title="RESTXQ: {$tree/@target}">X
</div>
</a>
else
<span class="content">{$tree/@name/string()}</span>
}</li>
default
return <li>unknown</li>
};
(:~
: html for page.
:)
declare function xqhtml:restxq($state,$annots,$opts)
{
let $tree:=trace($annots?uri)
let $tree:=tree:build($tree)=>trace("TRRES")
let $body:= <div>
<nav id="toc">
<h2>
<a href="index.html" class="tag tag-success">
{ $state?project }
</a>
/ RestXQ
</h2>
<h3>
Contents
</h3>
<ol class="toc">
<li>
<a href="#main">
<span class="secno">1 </span>
<span class="content">Introduction</span>
</a>
</li>
<li href="#main">
<a >
<span class="secno">2 </span>
<span class="content">Paths.</span>
</a>
</li>
<li>
<ol class="toc"> { $tree/*/*!xqhtml:tree-list(.,2) } </ol>
</li>
</ol>
</nav>
<a href="index.html">index: </a>
<ul>{$annots!xqhtml:path-to-html(.)}</ul>
</div>
return xqhtml:page($body,$opts)
};
declare function xqhtml:imports($state,$imports,$opts)
{
let $body:=<div>
<nav id="toc">
<h2>
<a href="index.html" class="tag tag-success">
{ $state?project }
</a>
/ Imports
</h2>
<h3>
Contents
</h3>
<ol class="toc">
<li>
<a href="#main">
<span class="secno">1 </span>
<span class="content">Introduction</span>
</a>
</li>
</ol>
</nav>
<a href="index.html">index</a>
<p>Lists all modules imported.</p>
{for $import in $imports
order by $import?uri
return <div id="{ $import?uri }">
<h4>{ $import?uri }
<div style="float:right"><a href="#{ $import?uri }">#</a></div>
</h4>
<ul>
{for $f in $import?where
return <li><a href="{$f}index.html">mod</a></li>
}
</ul>
</div>
}
</div>
return xqhtml:page($body,$opts)
};
(:~ html for a path :)
declare function xqhtml:path-to-html($rep as map(*))
as element(li){
<li id="{ $rep?uri }">
<h4>{ $rep?uri }</h4>
<ul>{
let $methods as map(*) :=$rep?methods
for $method in map:keys($methods)
let $d:=$methods?($method)
let $id:=head($d?function)
return <li>
<a href="{$d?uri}index.html#{$id }">{ $method }</a>
<div>{$d?description}</div>
</li>
}</ul>
</li>
};
(:~ (:~
: generate standard page wrapper : generate standard page wrapper
: uses $opts?resources
:) :)
declare function xqhtml:page($body,$opts as map(*)) declare function xqhtml:page($body,$opts as map(*))
as element(html) as element(html)

View file

@ -74,37 +74,41 @@ declare function xqd:gendoc(
) )
}; };
(:~ (:~
: create documentation folder map : create documentation folder map
: map{"base-uri":.., "files":map(*)*} : map{"base-uri":.., "files":map(*)*}
:) :)
declare function xqd:read($efolder as xs:string) declare function xqd:read($efolder as xs:string)
as map(*)
{ {
let $files:= file:list($efolder,true(),"*.xqm") let $files:= file:list($efolder,true(),"*.xqm")
let $full:= $files!concat($efolder || "\",.) let $full:= $files!concat($efolder || "\",.)
return map{ return map{
"base-uri": $efolder, "base-uri": $efolder,
"files": for $file in $files "project": tokenize($efolder,"[/\\]")[last()],
"files": for $file at $pos in $files
let $full:=concat($efolder || "\", $file) let $full:=concat($efolder || "\", $file)
let $spath:=translate($file,"\","/")
return map{ return map{
"full":$full, "path":$file,
"xqdoc": xqd:xqdoc($full,map{"_source": $full}), "href": ``[modules/F`{ $pos }`/]``,
"xqparse": xqd:parse($full) "xqdoc": xqd:xqdoc($full,map{"_source": $spath}),
"xqparse": fetch:text($full)=>xqd:parse()
} }
} }
}; };
(: return sequence of maps are imported ns values are where imported:)
declare function xqd:imports($doc) declare function xqd:imports($doc)
as map(*)*
{ {
let $keys:=$doc?files?xqdoc!map:entry(generate-id(.),position())=>map:merge() for $f in $doc?files
let $ns:=for $in in $doc?files?xqdoc//xqdoc:import[@type="library"] for $in in $f?xqdoc//xqdoc:import[@type="library"]
group by $ns:=$in/xqdoc:uri group by $ns:=$in/xqdoc:uri
let $id:=$keys?($in/root()/generate-id()) return map{ "uri": $ns, "where": $f?href}
return map:entry($ns,$id)
return map:merge(($doc,map{"keys": $keys,
"imports": $ns}))
}; };
(:~ (:~
@ -164,7 +168,7 @@ declare function xqd:store2($data,$url as xs:string,$params as map(*))
declare function xqd:parse($xq as xs:string) declare function xqd:parse($xq as xs:string)
as element(*) as element(*)
{ {
xp:parse($xq || "",map{"lang":"xquery","version":"3.1 basex-20161204"}) xp:parse($xq || "",map{"lang":"xquery","version":"3.1 basex"})
}; };
(:~ (:~
@ -212,6 +216,46 @@ function xqd:export-resources2($target as xs:string)
as empty-sequence(){ as empty-sequence(){
archive:extract-to($target, file:read-binary(resolve-uri('resources.zip'))) archive:extract-to($target, file:read-binary(resolve-uri('resources.zip')))
}; };
(:~ return sequence of maps with maps uri and methods :)
declare function xqd:rxq-paths($state)
as map(*)*
{
let $reports:= xqd:annots-rxq($state)
(: map keyed on uris :)
let $data:=map:merge(for $report in $reports
group by $uri:=$report?annot/xqdoc:literal/string()
let $methods:= map:merge(
for $annot in $report
let $hits:=for $method in $xqd:methods
let $hit:= xqd:methods($annot?annot/.., $xqd:nsRESTXQ, $method)
where $hit
return map{$method: $annot}
return if(exists($hits))then $hits else map{"ALL":$annot}
)
return map:entry($uri,map{ "uri": $uri, "methods": $methods})
)
let $uris:=sort(map:keys($data))
return $data?($uris)
};
(:~
: map for each restxq:path annotation
:)
declare function xqd:annots-rxq($state as map(*))
as map(*)*
{
for $f at $index in $state?files
for $annot in xqd:annotations($f?xqdoc, $xqd:nsRESTXQ,"path")
return map{
"id": $index,
"uri": $f?href,
"path": $f?path,
"annot": $annot,
"function": $annot/../../(xqdoc:name/string(),@arity/string()),
"description": $annot/../../xqdoc:comment/xqdoc:description/node()
}
};
(:~ (:~
: return all matching annotations in xqdoc : return all matching annotations in xqdoc
:) :)
@ -242,7 +286,8 @@ as element(xqdoc:annotation)*
(: @return map of functions and variables having annotations :) (: @return map of functions and variables having annotations :)
declare function xqd:annotation-map($xqdoc){ declare function xqd:annotation-map($xqdoc)
{
let $ns:=map:merge(( let $ns:=map:merge((
map:entry("", "http://www.w3.org/2012/xquery"), map:entry("", "http://www.w3.org/2012/xquery"),
$xqdoc//xqdoc:namespace!map:entry(string(@prefix),string(@uri)) $xqdoc//xqdoc:namespace!map:entry(string(@prefix),string(@uri))

View file

@ -1,4 +1,4 @@
// generated 2019-03-16T22:59:26.228Z // generated 2019-04-04T23:01:43.478+01:00
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
Vue.component('qd-autoheight',{template:` Vue.component('qd-autoheight',{template:`
@ -1395,7 +1395,7 @@ Vue.use(Fullscreen);
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/mimetypes.js // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/mimetypes.js
// Mimetype info // Mimetype info as vue extension. defines $MimeTypes
// //
// //
const MimeTypes=new function(){ const MimeTypes=new function(){
@ -4541,6 +4541,9 @@ const Documentation=Vue.extend({template:`
<v-toolbar dense> <v-toolbar dense>
<v-toolbar-title>documentation</v-toolbar-title> <v-toolbar-title>documentation</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn icon :loading="loading" @click="get()" :disabled="loading">
<v-icon>refresh</v-icon>
</v-btn>
<a href="/vue-poc/api/xqdocjob" target="doc">json</a> <a href="/vue-poc/api/xqdocjob" target="doc">json</a>
</v-toolbar> </v-toolbar>
@ -4548,8 +4551,11 @@ const Documentation=Vue.extend({template:`
<v-layout row wrap> <v-layout row wrap>
<v-flex height="80px" xs2 v-for="item in items" :key="item.id"> <v-flex height="80px" xs2 v-for="item in items" :key="item.id">
<v-card :hover="true"> <v-card :hover="true">
<v-card-title>{{ item.id }}</v-card-title> <v-card-title color="#26c6da">{{ item.id }}</v-card-title>
<v-card-text>{{ item.name }}</v-card-text> <v-card-text>{{ item.name }}</v-card-text>
<v-card-actions>
<a :href="item.href" target="_new">go</a>
</v-card-actions>
</v-card> </v-card>
</v-flex> </v-flex>
</v-layout> </v-layout>
@ -4561,7 +4567,8 @@ const Documentation=Vue.extend({template:`
data: function(){ data: function(){
return { return {
message: 'Hello Vue.js!', message: 'Hello Vue.js!',
items:[] items:[],
loading: false
} }
}, },
methods:{ methods:{
@ -4569,7 +4576,6 @@ const Documentation=Vue.extend({template:`
HTTP.get('xqdocjob') HTTP.get('xqdocjob')
.then((res) => { .then((res) => {
this.items = res.data; this.items = res.data;
console.log("items",this.items)
}); });
}, },
doEdit(item){ doEdit(item){
@ -5538,13 +5544,14 @@ const Dicetest=Vue.extend({template:`
<v-card-text> <v-card-text>
<p>Read json data for 1st page for entity.</p> <p>Read json data for 1st page for entity.</p>
<v-flex xs12 sm6> <v-flex xs12 sm6>
<v-combobox v-model="url" :items="urls" label="Select target"></v-combobox> <v-combobox v-model="url" :items="entities" item-text="name" label="Select target" clearable open-on-clear></v-combobox>
</v-flex> </v-flex>
<table class="v-table"> <table class="v-table">
<thead> <thead>
<tr> <tr>
<th xs1>url</th>
<th xs1>Action</th> <th xs1>Action</th>
<th xs1>Repeat</th> <th xs1>Repeat</th>
<th xs1>Last</th> <th xs1>Last</th>
@ -5560,10 +5567,12 @@ const Dicetest=Vue.extend({template:`
<tr> <tr>
<td> <td>
<v-btn @click="get()"> {{ url &amp;&amp; url.name }}
</td>
<td>
<v-btn @click="get()" :disabled="!url">
Read <v-icon right>compare_arrows</v-icon> Read <v-icon right>compare_arrows</v-icon>
</v-btn> </v-btn>
</td> </td>
<td> <td>
<v-switch v-on:change="gchange" v-model="repeat.get"></v-switch> <v-switch v-on:change="gchange" v-model="repeat.get"></v-switch>
@ -5606,17 +5615,18 @@ const Dicetest=Vue.extend({template:`
return { return {
getValues: new perfStat(), getValues: new perfStat(),
repeat: {get:false}, repeat: {get:false},
url: "data/entity", url: null,
urls: ["data/entity","data/taskhistory"],
counter: 0, counter: 0,
result: null result: null,
entities: null
} }
}, },
methods:{ methods:{
get(){ get(){
var _start = performance.now(); var _start = performance.now();
HTTP.get(this.url,axios_json) console.log("FFFFF"," "+ this.url.parentlink)
HTTP.get(this.url.parentlink,axios_json)
.then(r=>{ .then(r=>{
var elapsed=Math.floor(performance.now() - _start); var elapsed=Math.floor(performance.now() - _start);
this.counter++; this.counter++;
@ -5635,8 +5645,19 @@ const Dicetest=Vue.extend({template:`
reset(){ reset(){
Object.assign(this.getValues,this.getValues.clear()); Object.assign(this.getValues,this.getValues.clear());
this.$forceUpdate() this.$forceUpdate()
},
getentities(){
HTTP.get("data/entity",axios_json)
.then(r=>{
console.log("entities: ",r.data);
this.entities=r.data.items
})
} }
}, },
created(){
console.log("GET entities: ");
this.getentities()
},
beforeRouteLeave(to, from, next){ beforeRouteLeave(to, from, next){
var on=this.repeat.get var on=this.repeat.get
@ -6303,7 +6324,7 @@ const Runtask=Vue.extend({template:`
<v-card-text> <v-card-text>
<v-container fluid> <v-container fluid>
<v-layout row wrap> <v-layout row wrap>
<v-flex xs12> <v-flex xs12 v-if="!loading">
<vp-paramform ref="params" :endpoint="'tasks/'+task"></vp-paramform> <vp-paramform ref="params" :endpoint="'tasks/'+task"></vp-paramform>
</v-flex> </v-flex>
</v-layout> </v-layout>

View file

@ -10,7 +10,7 @@
<link rel="shortcut icon" href="/vue-poc/ui/icon.png"/> <link rel="shortcut icon" href="/vue-poc/ui/icon.png"/>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic"/> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic"/>
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons"/> <link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons"/>
<link rel="stylesheet" href="//unpkg.com/vuetify@1.5.7/dist/vuetify.min.css" type="text/css"/> <link rel="stylesheet" href="//unpkg.com/vuetify@1.5.9/dist/vuetify.min.css" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/@riophae/vue-treeselect@0.0.29/dist/vue-treeselect.min.css"/> <link rel="stylesheet" href="//unpkg.com/@riophae/vue-treeselect@0.0.29/dist/vue-treeselect.min.css"/>
<link rel="stylesheet" href="/vue-poc/ui/prism/prism.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="/vue-poc/ui/prism/prism.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/leaflet@1.0.3/dist/leaflet.css"/> <link rel="stylesheet" href="//unpkg.com/leaflet@1.0.3/dist/leaflet.css"/>
@ -22,7 +22,7 @@
<body> <body>
<div id="app"> <div id="app">
<h3><code>vue-poc</code> <small>(v0.3.160)</small> </h3> <h3><code>vue-poc</code> <small>(v0.3.161)</small> </h3>
<div class="spinner"> <div class="spinner">
<div class="rect1"></div> <div class="rect1"></div>
@ -39,7 +39,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js" crossorigin="anonymous"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js" crossorigin="anonymous"></script>
<script src="//unpkg.com/vuex@3.1.0/dist/vuex.js" crossorigin="anonymous"></script> <script src="//unpkg.com/vuex@3.1.0/dist/vuex.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js" crossorigin="anonymous" ></script> <script src="//cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js" crossorigin="anonymous" ></script>
<script src="//unpkg.com/vuetify@1.5.7/dist/vuetify.min.js" crossorigin="anonymous"></script> <script src="//unpkg.com/vuetify@1.5.9/dist/vuetify.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ace.js" crossorigin="anonymous"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ace.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ext-language_tools.js" crossorigin="anonymous"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ext-language_tools.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ext-linking.js" crossorigin="anonymous" charset="utf-8"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ext-linking.js" crossorigin="anonymous" charset="utf-8"></script>