Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.19 to 1.0.20

dist/prismic.io-1.0.20.min.js

2

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

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

/*!
* prismic.io 1.0.19
* prismic.io 1.0.20
* See release notes: https://github.com/prismicio/javascript-kit/releases
*/
!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"),f=(require("querystring"),require("../package.json"));return function(g,h){if(a[g])h(null,a[g]);else{var i=e.parse(g),j="https:"==i.protocol?d:c,k={hostname:i.hostname,path:i.path,query:i.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+f.version+" NodeJS/"+process.version}};j.get(k,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"],f=e&&/max-age=(\d+)/.test(e)?parseInt(/max-age=(\d+)/.exec(e)[1]):b,i=JSON.parse(d);f&&(a[g]=i),h(null,i,c)})}else h(new Error("Unexpected status code ["+c.statusCode+"] on URL "+g),null,c)})}}}};k.fn=k.prototype={AT:"at",ANY:"any",EVERYTHING:"everything",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},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.access_token={},h.fields.access_token.type="string",h.fields.access_token["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){if("string"==typeof a)return this.set("q",a);var b="string"==typeof a[0]?[a]:a,c=[];return b.forEach(function(a){var b=0==a[1].indexOf("my.")||0==a[1].indexOf("document.")?a[1]:'"'+a[1]+'"';c.push("[:d = "+a[0]+"("+b+", "+function(){return a.slice(2).map(function(a){return"string"==typeof a?'"'+a+'"':Array.isArray(a)?"["+a.map(function(a){return'"'+a+'"'}).join(",")+"]":a}).join(",")}()+")]")}),this.query("["+c.join("")+"]")},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];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 d=this.get(b);if(d instanceof a.Prismic.Fragments.Image)return d.getView(c);if(d instanceof a.Prismic.Fragments.StructuredText)for(var e=0;e<d.blocks.length;e++)if("image"==d.blocks[e].type)return d.blocks[e];return null},getAllImageViews:function(a,b){return this.getAllImages(a).map(function(a){return a.getView(b)})},getDate:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Date?c.value:void 0},getBoolean:function(a){var b=this.get(a);return b.value&&("yes"==b.value.toLowerCase()||"on"==b.value.toLowerCase()||"true"==b.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 c=this.get(b);return c instanceof a.Prismic.Fragments.StructuredText?c:void 0},getNumber:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Number?c.value:void 0},getColor:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Color?c.value:void 0},getGeoPoint:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.GeoPoint?c:void 0},getGroup:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Group?c:void 0},getHtml:function(a,b){var c=this.get(a);return c&&c.asHtml?c.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){this.blocks=a}function r(a){return a&&a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(a,b,c,d){if(!b||!b.length)return r(a);var e={},f={};b.forEach(function(a){e[a.start]||(e[a.start]=[]),f[a.end]||(f[a.end]=[]),e[a.start].push(a),f[a.end].unshift(a)});for(var g,h="",i=[],j=0,k=a.length+1;k>j;j++)f[j]&&f[j].forEach(function(){var a=i.pop(),b=u(a.span,a.text,d);0==i.length?h+=b:i[i.length-1].text+=b}),e[j]&&(e[j].sort(function(a,b){return b.end-b.start-(a.end-a.start)}),e[j].forEach(function(a){var b=null;if("hyperlink"==a.type){var d=t(a.data);if(!d)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",a),"";b=d.url(c),a.url=b}var e={span:a,text:""};i.push(e)})),j<a.length&&(g=a[j],0==i.length?h+=r(g):i[i.length-1].text+=r(g));return h}function t(a){var r,s;switch(a.type){case"Color":r=new h(a.value);break;case"Number":r=new j(a.value);break;case"Date":r=new k(a.value);break;case"Timestamp":r=new l(a.value);break;case"Text":r=new b(a.value);break;case"Embed":r=new m(a.value);break;case"GeoPoint":r=new i(a.value.latitude,a.value.longitude);break;case"Select":r=new g(a.value);break;case"Image":s=a.value.main,r=new n(new o(s.url,s.dimensions.width,s.dimensions.height,s.alt),{});for(var u in a.value.views)s=a.value.views[u],r.views[u]=new o(s.url,s.dimensions.width,s.dimensions.height,s.alt);break;case"StructuredText":r=new q(a.value);break;case"Link.document":r=new c(a.value);break;case"Link.web":r=new d(a.value);break;case"Link.file":r=new e(a.value);break;case"Link.image":r=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]=t(a.value[w][y]);v.push(x)}r=new p(v);break;default:console&&console.log&&console.log("Fragment type not supported: ",a.type)}return r}function u(a,b,c){if(c){var d=c(a,b);if(d)return d}var e={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(e[a.type]){var f=e[a.type],g=a.label?' class="'+a.label+'"':"";return"<"+f+g+">"+b+"</"+f+">"}if("image"==a.type){var h=a.label?" "+a.label:"",i='<img src="'+a.url+'" alt="'+a.alt+'">';return'<p class="block-img'+h+'">'+(a.linkUrl?'<a href="'+a.linkUrl+'">'+i+"</a>":i)+"</p>"}return"embed"==a.type?'<div data-oembed="'+a.embed_url+'" data-oembed-type="'+a.type+'" data-oembed-provider="'+a.provider_name+(a.label?'" class="'+h:"")+'">'+a.oembed.html+"</div>":"hyperlink"===a.type?'<a href="'+a.url+'">'+b+"</a>":"label"===a.type?'<span class="'+a.data.label+'">'+b+"</span>":"<!-- Warning: "+a.type+" not implemented. Upgrade the Developer Kit. -->"+b}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}},q.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,b){var c,d,e=[],f=[];if(Array.isArray(this.blocks)){for(var g=0;g<this.blocks.length;g++){if(d=this.blocks[g],"image"==d.type&&d.linkTo){var h=t(d.linkTo);d.linkUrl=h.url(a)}"list-item"!==d.type&&"o-list-item"!==d.type?(e.push(d),c=null):c&&c.type=="group-"+d.type?c.blocks.push(d):(c={type:"group-"+d.type,blocks:[d]},e.push(c))}var i=function(c){var d="";return c.blocks?c.blocks.forEach(function(a){d+=u(a,i(a),b)}):d=s(c.text,c.spans,a,b),d};e.forEach(function(a){f.push(u(a,i(a),b))})}return f.join("")},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:q,WebLink:d,DocumentLink:c,ImageLink:f,FileLink:e,Group:p,GeoPoint:i,initField:t,insertSpans: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 e(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 f(a){return this.fragments&&this.fragments[a]?Array.isArray(this.fragments[a])?this.fragments[a]:[this.fragments[a]]:[]}function g(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 h(a,b,c,d){this.id=a,this.slug=b,this.type=c,this.tags=d}function i(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 j(a,b,c,d,e){this.ref=a,this.label=b,this.isMaster=c,this.scheduledAt=d,this.id=e}function k(){this.cache={},this.states={}}var l=function(a,b,c,d,e){var f=new l.fn.init(a,c,d,e);return b&&f.get(b),f},m=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},n=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},o=function(){if("function"==typeof require&&require("http")){var a={},c=require("http"),d=require("https"),e=require("url"),f=(require("querystring"),require("../package.json"));return function(g,h){if(a[g])h(null,a[g]);else{var i=e.parse(g),j="https:"==i.protocol?d:c,k={hostname:i.hostname,path:i.path,query:i.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+f.version+" NodeJS/"+process.version}};j.get(k,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"],f=e&&/max-age=(\d+)/.test(e)?parseInt(/max-age=(\d+)/.exec(e)[1]):b,i=JSON.parse(d);f&&(a[g]=i),h(null,i,c)})}else h(new Error("Unexpected status code ["+c.statusCode+"] on URL "+g),null,c)})}}}};l.fn=l.prototype={AT:"at",ANY:"any",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},constructor:l,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,i,k={};for(i in a.forms)a.forms.hasOwnProperty(i)&&(h=a.forms[i],this.accessToken&&(h.fields.access_token={},h.fields.access_token.type="string",h.fields.access_token["default"]=this.accessToken),e=new c(h.name,h.fields,h.form_method,h.rel,h.enctype,h.action),k[i]=e);if(b=a.refs.map(function(a){return new j(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||m()||n()||o()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}(),this.apiCache=d||new k,this},forms:function(a){return this.form(a)},form:function(a){var b=this.data.forms[a];return b?new e(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}},l.fn.init.prototype=l.fn,c.prototype={},e.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){if("string"==typeof a)return this.set("q",a);var b=[].slice.apply(arguments),c=[];return b.forEach(function(a){var b=0==a[1].indexOf("my.")||0==a[1].indexOf("document.")?a[1]:'"'+a[1]+'"';c.push("[:d = "+a[0]+"("+b+", "+function(){return a.slice(2).map(function(a){return"string"==typeof a?'"'+a+'"':Array.isArray(a)?"["+a.map(function(a){return'"'+a+'"'}).join(",")+"]":a instanceof Date?d.getTime():a}).join(",")}()+")]")}),this.query("["+c.join("")+"]")},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 f=0;f<e.length;f++)b+=c+d+"="+encodeURIComponent(e[f]),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 h(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 i(a.id,a.type,a.href,a.tags,a.slugs,b,c)});a(null,new g(c.page,c.results_per_page,c.results_size,c.total_results_size,c.total_pages,c.next_page,c.prev_page,e||[]),d)})}},i.prototype={get:function(b){var c=f.call(this,b);return c.length?a.Prismic.Fragments.initField(c[0]):null},getAll:function(b){return f.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 d=this.get(b);if(d instanceof a.Prismic.Fragments.Image)return d.getView(c);if(d instanceof a.Prismic.Fragments.StructuredText)for(var e=0;e<d.blocks.length;e++)if("image"==d.blocks[e].type)return d.blocks[e];return null},getAllImageViews:function(a,b){return this.getAllImages(a).map(function(a){return a.getView(b)})},getDate:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Date?c.value:void 0},getBoolean:function(a){var b=this.get(a);return b.value&&("yes"==b.value.toLowerCase()||"on"==b.value.toLowerCase()||"true"==b.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 c=this.get(b);return c instanceof a.Prismic.Fragments.StructuredText?c:void 0},getNumber:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Number?c.value:void 0},getColor:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Color?c.value:void 0},getGeoPoint:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.GeoPoint?c:void 0},getGroup:function(b){var c=this.get(b);return c instanceof a.Prismic.Fragments.Group?c:void 0},getHtml:function(a,b){var c=this.get(a);return c&&c.asHtml?c.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("")}},j.prototype={},k.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:l}}("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){this.blocks=a}function r(a){return a&&a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(a,b,c,d){if(!b||!b.length)return r(a);var e={},f={};b.forEach(function(a){e[a.start]||(e[a.start]=[]),f[a.end]||(f[a.end]=[]),e[a.start].push(a),f[a.end].unshift(a)});for(var g,h="",i=[],j=0,k=a.length+1;k>j;j++)f[j]&&f[j].forEach(function(){var a=i.pop(),b=v(a.span,a.text,d);0==i.length?h+=b:i[i.length-1].text+=b}),e[j]&&(e[j].sort(function(a,b){return b.end-b.start-(a.end-a.start)}),e[j].forEach(function(a){var b=null;if("hyperlink"==a.type){var d=t(a.data);if(!d)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",a),"";b=d.url(c),a.url=b}var e={span:a,text:""};i.push(e)})),j<a.length&&(g=a[j],0==i.length?h+=r(g):i[i.length-1].text+=r(g));return h}function t(a){var r,s;switch(a.type){case"Color":r=new h(a.value);break;case"Number":r=new j(a.value);break;case"Date":r=new k(a.value);break;case"Timestamp":r=new l(a.value);break;case"Text":r=new b(a.value);break;case"Embed":r=new m(a.value);break;case"GeoPoint":r=new i(a.value.latitude,a.value.longitude);break;case"Select":r=new g(a.value);break;case"Image":s=a.value.main,r=new n(new o(s.url,s.dimensions.width,s.dimensions.height,s.alt),{});for(var u in a.value.views)s=a.value.views[u],r.views[u]=new o(s.url,s.dimensions.width,s.dimensions.height,s.alt);break;case"StructuredText":r=new q(a.value);break;case"Link.document":r=new c(a.value);break;case"Link.web":r=new d(a.value);break;case"Link.file":r=new e(a.value);break;case"Link.image":r=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]=t(a.value[w][y]);v.push(x)}r=new p(v);break;default:console&&console.log&&console.log("Fragment type not supported: ",a.type)}return r}function u(a){var b={};return a&&"[object Function]"===b.toString.call(a)}function v(a,b,c){if(c){var d=c(a,b);if(d)return d}var e={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(e[a.type]){var f=e[a.type],g=a.label?' class="'+a.label+'"':"";return"<"+f+g+">"+b+"</"+f+">"}if("image"==a.type){var h=a.label?" "+a.label:"",i='<img src="'+a.url+'" alt="'+a.alt+'">';return'<p class="block-img'+h+'">'+(a.linkUrl?'<a href="'+a.linkUrl+'">'+i+"</a>":i)+"</p>"}return"embed"==a.type?'<div data-oembed="'+a.embed_url+'" data-oembed-type="'+a.type+'" data-oembed-provider="'+a.provider_name+(a.label?'" class="'+h:"")+'">'+a.oembed.html+"</div>":"hyperlink"===a.type?'<a href="'+a.url+'">'+b+"</a>":"label"===a.type?'<span class="'+a.data.label+'">'+b+"</span>":"<!-- Warning: "+a.type+" not implemented. Upgrade the Developer Kit. -->"+b}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(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}},q.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,b){var c,d,e=[],f=[];if(!u(a)){var g=a;a=function(a,b){return g.linkResolver(g,a,b)}}if(Array.isArray(this.blocks)){for(var h=0;h<this.blocks.length;h++){if(d=this.blocks[h],"image"==d.type&&d.linkTo){var i=t(d.linkTo);d.linkUrl=i.url(a)}"list-item"!==d.type&&"o-list-item"!==d.type?(e.push(d),c=null):c&&c.type=="group-"+d.type?c.blocks.push(d):(c={type:"group-"+d.type,blocks:[d]},e.push(c))}var j=function(c){var d="";return c.blocks?c.blocks.forEach(function(a){d+=v(a,j(a),b)}):d=s(c.text,c.spans,a,b),d};e.forEach(function(a){f.push(v(a,j(a),b))})}return f.join("")},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:q,WebLink:d,DocumentLink:c,ImageLink:f,FileLink:e,Group:p,GeoPoint:i,initField:t,insertSpans:s}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(a){"use strict";var b={at:function(a,b){return["at",a,b]},any:function(a,b){return["any",a,b]},fulltext:function(a,b){return["fulltext",a,b]},similar:function(a,b){return["similar",a,b]},gt:function(a,b){return["number.gt",a,b]},lt:function(a,b){return["number.lt",a,b]},inRange:function(a,b,c){return["number.inRange",a,b,c]},dateBefore:function(a,b){return["date.before",a,b]},dateAfter:function(a,b){return["date.after",a,b]},dateBetween:function(a,b,c){return["date.between",a,b,c]},dayOfMonth:function(a,b){return["date.day-of-month",a,b]},dayOfMonthAfter:function(a,b){return["date.day-of-month-after",a,b]},dayOfMonthBefore:function(a,b){return["date.day-of-month-before",a,b]},dayOfWeek:function(a,b){return["date.day-of-week",a,b]},dayOfWeekAfter:function(a,b){return["date.day-of-week-after",a,b]},dayOfWeekBefore:function(a,b){return["date.day-of-week-before",a,b]},month:function(a,b){return["date.month",a,b]},monthBefore:function(a,b){return["date.month-before",a,b]},monthAfter:function(a,b){return["date.month-after",a,b]},year:function(a,b){return["date.year",a,b]},hour:function(a,b){return["date.hour",a,b]},hourBefore:function(a,b){return["date.hour-before",a,b]},hourAfter:function(a,b){return["date.hour-after",a,b]},near:function(a,b,c){return["near",a,b,c]}};a.Prismic.Predicates=b}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);

@@ -35,3 +35,3 @@ module.exports = function(grunt) {

dist: {
src: ['src/api.js', 'src/fragments.js'],
src: ['src/api.js', 'src/fragments.js', 'src/predicates.js'],
dest: 'dist/prismic.io.js'

@@ -38,0 +38,0 @@ }

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

],
"version": "1.0.19",
"version": "1.0.20",
"devDependencies": {

@@ -15,0 +15,0 @@ "grunt": "~0.4.1",

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

// Predicates: usable as the first element of a query array.
// Predicates
AT: "at",
ANY: "any",
EVERYTHING: "everything",
SIMILAR: "similar",

@@ -455,5 +454,5 @@ FULLTEXT: "fulltext",

* paste what you compose in your prismic.io API browser.
* You can pass an empty string, the method will simply not send that query.
*
* @param {string} query - The query to perform
* @example form.query(Prismic.Predicates.at("document.id", "foobar"))
* @param {string|...array} query - Either a query as a string, or as many predicates as you want. See Prismic.Predicates.
* @returns {SearchForm} - The SearchForm itself

@@ -465,5 +464,3 @@ */

} else {
var predicates = (typeof query[0] === 'string')
? [query]
: query;
var predicates = [].slice.apply(arguments); // Convert to a real JS array
var stringQueries = [];

@@ -478,6 +475,8 @@ predicates.forEach(function (predicate) {

return '"' + p + '"';
} else if(Array.isArray(p)) {
return "[" + p.map(function(e) {
} else if (Array.isArray(p)) {
return "[" + p.map(function (e) {
return '"' + e + '"';
}).join(',') + "]";
} else if (p instanceof Date) {
return d.getTime();
} else {

@@ -484,0 +483,0 @@ return p;

@@ -69,7 +69,7 @@ (function (Global, undefined) {

*
* @params {object} ctx - mandatory ctx object, with a useable linkResolver function (please read prismic.io online documentation about this)
* @params {object} linkResolver - mandatory linkResolver function (please read prismic.io online documentation about this)
* @returns {string} - the proper URL to use
*/
url: function (ctx) {
return ctx.linkResolver(ctx, this.document, this.isBroken);
url: function (linkResolver) {
return linkResolver(this.document, this.isBroken);
},

@@ -82,4 +82,4 @@

*/
asText: function(ctx) {
return this.url(ctx);
asText: function(linkResolver) {
return this.url(linkResolver);
}

@@ -580,6 +580,6 @@ };

* If the native HTML code doesn't suit your design, this function is meant to be overriden.
* @params {object} ctx - mandatory ctx object, with a useable linkResolver function (please read prismic.io online documentation about this)
* @params {function} linkResolver - linkResolver function (please read prismic.io online documentation about this)
* @returns {string} - basic HTML code for the fragment
*/
asHtml: function(ctx) {
asHtml: function(linkResolver) {
var output = "";

@@ -589,3 +589,3 @@ for (var i=0; i<this.value.length; i++) {

output += '<section data-field="'+fragmentName+'">';
output += this.value[i][fragmentName].asHtml(ctx);
output += this.value[i][fragmentName].asHtml(linkResolver);
output += '</section>';

@@ -611,7 +611,7 @@ }

*/
asText: function(ctx) {
asText: function(linkResolver) {
var output = "";
for (var i=0; i<this.value.length; i++) {
for (var fragmentName in this.value[i]) {
output += this.value[i][fragmentName].asText(ctx);
output += this.value[i][fragmentName].asText(linkResolver);
}

@@ -703,8 +703,7 @@ }

* If the native HTML code doesn't suit your design, this function is meant to be overriden.
* @params {object} ctx - mandatory ctx object, with a useable linkResolver function
* (please read prismic.io online documentation about this)
* @params {function} linkResolver - please read prismic.io online documentation about link resolvers
* @params {function} htmlSerializer optional HTML serializer to customize the output
* @returns {string} - basic HTML code for the fragment
*/
asHtml: function(ctx, htmlSerializer) {
asHtml: function(linkResolver, htmlSerializer) {
var blockGroups = [],

@@ -714,2 +713,9 @@ blockGroup,

html = [];
if (!isFunction(linkResolver)) {
// Backward compatibility with the old ctx argument
var ctx = linkResolver;
linkResolver = function(doc, isBroken) {
return ctx.linkResolver(ctx, doc, isBroken);
}
}
if (Array.isArray(this.blocks)) {

@@ -723,3 +729,3 @@

var link = initField(block.linkTo);
block.linkUrl = link.url(ctx);
block.linkUrl = link.url(linkResolver);
}

@@ -751,3 +757,3 @@

} else {
content = insertSpans(block.text, block.spans, ctx, htmlSerializer);
content = insertSpans(block.text, block.spans, linkResolver, htmlSerializer);
}

@@ -794,7 +800,7 @@ return content;

* @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)
* @param {object} linkResolver - the function to build links that may be in the fragment (please read prismic.io's online documentation about this)
* @param {function} htmlSerializer - optional serializer
* @returns {string} - the HTML output
*/
function insertSpans(text, spans, ctx, htmlSerializer) {
function insertSpans(text, spans, linkResolver, htmlSerializer) {
if (!spans || !spans.length) {

@@ -844,3 +850,3 @@ return htmlEscape(text);

if (fragment) {
url = fragment.url(ctx);
url = fragment.url(linkResolver);
} else {

@@ -984,2 +990,7 @@ console && console.error && console.error('Impossible to convert span.data as a Fragment', span);

function isFunction(f) {
var getType = {};
return f && getType.toString.call(f) === '[object Function]';
}
function serialize(element, content, htmlSerializer) {

@@ -986,0 +997,0 @@ // Return the user customized output (if available)

@@ -11,13 +11,11 @@ (function(Prismic) {

ctx = {
api: undefined,
ref: { ref: 'XXXXX', label: 'Future release', isMaster: false },
maybeRef: 'XXXXX',
oauth: function() { },
linkResolver: function(ctx, doc, isBroken) {
if (isBroken) return '#broken';
return "/testing_url/"+doc.id+"/"+doc.slug+( ctx.maybeRef ? '?ref=' + ctx.maybeRef : '' );
}
};
Predicates = Prismic.Predicates;
function getLinkResolver(ref) {
return function(doc, isBroken) {
if (isBroken) return '#broken';
return "/testing_url/" + doc.id + "/" + doc.slug + (ref ? ('?ref=' + ref) : '');
}
}
module('Prismic.io', {

@@ -106,3 +104,6 @@ setup: function() {}

if (err) { console.log(err); return; }
Api.form('everything').query(["any", "document.type", ["doc", "docchapter"]]).ref(Api.master()).submit(function(err, response) {
Api.form('everything')
.query(Predicates.any("document.type", ["doc", "docchapter"]))
.ref(Api.master())
.submit(function(err, response) {
if (err) { console.log(err); return; }

@@ -243,6 +244,4 @@ var document = response.results[0];

Api.form('everything').ref(Api.master()).query(
[
["at", "document.type", "article"],
["fulltext", "my.article.title", "meta"]
]
Predicates.at("document.type", "article"),
Predicates.fulltext("my.article.title", "meta")
).submit(function(err, documents) {

@@ -323,3 +322,3 @@ if (err) { console.log(err); return; }

notEqual(null, first);
first.asHtml(ctx);
first.asHtml(getLinkResolver());
start();

@@ -339,3 +338,3 @@ });

}
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"));
equal(fix(documents.results[0].asText(getLinkResolver('XXXXX'))), 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();

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

equal(
documents.results[0].getStructuredText('doc.content').asHtml(ctx),
documents.results[0].getStructuredText('doc.content').asHtml(getLinkResolver()),
'<p>Meta-micro gets installed pretty much like any javascript library:</p><ol><li><a href=\"/testing_url/U0w8OwEAACoAQEvB/download-meta-micro\">download</a> the .js file: get the minified one, unless the framework you\'re using minifies your .js files automatically.</li><li>add a link towards the file in your webpage\'s head.</li></ol><p>The link might look like this, anywhere inside your head tag:</p><pre>&lt;script type=\"text/javascript\" src=\"meta-micro.min.js\"&gt;&lt;/script&gt;</pre><p>You\'re all set!</p>');
start();
});
});
});
asyncTest('Test backward-compatibility with passing a ctx instead of just a linkResolver', 1, function() {
Prismic.Api(microRepository, function(err, Api) {
if (err) { console.log(err); return; }
Api.form('everything').query('[[:d = at(document.id, "UrDejAEAAFwMyrW9")]]').ref(Api.master()).submit(function(err, documents) {
if (err) { console.log(err); return; }
equal(
documents.results[0].getStructuredText('doc.content').asHtml({
api: undefined,
ref: { ref: 'XXXXX', label: 'Future release', isMaster: false },
maybeRef: 'XXXXX',
oauth: function() { },
linkResolver: function(ctx, doc, isBroken) {
if (isBroken) return '#broken';
return "/testing_url/"+doc.id+"/"+doc.slug+( ctx.maybeRef ? '?ref=' + ctx.maybeRef : '' );
}
}),
'<p>Meta-micro gets installed pretty much like any javascript library:</p><ol><li><a href=\"/testing_url/U0w8OwEAACoAQEvB/download-meta-micro?ref=XXXXX\">download</a> the .js file: get the minified one, unless the framework you\'re using minifies your .js files automatically.</li><li>add a link towards the file in your webpage\'s head.</li></ol><p>The link might look like this, anywhere inside your head tag:</p><pre>&lt;script type=\"text/javascript\" src=\"meta-micro.min.js\"&gt;&lt;/script&gt;</pre><p>You\'re all set!</p>');

@@ -409,3 +430,3 @@ start();

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 class=\"block-img\"><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>');
equal(documents.results[0].getStructuredText('blog-post.body').asHtml(getLinkResolver('XXXXX')), '<h1>Our world-famous Pastry Art Brainstorm event</h1><p class=\"block-img\"><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();

@@ -477,4 +498,22 @@ });

};
equal(documents.results[0].getStructuredText('blog-post.body').asHtml(ctx, htmlSerializer),
'<h1>Our world-famous Pastry Art Brainstorm event</h1><img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\"><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 class="some-link" 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>');
equal(documents.results[0].getStructuredText('blog-post.body').asHtml(getLinkResolver(), htmlSerializer),
'<h1>Our world-famous Pastry Art Brainstorm event</h1>' +
'<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\">' +
'<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 class="some-link" href=\"/testing_url/UlfoxUnM0wkXYXbu/les-bonnes-chosess-internship-a-testimony\">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();

@@ -523,3 +562,3 @@ });

if (err) { console.log(err); return; }
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>');
equal(documents.results[0].getAll('blog-post.relatedpost')[0].asHtml(getLinkResolver()), '<a href="/testing_url/UlfoxUnM0wkXYXbm/tips-to-dress-a-pastry">/testing_url/UlfoxUnM0wkXYXbm/tips-to-dress-a-pastry</a>');
start();

@@ -551,3 +590,3 @@ });

var text = Prismic.Fragments.initField(jsonObject);
equal(text.asHtml(ctx), '<p>Here is some introductory text.</p><p>The following image is linked.</p><p class=\"block-img\"><a href=\"http://google.com/\"><img src=\"http://fpoimg.com/129x260\" alt=\"\"></a></p><p><strong>More important stuff</strong></p><p>The next is linked to a valid document:</p><p class=\"block-img\"><a href=\"/testing_url/UxCQFFFFFFFaaYAH/something-fantastic?ref=XXXXX\"><img src=\"http://fpoimg.com/400x400\" alt=\"\"></a></p><p>The next is linked to a broken document:</p><p class=\"block-img\"><a href=\"#broken\"><img src=\"http://fpoimg.com/250x250\" alt=\"\"></a></p><p>One more image, this one is not linked:</p><p class=\"block-img\"><img src=\"http://fpoimg.com/199x300\" alt=\"\"></p>');
equal(text.asHtml(getLinkResolver()), '<p>Here is some introductory text.</p><p>The following image is linked.</p><p class=\"block-img\"><a href=\"http://google.com/\"><img src=\"http://fpoimg.com/129x260\" alt=\"\"></a></p><p><strong>More important stuff</strong></p><p>The next is linked to a valid document:</p><p class=\"block-img\"><a href=\"/testing_url/UxCQFFFFFFFaaYAH/something-fantastic\"><img src=\"http://fpoimg.com/400x400\" alt=\"\"></a></p><p>The next is linked to a broken document:</p><p class=\"block-img\"><a href=\"#broken\"><img src=\"http://fpoimg.com/250x250\" alt=\"\"></a></p><p>One more image, this one is not linked:</p><p class=\"block-img\"><img src=\"http://fpoimg.com/199x300\" alt=\"\"></p>');
});

@@ -559,3 +598,3 @@

var text = Prismic.Fragments.initField(jsonObject);
equal(text.asHtml(ctx), '<p>Here is some introductory text.</p><ul><li>first item</li><li>second item</li></ul><p>The following image is linked.</p><ul><li>first item 2</li><li>second item 2</li></ul>');
equal(text.asHtml(getLinkResolver()), '<p>Here is some introductory text.</p><ul><li>first item</li><li>second item</li></ul><p>The following image is linked.</p><ul><li>first item 2</li><li>second item 2</li></ul>');
});

@@ -601,5 +640,14 @@

// Group fragments are serializable when asHtml is called directly on them
equal(documents.results[0].getGroup('docchapter.docs').asHtml(ctx), '<section data-field=\"linktodoc\"><a href=\"/testing_url/UrDofwEAALAdpbNH/with-jquery?ref=XXXXX\">/testing_url/UrDofwEAALAdpbNH/with-jquery?ref=XXXXX</a></section><section data-field=\"linktodoc\"><a href=\"/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap?ref=XXXXX\">/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap?ref=XXXXX</a></section>');
equal(documents.results[0].getGroup('docchapter.docs').asHtml(getLinkResolver()),
'<section data-field=\"linktodoc\"><a href=\"/testing_url/UrDofwEAALAdpbNH/with-jquery\">/testing_url/UrDofwEAALAdpbNH/with-jquery</a></section>' +
'<section data-field=\"linktodoc\"><a href=\"/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap\">/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap</a></section>');
// Group fragments are serializable when as Html is called on a document
equal(documents.results[0].asHtml(ctx), '<section data-field=\"docchapter.title\"><h1>Using with other projects</h1></section><section data-field=\"docchapter.intro\"><p>As advertised, meta-micro knows how to stay out of the way of the rest of your application. Here are some cases of how to use it with some of the most used open-source projects in JavaScript.</p></section><section data-field=\"docchapter.priority\"><span>500</span></section><section data-field=\"docchapter.docs\"><section data-field=\"linktodoc\"><a href=\"/testing_url/UrDofwEAALAdpbNH/with-jquery?ref=XXXXX\">/testing_url/UrDofwEAALAdpbNH/with-jquery?ref=XXXXX</a></section><section data-field=\"linktodoc\"><a href=\"/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap?ref=XXXXX\">/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap?ref=XXXXX</a></section></section>');
equal(documents.results[0].asHtml(getLinkResolver()),
'<section data-field=\"docchapter.title\"><h1>Using with other projects</h1></section>' +
'<section data-field=\"docchapter.intro\"><p>As advertised, meta-micro knows how to stay out of the way of the rest of your application. Here are some cases of how to use it with some of the most used open-source projects in JavaScript.</p></section>' +
'<section data-field=\"docchapter.priority\"><span>500</span></section>' +
'<section data-field=\"docchapter.docs\">' +
'<section data-field=\"linktodoc\"><a href=\"/testing_url/UrDofwEAALAdpbNH/with-jquery\">/testing_url/UrDofwEAALAdpbNH/with-jquery</a></section>' +
'<section data-field=\"linktodoc\"><a href=\"/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap">/testing_url/UrDp8AEAAPUdpbNL/with-bootstrap</a></section>' +
'</section>');
start();

@@ -606,0 +654,0 @@ });

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

Sorry, the diff of this file is not supported yet

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