From 394460613bae46d066a3f16b5f96b43851d407f5 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Mon, 9 Sep 2019 20:18:24 +0200 Subject: [PATCH] Make it work --- dist/js-yaml.min.js | 1 + dist/plate.min.js | 3 +++ style.html.j2 | 9 +-------- style.js | 13 ++++++++++--- templates/style.xsl.j2 | 10 ++++++---- 5 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 dist/js-yaml.min.js create mode 100644 dist/plate.min.js diff --git a/dist/js-yaml.min.js b/dist/js-yaml.min.js new file mode 100644 index 0000000..0623500 --- /dev/null +++ b/dist/js-yaml.min.js @@ -0,0 +1 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}}(function(){return function o(a,s,c){function u(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[t]={exports:{}};a[t][0].call(r.exports,function(e){return u(a[t][1][e]||e)},r,r.exports,o,a,s,c)}return s[t].exports}for(var l="function"==typeof require&&require,e=0;e=i.flowLevel;switch(H(r,n,i.indent,t,function(e){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+V(r,i.indent)+Z(L(function(t,n){var e,i,r=/(\n+)([^\n]*)/g,o=function(){var e=t.indexOf("\n");return e=-1!==e?e:t.length,r.lastIndex=e,z(t.slice(0,e),n)}(),a="\n"===t[0]||" "===t[0];for(;i=r.exec(t);){var s=i[1],c=i[2];e=" "===c[0],o+=s+(a||e||""===c?"":"\n")+z(c,n),a=e}return o}(r,t),e));case $:return'"'+function(e){for(var t,n,i,r="",o=0;ot&&o tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function Q(e,t,n,i,r,o){e.tag=null,e.dump=n,J(e,n,!1)||J(e,n,!0);var a=p.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0 "+e.dump)}return!0}function X(e,t){var n,i,r=[],o=[];for(function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;ot)&&0!==i)N(e,"bad indentation of a sequence entry");else if(e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndentt)&&($(e,t,b,!0,r)&&(m?d=e.result:h=e.result),m||(U(e,l,p,f,d,h,o,a),f=d=h=null),Y(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)N(e,"bad indentation of a mapping entry");else if(e.lineIndentl&&(l=e.lineIndent),j(o))p++;else{if(e.lineIndent>10),56320+(c-65536&1023)),e.position++}else N(e,"unknown escape sequence");n=i=e.position}else j(s)?(L(e,n,i,!0),B(e,Y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?m=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!I(i)&&!O(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&N(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||N(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Y(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,c,u,l,p=e.kind,f=e.result;if(I(l=e.input.charCodeAt(e.position))||O(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(I(i=e.input.charCodeAt(e.position+1))||n&&O(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==l;){if(58===l){if(I(i=e.input.charCodeAt(e.position+1))||n&&O(i))break}else if(35===l){if(I(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&R(e)||n&&O(l))break;if(j(l)){if(s=e.line,c=e.lineStart,u=e.lineIndent,Y(e,!1,-1),e.lineIndent>=t){a=!0,l=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(L(e,r,o,!1),B(e,e.line-s),r=o=e.position,a=!1),S(l)||(o=e.position+1),l=e.input.charCodeAt(++e.position)}return L(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,p,x===n)&&(m=!0,null===e.tag&&(e.tag="?")):(m=!0,null===e.tag&&null===e.anchor||N(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(m=s&&P(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(c=0,u=e.implicitTypes.length;c tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):N(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):N(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||m}function H(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(Y(e,!0,-1),r=e.input.charCodeAt(e.position),!(0t/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;ot/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var i=e("./common"),r=e("./exception"),o=e("./type");function a(e,t,i){var r=[];return e.include.forEach(function(e){i=a(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function s(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=a(this,"implicit",[]),this.compiledExplicit=a(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0==(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18==n?(s.push(a>>10&255),s.push(a>>2&255)):12==n&&s.push(a>>4&255),c?c.from?c.from(s):new c(s):s},predicate:function(e){return c&&c.isBuffer(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0==(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2==n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1==n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}})},{"../type":13}],15:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var a=/^[-+]?[0-9]+e/;t.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,i,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],0<="+-".indexOf(t[0])&&(t=t.slice(1)),".inf"===t?1==n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:0<=t.indexOf(":")?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type");t.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a11)return"p.m.";return"a.m."};proto.A=function(){if(this.data.getHours()>11)return"PM";return"AM"};proto.f=function(){if(this.data.getMinutes()==0)return this.g();return this.g()+":"+this.i()};proto.g=function(){var h=this.data.getHours();return this.data.getHours()%12||12};proto.G=function(){return this.data.getHours()};proto.h=function(){return("0"+this.g()).slice(-2)};proto.H=function(){return("0"+this.G()).slice(-2)};proto.i=function(){return("0"+this.data.getMinutes()).slice(-2)};proto.P=function(){var m=this.data.getMinutes(),h=this.data.getHours();if(m==0&&h==0)return"midnight";if(m==0&&h==12)return"noon";return this.f()+" "+this.a()};proto.s=function(){return("0"+this.data.getSeconds()).slice(-2)};proto.u=function(){return this.data.getMilliseconds()};function DateFormat(t){this.data=t;this.year_days=[0,31,59,90,120,151,181,212,243,273,304,334]}proto=DateFormat.prototype=new TimeFormat;proto.contructor=DateFormat;proto.b=function(){return MONTHS_3[this.data.getMonth()]};proto.c=function(){return this.data.toISOString?this.data.toISOString():""};proto.d=function(){return("0"+this.data.getDate()).slice(-2)};proto.D=function(){return capfirst(WEEKDAYS_ABBR[this.data.getDay()])};proto.E=function(){return MONTHS_ALT[this.data.getMonth()+1]};proto.F=function(){return capfirst(MONTHS[this.data.getMonth()])};proto.I=function(){return this.data.isDST()?"1":"0"};proto.j=function(){return this.data.getDate()};proto.l=function(){return capfirst(WEEKDAYS[this.data.getDay()])};proto.L=function(){return new Date(this.data.getFullYear(),1,29).getMonth()===1};proto.m=function(){return("0"+(this.data.getMonth()+1)).slice(-2)};proto.M=function(){return capfirst(MONTHS_3[this.data.getMonth()])};proto.n=function(){return this.data.getMonth()+1};proto.N=function(){return MONTHS_AP[this.data.getMonth()]};proto.O=function(){var tzoffs=this.data.getTimezoneOffset(),offs=~~(tzoffs/60),mins=("00"+~~Math.abs(tzoffs%60)).slice(-2);return(tzoffs>0?"-":"+")+("00"+Math.abs(offs)).slice(-2)+mins};proto.r=function(){return this.format("D, j M Y H:i:s O")};proto.S=function(){var d=this.data.getDate();if(d>=11&&d<=13)return"th";var last=d%10;if(last==1)return"st";if(last==2)return"nd";if(last==3)return"rd";return"th"};proto.t=function(){return 32-new Date(this.data.getFullYear(),this.data.getMonth(),32).getDate()};proto.T=function(){if(this.data.tzinfo){return this.data.tzinfo().abbr||"???"}return"???"};proto.U=function(){return~~(this.data/1e3)};proto.w=function(){return this.data.getDay()};proto.W=function(){var jan1_weekday=new Date(this.data.getFullYear(),0,1).getDay(),weekday=this.data.getDay(),day_of_year=this.z(),week_number,i=365;if(day_of_year<=8-jan1_weekday&&jan1_weekday>4){if(jan1_weekday===5||jan1_weekday===6&&this.L.call({data:new Date(this.data.getFullYear()-1,0,1)})){week_number=53}else{week_number=52}}else{if(this.L()){i=366}if(i-day_of_year<4-weekday){week_number=1}else{week_number=~~((day_of_year+(7-weekday)+(jan1_weekday-1))/7);if(jan1_weekday>4)week_number-=1}}return week_number};proto.y=function(){return(""+this.data.getFullYear()).slice(-2)};proto.Y=function(){return this.data.getFullYear()};proto.z=function(){doy=this.year_days[this.data.getMonth()]+this.data.getDate();if(this.L()&&this.data.getMonth()>1)doy+=1;return doy};proto.Z=function(){return this.data.getTimezoneOffset()*-60};function format(value,format_string){var df=new DateFormat(value);return df.format(format_string)}function time_format(value,format_string){var tf=new TimeFormat(value);return tf.format(format_string)}},{tz:93}],6:[function(require,module,exports){module.exports={log:function(value){console.log(value)},error:function(err){console.error(err,err&&err.stack)},info:function(value){}}},{}],7:[function(require,module,exports){var Library=require("./library");module.exports=DefaultFilters;function DefaultFilters(){Library.call(this,this.builtins)}var cons=DefaultFilters,proto=cons.prototype=new Library;proto.constructor=cons;proto.builtins={add:require("./filters/add"),addslashes:require("./filters/addslashes"),capfirst:require("./filters/capfirst"),center:require("./filters/center"),cut:require("./filters/cut"),date:require("./filters/date"),"default":require("./filters/default"),dictsort:require("./filters/dictsort"),dictsortreversed:require("./filters/dictsortreversed"),divisibleby:require("./filters/divisibleby"),escape:require("./filters/escape"),filesizeformat:require("./filters/filesizeformat"),first:require("./filters/first"),floatformat:require("./filters/floatformat"),force_escape:require("./filters/force_escape"),get_digit:require("./filters/get_digit"),index:require("./filters/index"),iteritems:require("./filters/iteritems"),iriencode:require("./filters/iriencode"),join:require("./filters/join"),last:require("./filters/last"),length:require("./filters/length"),length_is:require("./filters/length_is"),linebreaks:require("./filters/linebreaks"),linebreaksbr:require("./filters/linebreaksbr"),linenumbers:require("./filters/linenumbers"),ljust:require("./filters/ljust"),lower:require("./filters/lower"),make_list:require("./filters/make_list"),phone2numeric:require("./filters/phone2numeric"),pluralize:require("./filters/pluralize"),random:require("./filters/random"),rjust:require("./filters/rjust"),safe:require("./filters/safe"),slice:require("./filters/slice"),slugify:require("./filters/slugify"),split:require("./filters/split"),striptags:require("./filters/striptags"),timesince:require("./filters/timesince"),timeuntil:require("./filters/timeuntil"),title:require("./filters/title"),truncatechars:require("./filters/truncatechars"),truncatewords:require("./filters/truncatewords"),unordered_list:require("./filters/unordered_list"),upper:require("./filters/upper"),urlencode:require("./filters/urlencode"),urlize:require("./filters/urlize"),urlizetrunc:require("./filters/urlizetrunc"),wordcount:require("./filters/wordcount"),wordwrap:require("./filters/wordwrap"),yesno:require("./filters/yesno")}},{"./filters/add":14,"./filters/addslashes":15,"./filters/capfirst":16,"./filters/center":17,"./filters/cut":18,"./filters/date":19,"./filters/default":20,"./filters/dictsort":21,"./filters/dictsortreversed":22,"./filters/divisibleby":23,"./filters/escape":24,"./filters/filesizeformat":25,"./filters/first":26,"./filters/floatformat":27,"./filters/force_escape":28,"./filters/get_digit":29,"./filters/index":30,"./filters/iriencode":31,"./filters/iteritems":32,"./filters/join":33,"./filters/last":34,"./filters/length":35,"./filters/length_is":36,"./filters/linebreaks":37,"./filters/linebreaksbr":38,"./filters/linenumbers":39,"./filters/ljust":40,"./filters/lower":41,"./filters/make_list":42,"./filters/phone2numeric":43,"./filters/pluralize":44,"./filters/random":45,"./filters/rjust":46,"./filters/safe":47,"./filters/slice":48,"./filters/slugify":49,"./filters/split":50,"./filters/striptags":51,"./filters/timesince":52,"./filters/timeuntil":53,"./filters/title":54,"./filters/truncatechars":55,"./filters/truncatewords":56,"./filters/unordered_list":57,"./filters/upper":58,"./filters/urlencode":59,"./filters/urlize":60,"./filters/urlizetrunc":61,"./filters/wordcount":62,"./filters/wordwrap":63,"./filters/yesno":64,"./library":67}],8:[function(require,module,exports){var Library=require("./library");module.exports=DefaultTags;function DefaultTags(){Library.call(this,this.builtins)}var cons=DefaultTags,proto=cons.prototype=new Library;proto.constructor=cons;proto.builtins={block:require("./tags/block").parse,comment:require("./tags/comment").parse,debug:require("./tags/debug").parse,"extends":require("./tags/extends").parse,"for":require("./tags/for").parse,"if":require("./tags/if/node").parse,include:require("./tags/include").parse,now:require("./tags/now").parse,"with":require("./tags/with").parse}},{"./library":67,"./tags/block":73,"./tags/comment":74,"./tags/debug":75,"./tags/extends":76,"./tags/for":77,"./tags/if/node":81,"./tags/include":85,"./tags/now":86,"./tags/with":87}],9:[function(require,module,exports){module.exports=FilterApplication;var Promise=require("./promise");function FilterApplication(name,bits){this.name=name;this.args=bits;this.filter=null}var cons=FilterApplication,proto=cons.prototype;proto.attach=function(parser){this.filter=parser.filters.lookup(this.name)};proto.resolve=function(context,value,fromIDX,argValues){var self=this,promise,start=fromIDX||0,result,tmp;argValues=argValues||[];if(value===undefined){return}if(value&&value.constructor===Promise){promise=new Promise;value.once("done",function(val){promise.resolve(self.resolve(context,val))});return promise}for(var i=start,len=self.args.length;i/g,">").replace(/"/g,""").replace(/'/g,"'")}},{"./debug":6,"./promise":71}],13:[function(require,module,exports){var Token=require("./token"),FilterNode=require("./filter_node");module.exports=FilterToken;function FilterToken(content,line){Token.call(this,content,line)}var cons=FilterToken,proto=cons.prototype=new Token;proto.constructor=cons;proto.node=function(parser){return new FilterNode(parser.compile(this.content))}},{"./filter_node":12,"./token":90}],14:[function(require,module,exports){module.exports=function(input,value){return parseInt(input,10)+parseInt(value,10)}},{}],15:[function(require,module,exports){module.exports=function(input){return input.toString().replace(/'/g,"\\'")}},{}],16:[function(require,module,exports){module.exports=function(input){var str=input.toString();return[str.slice(0,1).toUpperCase(),str.slice(1)].join("")}},{}],17:[function(require,module,exports){module.exports=function(input,len,ready){if(ready===undefined)len=0;var str=input.toString(),value=" ";len-=str.length;if(len<0){return str}var len_half=len/2,arr=[],idx=Math.floor(len_half);while(idx-->0){arr.push(value)}arr=arr.join("");str=arr+str+arr;if(len_half-Math.floor(len_half)>0){str=input.toString().length%2==0?value+str:str+value}return str}},{}],18:[function(require,module,exports){module.exports=function(input,value){var str=input.toString();return str.replace(new RegExp(value,"g"),"")}},{}],19:[function(require,module,exports){var format=require("../date").date;module.exports=function(input,value,ready){if(ready===undefined)value="N j, Y";return format(input.getFullYear?input:new Date(input),value)}},{"../date":5}],20:[function(require,module,exports){module.exports=function(input,def,ready){return input?input:def}},{}],21:[function(require,module,exports){module.exports=function(input,key){return input.sort(function(x,y){if(x[key]>y[key])return 1;if(x[key]==y[key])return 0;if(x[key]=0,asNumber=parseFloat(input),absValue=Math.abs(val),pow=Math.pow(10,absValue),pow_minus_one=Math.pow(10,Math.max(absValue-1,0)),asString;asNumber=Math.round(pow*asNumber/pow_minus_one);if(val!==0)asNumber/=10;asString=asNumber.toString();if(isPositive){var split=asString.split("."),decimal=split.length>1?split[1]:"";while(decimal.length"))}return safe("

"+out.join("

")+"

")}},{"./escape":24,"./safe":47}],38:[function(require,module,exports){var escape=require("./escape"),safe=require("./safe");module.exports=function(input){var str=input.toString(),out=str.split("\n");for(var i=0,len=out.length;i"))}},{"./escape":24,"./safe":47}],39:[function(require,module,exports){module.exports=function(input){var str=input.toString(),bits=str.split("\n"),out=[],len=bits.length;while(bits.length){out.unshift(len-out.length+". "+bits.pop())}return out.join("\n")}},{}],40:[function(require,module,exports){module.exports=function(input,num){var bits=(input===null||input===undefined?"":input).toString().split(""),difference=num-bits.length;while(difference>0){difference=num-bits.push(" ")}return bits.join("")}},{}],41:[function(require,module,exports){module.exports=function(input){return input.toString().toLowerCase()}},{}],42:[function(require,module,exports){module.exports=function(input){input=input instanceof Array?input:input.toString().split("");return input}},{}],43:[function(require,module,exports){var LETTERS={a:"2",b:"2",c:"2",d:"3",e:"3",f:"3",g:"4",h:"4",i:"4",j:"5",k:"5",l:"5",m:"6",n:"6",o:"6",p:"7",q:"7",r:"7",s:"7",t:"8",u:"8",v:"8",w:"9",x:"9",y:"9",z:"9"};module.exports=function(input){var str=input.toString().toLowerCase().split(""),out=[],ltr;while(str.length){ltr=str.pop();out.unshift(LETTERS[ltr]?LETTERS[ltr]:ltr)}return out.join("")}},{}],44:[function(require,module,exports){module.exports=function(input,plural){plural=(typeof plural==="string"?plural:"s").split(",");var val=Number(input),suffix;suffix=plural[plural.length-1];if(val===1){suffix=plural.length>1?plural[0]:""}return suffix}},{}],45:[function(require,module,exports){module.exports=function(input){var cb=input.charAt||function(idx){return this[idx]};return cb.call(input,Math.floor(Math.random()*input.length))}},{}],46:[function(require,module,exports){module.exports=function(input,num){var bits=(input===null||input===undefined?"":input).toString().split(""),difference=num-bits.length;while(difference>0){difference=(bits.unshift(" "),num-bits.length)}return bits.join("")}},{}],47:[function(require,module,exports){var FilterNode=require("../filter_node");module.exports=function(input){input=new String(input);input.safe=true;return input}},{"../filter_node":12}],48:[function(require,module,exports){module.exports=function(input,by){by=by.toString();if(by.charAt(0)===":"){by="0"+by}if(by.charAt(by.length-1)===":"){by=by.slice(0,-1)}var splitBy=by.split(":"),slice=input.slice||function(){input=this.toString();return input.slice}();return slice.apply(input,splitBy)}},{}],49:[function(require,module,exports){module.exports=function(input){input=input.toString();return input.replace(/[^\w\s\d\-]/g,"").replace(/^\s*/,"").replace(/\s*$/,"").replace(/[\-\s]+/g,"-").toLowerCase()}},{}],50:[function(require,module,exports){module.exports=function(input,by,ready){by=arguments.length===2?",":by;input=""+input;return input.split(by)}},{}],51:[function(require,module,exports){module.exports=function(input){var str=input.toString();return str.replace(/<[^>]*?>/g,"")}},{}],52:[function(require,module,exports){module.exports=function(input,n,ready){var input=new Date(input),now=ready===undefined?new Date:new Date(n),diff=input-now,since=Math.abs(diff);if(diff>0)return"0 minutes";var years=~~(since/315576e5),months=~~((since-years*315576e5)/2592e6),days=~~((since-(years*315576e5+months*2592e6))/864e5),hours=~~((since-(years*315576e5+months*2592e6+days*864e5))/36e5),minutes=~~((since-(years*315576e5+months*2592e6+days*864e5+hours*36e5))/6e4),result=[years?pluralize(years,"year"):null,months?pluralize(months,"month"):null,days?pluralize(days,"day"):null,hours?pluralize(hours,"hour"):null,minutes?pluralize(minutes,"minute"):null],out=[];for(var i=0,len=result.length;i"+ulparser(item)+"");else out.unshift("
  • "+item)}return out.join("").replace(/^<\/li>/,"")+"
  • "};module.exports=function(input){return input instanceof Array?safe(ulparser(input)):input}},{"./safe":47}],58:[function(require,module,exports){module.exports=function(input){return input.toString().toUpperCase()}},{}],59:[function(require,module,exports){module.exports=function(input){return escape(input.toString())}},{}],60:[function(require,module,exports){var safe=require("./safe");var url_finder=require("../url_finder");module.exports=function(input){return safe(url_finder(input,function(){return''+arguments[0]+""}))}},{"../url_finder":91,"./safe":47}],61:[function(require,module,exports){var safe=require("./safe");var url_finder=require("../url_finder");module.exports=function(input,len){len=parseInt(len,10)||1e3;return safe(url_finder(input,function(){var ltr=arguments[0].length>len?arguments[0].slice(0,len)+"...":arguments[0];return''+ltr+""}))}},{"../url_finder":91,"./safe":47}],62:[function(require,module,exports){module.exports=function(input){var str=input.toString(),bits=str.split(/\s+/g);return bits.length}},{}],63:[function(require,module,exports){module.exports=function(input,len){var words=input.toString().split(/\s+/g),out=[],len=parseInt(len,10)||words.length;while(words.length){out.unshift(words.splice(0,len).join(" "))}return out.join("\n")}},{}],64:[function(require,module,exports){module.exports=function(input,map){var ourMap=map.toString().split(","),value;ourMap.length<3&&ourMap.push(ourMap[1]);value=ourMap[input?0:input===false?1:2];return value}},{}],65:[function(require,module,exports){(function(global){var FilterToken=require("./filter_token"),TagToken=require("./tag_token"),CommentToken=require("./comment_token"),TextToken=require("./text_token"),libraries=require("./libraries"),Parser=require("./parser"),Context=require("./context"),Meta=require("./meta"),Promise=require("./promise");module.exports=Template;Template.Template=Template;Template.Context=Context;var later=typeof global!=="undefined"?function(fn){global.setTimeout(fn,0)}:function(fn){this.setTimeout(fn,0)};function Template(raw,libraries,parser){if(typeof raw!=="string"){throw new TypeError("input should be a string")}this.raw=raw;libraries=libraries||{};this.tagLibrary=libraries.tag_library||Template.Meta.createTagLibrary();this.filterLibrary=libraries.filter_library||Template.Meta.createFilterLibrary();this.pluginLibrary=libraries.plugin_library||Template.Meta.createPluginLibrary();this.parser=parser||Parser;this.tokens=null}var cons=Template,proto=cons.prototype,meta=cons.Meta=new Meta;cons.createPluginLibrary=function(){return new libraries.DefaultPluginLibrary};proto.getNodeList=function(){this.nodelist=this.nodelist||this.parse();return this.nodelist};proto.parse=function(){var parser;this.tokens=this.tokens||cons.tokenize(this.raw);parser=new this.parser(this.tokens,this.tagLibrary,this.filterLibrary,this.pluginLibrary,this);return parser.parse()};proto.render=protect(function(context,ready){context=new Context(context);var result;result=this.getNodeList().render(context);if(result.constructor===Promise){result.once("done",function(data){ready(null,data)})}else{later(function(){ready(null,result)},0)}});function protect(fn){return function(context,ready){if(!context||!ready){throw new TypeError}try{return fn.call(this,context,ready)}catch(e){later(function(){ready(e,null)},0)}}}cons.MATCH_RE=/\{[%#\{](.*?)[\}#%]\}/;cons.tokenize=function(content){var match=null,tokens=[],lineNo=1,incLineNo=function(str){lineNo+=str.split("\n").length},map={"%":TagToken,"#":CommentToken,"{":FilterToken},rex=this.MATCH_RE,literal;do{match=rex.exec(content);if(!match)continue;literal=content.slice(0,match.index);incLineNo(literal);if(match.index)tokens.push(new TextToken(literal.slice(0,match.index,lineNo)));match[1]=match[1].replace(/^\s+/,"").replace(/\s+$/,"");tokens.push(new(map[match[0].charAt(1)])(match[1],lineNo));content=content.slice(match.index+match[0].length)}while(content.length&&match);tokens.push(new TextToken(content));return tokens}})(self)},{"./comment_token":3,"./context":4,"./filter_token":13,"./libraries":66,"./meta":68,"./parser":70,"./promise":71,"./tag_token":72,"./text_token":89}],66:[function(require,module,exports){module.exports={Library:require("./library"),DefaultPluginLibrary:require("./library"),DefaultTagLibrary:require("./defaulttags"),DefaultFilterLibrary:require("./defaultfilters")}},{"./defaultfilters":7,"./defaulttags":8,"./library":67}],67:[function(require,module,exports){module.exports=Library;var Promise=require("./promise");function Library(lib){this.registry=lib||{}}var cons=Library,proto=cons.prototype;proto.lookup=errorOnNull(function(name){var out=this.registry[name]||null;if(typeof out==="function"&&out.length===2&&name==="loader"){out=Promise.toPromise(out)}return out},"Could not find {0}!");proto.register=errorOnNull(function(name,item){if(this.registry[name])return null;this.registry[name]=item},"{0} is already registered!");function errorOnNull(fn,msg){return function(){var result=fn.call(this,arguments[0],arguments[1]),args=arguments; +if(result===null)throw new Error(msg.replace(/\{(\d+?)\}/g,function(a,m){return args[+m]}));return result}}},{"./promise":71}],68:[function(require,module,exports){var libraries=require("./libraries");module.exports=Meta;function Meta(){this._autoregister={plugin:{},tag:{},filter:{}};this._cache={};this._classes={filter:libraries.DefaultFilterLibrary,plugin:libraries.DefaultPluginLibrary,tag:libraries.DefaultTagLibrary}}var cons=Meta,proto=cons.prototype;proto.createPluginLibrary=createLibrary("plugin");proto.createFilterLibrary=createLibrary("filter");proto.createTagLibrary=createLibrary("tag");proto.registerPlugin=createAutoregister("plugin");proto.registerFilter=createAutoregister("filter");proto.registerTag=createAutoregister("tag");function createAutoregister(name){return function(key,item){if(this._cache[name])this._cache[name].register(key,item);else this._autoregister[name][key]=item}}function createLibrary(name){return function(){if(this._cache[name])return this._cache[name];var lib=new this._classes[name];for(var key in this._autoregister[name]){lib.register(key,this._autoregister[name][key])}this._cache[name]=lib;return lib}}},{"./libraries":66}],69:[function(require,module,exports){module.exports=NodeList;var Promise=require("./promise");function NodeList(nodes){this.nodes=nodes}var cons=NodeList,proto=cons.prototype;proto.render=function(context){var promises=[],results=[],nodes=this.nodes,result;for(var i=0,len=nodes.length;i0){token=this.tokens.shift();if(until&&token.is(until)&&token.constructor===TagToken){this.tokens.unshift(token);okay=true;break}if(node=token.node(this)){output.push(node)}}if(!okay){throw new Error("expected one of "+until)}return new NodeList(output)};proto.compileNumber=function(content,idx,output){var decimal=content.charAt(idx)===".",bits=decimal?["0."]:[],parse,c;do{c=content.charAt(idx);if(c==="."){if(decimal){break}decimal=true;bits.push(".")}else if(/\d/.test(c)){bits.push(c)}}while(++idx":function(){return new InfixOperator(10,function(x,y){return x>y})},">=":function(){return new InfixOperator(10,function(x,y){return x>=y})},"<":function(){return new InfixOperator(10,function(x,y){return x=this.tokens.length){return new EndToken}return this.tokens[this.pos++]};proto.parse=function(){var retval=this.expression();if(!(this.currentToken.constructor===EndToken)){throw new Error("Unused "+this.currentToken+" at end of if expression.")}return retval};proto.expression=function(rbp){rbp=rbp||0;var t=this.currentToken,left;this.currentToken=this.next();left=t.nud(this);while(rbp"};proto.is=function(names){for(var i=0,len=names.length;ithresholds.fall_back,max=Math.max(thresholds.fall_back,thresholds.spring_forward),min=Math.min(thresholds.fall_back,thresholds.spring_forward);if(min0?"-":"+")+("00"+Math.abs(offs)).slice(-2)+mins;return offs}function tzinfo(date,tz_list,determine_dst,TZ){var fmt=get_offset_fmt(date.getTimezoneOffset());TZ=TZ||tz;tz_list=tz_list||TZ[fmt];determine_dst=determine_dst||isDST;var date_is_dst=determine_dst(date),date_dst_thresholds=determine_dst.find_thresholds(),has_dst=date_dst_thresholds.spring_forward!==date_dst_thresholds.fall_back,is_north=has_dst&&date_dst_thresholds.spring_forward - - +asdasd diff --git a/style.js b/style.js index 615989f..6ce21dd 100644 --- a/style.js +++ b/style.js @@ -1,6 +1,13 @@ -template = new plate.Template(jinja_template) +var template = new plate.Template(jinja_template) +var context = jsyaml.load(document.getElementById("yaml_data").innerHTML); -template.render({world: 'everyone'}, function(err, data) { - document.write(data); + + +console.log(yaml_data); + +template.render(context, function(err, data) { + if (err) throw err; + document.getElementById("my_card").innerHTML = data; +// document.write(data); }) diff --git a/templates/style.xsl.j2 b/templates/style.xsl.j2 index 085043b..c46488e 100644 --- a/templates/style.xsl.j2 +++ b/templates/style.xsl.j2 @@ -4,8 +4,8 @@ <!DOCTYPE html> - - + + +