mountain_view 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25ec841a341408131f8ccd8733828fe272c650ff
4
- data.tar.gz: 542bd1791a9512035b28beaf141c500a78b702cd
3
+ metadata.gz: 48440d3d9b61479fd626bb86f549fd3420f6f7de
4
+ data.tar.gz: ae42aa4bff08fb3e264b74e65799576432386a04
5
5
  SHA512:
6
- metadata.gz: f1141f20cc830bf54197f9e72f9fc0d3479314b2b12247e888dc7a30cfcff4e0924a53e76a412119169acd5b0b7935cd2f096e05d5fb68d738dcebfde3acf958
7
- data.tar.gz: 3399e1b98ae937d0b49d8a5f350fcbaefcc5cf1931b80b4aa836bda6e4407d8bba5b0875cfd956966f1e28f07cf440dfa4e97bfb621f4cbd1cae12259e95d963
6
+ metadata.gz: 8bd1af8db259ac3aa85718456e917516cedd9768cc5bfd278e025e69623a001d1fe5f5b22d9d0be775a61544f1196ca3d3550f3ac08d2b64d9482029108fd136
7
+ data.tar.gz: 8180bc5af346fdb2ed0c207c90aabe57d79b2cedbb188151fddc88352845df8af8656b03413a4a79a078403139631da62161382391c8e00fe2c740248ef40a64
@@ -1,5 +1,7 @@
1
- /* http://prismjs.com/download.html?themes=prism&languages=clike+javascript+ruby */
2
- self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var s={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var l in a)a.hasOwnProperty(l)&&(s[l]=a[l]);s[o]=i[o]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=s)}),r[e]=s},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)t.highlightElement(a,e===!0,n)},highlightElement:function(a,r,i){for(var l,s,o=a;o&&!e.test(o.className);)o=o.parentNode;if(o&&(l=(o.className.match(e)||[,""])[1],s=t.languages[l]),s){a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=a.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var u=a.textContent;if(u){u=u.replace(/^(?:\r?\n|\r)/,"");var g={element:a,language:l,grammar:s,code:u};if(t.hooks.run("before-highlight",g),r&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){g.highlightedCode=n.stringify(JSON.parse(e.data),l),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(g.element),t.hooks.run("after-highlight",g)},c.postMessage(JSON.stringify({language:g.language,code:g.code}))}else g.highlightedCode=t.highlight(g.code,g.grammar,g.language),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",g)}}},highlight:function(e,a,r){var i=t.tokenize(e,a);return n.stringify(t.util.encode(i),r)},tokenize:function(e,n){var a=t.Token,r=[e],i=n.rest;if(i){for(var l in i)n[l]=i[l];delete n.rest}e:for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var s=n[l];s="Array"===t.util.type(s)?s:[s];for(var o=0;o<s.length;++o){var u=s[o],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),N=[p,1];b&&N.push(b);var O=new a(l,g?t.tokenize(m,g):m,h);N.push(O),w&&N.push(w),Array.prototype.splice.apply(r,N)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+"</"+i.tag+">"},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);;
3
- Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/("|')(\\\n|\\?.)*?\1/,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":{pattern:/[a-z0-9_]+\(/i,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,ignore:/&(lt|gt|amp);/i,punctuation:/[{}[\];(),.:]/};;
4
- Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/,"function":/(?!\d)[a-z0-9_$]+(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}});;
5
- Prism.languages.ruby=Prism.languages.extend("clike",{comment:/#[^\r\n]*(\r?\n|$)/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/,builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*[?!]?\b/}),Prism.languages.insertBefore("ruby","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0},variable:/[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/,symbol:/:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/});;
1
+ /* http://prismjs.com/download.html?themes=prism&languages=markup+clike+javascript+ruby+yaml */
2
+ var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=t.languages[l]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run("complete",u),void 0;if(t.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,g?t.tokenize(m,g):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var l={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3
+ Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4
+ Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
5
+ Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
6
+ !function(e){e.languages.ruby=e.languages.extend("clike",{comment:/#(?!\{[^\r\n]*?\}).*/,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/});var n={pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"tag"},rest:e.util.clone(e.languages.ruby)}};e.languages.insertBefore("ruby","keyword",{regex:[{pattern:/%r([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/,inside:{interpolation:n}},{pattern:/%r<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/,inside:{interpolation:n}},{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}],variable:/[@$]+[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/,symbol:/:[a-zA-Z_][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.insertBefore("ruby","number",{builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*(?:[?!]|\b)/}),e.languages.ruby.string=[{pattern:/%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,inside:{interpolation:n}},{pattern:/%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,inside:{interpolation:n}},{pattern:/("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,inside:{interpolation:n}}]}(Prism);
7
+ Prism.languages.yaml={scalar:{pattern:/([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*($|,|]|}))/m,lookbehind:!0,alias:"number"},"boolean":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},"null":{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')(?=[ \t]*($|,|]|}))/m,lookbehind:!0},number:{pattern:/([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./};
@@ -5,133 +5,141 @@
5
5
  * @author Lea Verou
6
6
  */
7
7
 
8
- code[class*="language-"],
9
- pre[class*="language-"] {
10
- color: black;
11
- text-shadow: 0 1px white;
12
- font-family: Consolas, Monaco, 'Andale Mono', monospace;
13
- direction: ltr;
14
- text-align: left;
15
- white-space: pre;
16
- word-spacing: normal;
17
- word-break: normal;
18
- line-height: 1.5;
19
-
20
- -moz-tab-size: 4;
21
- -o-tab-size: 4;
22
- tab-size: 4;
23
-
24
- -webkit-hyphens: none;
25
- -moz-hyphens: none;
26
- -ms-hyphens: none;
27
- hyphens: none;
28
- }
29
-
30
- pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
31
- code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
32
- text-shadow: none;
33
- background: #b3d4fc;
34
- }
35
-
36
- pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
37
- code[class*="language-"]::selection, code[class*="language-"] ::selection {
38
- text-shadow: none;
39
- background: #b3d4fc;
40
- }
41
-
42
- @media print {
43
- code[class*="language-"],
44
- pre[class*="language-"] {
45
- text-shadow: none;
46
- }
47
- }
48
-
49
- /* Code blocks */
50
- pre[class*="language-"] {
51
- padding: 1em;
52
- margin: .5em 0;
53
- overflow: auto;
54
- }
55
-
56
- :not(pre) > code[class*="language-"],
57
- pre[class*="language-"] {
58
- background: #f5f2f0;
59
- }
60
-
61
- /* Inline code */
62
- :not(pre) > code[class*="language-"] {
63
- padding: .1em;
64
- border-radius: .3em;
65
- }
66
-
67
- .token.comment,
68
- .token.prolog,
69
- .token.doctype,
70
- .token.cdata {
71
- color: slategray;
72
- }
73
-
74
- .token.punctuation {
75
- color: #999;
76
- }
77
-
78
- .namespace {
79
- opacity: .7;
80
- }
81
-
82
- .token.property,
83
- .token.tag,
84
- .token.boolean,
85
- .token.number,
86
- .token.constant,
87
- .token.symbol,
88
- .token.deleted {
89
- color: #905;
90
- }
91
-
92
- .token.selector,
93
- .token.attr-name,
94
- .token.string,
95
- .token.char,
96
- .token.builtin,
97
- .token.inserted {
98
- color: #690;
99
- }
100
-
101
- .token.operator,
102
- .token.entity,
103
- .token.url,
104
- .language-css .token.string,
105
- .style .token.string {
106
- color: #a67f59;
107
- background: hsla(0, 0%, 100%, .5);
108
- }
109
-
110
- .token.atrule,
111
- .token.attr-value,
112
- .token.keyword {
113
- color: #07a;
114
- }
115
-
116
- .token.function {
117
- color: #DD4A68;
118
- }
119
-
120
- .token.regex,
121
- .token.important,
122
- .token.variable {
123
- color: #e90;
124
- }
125
-
126
- .token.important,
127
- .token.bold {
128
- font-weight: bold;
129
- }
130
- .token.italic {
131
- font-style: italic;
132
- }
133
-
134
- .token.entity {
135
- cursor: help;
136
- }
8
+ /* http://prismjs.com/download.html?themes=prism&languages=markup+clike+javascript+ruby+yaml */
9
+ /**
10
+ * prism.js default theme for JavaScript, CSS and HTML
11
+ * Based on dabblet (http://dabblet.com)
12
+ * @author Lea Verou
13
+ */
14
+
15
+ code[class*="language-"],
16
+ pre[class*="language-"] {
17
+ color: black;
18
+ text-shadow: 0 1px white;
19
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
20
+ direction: ltr;
21
+ text-align: left;
22
+ white-space: pre;
23
+ word-spacing: normal;
24
+ word-break: normal;
25
+ word-wrap: normal;
26
+ line-height: 1.5;
27
+
28
+ -moz-tab-size: 4;
29
+ -o-tab-size: 4;
30
+ tab-size: 4;
31
+
32
+ -webkit-hyphens: none;
33
+ -moz-hyphens: none;
34
+ -ms-hyphens: none;
35
+ hyphens: none;
36
+ }
37
+
38
+ pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
39
+ code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
40
+ text-shadow: none;
41
+ background: #b3d4fc;
42
+ }
43
+
44
+ pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
45
+ code[class*="language-"]::selection, code[class*="language-"] ::selection {
46
+ text-shadow: none;
47
+ background: #b3d4fc;
48
+ }
49
+
50
+ @media print {
51
+ code[class*="language-"],
52
+ pre[class*="language-"] {
53
+ text-shadow: none;
54
+ }
55
+ }
56
+
57
+ /* Code blocks */
58
+ pre[class*="language-"] {
59
+ padding: 1em;
60
+ margin: .5em 0;
61
+ overflow: auto;
62
+ }
63
+
64
+ :not(pre) > code[class*="language-"],
65
+ pre[class*="language-"] {
66
+ background: #f5f2f0;
67
+ }
68
+
69
+ /* Inline code */
70
+ :not(pre) > code[class*="language-"] {
71
+ padding: .1em;
72
+ border-radius: .3em;
73
+ }
74
+
75
+ .token.comment,
76
+ .token.prolog,
77
+ .token.doctype,
78
+ .token.cdata {
79
+ color: slategray;
80
+ }
81
+
82
+ .token.punctuation {
83
+ color: #999;
84
+ }
85
+
86
+ .namespace {
87
+ opacity: .7;
88
+ }
89
+
90
+ .token.property,
91
+ .token.tag,
92
+ .token.boolean,
93
+ .token.number,
94
+ .token.constant,
95
+ .token.symbol,
96
+ .token.deleted {
97
+ color: #905;
98
+ }
99
+
100
+ .token.selector,
101
+ .token.attr-name,
102
+ .token.string,
103
+ .token.char,
104
+ .token.builtin,
105
+ .token.inserted {
106
+ color: #690;
107
+ }
108
+
109
+ .token.operator,
110
+ .token.entity,
111
+ .token.url,
112
+ .language-css .token.string,
113
+ .style .token.string {
114
+ color: #a67f59;
115
+ background: hsla(0, 0%, 100%, .5);
116
+ }
117
+
118
+ .token.atrule,
119
+ .token.attr-value,
120
+ .token.keyword {
121
+ color: #07a;
122
+ }
123
+
124
+ .token.function {
125
+ color: #DD4A68;
126
+ }
127
+
128
+ .token.regex,
129
+ .token.important,
130
+ .token.variable {
131
+ color: #e90;
132
+ }
133
+
134
+ .token.important,
135
+ .token.bold {
136
+ font-weight: bold;
137
+ }
138
+ .token.italic {
139
+ font-style: italic;
140
+ }
141
+
142
+ .token.entity {
143
+ cursor: help;
144
+ }
137
145
 
@@ -95,6 +95,17 @@ body{
95
95
  .mv-component__item{
96
96
  }
97
97
 
98
+ .mv-component__meta{
99
+ padding: 25px;
100
+ margin-bottom: 20px;
101
+ background: #F7F7F7;
102
+ border: 1px solid #E4E4E4;
103
+ }
104
+
105
+ .mv-component__meta p{
106
+ color: #000;
107
+ }
108
+
98
109
  .mv-component__description{
99
110
  padding: 25px;
100
111
  background: #F7F7F7;
@@ -0,0 +1,11 @@
1
+ <pre>
2
+ :meta: 'information about the component <%= component_name %>' # Optional
3
+ :stubs: # As many as you need
4
+ -
5
+ :id: 1
6
+ :title: "Some title"
7
+ :subtitle: "Some subtitle"
8
+ -
9
+ :id: 2
10
+ :title: "Another subtitle"
11
+ </pre>
@@ -3,21 +3,43 @@
3
3
  </div>
4
4
 
5
5
  <% if @component.stubs? %>
6
- <% @component.styleguide_stubs.each_with_index do |component_properties, index| %>
7
- <div class="mv-component">
8
- <div class="mv-component__item">
9
- <%= render_component @component.name, component_properties %>
10
- </div>
11
- <div class="mv-component__description">
12
- <h2><%= @component.title %> <%= index + 1 %></h2>
13
- <div class="mv-component__description__definition">
14
- <code class="language-ruby">&lt;%= render_component("<%= @component.name %>", {properties as below}) %&gt;</code>
15
- </div>
16
- <%- formatted = JSON.pretty_generate component_properties %>
17
- <div class="mv-component__description__properties">
18
- <code class="language-ruby"><%= formatted.gsub(/\"(\S+)?\":/, '\1:') %></code>
19
- </div>
6
+ <% if @component.stubs_correct_format? %>
7
+ <% if @component.stubs_extra_info? %>
8
+ <div class="mv-component__meta">
9
+ <p><%= @component.stubs_extra_info %></p>
20
10
  </div>
11
+ <% end %>
12
+ <% if @component.component_stubs? %>
13
+ <% @component.component_stubs.each_with_index do |component_properties, index| %>
14
+ <div class="mv-component">
15
+ <div class="mv-component__item">
16
+ <%= render_component @component.name, component_properties %>
17
+ </div>
18
+ <div class="mv-component__description">
19
+ <h2><%= @component.title %> <%= index + 1 %></h2>
20
+ <div class="mv-component__description__definition">
21
+ <code class="language-ruby">&lt;%= render_component("<%= @component.name %>", {properties as below}) %&gt;</code>
22
+ </div>
23
+ <%- formatted = JSON.pretty_generate component_properties %>
24
+ <div class="mv-component__description__properties">
25
+ <code class="language-ruby"><%= formatted.gsub(/\"(\S+)?\":/, '\1:') %></code>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+ <% end %>
31
+ <% else %>
32
+ <div class="mv-hint">
33
+ <h2><span>Hint:</span>You have Stubs but they don't follow the correct format</h2>
34
+ <ul>
35
+ <li>
36
+ You should write stub examples like this:
37
+ <br>
38
+ <div class="mv-component__description__properties">
39
+ <code class="language-yaml"><%= render 'example', component_name: @component.name %></code>
40
+ </div>
41
+ </li>
42
+ </ul>
21
43
  </div>
22
44
  <% end %>
23
45
  <% else %>
@@ -28,6 +50,9 @@
28
50
  You should write stub examples here:
29
51
  <br>
30
52
  <strong><%= @component.stubs_file %></strong>
53
+ <div class="mv-component__description__properties">
54
+ <code class="language-yaml"><%= render 'example', component_name: @component.name %></code>
55
+ </div>
31
56
  </li>
32
57
  </ul>
33
58
  </div>
@@ -11,7 +11,21 @@ module MountainView
11
11
  end
12
12
 
13
13
  def styleguide_stubs
14
- YAML.load_file stubs_file
14
+ YAML.load_file(stubs_file) || {}
15
+ rescue Errno::ENOENT
16
+ {}
17
+ end
18
+
19
+ def component_stubs
20
+ if styleguide_stubs.is_a?(Hash)
21
+ styleguide_stubs[:stubs] || {}
22
+ elsif styleguide_stubs.is_a?(Array)
23
+ styleguide_stubs
24
+ end
25
+ end
26
+
27
+ def component_stubs?
28
+ component_stubs.any?
15
29
  end
16
30
 
17
31
  def stubs_file
@@ -19,9 +33,27 @@ module MountainView
19
33
  end
20
34
 
21
35
  def stubs?
22
- styleguide_stubs.is_a?(Array) && styleguide_stubs.any?
23
- rescue Errno::ENOENT
24
- false
36
+ styleguide_stubs.any?
37
+ end
38
+
39
+ def stubs_extra_info?
40
+ !stubs_extra_info.empty?
41
+ end
42
+
43
+ def stubs_extra_info
44
+ if styleguide_stubs.is_a?(Hash) && styleguide_stubs.key?(:meta)
45
+ styleguide_stubs[:meta]
46
+ else
47
+ {}
48
+ end
49
+ end
50
+
51
+ def stubs_correct_format?
52
+ stubs_are_a_hash_with_info? || styleguide_stubs.is_a?(Array)
53
+ end
54
+
55
+ def stubs_are_a_hash_with_info?
56
+ styleguide_stubs.is_a?(Hash) && styleguide_stubs.key?(:stubs)
25
57
  end
26
58
  end
27
59
  end
@@ -1,3 +1,3 @@
1
1
  module MountainView
2
- VERSION = "0.7.1".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
@@ -1,7 +1,9 @@
1
- -
2
- :id: 1
3
- :title: "20 Mountains you didn't know they even existed"
4
- :subtitle: "Buzzfeed title"
5
- -
6
- :id: 2
7
- :title: "You won't believe what happened to this man at Aspen"
1
+ :meta: 'There is this different classes'
2
+ :stubs:
3
+ -
4
+ :id: 1
5
+ :title: "20 Mountains you didn't know they even existed"
6
+ :subtitle: "Buzzfeed title"
7
+ -
8
+ :id: 2
9
+ :title: "You won't believe what happened to this man at Aspen"
@@ -13,6 +13,8 @@ class ComponentGeneratorTest < Rails::Generators::TestCase
13
13
  assert_file "app/components/widget/widget.css"
14
14
  assert_file "app/components/widget/widget.js"
15
15
  assert_file "app/components/widget/widget.yml"
16
+ # Delete generated files so the test don't fail if the order is random
17
+ FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
16
18
  end
17
19
 
18
20
  test "Generates different engines" do
@@ -26,5 +28,7 @@ class ComponentGeneratorTest < Rails::Generators::TestCase
26
28
  assert_file "app/components/widget/widget.scss"
27
29
  assert_file "app/components/widget/widget.coffee"
28
30
  assert_file "app/components/widget/widget.yml"
31
+ # Delete generated files so the test don't fail if the order is random
32
+ FileUtils.remove_dir(File.expand_path("../../tmp", __FILE__))
29
33
  end
30
34
  end
@@ -15,15 +15,101 @@ class MountainViewComponentTest < ActiveSupport::TestCase
15
15
 
16
16
  def test_styleguide_stubs
17
17
  component = MountainView::Component.new("header")
18
+ expected_stub =
19
+ {
20
+ meta: "There is this different classes",
21
+ stubs:
22
+ [
23
+ {
24
+ id: 1,
25
+ title: "20 Mountains you didn't know they even existed",
26
+ subtitle: "Buzzfeed title"
27
+ },
28
+ { id: 2,
29
+ title: "You won't believe what happened to this man at Aspen"
30
+ }
31
+ ]
32
+ }
18
33
 
19
- expected_stub = {
20
- id: 1,
21
- title: "20 Mountains you didn't know they even existed",
22
- subtitle: "Buzzfeed title"
23
- }
34
+ assert_instance_of Hash, component.styleguide_stubs
35
+ assert_equal expected_stub, component.styleguide_stubs
36
+ end
37
+
38
+ def test_component_stubs
39
+ component = MountainView::Component.new("header")
40
+ expected_stub =
41
+ [
42
+ {
43
+ id: 1,
44
+ title: "20 Mountains you didn't know they even existed",
45
+ subtitle: "Buzzfeed title"
46
+ },
47
+ {
48
+ id: 2,
49
+ title: "You won't believe what happened to this man at Aspen"
50
+ }
51
+ ]
52
+ assert_instance_of Array, component.component_stubs
53
+ assert_equal expected_stub, component.component_stubs
54
+ end
55
+
56
+ def test_component_stubs?
57
+ component_with_stubs = MountainView::Component.new("header")
58
+ component_with_empty_stub_file = MountainView::Component.new("breadcrumbs")
59
+ component_without_stub_file =
60
+ MountainView::Component.new("social_media_icons")
61
+ compoenet_with_stubs_but_incorrect_format =
62
+ MountainView::Component.new("card")
63
+ assert_equal true, component_with_stubs.component_stubs?
64
+ assert_equal false, component_without_stub_file.component_stubs?
65
+ assert_equal false, component_with_empty_stub_file.component_stubs?
66
+ assert_equal true, compoenet_with_stubs_but_incorrect_format.
67
+ component_stubs?
68
+ end
69
+
70
+ def test_stubs_extra_info
71
+ component_with_extra_info = MountainView::Component.new("header")
72
+ component_with_empty_stub_file =
73
+ MountainView::Component.new("breadcrumbs")
74
+ component_without_stub_file =
75
+ MountainView::Component.new("paragraph")
76
+ expected_extra_info_stub = "There is this different classes"
77
+
78
+ assert_equal expected_extra_info_stub, component_with_extra_info.
79
+ stubs_extra_info
80
+ assert_equal true, component_with_empty_stub_file.stubs_extra_info.empty?
81
+ assert_equal true, component_without_stub_file.stubs_extra_info.empty?
82
+ end
83
+
84
+ def test_stubs_extra_info?
85
+ component_with_stubs = MountainView::Component.new("header")
86
+ component_with_empty_stub_file =
87
+ MountainView::Component.new("breadcrumbs")
88
+ component_without_stub_file =
89
+ MountainView::Component.new("social_media_icons")
90
+ component_with_stubs_but_no_extra_info =
91
+ MountainView::Component.new("card")
92
+
93
+ assert_equal true, component_with_stubs.stubs_extra_info?
94
+ assert_equal false, component_without_stub_file.stubs_extra_info?
95
+ assert_equal false, component_with_empty_stub_file.stubs_extra_info?
96
+ assert_equal false, component_with_stubs_but_no_extra_info.
97
+ stubs_extra_info?
98
+ end
99
+
100
+ def test_stubs_correct_format?
101
+ component_with_correct_stubs = MountainView::Component.new("header")
102
+ component_with_empty_stub_file = MountainView::Component.new("breadcrumbs")
103
+ component_without_stub_file =
104
+ MountainView::Component.new("social_media_icons")
105
+ component_with_stubs_but_old_syntax =
106
+ MountainView::Component.new("card")
24
107
 
25
- assert_instance_of Array, component.styleguide_stubs
26
- assert_equal expected_stub, component.styleguide_stubs.first
108
+ assert_equal true, component_with_correct_stubs.stubs_correct_format?
109
+ assert_equal false, component_without_stub_file.stubs_correct_format?
110
+ assert_equal false, component_with_empty_stub_file.stubs_correct_format?
111
+ assert_equal true, component_with_stubs_but_old_syntax.
112
+ stubs_correct_format?
27
113
  end
28
114
 
29
115
  def test_stubs_file