Socket
Socket
Sign inDemoInstall

prismic.io

Package Overview
Dependencies
Maintainers
3
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prismic.io - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

.travis.yml

2

bower.json
{
"name": "prismic-js-SDK",
"version": "1.0.12",
"version": "1.0.13",
"homepage": "https://github.com/prismicio/javascript-kit",

@@ -5,0 +5,0 @@ "authors": [

@@ -5,2 +5,2 @@ /*!

*/
!function(a,b){"use strict";function c(a,b,c,d,e,f){this.name=a,this.fields=b,this.form_method=c,this.rel=d,this.enctype=e,this.action=f}function d(a,b,c){this.api=a,this.form=b,this.data=c||{};for(var d in b.fields)b.fields[d].default&&(this.data[d]=[b.fields[d].default])}function e(a){return this.fragments&&this.fragments[a]?Array.isArray(this.fragments[a])?this.fragments[a]:[this.fragments[a]]:[]}function f(a,b,c,d,e,f,g,h){this.page=a,this.results_per_page=b,this.results_size=c,this.total_results_size=d,this.total_pages=e,this.next_page=f,this.prev_page=g,this.results=h}function g(a,b,c,d){this.id=a,this.slug=b,this.type=c,this.tags=d}function h(a,b,c,d,e,f,g){this.id=a,this.type=b,this.href=c,this.tags=d,this.slug=e?e[0]:"-",this.slugs=e,this.linkedDocuments=f,this.fragments=g}function i(a,b,c,d,e){this.ref=a,this.label=b,this.isMaster=c,this.scheduledAt=d,this.id=e}function j(){this.cache={},this.states={}}var k=function(a,b,c,d,e){var f=new k.fn.init(a,c,d,e);return b&&f.get(b),f},l=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(a,b){var c=new XMLHttpRequest,d=function(){b(null,JSON.parse(c.responseText),c)},e=function(){var d=c.status;b(new Error("Unexpected status code ["+d+"] on URL "+a),null,c)};c.onreadystatechange=function(){4===c.readyState&&(c.status&&200==c.status?d():e())},c.open("GET",a,!0),c.setRequestHeader("Accept","application/json"),c.send()}:void 0},m=function(){return"undefined"!=typeof XDomainRequest?function(a,b){var c=new XDomainRequest,d=function(){b(null,JSON.parse(c.responseText),c)},e=function(a){b(new Error(a),null,c)};c.onload=function(){d(c)},c.onerror=function(){e("Unexpected status code on URL "+a)},c.open("GET",a,!0),c.ontimeout=function(){e("Request timeout")},c.onprogress=function(){},c.send()}:void 0},n=function(){if("function"==typeof require&&require("http")){{var a={},c=require("http"),d=require("https"),e=require("url");require("querystring")}return function(f,g){if(a[f])g(null,a[f]);else{var h=e.parse(f),i="https:"==h.protocol?d:c,j={hostname:h.hostname,path:h.path,query:h.query,headers:{Accept:"application/json"}};i.get(j,function(c){if(c.statusCode&&200==c.statusCode){var d="";c.setEncoding("utf8"),c.on("data",function(a){d+=a}),c.on("end",function(){var e=c.headers["cache-control"],h=e&&/max-age=(\d+)/.test(e)?parseInt(/max-age=(\d+)/.exec(e)[1]):b,i=JSON.parse(d);h&&(a[f]=i),g(null,i,c)})}else g(new Error("Unexpected status code ["+c.statusCode+"] on URL "+f),null,c)})}}}};k.fn=k.prototype={constructor:k,data:null,get:function(a){var b=this,c=this.url+(this.accessToken?"#"+this.accessToken:"");this.apiCache.getOrSet(c,5,function(a){b.requestHandler(b.url,function(c,d,e){c?a&&a(c,null,e):a&&a(null,b.parse(d),e)})},function(c,d,e){c?a&&a(c,null,e):(b.data=d,b.bookmarks=d.bookmarks,a&&a(null,b,e))})},parse:function(a){var b,d,e,f,g,h,j,k={};for(j in a.forms)a.forms.hasOwnProperty(j)&&(h=a.forms[j],this.accessToken&&(h.fields.accessToken={type:"string","default":this.accessToken}),e=new c(h.name,h.fields,h.form_method,h.rel,h.enctype,h.action),k[j]=e);if(b=a.refs.map(function(a){return new i(a.ref,a.label,a.isMasterRef,a.scheduledAt,a.id)})||[],d=b.filter(function(a){return a.isMaster===!0}),f=a.types,g=a.tags,0===d.length)throw"No master ref.";return{bookmarks:a.bookmarks||{},refs:b,forms:k,master:d[0],types:f,tags:g,oauthInitiate:a.oauth_initiate,oauthToken:a.oauth_token}},init:function(a,b,c,d){return this.url=a+(b?(a.indexOf("?")>-1?"&":"?")+"access_token="+b:""),this.accessToken=b,this.requestHandler=c||l()||m()||n()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}(),this.apiCache=d||new j,this},forms:function(a){return this.form(a)},form:function(a){var b=this.data.forms[a];return b?new d(this,b,{}):void 0},master:function(){return this.data.master.ref},ref:function(a){for(var b=0;b<this.data.refs.length;b++)if(this.data.refs[b].label==a)return this.data.refs[b].ref}},k.fn.init.prototype=k.fn,c.prototype={},d.prototype={set:function(a,c){var d=this.form.fields[a];if(!d)throw new Error("Unknown field "+a);var e=this.data[a]||[];return(""===c||c===b)&&(c=null),d.multiple?null!=c&&e.push(c):e=null!=c&&[c],this.data[a]=e,this},ref:function(a){return this.set("ref",a)},query:function(a){return this.set("q",a)},pageSize:function(a){return this.set("pageSize",a)},page:function(a){return this.set("page",a)},orderings:function(a){return this.set("orderings",a)},submit:function(a){var b=this.form.action;if(this.data){var c=b.indexOf("?")>-1?"&":"?";for(var d in this.data){var e=this.data[d];if(e)for(var i=0;i<e.length;i++)b+=c+d+"="+encodeURIComponent(e[i]),c="&"}}this.api.requestHandler(b,function(b,c,d){if(b)return a(b,null,d),void 0;var e=c.results.map(function(a){var b=[];a.linked_documents&&(b=a.linked_documents.map(function(a){return new g(a.id,a.slug,a.type,a.tags)}));var c={};for(var d in a.data[a.type])c[a.type+"."+d]=a.data[a.type][d];return new h(a.id,a.type,a.href,a.tags,a.slugs,b,c)});a(null,new f(c.page,c.results_per_page,c.results_size,c.total_results_size,c.total_pages,c.next_page,c.prev_page,e||[]),d)})}},h.prototype={get:function(b){var c=e.call(this,b);return c.length?a.Prismic.Fragments.initField(c[0]):null},getAll:function(b){return e.call(this,b).map(function(b){return a.Prismic.Fragments.initField(b)},this)},getImage:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Image?c:c instanceof a.Prismic.Fragments.StructuredText?c:null},getAllImages:function(b){var c=this.getAll(b);return c.map(function(b){if(b instanceof a.Prismic.Fragments.Image)return b;if(b instanceof a.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(b,c){var b=this.get(b);if(b instanceof a.Prismic.Fragments.Image)return b.getView(c);if(b instanceof a.Prismic.Fragments.StructuredText)for(var d=0;d<b.blocks.length;d++)if("image"==b.blocks[d].type)return b.blocks[d];return null},getAllImageViews:function(a,b){return this.getAllImages(a).map(function(a){return a.getView(b)})},getDate:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Date?b.value:void 0},getBoolean:function(a){var a=this.get(a);return a.value&&("yes"==a.value.toLowerCase()||"on"==a.value.toLowerCase()||"true"==a.value.toLowerCase())},getText:function(b,c){var d=this.get(b);return d instanceof a.Prismic.Fragments.StructuredText?d.blocks.map(function(a){return a.text?a.text+(c?c:""):void 0}).join("\n"):d instanceof a.Prismic.Fragments.Text&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Number&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Select&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Color&&d.value?d.value+(c?c:""):void 0},getStructuredText:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.StructuredText?b:void 0},getNumber:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Number?b.value:void 0},getColor:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Color?b.value:void 0},getGroup:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Group?b:void 0},getHtml:function(a,b){var a=this.get(a);return a&&a.asHtml?a.asHtml(b):void 0},asHtml:function(a){var b=[];for(var c in this.fragments){var d=this.get(c);b.push(d&&d.asHtml?'<section data-field="'+c+'">'+d.asHtml(a)+"</section>":"")}return b.join("")},asText:function(a){var b=[];for(var c in this.fragments){var d=this.get(c);b.push(d&&d.asText?d.asText(a):"")}return b.join("")}},i.prototype={},j.prototype={get:function(a){var b=this.cache[a];return b&&(!this.isExpired(a)||this.isExpired(a)&&this.isInProgress(a))?b.data:null},set:function(a,b,c){this.cache[a]={data:b,expiredIn:c?Date.now()+1e3*c:0}},getOrSet:function(a,b,c,d){var e=this.get(a),f=this;if(e)d&&d(null,e);else{this.states[a]="progress";{c(function(c,e,g){f.set(a,e,b),delete f.states[a],d&&d(c,e,g)})}}},isExpired:function(a){var b=this.cache[a];return b?0!=b.expiredIn&&b.expiredIn<Date.now():!1},isInProgress:function(a){return"progress"==this.states[a]},exists:function(a){return!!this.cache[a]},remove:function(a){return delete this.cache[a]},clear:function(){this.cache={}}},a.Prismic={Api:k}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(a){"use strict";function b(a){this.value=a}function c(a){this.value=a,this.document=a.document,this.isBroken=a.isBroken}function d(a){this.value=a}function e(a){this.value=a}function f(a){this.value=a}function g(a){this.value=a}function h(a){this.value=a}function i(a){this.value=a}function j(a){this.value=new Date(a)}function k(a){this.value=a}function l(a,b){this.main=a,this.views=b||{}}function m(a,b,c,d){this.url=a,this.width=b,this.height=c,this.alt=d}function n(a){this.value=a}function o(a,b){this.tag=a,this.blocks=b}function p(a){this.blocks=a}function q(a,b){var c,d,e=[],f=[];if(Array.isArray(a)){for(var g=0;g<a.length;g++)d=a[g],"list-item"!=d.type&&"o-list-item"!=d.type?(c=new o(d.type,[]),e.push(c)):c&&c.tag==d.type||(c=new o(d.type,[]),e.push(c)),c.blocks.push(d);e.forEach(function(a){if("heading1"==a.tag)f.push("<h1>"+r(a.blocks[0].text,a.blocks[0].spans,b)+"</h1>");else if("heading2"==a.tag)f.push("<h2>"+r(a.blocks[0].text,a.blocks[0].spans,b)+"</h2>");else if("heading3"==a.tag)f.push("<h3>"+r(a.blocks[0].text,a.blocks[0].spans,b)+"</h3>");else if("paragraph"==a.tag)f.push("<p>"+r(a.blocks[0].text,a.blocks[0].spans,b)+"</p>");else if("preformatted"==a.tag)f.push("<pre>"+a.blocks[0].text+"</pre>");else if("image"==a.tag)f.push('<p><img src="'+a.blocks[0].url+'" alt="'+a.blocks[0].alt+'"></p>');else if("embed"==a.tag)f.push('<div data-oembed="'+a.blocks[0].embed_url+'" data-oembed-type="'+a.blocks[0].type+'" data-oembed-provider="'+a.blocks[0].provider_name+'">'+a.blocks[0].oembed.html+"</div>");else{if("list-item"!=a.tag&&"o-list-item"!=a.tag)throw new Error(a.tag+" not implemented");f.push("list-item"==a.tag?"<ul>":"<ol>"),a.blocks.forEach(function(a){f.push("<li>"+r(a.text,a.spans,b)+"</li>")}),f.push("list-item"==a.tag?"</ul>":"</ol>")}})}return f.join("")}function r(a,b,c){var d=[],e=[],f=0,g=[];return b.forEach(function(b){return b.end<b.start?a:b.start<f?a:(f=b.end,void 0)}),f=0,b.forEach(function(b){d.push(a.substring(0,b.start-f)),a=a.substring(b.start-f),f=b.start,d.push(a.substring(0,b.end-f)),a=a.substring(b.end-f),e.push(b),f=b.end}),d.push(a),e.forEach(function(a){g.push(d.shift()),"hyperlink"==a.type?(g.push('<a href="'+s(a.data).url(c)+'">'),g.push(d.shift()),g.push("</a>")):(g.push("<"+a.type+">"),g.push(d.shift()),g.push("</"+a.type+">"))}),g.push(d.shift()),g.join("")}function s(a){var o,q;switch(a.type){case"Color":o=new h(a.value);break;case"Number":o=new i(a.value);break;case"Date":o=new j(a.value);break;case"Text":o=new b(a.value);break;case"Embed":o=new k(a.value);break;case"Select":o=new g(a.value);break;case"Image":var q=a.value.main;o=new l(new m(q.url,q.dimensions.width,q.dimensions.height,q.alt),{});for(var r in a.value.views){var q=a.value.views[r];o.views[r]=new m(q.url,q.dimensions.width,q.dimensions.height,q.alt)}break;case"StructuredText":o=new p(a.value);break;case"Link.document":o=new c(a.value);break;case"Link.web":o=new d(a.value);break;case"Link.file":o=new e(a.value);break;case"Link.image":o=new f(a.value);break;case"Group":for(var t=[],u=0;u<a.value.length;u++){var v={};for(var w in a.value[u])v[w]=s(a.value[u][w]);t.push(v)}o=new n(t);break;default:console.log("Fragment type not supported: ",a.type)}return o}b.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},c.prototype={asHtml:function(a){return'<a href="'+this.url(a)+'">'+this.url(a)+"</a>"},url:function(a){return a.linkResolver(a,this.document,this.isBroken)},asText:function(a){return this.url(a)}},d.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},e.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},f.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},g.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},h.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},i.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},j.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},k.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},l.prototype={getView:function(a){return"main"===a?this.main:this.views[a]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},m.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return"<img src="+this.url+" width="+this.width+" height="+this.height+' alt="'+this.alt+'">'},asText:function(){return""}},n.prototype={asHtml:function(a){for(var b="",c=0;c<this.value.length;c++)for(var d in this.value[c])b+='<section data-field="'+d+'">',b+=this.value[c][d].asHtml(a),b+="</section>";return b},toArray:function(){return this.value},asText:function(a){for(var b="",c=0;c<this.value.length;c++)for(var d in this.value[c])b+=this.value[c][d].asText(a);return b}},p.prototype={getTitle:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if(0==b.type.indexOf("heading"))return b}},getFirstParagraph:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if("paragraph"==b.type)return b}},getParagraphs:function(){for(var a=[],b=0;b<this.blocks.length;b++){var c=this.blocks[b];"paragraph"==c.type&&a.push(c)}return a},getParagraph:function(a){return this.getParagraphs()[a]},getFirstImage:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if("image"==b.type)return new m(b.url,b.dimensions.width,b.dimensions.height,b.alt)}},asHtml:function(a){return q.call(this,this.blocks,a)},asText:function(){for(var a=[],b=0;b<this.blocks.length;b++){var c=this.blocks[b];c.text&&a.push(c.text)}return a.join(" ")}},a.Prismic.Fragments={Image:l,ImageView:m,Text:b,Number:i,Date:j,Select:g,Color:h,StructuredText:p,WebLink:d,DocumentLink:c,ImageLink:f,FileLink:e,Group:n,initField:s}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);
!function(a,b){"use strict";function c(a,b,c,d,e,f){this.name=a,this.fields=b,this.form_method=c,this.rel=d,this.enctype=e,this.action=f}function d(a,b,c){this.api=a,this.form=b,this.data=c||{};for(var d in b.fields)b.fields[d]["default"]&&(this.data[d]=[b.fields[d]["default"]])}function e(a){return this.fragments&&this.fragments[a]?Array.isArray(this.fragments[a])?this.fragments[a]:[this.fragments[a]]:[]}function f(a,b,c,d,e,f,g,h){this.page=a,this.results_per_page=b,this.results_size=c,this.total_results_size=d,this.total_pages=e,this.next_page=f,this.prev_page=g,this.results=h}function g(a,b,c,d){this.id=a,this.slug=b,this.type=c,this.tags=d}function h(a,b,c,d,e,f,g){this.id=a,this.type=b,this.href=c,this.tags=d,this.slug=e?e[0]:"-",this.slugs=e,this.linkedDocuments=f,this.fragments=g}function i(a,b,c,d,e){this.ref=a,this.label=b,this.isMaster=c,this.scheduledAt=d,this.id=e}function j(){this.cache={},this.states={}}var k=function(a,b,c,d,e){var f=new k.fn.init(a,c,d,e);return b&&f.get(b),f},l=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(a,b){var c=new XMLHttpRequest,d=function(){b(null,JSON.parse(c.responseText),c)},e=function(){var d=c.status;b(new Error("Unexpected status code ["+d+"] on URL "+a),null,c)};c.onreadystatechange=function(){4===c.readyState&&(c.status&&200==c.status?d():e())},c.open("GET",a,!0),c.setRequestHeader("Accept","application/json"),c.send()}:void 0},m=function(){return"undefined"!=typeof XDomainRequest?function(a,b){var c=new XDomainRequest,d=function(){b(null,JSON.parse(c.responseText),c)},e=function(a){b(new Error(a),null,c)};c.onload=function(){d(c)},c.onerror=function(){e("Unexpected status code on URL "+a)},c.open("GET",a,!0),c.ontimeout=function(){e("Request timeout")},c.onprogress=function(){},c.send()}:void 0},n=function(){if("function"==typeof require&&require("http")){{var a={},c=require("http"),d=require("https"),e=require("url");require("querystring")}return function(f,g){if(a[f])g(null,a[f]);else{var h=e.parse(f),i="https:"==h.protocol?d:c,j={hostname:h.hostname,path:h.path,query:h.query,headers:{Accept:"application/json"}};i.get(j,function(c){if(c.statusCode&&200==c.statusCode){var d="";c.setEncoding("utf8"),c.on("data",function(a){d+=a}),c.on("end",function(){var e=c.headers["cache-control"],h=e&&/max-age=(\d+)/.test(e)?parseInt(/max-age=(\d+)/.exec(e)[1]):b,i=JSON.parse(d);h&&(a[f]=i),g(null,i,c)})}else g(new Error("Unexpected status code ["+c.statusCode+"] on URL "+f),null,c)})}}}};k.fn=k.prototype={constructor:k,data:null,get:function(a){var b=this,c=this.url+(this.accessToken?"#"+this.accessToken:"");this.apiCache.getOrSet(c,5,function(a){b.requestHandler(b.url,function(c,d,e){c?a&&a(c,null,e):a&&a(null,b.parse(d),e)})},function(c,d,e){c?a&&a(c,null,e):(b.data=d,b.bookmarks=d.bookmarks,a&&a(null,b,e))})},parse:function(a){var b,d,e,f,g,h,j,k={};for(j in a.forms)a.forms.hasOwnProperty(j)&&(h=a.forms[j],this.accessToken&&(h.fields.accessToken={},h.fields.accessToken.type="string",h.fields.accessToken["default"]=this.accessToken),e=new c(h.name,h.fields,h.form_method,h.rel,h.enctype,h.action),k[j]=e);if(b=a.refs.map(function(a){return new i(a.ref,a.label,a.isMasterRef,a.scheduledAt,a.id)})||[],d=b.filter(function(a){return a.isMaster===!0}),f=a.types,g=a.tags,0===d.length)throw"No master ref.";return{bookmarks:a.bookmarks||{},refs:b,forms:k,master:d[0],types:f,tags:g,oauthInitiate:a.oauth_initiate,oauthToken:a.oauth_token}},init:function(a,b,c,d){return this.url=a+(b?(a.indexOf("?")>-1?"&":"?")+"access_token="+b:""),this.accessToken=b,this.requestHandler=c||l()||m()||n()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}(),this.apiCache=d||new j,this},forms:function(a){return this.form(a)},form:function(a){var b=this.data.forms[a];return b?new d(this,b,{}):void 0},master:function(){return this.data.master.ref},ref:function(a){for(var b=0;b<this.data.refs.length;b++)if(this.data.refs[b].label==a)return this.data.refs[b].ref}},k.fn.init.prototype=k.fn,c.prototype={},d.prototype={set:function(a,c){var d=this.form.fields[a];if(!d)throw new Error("Unknown field "+a);var e=this.data[a]||[];return(""===c||c===b)&&(c=null),d.multiple?null!=c&&e.push(c):e=null!=c&&[c],this.data[a]=e,this},ref:function(a){return this.set("ref",a)},query:function(a){return this.set("q",a)},pageSize:function(a){return this.set("pageSize",a)},page:function(a){return this.set("page",a)},orderings:function(a){return this.set("orderings",a)},submit:function(a){var b=this.form.action;if(this.data){var c=b.indexOf("?")>-1?"&":"?";for(var d in this.data){var e=this.data[d];if(e)for(var i=0;i<e.length;i++)b+=c+d+"="+encodeURIComponent(e[i]),c="&"}}this.api.requestHandler(b,function(b,c,d){if(b)return void a(b,null,d);var e=c.results.map(function(a){var b=[];a.linked_documents&&(b=a.linked_documents.map(function(a){return new g(a.id,a.slug,a.type,a.tags)}));var c={};for(var d in a.data[a.type])c[a.type+"."+d]=a.data[a.type][d];for(var e in c){var f=c[e];if("StructuredText"===f.type)for(var i in f.value){var j=f.value[i],k=[];for(var l in j.spans){var m=j.spans[l];m.start<m.end&&k.push(m)}j.spans=k}}return new h(a.id,a.type,a.href,a.tags,a.slugs,b,c)});a(null,new f(c.page,c.results_per_page,c.results_size,c.total_results_size,c.total_pages,c.next_page,c.prev_page,e||[]),d)})}},h.prototype={get:function(b){var c=e.call(this,b);return c.length?a.Prismic.Fragments.initField(c[0]):null},getAll:function(b){return e.call(this,b).map(function(b){return a.Prismic.Fragments.initField(b)},this)},getImage:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Image?c:c instanceof a.Prismic.Fragments.StructuredText?c:null},getAllImages:function(b){var c=this.getAll(b);return c.map(function(b){if(b instanceof a.Prismic.Fragments.Image)return b;if(b instanceof a.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(b,c){var b=this.get(b);if(b instanceof a.Prismic.Fragments.Image)return b.getView(c);if(b instanceof a.Prismic.Fragments.StructuredText)for(var d=0;d<b.blocks.length;d++)if("image"==b.blocks[d].type)return b.blocks[d];return null},getAllImageViews:function(a,b){return this.getAllImages(a).map(function(a){return a.getView(b)})},getDate:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Date?b.value:void 0},getBoolean:function(a){var a=this.get(a);return a.value&&("yes"==a.value.toLowerCase()||"on"==a.value.toLowerCase()||"true"==a.value.toLowerCase())},getText:function(b,c){var d=this.get(b);return d instanceof a.Prismic.Fragments.StructuredText?d.blocks.map(function(a){return a.text?a.text+(c?c:""):void 0}).join("\n"):d instanceof a.Prismic.Fragments.Text&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Number&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Select&&d.value?d.value+(c?c:""):d instanceof a.Prismic.Fragments.Color&&d.value?d.value+(c?c:""):void 0},getStructuredText:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.StructuredText?b:void 0},getNumber:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Number?b.value:void 0},getColor:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Color?b.value:void 0},getGeoPoint:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.GeoPoint?b:void 0},getGroup:function(b){var b=this.get(b);return b instanceof a.Prismic.Fragments.Group?b:void 0},getHtml:function(a,b){var a=this.get(a);return a&&a.asHtml?a.asHtml(b):void 0},asHtml:function(a){var b=[];for(var c in this.fragments){var d=this.get(c);b.push(d&&d.asHtml?'<section data-field="'+c+'">'+d.asHtml(a)+"</section>":"")}return b.join("")},asText:function(a){var b=[];for(var c in this.fragments){var d=this.get(c);b.push(d&&d.asText?d.asText(a):"")}return b.join("")}},i.prototype={},j.prototype={get:function(a){var b=this.cache[a];return b&&(!this.isExpired(a)||this.isExpired(a)&&this.isInProgress(a))?b.data:null},set:function(a,b,c){this.cache[a]={data:b,expiredIn:c?Date.now()+1e3*c:0}},getOrSet:function(a,b,c,d){var e=this.get(a),f=this;if(e)d&&d(null,e);else{this.states[a]="progress";{c(function(c,e,g){f.set(a,e,b),delete f.states[a],d&&d(c,e,g)})}}},isExpired:function(a){var b=this.cache[a];return b?0!=b.expiredIn&&b.expiredIn<Date.now():!1},isInProgress:function(a){return"progress"==this.states[a]},exists:function(a){return!!this.cache[a]},remove:function(a){return delete this.cache[a]},clear:function(){this.cache={}}},a.Prismic={Api:k}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(a){"use strict";function b(a){this.value=a}function c(a){this.value=a,this.document=a.document,this.isBroken=a.isBroken}function d(a){this.value=a}function e(a){this.value=a}function f(a){this.value=a}function g(a){this.value=a}function h(a){this.value=a}function i(a,b){this.latitude=a,this.longitude=b}function j(a){this.value=a}function k(a){this.value=new Date(a)}function l(a){var b=24==a.length?a.substring(0,22)+":"+a.substring(22,24):a;this.value=new Date(b)}function m(a){this.value=a}function n(a,b){this.main=a,this.views=b||{}}function o(a,b,c,d){this.url=a,this.width=b,this.height=c,this.alt=d}function p(a){this.value=a}function q(a,b,c){this.tag=a,this.blocks=b,this.label=c}function r(a){this.blocks=a}function s(a,b){var c,d,e=[],f=[];if(Array.isArray(a)){for(var g=0;g<a.length;g++)d=a[g],"list-item"!=d.type&&"o-list-item"!=d.type?(c=new q(d.type,[],d.label),e.push(c)):c&&c.tag==d.type||(c=new q(d.type,[],d.label),e.push(c)),c.blocks.push(d);var h={heading1:"h1",heading2:"h2",heading3:"h3",paragraph:"p"};e.forEach(function(a){var c=a.label?' class ="'+a.label+'"':"";if(h[a.tag]){var d=h[a.tag];f.push("<"+d+c+">"+t(a.blocks[0].text,a.blocks[0].spans,b)+"</"+d+">")}else if("preformatted"==a.tag)f.push("<pre"+c+">"+a.blocks[0].text+"</pre>");else if("image"==a.tag)f.push("<p"+c+'><img src="'+a.blocks[0].url+'" alt="'+a.blocks[0].alt+'"></p>');else if("embed"==a.tag)f.push('<div data-oembed="'+a.blocks[0].embed_url+'" data-oembed-type="'+a.blocks[0].type+'" data-oembed-provider="'+a.blocks[0].provider_name+c+'">'+a.blocks[0].oembed.html+"</div>");else{if("list-item"!=a.tag&&"o-list-item"!=a.tag)throw new Error(a.tag+" not implemented");f.push("list-item"==a.tag?"<ul>":"<ol>"),a.blocks.forEach(function(a){f.push("<li>"+t(a.text,a.spans,b)+"</li>")}),f.push("list-item"==a.tag?"</ul>":"</ol>")}})}return f.join("")}function t(a,b,c){function d(a,b){if("hyperlink"===a.type){var d=u(a.data);return d?b?'<a href="'+d.url(c)+'">':"</a>":(console&&console.error&&console.error("Impossible to convert span.data as a Fragment",a),"")}return"label"===a.type?b?'<span class="'+a.data.label+'">':"</span>":"<"+(b?"":"/")+a.type+">"}if(!b||!b.length)return a;var e=[],f={},g={};b.forEach(function(a){f[a.start]||(f[a.start]=[]),g[a.end]||(g[a.end]=[]),f[a.start].push(d(a,!0)),g[a.end].unshift(d(a,!1)),e.push(a.start,a.end)}),e=e.filter(function(a,b,c){return c.indexOf(a)===b}).sort(function(a,b){return a-b});var h=[],i=0;return e.forEach(function(b){h.push(a.substring(i,b)),h=h.concat(g[b]||[]),h=h.concat(f[b]||[]),i=b}),h.push(a.substring(i)),h.join("")}function u(a){var q,s;switch(a.type){case"Color":q=new h(a.value);break;case"Number":q=new j(a.value);break;case"Date":q=new k(a.value);break;case"Timestamp":q=new l(a.value);break;case"Text":q=new b(a.value);break;case"Embed":q=new m(a.value);break;case"GeoPoint":q=new i(a.value.latitude,a.value.longitude);break;case"Select":q=new g(a.value);break;case"Image":s=a.value.main,q=new n(new o(s.url,s.dimensions.width,s.dimensions.height,s.alt),{});for(var t in a.value.views)s=a.value.views[t],q.views[t]=new o(s.url,s.dimensions.width,s.dimensions.height,s.alt);break;case"StructuredText":q=new r(a.value);break;case"Link.document":q=new c(a.value);break;case"Link.web":q=new d(a.value);break;case"Link.file":q=new e(a.value);break;case"Link.image":q=new f(a.value);break;case"Group":for(var v=[],w=0;w<a.value.length;w++){var x={};for(var y in a.value[w])x[y]=u(a.value[w][y]);v.push(x)}q=new p(v);break;default:console.log("Fragment type not supported: ",a.type)}return q}b.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},c.prototype={asHtml:function(a){return'<a href="'+this.url(a)+'">'+this.url(a)+"</a>"},url:function(a){return a.linkResolver(a,this.document,this.isBroken)},asText:function(a){return this.url(a)}},d.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},e.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},f.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},g.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},h.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},i.prototype={asHtml:function(){return'<div class="geopoint"><span class="latitude">'+this.latitude+'</span><span class="longitude">'+this.longitude+"</span></div>"},asText:function(){return"("+this.latitude+","+this.longitude+")"}},j.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},k.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},l.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},m.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},n.prototype={getView:function(a){return"main"===a?this.main:this.views[a]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},o.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return"<img src="+this.url+" width="+this.width+" height="+this.height+' alt="'+this.alt+'">'},asText:function(){return""}},p.prototype={asHtml:function(a){for(var b="",c=0;c<this.value.length;c++)for(var d in this.value[c])b+='<section data-field="'+d+'">',b+=this.value[c][d].asHtml(a),b+="</section>";return b},toArray:function(){return this.value},asText:function(a){for(var b="",c=0;c<this.value.length;c++)for(var d in this.value[c])b+=this.value[c][d].asText(a);return b}},r.prototype={getTitle:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if(0==b.type.indexOf("heading"))return b}},getFirstParagraph:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if("paragraph"==b.type)return b}},getParagraphs:function(){for(var a=[],b=0;b<this.blocks.length;b++){var c=this.blocks[b];"paragraph"==c.type&&a.push(c)}return a},getParagraph:function(a){return this.getParagraphs()[a]},getFirstImage:function(){for(var a=0;a<this.blocks.length;a++){var b=this.blocks[a];if("image"==b.type)return new o(b.url,b.dimensions.width,b.dimensions.height,b.alt)}},asHtml:function(a){return s.call(this,this.blocks,a)},asText:function(){for(var a=[],b=0;b<this.blocks.length;b++){var c=this.blocks[b];c.text&&a.push(c.text)}return a.join(" ")}},a.Prismic.Fragments={Image:n,ImageView:o,Text:b,Number:j,Date:k,Timestamp:l,Select:g,Color:h,StructuredText:r,WebLink:d,DocumentLink:c,ImageLink:f,FileLink:e,Group:p,GeoPoint:i,initField:u,insertSpans:t}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);

@@ -24,5 +24,7 @@ module.exports = function(grunt) {

qunit: {
files: ['test/**/*.html']
local: ['./test/**/*.html'],
int: { options: { urls: ['http://localhost:8888/test/test.html'] }},
unit: { options: { urls: ['http://localhost:8888/test/unit.html'] }}
},
clean: {

@@ -38,3 +40,3 @@ src: ['dist/prismic.io.js','dist/prismic.io.min.js', 'doc']

},
uglify: {

@@ -80,2 +82,16 @@ options: {

}
},
connect: {
options: {
hostname: 'localhost',
port: 8888,
base: '.',
},
testAuto: {},
test: {
options: {
keepalive: true
}
}
}

@@ -91,2 +107,3 @@

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-bump');

@@ -104,2 +121,11 @@ grunt.loadNpmTasks('grunt-jsdoc');

};
// Launch a local test server and run the tests on it
// or keep the server running so you can debug on your browser
grunt.registerTask('test', ['connect:testAuto', 'qunit:int', 'qunit:unit']);
grunt.registerTask('test:local', ['qunit:local']);
grunt.registerTask('test:int', ['connect:testAuto', 'qunit:int']);
grunt.registerTask('test:unit', ['connect:testAuto', 'qunit:unit']);
grunt.registerTask('test:browser', ['connect:test']);
};

@@ -12,3 +12,3 @@ {

],
"version": "1.0.12",
"version": "1.0.13",
"devDependencies": {

@@ -21,2 +21,3 @@ "grunt": "~0.4.1",

"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-connect": "0.8.0",
"grunt-bump": "~0.0.13",

@@ -29,3 +30,6 @@ "grunt-jsdoc": "~0.5.4"

},
"main": "dist/prismic.io"
"main": "dist/prismic.io",
"scripts:": {
"test": "grunt test"
}
}
## JavaScript development kit for prismic.io
[![Build Status](https://api.travis-ci.org/prismicio/javascript-kit.png)](https://travis-ci.org/prismicio/javascript-kit)
### Getting started

@@ -72,6 +74,12 @@

Please write tests in [test/test.js](test/test.js) for any bugfix or new feature, following the [very simple QUnit syntax](http://qunitjs.com/).
Please write tests in [test/test.js](test/test.js) for any bugfix or new feature, following the [very simple QUnit syntax](http://qunitjs.com/), if you need to test with a real Prismic.io repository. Otherwise use [test/unit.js](test/unit.js) for unit testing features.
Execute the tests either by opening [test/test.html](test/test.html) in a browser, or by running ```grunt qunit```.
Execute the tests either by opening [test/test.html](test/test.html) or [test/unit.html](test/unit.html) in a browser, or by using Grunt:
* ```grunt test``` will run all the tests and display the result on your shell
* ```grunt test:int``` will run all integration tests (the ones from [test/test.html](test/test.html))
* ```grunt test:unit``` will run all unit tests (the ones from [test/unit.html](test/unit.html))
* ```grunt test:browser``` will start a local server at [http://localhost:8888](http://localhost:8888) so that you can run the tests on your browser
* ```grunt test:local``` will test the local files without starting any server
If you find existing code that is not optimally tested and wish to make it better, we really appreciate it; but you should document it on its own branch and its own pull request.

@@ -78,0 +86,0 @@

@@ -226,6 +226,5 @@ (function (Global, undefined) {

if(this.accessToken) {
f.fields['accessToken'] = {
type: 'string',
default: this.accessToken
};
f.fields['accessToken'] = {};
f.fields['accessToken']['type'] = 'string';
f.fields['accessToken']['default'] = this.accessToken;
}

@@ -377,4 +376,4 @@

for(var field in form.fields) {
if(form.fields[field].default) {
this.data[field] = [form.fields[field].default];
if(form.fields[field]['default']) {
this.data[field] = [form.fields[field]['default']];
}

@@ -510,2 +509,21 @@ }

/* Removing incorrect spans from StructuredText fragments */
// This should be removed when the issue is fixed in the API
for(var fragmentKey in fragments) {
var fragment = fragments[fragmentKey];
if (fragment.type === 'StructuredText') {
for (var blockKey in fragment.value) {
var block = fragment.value[blockKey];
var newSpanArray = [];
for (var spanKey in block.spans) {
var span = block.spans[spanKey];
if (span.start < span.end) {
newSpanArray.push(span);
}
}
block['spans'] = newSpanArray;
}
}
}
return new Doc(

@@ -864,2 +882,16 @@ doc.id,

/* Gets the GeoPoint fragment in the current Document object, for further manipulation.
* Typical use: document.getGeoPoint('blog-post.location').asHtml(ctx)
*
* @param {string} fragment - The name of the fragment to get, with its type; for instance, "blog-post.location"
* @returns {GeoPoint} - The GeoPoint object to manipulate
*/
getGeoPoint: function(fragment) {
var fragment = this.get(fragment);
if(fragment instanceof Global.Prismic.Fragments.GeoPoint) {
return fragment;
}
},
/**

@@ -866,0 +898,0 @@ * Gets the Group fragment in the current Document object, for further manipulation.

@@ -281,2 +281,42 @@ (function (Global, undefined) {

/**
* Embodies a geopoint
* @constructor
* @global
* @alias Fragments:GeoPoint
*/
function GeoPoint(latitude, longitude) {
/**
* @field
* @description the latitude of the geo point
*/
this.latitude = latitude;
/**
* @field
* @description the longitude of the geo point
*/
this.longitude = longitude;
}
GeoPoint.prototype = {
/**
* Turns the fragment into a useable HTML version of it.
* If the native HTML code doesn't suit your design, this function is meant to be overriden.
*
* @returns {string} - basic HTML code for the fragment
*/
asHtml: function () {
return '<div class="geopoint"><span class="latitude">' + this.latitude + '</span><span class="longitude">' + this.longitude + '</span></div>';
},
/**
* Turns the fragment into a useable text version of it.
*
* @returns {string} - basic text version of the fragment
*/
asText: function() {
return '(' + this.latitude + "," + this.longitude + ')';
}
};
/**
* Embodies a Number fragment

@@ -316,8 +356,8 @@ * @constructor

/**
* Embodies a DateTime fragment
* Embodies a Date fragment
* @constructor
* @global
* @alias Fragments:DateTime
* @alias Fragments:Date
*/
function DateTime(data) {
function DateFragment(data) {
/**

@@ -330,3 +370,3 @@ * @field

DateTime.prototype = {
DateFragment.prototype = {
/**

@@ -353,2 +393,39 @@ * Turns the fragment into a useable HTML version of it.

/**
* Embodies a Timestamp fragment
* @constructor
* @global
* @alias Fragments:Timestamp
*/
function Timestamp(data) {
/**
* @field
* @description the Date value of the fragment (as a regular JS Date object)
*/
// Adding ":" in the locale if needed, so JS considers it ISO8601-compliant
var correctIso8601Date = (data.length == 24) ? data.substring(0, 22) + ':' + data.substring(22, 24) : data;
this.value = new Date(correctIso8601Date);
}
Timestamp.prototype = {
/**
* Turns the fragment into a useable HTML version of it.
* If the native HTML code doesn't suit your design, this function is meant to be overriden.
*
* @returns {string} - basic HTML code for the fragment
*/
asHtml: function () {
return "<time>" + this.value + "</time>";
},
/**
* Turns the fragment into a useable text version of it.
*
* @returns {string} - basic text version of the fragment
*/
asText: function() {
return this.value.toString();
}
};
/**
* Embodies an embed fragment

@@ -490,3 +567,3 @@ * @constructor

}
}
};

@@ -544,3 +621,3 @@ /**

}
}
};

@@ -554,5 +631,6 @@

*/
function BlockGroup(tag, blocks) {
function BlockGroup(tag, blocks, label) {
this.tag = tag;
this.blocks = blocks;
this.label = label;
}

@@ -669,7 +747,7 @@

if (block.type != "list-item" && block.type != "o-list-item") { // it's not a type that groups
blockGroup = new BlockGroup(block.type, []);
blockGroup = new BlockGroup(block.type, [], block.label);
blockGroups.push(blockGroup);
}
else if (!blockGroup || blockGroup.tag != block.type) { // it's a new type or no BlockGroup was set so far
blockGroup = new BlockGroup(block.type, []);
blockGroup = new BlockGroup(block.type, [], block.label);
blockGroups.push(blockGroup);

@@ -680,23 +758,27 @@ }

blockGroup.blocks.push(block);
}
var TAG_NAMES = {
"heading1": "h1",
"heading2": "h2",
"heading3": "h3",
"heading4": "h4",
"heading5": "h5",
"heading6": "h6",
"paragraph": "p"
};
blockGroups.forEach(function (blockGroup) {
if(blockGroup.tag == "heading1") {
html.push('<h1>' + insertSpans(blockGroup.blocks[0].text, blockGroup.blocks[0].spans, ctx) + '</h1>');
var classCode = blockGroup.label ? ' class ="' + blockGroup.label + '"' : '';
if (TAG_NAMES[blockGroup.tag]) {
var name = TAG_NAMES[blockGroup.tag];
html.push('<' + name + classCode + '>'
+ insertSpans(blockGroup.blocks[0].text, blockGroup.blocks[0].spans, ctx)
+ '</' + name + '>');
}
else if(blockGroup.tag == "heading2") {
html.push('<h2>' + insertSpans(blockGroup.blocks[0].text, blockGroup.blocks[0].spans, ctx) + '</h2>');
}
else if(blockGroup.tag == "heading3") {
html.push('<h3>' + insertSpans(blockGroup.blocks[0].text, blockGroup.blocks[0].spans, ctx) + '</h3>');
}
else if(blockGroup.tag == "paragraph") {
html.push('<p>' + insertSpans(blockGroup.blocks[0].text, blockGroup.blocks[0].spans, ctx) + '</p>');
}
else if(blockGroup.tag == "preformatted") {
html.push('<pre>' + blockGroup.blocks[0].text + '</pre>');
html.push('<pre' + classCode + '>' + blockGroup.blocks[0].text + '</pre>');
}
else if(blockGroup.tag == "image") {
html.push('<p><img src="' + blockGroup.blocks[0].url + '" alt="' + blockGroup.blocks[0].alt + '"></p>');
html.push('<p' + classCode + '><img src="' + blockGroup.blocks[0].url + '" alt="' + blockGroup.blocks[0].alt + '"></p>');
}

@@ -707,2 +789,3 @@ else if(blockGroup.tag == "embed") {

+ '" data-oembed-provider="'+ blockGroup.blocks[0].provider_name
+ classCode
+ '">' + blockGroup.blocks[0].oembed.html+"</div>")

@@ -729,5 +812,4 @@ }

*
* @private
* @param {string} text - the original text of the block
* @param {object} span - the spans as returned by the API
* @param {object} spans - the spans as returned by the API
* @param {object} ctx - the context object, containing the linkResolver function to build links that may be in the fragment (please read prismic.io's online documentation about this)

@@ -737,42 +819,56 @@ * @returns {string} - the HTML output

function insertSpans(text, spans, ctx) {
var textBits = [];
var tags = [];
var cursor = 0;
var html = [];
function getTag(span, isStart) {
if (span.type === 'hyperlink') {
var fragment = initField(span.data);
if (fragment) {
return (isStart ? '<a href="' + fragment.url(ctx) + '">' : '</a>');
} else {
console && console.error && console.error('Impossible to convert span.data as a Fragment', span);
return '';
}
}
if (span.type === 'label') {
return (isStart ? '<span class="' + span.data.label + '">' : '</span>');
}
return '<' + (isStart ? '': '/') + span.type + '>'
}
/* checking the spans are following each other, or else not doing anything */
spans.forEach(function(span){
if (span.end < span.start) return text;
if (span.start < cursor) return text;
cursor = span.end;
});
// Ultimate optimization!
// You know... doing nothing when there is nothing to be done
if (!spans || !spans.length) {
return text;
}
cursor = 0;
var positions = [];
var tagsStart = {};
var tagsEnd = {};
spans.forEach(function(span){
textBits.push(text.substring(0, span.start-cursor));
text = text.substring(span.start-cursor);
cursor = span.start;
textBits.push(text.substring(0, span.end-cursor));
text = text.substring(span.end-cursor);
tags.push(span);
cursor = span.end;
spans.forEach(function (span) {
if (!tagsStart[span.start]) { tagsStart[span.start] = []; }
if (!tagsEnd[span.end]) { tagsEnd[span.end] = []; }
tagsStart[span.start].push(getTag(span, true));
tagsEnd[span.end].unshift(getTag(span, false));
positions.push(span.start, span.end);
});
textBits.push(text);
tags.forEach(function(tag, index){
html.push(textBits.shift());
if(tag.type == "hyperlink"){
// Since the content of tag.data is similar to a link fragment, we can initialize it just like a fragment.
html.push('<a href="'+ initField(tag.data).url(ctx) +'">');
html.push(textBits.shift());
html.push('</a>');
} else {
html.push('<'+tag.type+'>');
html.push(textBits.shift());
html.push('</'+tag.type+'>');
}
positions = positions.filter(function (elem, index, self) {
return self.indexOf(elem) === index;
}).sort(function(a, b) {
return a - b;
});
html.push(textBits.shift());
var html = [];
var cursor = 0;
positions.forEach(function (pos) {
html.push(text.substring(cursor, pos));
html = html.concat(tagsEnd[pos] || []);
html = html.concat(tagsStart[pos] || []);
cursor = pos;
});
html.push(text.substring(cursor));
return html.join('');

@@ -790,4 +886,3 @@ }

var output,
img;
var output, img;

@@ -805,5 +900,9 @@ switch (field.type) {

case "Date":
output = new DateTime(field.value);
output = new DateFragment(field.value);
break;
case "Timestamp":
output = new Timestamp(field.value);
break;
case "Text":

@@ -817,2 +916,6 @@ output = new Text(field.value);

case "GeoPoint":
output = new GeoPoint(field.value.latitude, field.value.longitude);
break;
case "Select":

@@ -823,3 +926,3 @@ output = new Select(field.value);

case "Image":
var img = field.value.main;
img = field.value.main;
output = new ImageEl(

@@ -835,3 +938,3 @@ new ImageView(

for (var name in field.value.views) {
var img = field.value.views[name];
img = field.value.views[name];
output.views[name] = new ImageView(

@@ -894,3 +997,4 @@ img.url,

Number: Num,
Date: DateTime,
Date: DateFragment,
Timestamp: Timestamp,
Select: Select,

@@ -904,5 +1008,7 @@ Color: Color,

Group: Group,
initField: initField
GeoPoint: GeoPoint,
initField: initField,
insertSpans: insertSpans
}
}(typeof exports === 'object' && exports ? exports : (typeof module === "object" && module && typeof module.exports === "object" ? module.exports : window)));

@@ -7,3 +7,2 @@ (function(Prismic) {

// This token allow to preview future releases of this repository (nothing secret ;)
previewToken = 'MC5VbDdXQmtuTTB6Z0hNWHF3.c--_vVbvv73vv73vv73vv71EA--_vS_vv73vv70T77-9Ke-_ve-_vWfvv70ebO-_ve-_ve-_vQN377-9ce-_vRfvv70',

@@ -79,3 +78,3 @@

equal(documents.results.length, 20);
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=2&pageSize=20");
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UlfoxUnM08QWYXdl&page=2&pageSize=20");
equal(documents.page, 1);

@@ -111,3 +110,3 @@ equal(documents.prev_page, null);

equal(documents.results.length, 20);
equal(documents.results[0].id, 'UkL0gMuvzYUANCpm');
equal(documents.results[0].id, 'UlfoxUnM0wkXYXbj');
start();

@@ -126,3 +125,3 @@ });

equal(documents.page, 2);
equal(documents.prev_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=1&pageSize=20");
equal(documents.prev_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UlfoxUnM08QWYXdl&page=1&pageSize=20");
equal(documents.results_per_page, 20);

@@ -143,3 +142,3 @@ equal(documents.results_size, 20);

equal(documents.results.length, 10);
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=2&pageSize=10");
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UlfoxUnM08QWYXdl&page=2&pageSize=10");
equal(documents.page, 1);

@@ -162,5 +161,5 @@ equal(documents.prev_page, null);

equal(documents.results.length, 10);
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=3&pageSize=10");
equal(documents.next_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UlfoxUnM08QWYXdl&page=3&pageSize=10");
equal(documents.page, 2);
equal(documents.prev_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=1&pageSize=10");
equal(documents.prev_page, "https://lesbonneschoses.prismic.io/api/documents/search?ref=UlfoxUnM08QWYXdl&page=1&pageSize=10");
equal(documents.results_per_page, 10);

@@ -180,3 +179,3 @@ equal(documents.results_size, 10);

ok(err);
equal(err.message, "Unexpected status code [400] on URL https://lesbonneschoses.prismic.io/api/documents/search?page=1&pageSize=20&ref=UkL0hcuvzYUANCrm&q=wrongpredicate");
equal(err.message, "Unexpected status code [400] on URL https://lesbonneschoses.prismic.io/api/documents/search?page=1&pageSize=20&ref=UlfoxUnM08QWYXdl&q=wrongpredicate");
start();

@@ -260,3 +259,3 @@ });

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpV")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbg")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -286,3 +285,3 @@ var doc = documents.results[0];

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpr")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbX")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -293,3 +292,3 @@ function fix(s) {

}
equal(fix(documents.results[0].asText(ctx)), fix("Get the right approach to ganache A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache. Indeed, ganache is the macaron's softener, or else, macarons would be but tough biscuits; it is the cupcake's wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies' content. How to approach ganache Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache: working from the top down: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk) working from the bottom up: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer. We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it! Ganache at Les Bonnes Choses We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\" As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they're given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they'll thrive as they work on other kinds of preparations. About the chocolate in our ganache Now, we've also had a lot of questions about how our chocolate gets made. It's true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.Ganache is a tricky topic, but here's some guidance.Tue Jul 23 2013 17:00:00 GMT-0700 (PDT)Steve Adams, Ganache SpecialistDo it yourselfYes/testing_url/UkL0gMuvzYUANCpm/triple-chocolate-cupcake?ref=XXXXX/testing_url/UkL0gMuvzYUANCpn/tips-to-dress-a-pastry?ref=XXXXX"));
equal(fix(documents.results[0].asText(ctx)), fix("Get the right approach to ganache A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache. Indeed, ganache is the macaron's softener, or else, macarons would be but tough biscuits; it is the cupcake's wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies' content. How to approach ganache Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache: working from the top down: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk) working from the bottom up: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer. We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it! Ganache at Les Bonnes Choses We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\" As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they're given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they'll thrive as they work on other kinds of preparations. About the chocolate in our ganache Now, we've also had a lot of questions about how our chocolate gets made. It's true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.Ganache is a tricky topic, but here's some guidance.Tue Jul 23 2013 17:00:00 GMT-0700 (PDT)Steve Adams, Ganache SpecialistDo it yourselfYes/testing_url/UlfoxUnM0wkXYXbj/triple-chocolate-cupcake?ref=XXXXX/testing_url/UlfoxUnM0wkXYXbm/tips-to-dress-a-pastry?ref=XXXXX"));
start();

@@ -303,3 +302,3 @@ });

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpr")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbX")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -315,3 +314,3 @@ equal(documents.results[0].getStructuredText('blog-post.body').asHtml(), '<h1>Get the right approach to ganache</h1><p>A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache.</p><p>Indeed, ganache is the macaron\'s softener, or else, macarons would be but tough biscuits; it is the cupcake\'s wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies\' content.</p><h2>How to approach ganache</h2><p><img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/ee7b984b98db4516aba2eabd54ab498293913c6c.jpg\" alt=\"\"></p><p>Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache:</p><ul><li><strong>working from the top down</strong>: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk)</li><li><strong>working from the bottom up</strong>: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer.</li></ul><p>We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it!</p><h2>Ganache at <em>Les Bonnes Choses</em></h2><p>We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\"</p><p>As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they\'re given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they\'ll thrive as they work on other kinds of preparations.</p><h2>About the chocolate in our ganache</h2><p>Now, we\'ve also had a lot of questions about how our chocolate gets made. It\'s true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.</p><div data-oembed=\"undefined\" data-oembed-type=\"embed\" data-oembed-provider=\"undefined\"><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/Ye78F3-CuXY?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe></div>');

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpr")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbX")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -338,3 +337,3 @@ equal(documents.results[0].getStructuredText('blog-post.body').asText(), "Get the right approach to ganache A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache. Indeed, ganache is the macaron's softener, or else, macarons would be but tough biscuits; it is the cupcake's wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies' content. How to approach ganache Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache: working from the top down: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk) working from the bottom up: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer. We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it! Ganache at Les Bonnes Choses We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\" As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they're given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they'll thrive as they work on other kinds of preparations. About the chocolate in our ganache Now, we've also had a lot of questions about how our chocolate gets made. It's true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.");

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCps")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbt")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -350,3 +349,3 @@ equal(documents.results[0].getStructuredText('blog-post.body').asHtml(), '<h1>The end of a chapter the beginning of a new one</h1><p><img src="https://prismic-io.s3.amazonaws.com/lesbonneschoses/8181933ff2f5032daff7d732e33a3beb6f57e09f.jpg" alt=\"\"></p><p>Jean-Michel Pastranova, the founder of <em>Les Bonnes Choses</em>, and creator of the whole concept of modern fine pastry, has decided to step down as the CEO and the Director of Workshops of <em>Les Bonnes Choses</em>, to focus on other projects, among which his now best-selling pastry cook books, but also to take on a primary role in a culinary television show to be announced later this year.</p><p>"I believe I\'ve taken the <em>Les Bonnes Choses</em> concept as far as it can go. <em>Les Bonnes Choses</em> is already an entity that is driven by its people, thanks to a strong internal culture, so I don\'t feel like they need me as much as they used to. I\'m sure they are greater ways to come, to innovate in pastry, and I\'m sure <em>Les Bonnes Choses</em>\'s coming innovation will be even more mind-blowing than if I had stayed longer."</p><p>He will remain as a senior advisor to the board, and to the workshop artists, as his daughter Selena, who has been working with him for several years, will fulfill the CEO role from now on.</p><p>"My father was able not only to create a revolutionary concept, but also a company culture that puts everyone in charge of driving the company\'s innovation and quality. That gives us years, maybe decades of revolutionary ideas to come, and there\'s still a long, wonderful path to walk in the fine pastry world."</p>');

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCph")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbW")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -362,5 +361,5 @@ equal(documents.results[0].getStructuredText('job-offer.profile').asHtml(), '<p>As a company whose marketing is very content-centric, we expect our Content Director to have a tremendous experience, both in content strategy, and in content writing. We expect our applicants to show off some of the content strategies they set up themselves, explaining their choices, and to provide amazing contents they personally wrote.</p><p>Our contents get flexibly powerfully shared on various supports: our site, our in-store printed magazine, our mobile apps, our mailings ... Our Content Director must have experience with all of those, and with using modern adaptive content managers such as <a href=\"http://prismic.io\">prismic.io</a>.</p>');

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpo")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbl")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }
equal(documents.results[0].getStructuredText('blog-post.body').asHtml(ctx), '<h1>Our world-famous Pastry Art Brainstorm event</h1><p><img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\"></p><p>Each year, <em>Les Bonnes Choses</em> organizes a world-famous two-day event called the \"Pastry Art Brainstorm\", and which is the perfect excuse for every fine pastry artist in the world to exercise their art, and build their skills up. The event is a multiple win-win operation, at many levels: see what the event is, as seen by many point of views.</p><h2>As seen by the top pastry artists worldwide</h2><p>The event always starts with half a day of conference talks, given by the most insightful pastry artists in the world, selected for having made tremendous achievements in pastry that year. The list of invited guest speakers is decided jointly by the <em>Les Bonnes Choses</em> staff and the Fine Pastry Magazine editors.</p><p>This is great for the speakers, who get an occasion to share their work, and have people build up on it with them.</p><h2>As seen by the pastry professionals</h2><p>After half a day of thoughtful conference, the professionals will get to put what they learned to good use, and mingle with the best artists worldwide to make the most daring pastries together. There are no set rules about who does what during this giant innovation workshop, and many crazy ideas get created out of thin air. As a virtually infinite amount of ingredients is provided by the <em>Les Bonnes Choses</em> staff, many unexpected pastries happen on that day, and professionals taste each other\'s creations, and provide relevant feedback to each other. Most pieces get showcased to the amateur audience as well, who get invited to taste some of the pieces.</p><p>At noon on the second day, teams are expected to subscribe to our Pastry Art Challenge, during which they will make the best possible pastry, judged on many aspects (originality, taste, looks, ...) by a jury of amateurs and professionals. The team members of the three winning pieces share a substantial prize, and their pastries may even join the Les Bonnes Choses catalogue, and be offered in all the <em>Les Bonnes Choses</em> shops worldwide!</p><h2>As seen by the pastry amateurs</h2><p>The conference is limited with a reasonable fee; but the showcase is open to everyone, although visitors are often expected to pay the pastry chefs for the pastries they taste. The educated amateurs spend their day tasting the most daring pieces, giving some appreciated feedback to their chefs, and challenging their own tastebuds. The novice amateurs usually get a once-in-a-lifetime experience, and often mention being blown away by how rich the fine pastry art can be. All in all, every one goes home with a smile on their faces!</p><h2>As seen by the Les Bonnes Choses interns</h2><p>Every year, we recruit a very limited amount of interns, who get aboard a <a href=\"/testing_url/UkL0gMuvzYUANCpp/les-bonnes-chosess-internship-a-testimony?ref=XXXXX\">life-defining adventure around fine pastries</a>, discovering <em>Les Bonnes Choses</em> during half a year, with part of this time spent in one of our shops abroad. We always manage to get them on board at a time when we know they will be able to attend a Fine Pastry Brainstorm, because we consider it is a very defining element in the experience of being part of <em>Les Bonnes Choses</em>.</p><p>Not only do we invite them to the event (whatever the country they are stationed in when the event happens), but we give them a front-row seat! They are part of the jury for the Fine Pastry Challenge, they are introduced to every speaker as the next generation of pastry (thus having the occasion to learn even more, directly from them).</p><h2>As seen by fine pastry as a field</h2><p>There wasn\'t really an international occasion for pastry artists to join and share, before <em>Les Bonnes Choses</em> came up with the first Fine Pastry Brainstorm, in 2006. Fine Pastry Magazine\'s first edition was out in 2004, and initiated the idea that pastry art needed to be shared better between professionals. But a proper event to meet up in person was missing, and <em>Les Bonnes Choses</em> is proud to be the one to have come up with it first.</p><p>Since then, more local initiatives have been started (notably in Argentina, and Canada), but none comes close to the size of <em>Les Bonnes Choses</em>\'s international Fine Pastry Brainstorm.</p><h2>As seen by <em>Les Bonnes Choses</em></h2><p>As the almost only sponsor of every edition of the event, <em>Les Bonnes Choses</em> makes sure enough ingredients are available for everyone, rents the premises, makes sure the speakers are as comfortable as possible, and takes care of the whole organization! But through the operation, <em>Les Bonnes Choses</em> gains much more than any sponsoring can buy: not only does it get to secure <em>Les Bonnes Choses</em> as the world reference in pastry arts, but it also allows them to claim rightfully that they do offer in their shops the best pastries, created by the world top artists indeed.</p>');
equal(documents.results[0].getStructuredText('blog-post.body').asHtml(ctx), '<h1>Our world-famous Pastry Art Brainstorm event</h1><p><img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\"></p><p>Each year, <em>Les Bonnes Choses</em> organizes a world-famous two-day event called the \"Pastry Art Brainstorm\", and which is the perfect excuse for every fine pastry artist in the world to exercise their art, and build their skills up. The event is a multiple win-win operation, at many levels: see what the event is, as seen by many point of views.</p><h2>As seen by the top pastry artists worldwide</h2><p>The event always starts with half a day of conference talks, given by the most insightful pastry artists in the world, selected for having made tremendous achievements in pastry that year. The list of invited guest speakers is decided jointly by the <em>Les Bonnes Choses</em> staff and the Fine Pastry Magazine editors.</p><p>This is great for the speakers, who get an occasion to share their work, and have people build up on it with them.</p><h2>As seen by the pastry professionals</h2><p>After half a day of thoughtful conference, the professionals will get to put what they learned to good use, and mingle with the best artists worldwide to make the most daring pastries together. There are no set rules about who does what during this giant innovation workshop, and many crazy ideas get created out of thin air. As a virtually infinite amount of ingredients is provided by the <em>Les Bonnes Choses</em> staff, many unexpected pastries happen on that day, and professionals taste each other\'s creations, and provide relevant feedback to each other. Most pieces get showcased to the amateur audience as well, who get invited to taste some of the pieces.</p><p>At noon on the second day, teams are expected to subscribe to our Pastry Art Challenge, during which they will make the best possible pastry, judged on many aspects (originality, taste, looks, ...) by a jury of amateurs and professionals. The team members of the three winning pieces share a substantial prize, and their pastries may even join the Les Bonnes Choses catalogue, and be offered in all the <em>Les Bonnes Choses</em> shops worldwide!</p><h2>As seen by the pastry amateurs</h2><p>The conference is limited with a reasonable fee; but the showcase is open to everyone, although visitors are often expected to pay the pastry chefs for the pastries they taste. The educated amateurs spend their day tasting the most daring pieces, giving some appreciated feedback to their chefs, and challenging their own tastebuds. The novice amateurs usually get a once-in-a-lifetime experience, and often mention being blown away by how rich the fine pastry art can be. All in all, every one goes home with a smile on their faces!</p><h2>As seen by the Les Bonnes Choses interns</h2><p>Every year, we recruit a very limited amount of interns, who get aboard a <a href=\"/testing_url/UlfoxUnM0wkXYXbu/les-bonnes-chosess-internship-a-testimony?ref=XXXXX\">life-defining adventure around fine pastries</a>, discovering <em>Les Bonnes Choses</em> during half a year, with part of this time spent in one of our shops abroad. We always manage to get them on board at a time when we know they will be able to attend a Fine Pastry Brainstorm, because we consider it is a very defining element in the experience of being part of <em>Les Bonnes Choses</em>.</p><p>Not only do we invite them to the event (whatever the country they are stationed in when the event happens), but we give them a front-row seat! They are part of the jury for the Fine Pastry Challenge, they are introduced to every speaker as the next generation of pastry (thus having the occasion to learn even more, directly from them).</p><h2>As seen by fine pastry as a field</h2><p>There wasn\'t really an international occasion for pastry artists to join and share, before <em>Les Bonnes Choses</em> came up with the first Fine Pastry Brainstorm, in 2006. Fine Pastry Magazine\'s first edition was out in 2004, and initiated the idea that pastry art needed to be shared better between professionals. But a proper event to meet up in person was missing, and <em>Les Bonnes Choses</em> is proud to be the one to have come up with it first.</p><p>Since then, more local initiatives have been started (notably in Argentina, and Canada), but none comes close to the size of <em>Les Bonnes Choses</em>\'s international Fine Pastry Brainstorm.</p><h2>As seen by <em>Les Bonnes Choses</em></h2><p>As the almost only sponsor of every edition of the event, <em>Les Bonnes Choses</em> makes sure enough ingredients are available for everyone, rents the premises, makes sure the speakers are as comfortable as possible, and takes care of the whole organization! But through the operation, <em>Les Bonnes Choses</em> gains much more than any sponsoring can buy: not only does it get to secure <em>Les Bonnes Choses</em> as the world reference in pastry arts, but it also allows them to claim rightfully that they do offer in their shops the best pastries, created by the world top artists indeed.</p>');
start();

@@ -374,3 +373,3 @@ });

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpo")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbl")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -397,5 +396,5 @@ equal(documents.results[0].getStructuredText('blog-post.body').getFirstImage().url, "https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg");

if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpr")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbX")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }
equal(documents.results[0].getAll('blog-post.relatedpost')[0].asHtml(ctx), '<a href="/testing_url/UkL0gMuvzYUANCpn/tips-to-dress-a-pastry?ref=XXXXX">/testing_url/UkL0gMuvzYUANCpn/tips-to-dress-a-pastry?ref=XXXXX</a>');
equal(documents.results[0].getAll('blog-post.relatedpost')[0].asHtml(ctx), '<a href="/testing_url/UlfoxUnM0wkXYXbm/tips-to-dress-a-pastry?ref=XXXXX">/testing_url/UlfoxUnM0wkXYXbm/tips-to-dress-a-pastry?ref=XXXXX</a>');
start();

@@ -406,6 +405,23 @@ });

test('Dates are well retrieved', function() {
var timestampHtml = Prismic.Fragments.initField({"type" : "Date", "value" : "2014-04-01"}).asHtml();
equal(
(new RegExp('<time>... ... \\d\\d 2014 \\d\\d:00:00 GMT[-+]\\d\\d00 \\(.+\\)</time>')).test(timestampHtml),
true
);
});
test('Timestamps are well retrieved', function() {
var timestampHtml = Prismic.Fragments.initField({"type" : "Timestamp", "value" : "2014-06-18T15:30:00+0000"}).asHtml();
equal(
(new RegExp('<time>... ... \\d\\d 2014 \\d\\d:30:00 GMT[-+]\\d\\d00 \\(.+\\)</time>')).test(timestampHtml),
true,
timestampHtml
);
});
asyncTest('ImageViews are well retrieved', 2, function() {
Prismic.Api(testRepository, function(err, Api) {
if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UkL0gMuvzYUANCpR")]]').ref(Api.master()).submit(function(err, documents) {
Api.form('everything').query('[[:d = at(document.id, "UlfoxUnM0wkXYXbO")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }

@@ -419,2 +435,14 @@ equal(documents.results[0].getImageView('product.image', 'main').asHtml(), '<img src=https://prismic-io.s3.amazonaws.com/lesbonneschoses/f606ad513fcc2a73b909817119b84d6fd0d61a6d.png width=500 height=500 alt="">');

asyncTest('GeoPoint is retrieved', 1, function() {
Prismic.Api(microRepository, function(err, Api) {
if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "U9pjvjQAADAAehbf")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }
var html = '<div class="geopoint"><span class="latitude">48.87687670000001</span><span class="longitude">2.3338801999999825</span></div>';
equal(documents.results[0].getGeoPoint('contributor.location').asHtml(), html);
start();
});
});
});
asyncTest('Block fragments are accessible, loopable, and serializable', 4, function() {

@@ -421,0 +449,0 @@ Prismic.Api(microRepository, function(err, Api) {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc