improve compile

This commit is contained in:
Andy Bunce 2017-06-06 13:32:41 +01:00
parent ee22286a95
commit 18b2d52841
19 changed files with 561 additions and 182 deletions

View file

@ -24,10 +24,9 @@ let $id := Element:getAttribute($tempNode,"id")
let $name:=functx:capitalize-first($id)=>trace("ID")
let $script:= html5:getElementFirstByTagName($doc,"script")
let $tempfix:=replace($template,"\$","\\\$")
let $s:= Node:getInnerHTML($script)=>replace('[''"]#' || $id || '[''"]','`' ||$tempfix ||'`')
let $js:= ``[const `{$name}`=Vue.extend(`{$s}`
let $script:= Node:getInnerHTML($script)=>substring-after("{")
let $js:= ``[const `{$name}`=Vue.extend({template:` `{$template}` `,
`{$script}`
);
]``
return if(empty($id)) then () else $js

View file

@ -45,4 +45,12 @@ declare function html5:selector()
=>Selector:element("script")
=>Selector:attrValEq("type", "text/x-template")
=>Selector:toMatcher()
};
(:~
:write file
:)
declare function html5:write-text($text as xs:string,$file as xs:string)
{
file:write-text($file,$text)
};