update for basex 8.0

This commit is contained in:
Andy Bunce 2015-03-07 22:48:51 +00:00
parent 47ae7ff0b7
commit dd3c397ba6
23 changed files with 1181 additions and 1163 deletions

View file

@ -5,6 +5,11 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>de.loskutov.FileSync.FSBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
</natures> </natures>

View file

@ -1,4 +1,4 @@
# graphxq - interface to graphviz for BaseX 7.5 # graphxq - interface to graphviz for BaseX 8.0
* includes dotML * includes dotML
* BaseX RestXQ interface * BaseX RestXQ interface

View file

@ -1,181 +1,181 @@
<!-- <!--
graphviz options for shape,color graphviz options for shape,color
--> -->
<graphviz> <graphviz>
<shapes> <shapes>
<shape>box</shape> <shape>box</shape>
<shape>polygon</shape> <shape>polygon</shape>
<shape>ellipse</shape> <shape>ellipse</shape>
<shape>circle</shape> <shape>circle</shape>
<shape>point</shape> <shape>point</shape>
<shape>egg</shape> <shape>egg</shape>
<shape>triangle</shape> <shape>triangle</shape>
<shape>plaintext</shape> <shape>plaintext</shape>
<shape>diamond</shape> <shape>diamond</shape>
<shape>trapezium</shape> <shape>trapezium</shape>
<shape>parallelogram</shape> <shape>parallelogram</shape>
<shape>house</shape> <shape>house</shape>
<shape>hexagon</shape> <shape>hexagon</shape>
<shape>octagon</shape> <shape>octagon</shape>
<shape>doublecircle</shape> <shape>doublecircle</shape>
<shape>doubleoctagon</shape> <shape>doubleoctagon</shape>
<shape>tripleoctagon</shape> <shape>tripleoctagon</shape>
<shape>invtriangle</shape> <shape>invtriangle</shape>
<shape>invtrapezium</shape> <shape>invtrapezium</shape>
<shape>invhouse</shape> <shape>invhouse</shape>
<shape>Mdiamond</shape> <shape>Mdiamond</shape>
<shape>Msquare</shape> <shape>Msquare</shape>
<shape>Mcircle</shape> <shape>Mcircle</shape>
<shape>record</shape> <shape>record</shape>
<shape>Mrecord</shape> <shape>Mrecord</shape>
</shapes> </shapes>
<colors> <colors>
<color>aliceblue</color> <color>aliceblue</color>
<color>antiquewhite</color> <color>antiquewhite</color>
<color>aqua</color> <color>aqua</color>
<color>aquamarine</color> <color>aquamarine</color>
<color>azure</color> <color>azure</color>
<color>beige</color> <color>beige</color>
<color>bisque</color> <color>bisque</color>
<color>black</color> <color>black</color>
<color>blanchedalmond</color> <color>blanchedalmond</color>
<color>blue</color> <color>blue</color>
<color>blueviolet</color> <color>blueviolet</color>
<color>brown</color> <color>brown</color>
<color>burlywood</color> <color>burlywood</color>
<color>cadetblue</color> <color>cadetblue</color>
<color>chartreuse</color> <color>chartreuse</color>
<color>chocolate</color> <color>chocolate</color>
<color>coral</color> <color>coral</color>
<color>cornflowerblue</color> <color>cornflowerblue</color>
<color>cornsilk</color> <color>cornsilk</color>
<color>crimson</color> <color>crimson</color>
<color>cyan</color> <color>cyan</color>
<color>darkblue</color> <color>darkblue</color>
<color>darkcyan</color> <color>darkcyan</color>
<color>darkgoldenrod</color> <color>darkgoldenrod</color>
<color>darkgray</color> <color>darkgray</color>
<color>darkgreen</color> <color>darkgreen</color>
<color>darkgrey</color> <color>darkgrey</color>
<color>darkkhaki</color> <color>darkkhaki</color>
<color>darkmagenta</color> <color>darkmagenta</color>
<color>darkolivegreen</color> <color>darkolivegreen</color>
<color>darkorange</color> <color>darkorange</color>
<color>darkorchid</color> <color>darkorchid</color>
<color>darkred</color> <color>darkred</color>
<color>darksalmon</color> <color>darksalmon</color>
<color>darkseagreen</color> <color>darkseagreen</color>
<color>darkslateblue</color> <color>darkslateblue</color>
<color>darkslategray</color> <color>darkslategray</color>
<color>darkslategrey</color> <color>darkslategrey</color>
<color>darkturquoise</color> <color>darkturquoise</color>
<color>darkviolet</color> <color>darkviolet</color>
<color>deeppink</color> <color>deeppink</color>
<color>deepskyblue</color> <color>deepskyblue</color>
<color>dimgray</color> <color>dimgray</color>
<color>dimgrey</color> <color>dimgrey</color>
<color>dodgerblue</color> <color>dodgerblue</color>
<color>firebrick</color> <color>firebrick</color>
<color>floralwhite</color> <color>floralwhite</color>
<color>forestgreen</color> <color>forestgreen</color>
<color>fuchsia</color> <color>fuchsia</color>
<color>gainsboro</color> <color>gainsboro</color>
<color>ghostwhite</color> <color>ghostwhite</color>
<color>gold</color> <color>gold</color>
<color>goldenrod</color> <color>goldenrod</color>
<color>gray</color> <color>gray</color>
<color>grey</color> <color>grey</color>
<color>green</color> <color>green</color>
<color>greenyellow</color> <color>greenyellow</color>
<color>honeydew</color> <color>honeydew</color>
<color>hotpink</color> <color>hotpink</color>
<color>indianred</color> <color>indianred</color>
<color>indigo</color> <color>indigo</color>
<color>ivory</color> <color>ivory</color>
<color>khaki</color> <color>khaki</color>
<color>lavender</color> <color>lavender</color>
<color>lavenderblush</color> <color>lavenderblush</color>
<color>lawngreen</color> <color>lawngreen</color>
<color>lemonchiffon</color> <color>lemonchiffon</color>
<color>lightblue</color> <color>lightblue</color>
<color>lightcoral</color> <color>lightcoral</color>
<color>lightcyan</color> <color>lightcyan</color>
<color>lightgoldenrodyellow</color> <color>lightgoldenrodyellow</color>
<color>lightgray</color> <color>lightgray</color>
<color>lightgreen</color> <color>lightgreen</color>
<color>lightgrey</color> <color>lightgrey</color>
<color>lightpink</color> <color>lightpink</color>
<color>lightsalmon</color> <color>lightsalmon</color>
<color>lightseagreen</color> <color>lightseagreen</color>
<color>lightskyblue</color> <color>lightskyblue</color>
<color>lightslategray</color> <color>lightslategray</color>
<color>lightslategrey</color> <color>lightslategrey</color>
<color>lightsteelblue</color> <color>lightsteelblue</color>
<color>lightyellow</color> <color>lightyellow</color>
<color>lime</color> <color>lime</color>
<color>limegreen</color> <color>limegreen</color>
<color>linen</color> <color>linen</color>
<color>magenta</color> <color>magenta</color>
<color>maroon</color> <color>maroon</color>
<color>mediumaquamarine</color> <color>mediumaquamarine</color>
<color>mediumblue</color> <color>mediumblue</color>
<color>mediumorchid</color> <color>mediumorchid</color>
<color>mediumpurple</color> <color>mediumpurple</color>
<color>mediumseagreen</color> <color>mediumseagreen</color>
<color>mediumslateblue</color> <color>mediumslateblue</color>
<color>mediumspringgreen</color> <color>mediumspringgreen</color>
<color>mediumturquoise</color> <color>mediumturquoise</color>
<color>mediumvioletred</color> <color>mediumvioletred</color>
<color>midnightblue</color> <color>midnightblue</color>
<color>mintcream</color> <color>mintcream</color>
<color>mistyrose</color> <color>mistyrose</color>
<color>moccasin</color> <color>moccasin</color>
<color>navajowhite</color> <color>navajowhite</color>
<color>navy</color> <color>navy</color>
<color>oldlace</color> <color>oldlace</color>
<color>olive</color> <color>olive</color>
<color>olivedrab</color> <color>olivedrab</color>
<color>orange</color> <color>orange</color>
<color>orangered</color> <color>orangered</color>
<color>orchid</color> <color>orchid</color>
<color>palegoldenrod</color> <color>palegoldenrod</color>
<color>palegreen</color> <color>palegreen</color>
<color>paleturquoise</color> <color>paleturquoise</color>
<color>palevioletred</color> <color>palevioletred</color>
<color>papayawhip</color> <color>papayawhip</color>
<color>peachpuff</color> <color>peachpuff</color>
<color>peru</color> <color>peru</color>
<color>pink</color> <color>pink</color>
<color>plum</color> <color>plum</color>
<color>powderblue</color> <color>powderblue</color>
<color>purple</color> <color>purple</color>
<color>red</color> <color>red</color>
<color>rosybrown</color> <color>rosybrown</color>
<color>royalblue</color> <color>royalblue</color>
<color>saddlebrown</color> <color>saddlebrown</color>
<color>salmon</color> <color>salmon</color>
<color>sandybrown</color> <color>sandybrown</color>
<color>seagreen</color> <color>seagreen</color>
<color>seashell</color> <color>seashell</color>
<color>sienna</color> <color>sienna</color>
<color>silver</color> <color>silver</color>
<color>skyblue</color> <color>skyblue</color>
<color>slateblue</color> <color>slateblue</color>
<color>slategray</color> <color>slategray</color>
<color>slategrey</color> <color>slategrey</color>
<color>snow</color> <color>snow</color>
<color>springgreen</color> <color>springgreen</color>
<color>steelblue</color> <color>steelblue</color>
<color>tan</color> <color>tan</color>
<color>teal</color> <color>teal</color>
<color>thistle</color> <color>thistle</color>
<color>tomato</color> <color>tomato</color>
<color>turquoise</color> <color>turquoise</color>
<color>violet</color> <color>violet</color>
<color>wheat</color> <color>wheat</color>
<color>white</color> <color>white</color>
<color>whitesmoke</color> <color>whitesmoke</color>
<color>yellow</color> <color>yellow</color>
<color>yellowgreen</color> <color>yellowgreen</color>
</colors> </colors>
</graphviz> </graphviz>

View file

@ -52,7 +52,7 @@ declare %private function dot-execute( $dot as xs:string, $params as xs:string*)
}; };
(:~ run dot command returning binary :) (:~ run dot command returning binary :)
declare %private function dot-executeb( $dot as xs:string, $params as xs:string*) as xs:base64Binary{ declare function dot-executeb( $dot as xs:string, $params as xs:string*) as xs:base64Binary{
let $fname:=$gr:tmpdir || random:uuid() let $fname:=$gr:tmpdir || random:uuid()
let $oname:=$fname || ".o" let $oname:=$fname || ".o"
let $junk:=file:write-text($fname,$dot) let $junk:=file:write-text($fname,$dot)

View file

@ -1,207 +1,207 @@
(:~ (:~
: RESTXQ interface for graphviz : RESTXQ interface for graphviz
: @author andy bunce : @author andy bunce
: @since sept 2012 : @since sept 2012
:) :)
module namespace grxq = 'apb.graphviz.web'; module namespace grxq = 'apb.graphviz.web';
declare default function namespace 'apb.graphviz.web'; declare default function namespace 'apb.graphviz.web';
import module namespace gr = 'apb.graphviz' at "graphviz.xqm"; import module namespace gr = 'apb.graphviz' at "graphviz.xqm";
import module namespace dotml = 'http://www.martin-loetzsch.de/DOTML' at "dotml.xqm"; import module namespace dotml = 'http://www.martin-loetzsch.de/DOTML' at "dotml.xqm";
import module namespace dotui = 'apb.graphxq.dotui' at "dotui.xqm"; import module namespace dotui = 'apb.graphxq.dotui' at "dotui.xqm";
import module namespace txq = 'apb.txq' at "lib/txq.xqm"; import module namespace txq = 'quodatum.txq' at "lib/txq.xqm";
import module namespace request = "http://exquery.org/ns/request"; import module namespace request = "http://exquery.org/ns/request";
declare namespace svg= "http://www.w3.org/2000/svg"; declare namespace svg= "http://www.w3.org/2000/svg";
declare namespace restxq = 'http://exquery.org/ns/restxq'; declare namespace restxq = 'http://exquery.org/ns/restxq';
(:~ shared page wrapper :) (:~ shared page wrapper :)
declare variable $grxq:layout:=fn:resolve-uri("views/layout.xml"); declare variable $grxq:layout:=fn:resolve-uri("views/layout.xq");
(:~ (:~
: Home page for app : Home page for app
:) :)
declare declare
%restxq:GET %restxq:path("graphxq") %restxq:GET %restxq:path("graphxq")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
function home(){ function home(){
<restxq:redirect>/restxq/graphxq/about</restxq:redirect> <restxq:redirect>/graphxq/about</restxq:redirect>
}; };
(:~ (:~
: about page for app : about page for app
:) :)
declare declare
%restxq:GET %restxq:path("graphxq/about") %restxq:GET %restxq:path("graphxq/about")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
function about(){ function about(){
render("views/about.xml",map{"title":="GraphXQ"}) render("views/about.xml",map{"title":"GraphXQ"})
}; };
(:~ (:~
: GET or POST return svg for dot, with download option : GET or POST return svg for dot, with download option
:) :)
declare declare
%restxq:path("graphxq/api/dot") %restxq:path("graphxq/api/dot")
%restxq:form-param("data","{$dot}") %restxq:form-param("data","{$dot}")
%restxq:form-param("url","{$url}") %restxq:form-param("url","{$url}")
%restxq:form-param("dl","{$dl}") %restxq:form-param("dl","{$dl}")
%restxq:form-param("dotopt","{$dotopt}") %restxq:form-param("dotopt","{$dotopt}")
%output:media-type("image/svg+xml") %output:media-type("image/svg+xml")
function graphxq-svg($dot,$url,$dl,$dotopt) { function graphxq-svg($dot,$url,$dl,$dotopt) {
let $dot2:=getdot($dot,$url) let $dot2:=getdot($dot,$url)
let $svg:=dot2svg($dot2) let $svg:=dot2svg($dot2)
let $fname:=if($dl)then "dot.svg" else () let $fname:=if($dl)then "dot.svg" else ()
return (headers($fname),$svg) return (headers($fname),$svg)
}; };
(:~ (:~
: display dot edit form : display dot edit form
: @param src load from url : @param src load from url
:) :)
declare declare
%restxq:GET %restxq:path("graphxq/dot") %restxq:GET %restxq:path("graphxq/dot")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
%restxq:form-param("src","{$src}") %restxq:form-param("src","{$src}")
function dotform($src){ function dotform($src){
let $dot:= getdot("digraph {a -> b}",$src) let $dot:= getdot("digraph {a -> b}",$src)
let $svgwidget:=fn:doc("views/widget.svg") let $svgwidget:=fn:doc("views/widget.svg")
let $toolbar:=fn:doc("views/toolbar.xml") let $toolbar:=fn:doc("views/toolbar.xml")
let $map:=map{"list-shapes":=dotui:shapes(""), let $map:=map{"list-shapes": dotui:shapes(""),
"list-colors":=dotui:colors(""), "list-colors": dotui:colors(""),
"svgwidget":=$svgwidget, "svgwidget": $svgwidget,
"toolbar":=$toolbar, "toolbar": $toolbar,
"title":="DOT editor", "title": "DOT editor",
"dot":=$dot} "dot": $dot}
return render("views/dotform.xml",$map) return render("views/dotform.xq",$map)
}; };
declare declare
%restxq:GET %restxq:path("graphxq/dotml") %restxq:GET %restxq:path("graphxq/dotml")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
%restxq:form-param("src","{$src}") %restxq:form-param("src","{$src}")
function dotmlform($src){ function dotmlform($src){
let $svgwidget:=fn:doc("views/widget.svg") let $svgwidget:=fn:doc("views/widget.svg")
let $toolbar:=fn:doc("views/toolbar.xml") let $toolbar:=fn:doc("views/toolbar.xml")
let $default:=<graph xmlns="http://www.martin-loetzsch.de/DOTML"><node id="test"/></graph> let $default:=<graph xmlns="http://www.martin-loetzsch.de/DOTML"><node id="test"/></graph>
let $dotml:= getdotml($default ,$src) let $dotml:= getdotml($default ,$src)
let $dotml:= fn:serialize($dotml) let $dotml:= fn:serialize($dotml)
let $v:=map{ "svgwidget":=$svgwidget, let $v:=map{ "svgwidget": $svgwidget,
"toolbar":=$toolbar, "toolbar": $toolbar,
"title":="DOTML editor", "title": "DOTML editor",
"bodyclass":="h100", "bodyclass": "h100",
"dotml":=$dotml} "dotml": $dotml}
return render("views/dotmlform.xml",$v) return render("views/dotmlform.xq",$v)
}; };
(:~ static api page :) (:~ static api page :)
declare declare
%restxq:GET %restxq:path("graphxq/api") %restxq:GET %restxq:path("graphxq/api")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
function api(){ function api(){
render("views/api.xml",map{"title":="API information"}) render("views/api.xml",map{"title": "API information"})
}; };
(:~ static ace page :) (:~ static ace page :)
declare declare
%restxq:GET %restxq:path("graphxq/ace") %restxq:GET %restxq:path("graphxq/ace")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
function ace(){ function ace(){
let $svgwidget:=fn:doc("views/widget.svg") let $svgwidget:=fn:doc("views/widget.svg")
let $toolbar:=fn:doc("views/toolbar.xml") let $toolbar:=fn:doc("views/toolbar.xml")
let $v:=map{ let $v:=map{
"title":="XQuery editor (for no reason) ", "title": "XQuery editor (for no reason) ",
"bodyclass":="h100" "bodyclass": "h100"
} }
return render("views/ace.xml",$v) return render("views/ace.xml",$v)
}; };
declare declare
%restxq:GET %restxq:path("graphxq/library") %restxq:GET %restxq:path("graphxq/library")
%output:method("html") %output:version("5.0") %output:method("html") %output:version("5.0")
function library(){ function library(){
let $lib:=fn:doc("data/library.xml") let $lib:=fn:doc("data/library.xml")
let $map:=map{"title":="Samples", let $map:=map{"title": "Samples",
"items":=$lib//items, "items": $lib//items,
"url":=function($item){fn:concat($item/url/@type,'?src=data/samples/',$item/url)} "url": function($item){fn:concat($item/url/@type,'?src=data/samples/',$item/url)}
} }
return render("views/library.xml",$map) return render("views/library.xml",$map)
}; };
(:~ (:~
: @return svg from dotml : @return svg from dotml
:) :)
declare declare
%restxq:POST %restxq:path("graphxq/api/dotml") %restxq:POST %restxq:path("graphxq/api/dotml")
%restxq:form-param("data","{$dotml}") %restxq:form-param("data","{$dotml}")
%restxq:form-param("dl","{$dl}") %restxq:form-param("dl","{$dl}")
function api-dotml($dotml,$dl ) { function api-dotml($dotml,$dl ) {
let $dotml:=fn:trace($dotml,"dot: ") let $dotml:=fn:trace($dotml,"dot: ")
let $dotml:=fn:parse-xml($dotml) let $dotml:=fn:parse-xml($dotml)
let $x:=dotml:generate($dotml) let $x:=dotml:generate($dotml)
let $svg:=dot2svg($x) let $svg:=dot2svg($x)
let $fname:=if($dl)then "dotml.svg" else () let $fname:=if($dl)then "dotml.svg" else ()
return (headers($fname),$svg) return (headers($fname),$svg)
}; };
(:~ if url is defined then treat as url and fetch else use dot :) (:~ if url is defined then treat as url and fetch else use dot :)
declare %private function getdot($dot as xs:string,$url) as xs:string{ declare %private function getdot($dot as xs:string,$url) as xs:string{
if($url) then if($url) then
try{fn:unparsed-text(fn:resolve-uri($url))} catch * { "digraph {{ failed to load remote }}" } try{fn:unparsed-text(fn:resolve-uri($url))} catch * { "digraph {{ failed to load remote }}" }
else else
$dot $dot
}; };
(:~ if url is defined then treat as url and fetch else use dotml :) (:~ if url is defined then treat as url and fetch else use dotml :)
declare %private function getdotml($dotml as node(),$url) as node(){ declare %private function getdotml($dotml as node(),$url) as node(){
if($url) then if($url) then
try{ try{
fn:doc(fn:resolve-uri($url)) fn:doc(fn:resolve-uri($url))
} catch * { } catch * {
<graph xmlns="http://www.martin-loetzsch.de/DOTML"> <graph xmlns="http://www.martin-loetzsch.de/DOTML">
<node id="fail"/> <node id="fail"/>
</graph> } </graph> }
else else
$dotml $dotml
}; };
(:~ CORS header with download option :) (:~ CORS header with download option :)
declare function headers($attachment){ declare function headers($attachment){
<restxq:response> <restxq:response>
<http:response> <http:response>
<http:header name="Access-Control-Allow-Origin" value="*"/> <http:header name="Access-Control-Allow-Origin" value="*"/>
{if($attachment) {if($attachment)
then <http:header name="Content-Disposition" value='attachment;filename="{$attachment}"'/> then <http:header name="Content-Disposition" value='attachment;filename="{$attachment}"'/>
else ()} else ()}
</http:response> </http:response>
</restxq:response> </restxq:response>
}; };
(:~ Generate svg from dot :) (:~ Generate svg from dot :)
declare %private function dot2svg($dot as xs:string) as node(){ declare %private function dot2svg($dot as xs:string) as node(){
let $svgx:=gr:dot($dot,()) let $svgx:=gr:dot($dot,())
return gr:autosize($svgx) return gr:autosize($svgx)
}; };
(:~ css class to highlight current page :) (:~ css class to highlight current page :)
declare function active-link($path as xs:string,$page as xs:string) as xs:string{ declare function active-link($path as xs:string,$page as xs:string) as xs:string{
if(fn:ends-with($path,$page)) then "active" else "" if(fn:ends-with($path,$page)) then "active" else ""
}; };
(:~ (:~
: Render html page : Render html page
: @param template path to page template : @param template path to page template
: @params locals map of page variables : @params locals map of page variables
:) :)
declare function render($template as xs:string,$locals){ declare function render($template as xs:string,$locals){
let $path:=request:path() let $path:=request:path()
let $default:=map{ "title":=request:path(), let $default:=map{ "title": request:path(),
"active-link":=active-link($path,?), (: *** FAILS IF request:path() :) "active-link": active-link($path,?), (: *** FAILS IF request:path() :)
"bodyclass":=""} "bodyclass": ""}
let $locals:=map:new(($default,$locals)) let $locals:=map:merge(($default,$locals))
return txq:render(fn:resolve-uri($template),$locals,$grxq:layout) return txq:render(fn:resolve-uri($template),$locals,$grxq:layout)
}; };

View file

@ -1,45 +1,46 @@
(:~ xquery version "3.0";
: A(nother) templating Engine for XQuery (BaseX 7.5 specific) (:~
: specials: : A(nother) templating Engine for XQuery (BaseX specific)
: partial(file,name,sequence) : specials:
: : partial(file,name,sequence)
: @author andy bunce :
: @since sept 2012 : @author andy bunce
:) : @since sept 2012
: @licence apache 2
module namespace txq = 'apb.txq'; :)
declare default function namespace 'apb.txq';
import module namespace xquery = "http://basex.org/modules/xquery"; module namespace txq = 'quodatum.txq';
declare default function namespace 'quodatum.txq';
(:~ import module namespace xquery = "http://basex.org/modules/xquery";
: template function
: @param template url to fill (:~
: @param map name and value to apply : template function
: @return updated doc from map : @param template url to fill
:) : @param map name and value to apply
declare function render($template as xs:string,$map as map(*)){ : @return updated doc from map
let $map:=map:new(($map,map{"partial":=partial(?,?,?,$map,$template)})) :)
return xquery:invoke($template,$map) declare function render($template as xs:string,$map as map(*)){
}; let $map:=map:merge(($map,map{"partial": partial(?,?,?,$map,$template)}))
return xquery:invoke($template,$map)
(:~ };
: template function with wrapping layout
: @param layout (:~
: @return updated doc from map : template function with wrapping layout
:) : @param $layout outer template with $body placeholder to insert $template
declare function render($template as xs:string,$map as map(*),$layout as xs:string){ : @return updated doc from map
let $content:=render($template,$map) :)
let $map:=map:new(($map,map{"body":=$content})) declare function render($template as xs:string,$map as map(*),$layout as xs:string){
return render($layout,$map) let $content:=render($template,$map)
}; let $map:=map:merge(($map,map{"body": $content}))
return render($layout,$map)
(:~ };
: partial template function: evaluate part for each value in sequence
: @return updated doc from map (:~
:) : partial template function: evaluate part for each value in sequence
declare function partial($part as xs:string,$name,$seq,$map,$base){ : @return updated doc from map
for $s in $seq :)
let $map:=map:new(($map,map{$name:=$s})) declare function partial($part as xs:string,$name,$seq,$map,$base){
return render(fn:resolve-uri($part,$base),$map) for $s in $seq
}; let $map:=map:merge(($map,map{$name: $s}))
return render(fn:resolve-uri($part,$base),$map)
};

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -55,7 +55,7 @@ for a better way?
<img style="position: absolute; top: 50px; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"/> <img style="position: absolute; top: 50px; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"/>
</a> </a>
<footer> <footer>
<p>&#169; Andy Bunce 2013</p> <p>&#169; Andy Bunce 2013 -2015</p>
<ul class="quick-links"> <ul class="quick-links">
<!-- <!--
<li><iframe class="github-btn" <li><iframe class="github-btn"

View file

@ -1,34 +1,37 @@
<div class="row-fluid"> declare variable $toolbar external :="{tooolbar}";
declare variable $dot external :="{dot}";
<div class="row-fluid" style="height:24px"> declare variable $svgwidget external :="{svg}";
{$toolbar} <div class="row-fluid">
</div>
<div class="row-fluid"> <div class="row-fluid" style="height:24px">
<div class="span6 " id="leftPane"> {$toolbar}
<div id="dsrc" class="extend ace-container" > </div>
<div id="acedata" class="ace " data-mode="dot" ></div> <div class="row-fluid">
</div> <div class="span6 " id="leftPane">
<form id="editForm" action="api/dot" method="post" target="_new" style="display:none" <div id="dsrc" class="extend ace-container" >
> <div id="acedata" class="ace " data-mode="dot" ></div>
<textarea id="data" name="data" rows="100" </div>
style="width:100%;overflow:scroll;height:98%">{$dot}</textarea> <form id="editForm" action="api/dot" method="post" target="_new" style="display:none"
<input name="dl" type="checkbox" style="display:none"/> >
<input name="dotopt" type="text" value="a" style="display:none"/> <textarea id="data" name="data" rows="100"
<input name="dotopt" type="text" value="bb" style="display:none"/> style="width:100%;overflow:scroll;height:98%">{$dot}</textarea>
</form> <input name="dl" type="checkbox" style="display:none"/>
<textarea id="cleartext" style="display: none">digraph title {{ bgcolor=seashell <input name="dotopt" type="text" value="a" style="display:none"/>
node[shape=circle,style=filled,fillcolor=lightblue] <input name="dotopt" type="text" value="bb" style="display:none"/>
</form>
}}</textarea> <textarea id="cleartext" style="display: none">digraph title {{ bgcolor=seashell
</div> node[shape=circle,style=filled,fillcolor=lightblue]
<div class="span6" id="rightPane">
<div id="svgdiv" class="extend" }}</textarea>
style="width:100%;height:30em;border: 1px solid #E3E3E3;min-height:10em;">{$svgwidget}</div> </div>
<div id="svgsrc" class="extend ace-container" style="display: none"> <div class="span6" id="rightPane">
<div id="svgsrc2" class="ace " data-mode="svg" data-readonly="1">(no svg loaded)</div> <div id="svgdiv" class="extend"
</div> style="width:100%;height:30em;border: 1px solid #E3E3E3;min-height:10em;">{$svgwidget}</div>
</div> <div id="svgsrc" class="extend ace-container" style="display: none">
<div id="svgsrc2" class="ace " data-mode="svg" data-readonly="1">(no svg loaded)</div>
</div> </div>
</div>
</div>
</div> </div>

View file

@ -1,29 +1,33 @@
<div class="row-fluid"> declare variable $toolbar external :="{tooolbar}";
<div class="row-fluid" style="height:24px"> declare variable $dotml external :="{dotml}";
{$toolbar} declare variable $svgwidget external :="{svg}";
</div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span6" id="leftPane" style="position:relative;height:100%"> <div class="row-fluid" style="height:24px">
<div id="dsrc" class="extend ace-container" > {$toolbar}
<div id="acedata" class="ace " data-mode="xml" ></div> </div>
</div> <div class="row-fluid">
<form id="editForm" method="post" action="api/dotml" target="_new" style="display:none" <div class="span6" id="leftPane" style="position:relative;height:100%">
> <div id="dsrc" class="extend ace-container" >
<textarea id="data" name="data" rows="20" <div id="acedata" class="ace " data-mode="xml" ></div>
style="width:100%;overflow:scroll;height:98%">{$dotml}</textarea> </div>
<input name="dl" type="checkbox" style="display:none" /> <form id="editForm" method="post" action="api/dotml" target="_new" style="display:none"
</form> >
<textarea id="cleartext" style="display: none">&lt;graph xmlns="http://www.martin-loetzsch.de/DOTML"&gt; <textarea id="data" name="data" rows="20"
&lt;node id="test"/&gt; style="width:100%;overflow:scroll;height:98%">{$dotml}</textarea>
&lt;/graph&gt;</textarea> <input name="dl" type="checkbox" style="display:none" />
</div> </form>
<div class="span6" id="rightPane"> <textarea id="cleartext" style="display: none">&lt;graph xmlns="http://www.martin-loetzsch.de/DOTML"&gt;
<div id="svgdiv" class="extend" &lt;node id="test"/&gt;
style="width:100%;height:30em;border: 1px solid #E3E3E3;min-height:10em;">{$svgwidget}</div> &lt;/graph&gt;</textarea>
<div id="svgsrc" class="extend ace-container" style="display: none"> </div>
<div id="svgsrc2" class="ace " <div class="span6" id="rightPane">
data-mode="svg" data-readonly="1">(no svg loaded)</div> <div id="svgdiv" class="extend"
</div> style="width:100%;height:30em;border: 1px solid #E3E3E3;min-height:10em;">{$svgwidget}</div>
</div> <div id="svgsrc" class="extend ace-container" style="display: none">
</div> <div id="svgsrc2" class="ace "
data-mode="svg" data-readonly="1">(no svg loaded)</div>
</div>
</div>
</div>
</div> </div>

View file

@ -1,3 +1,8 @@
declare variable $body external :="{body}";
declare variable $title external :="{title}";
declare variable $bodyclass external :="{$bodyclass}";
declare variable $active-link external :=function($_){$_};
<html > <html >
<head id="head"> <head id="head">
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -14,13 +19,13 @@
rel="stylesheet" type="text/css" /> rel="stylesheet" type="text/css" />
<!-- Le fav and touch icons --> <!-- Le fav and touch icons -->
<link rel="shortcut icon" href="/graphxq/graphxq2.png" /> <link rel="shortcut icon" href="/static/graphxq/graphxq2.png" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js" type="text/javascript"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js" type="text/javascript"></script>
<script src="http://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script> <script src="http://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<link href="/graphxq/app.css" rel="stylesheet" type="text/css" /> <link href="/static/graphxq/app.css" rel="stylesheet" type="text/css" />
<script src="/graphxq/app.js" type="text/javascript"></script> <script src="/static/graphxq/app.js" type="text/javascript"></script>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
var _gaq = _gaq || []; var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34544921-1']); _gaq.push(['_setAccount', 'UA-34544921-1']);
@ -44,7 +49,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</a> </a>
<a href="about" class="brand" title="Version 0.4.0"> <a href="about" class="brand" title="Version 0.4.0">
<img src="/graphxq/graphxq2.png" /> <img src="/static/graphxq/graphxq2.png" />
graphXQ graphXQ
</a> </a>

View file

@ -1,64 +1,64 @@
<div> <div>
<div class="btn-group"> <div class="btn-group">
<button id="bnRefresh" class="btn btn-mini" <button id="bnRefresh" class="btn btn-mini"
title="Resend SVG request" > title="Resend SVG request" >
<i class="icon-refresh"></i> <i class="icon-refresh"></i>
Redraw Redraw
</button> </button>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<a id="bnOpts" class="btn btn-mini" <a id="bnOpts" class="btn btn-mini"
href="/graphxq/views/options.xml" data-target="#myModal" data-toggle="modal" href="/graphxq/views/options.xml" data-target="#myModal" data-toggle="modal"
title="Extra settings (not implemented yet)" > title="Extra settings (not implemented yet)" >
<i class="icon-gift"></i> <i class="icon-gift"></i>
Options Options
</a> </a>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button id="bnclear" class="btn btn-mini" <button id="bnclear" class="btn btn-mini"
title="Set editor to default empty content" > title="Set editor to default empty content" >
<i class="icon-remove"></i> <i class="icon-remove"></i>
Clear Clear
</button> </button>
</div> </div>
<!-- http://stackoverflow.com/questions/12101781/splitter-for-twitter-bootstrap --> <!-- http://stackoverflow.com/questions/12101781/splitter-for-twitter-bootstrap -->
<div class="btn-group " data-toggle="buttons-radio"> <div class="btn-group " data-toggle="buttons-radio">
<a rel="tooltip" title="Show only the editor" class="btn btn-mini" <a rel="tooltip" title="Show only the editor" class="btn btn-mini"
data-action="lDom" data-placement="left"> data-action="lDom" data-placement="left">
<i class="icon icon-indent-left"></i> <i class="icon icon-indent-left"></i>
</a> </a>
<a rel="tooltip" title="Make both sides equal" class="btn btn-mini" <a rel="tooltip" title="Make both sides equal" class="btn btn-mini"
data-placement="left" data-action="equality"> data-placement="left" data-action="equality">
<i class="icon icon-resize-horizontal"></i> <i class="icon icon-resize-horizontal"></i>
</a> </a>
<a rel="tooltip" title="Show only the result" class="btn btn-mini" <a rel="tooltip" title="Show only the result" class="btn btn-mini"
data-placement="left" data-action="rDom"> data-placement="left" data-action="rDom">
<i class="icon icon-indent-right"></i> <i class="icon icon-indent-right"></i>
</a> </a>
</div> </div>
<a id="infotip" data-original-title="Status from Ajax" <a id="infotip" data-original-title="Status from Ajax"
class="btn btn-mini" rel="popover" data-placement="bottom" data-content="nothing yet." class="btn btn-mini" rel="popover" data-placement="bottom" data-content="nothing yet."
title="Ajax request status"> title="Ajax request status">
<i class="icon-info-sign" title="Request status, click for more.">></i> <i class="icon-info-sign" title="Request status, click for more.">></i>
</a> </a>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button id="bnsvg" class="btn btn-mini" title="Show SVG standalone."> <button id="bnsvg" class="btn btn-mini" title="Show SVG standalone.">
<i class="icon-fullscreen"></i> <i class="icon-fullscreen"></i>
SVG SVG
</button> </button>
<button id="bndn" class="btn btn-mini" title="Download SVG file"> <button id="bndn" class="btn btn-mini" title="Download SVG file">
<i class="icon-download-alt"></i> <i class="icon-download-alt"></i>
download download
</button> </button>
</div> </div>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button id="bnxml" class="btn btn-mini" data-toggle="button" title="Toggle SVG graphic and text"> <button id="bnxml" class="btn btn-mini" data-toggle="button" title="Toggle SVG graphic and text">
<i class="icon-eye-close"></i> <i class="icon-eye-close"></i>
SVG text SVG text
</button> </button>
</div> </div>
</div> </div>

View file

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 880 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 880 B

View file

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 880 B