vivus 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/vivus/application.js +11 -4
- data/app/assets/javascripts/vivus/highlight.pack.js +1 -0
- data/app/assets/stylesheets/vivus/application.css.scss +6 -22
- data/app/assets/stylesheets/vivus/core/constants.scss +6 -0
- data/app/assets/stylesheets/vivus/core/mediaqueries.scss +46 -0
- data/app/assets/stylesheets/vivus/core/mixins.scss +14 -0
- data/app/assets/stylesheets/vivus/core/typography.scss +23 -0
- data/app/assets/stylesheets/vivus/module/block.scss +43 -15
- data/app/assets/stylesheets/vivus/module/nav.scss +57 -3
- data/app/controllers/vivus/styles_controller.rb +7 -8
- data/app/models/description.rb +21 -0
- data/app/models/example.rb +25 -0
- data/app/models/stylesheet.rb +12 -56
- data/app/views/shared/_description.html.erb +3 -0
- data/app/views/shared/_example.html.erb +9 -0
- data/app/views/vivus/styles/index.html.erb +29 -43
- data/lib/vivus.rb +1 -1
- data/lib/vivus/version.rb +1 -1
- metadata +28 -34
- data/app/assets/stylesheets/vivus/module/all.scss +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b26453f767a461be30b9633bd194e6886a943a7
|
|
4
|
+
data.tar.gz: da1761ef6d903eb45599c6a35d11ebd6ad7b16d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d25ce19b32fd34f512ab47bc0b64d2b56547951af814f7eb93fb185da7261109a3c847f474a242c7a4c173aa8fe8b77456e427bfabe6b0117026f3a5fb870b12
|
|
7
|
+
data.tar.gz: de318073341ba83255e2c8cc4ebef63210b90b441a02a4456131abe7dbdc1533cff5f6174a1759d75b0657da5e3d785032100c472bd6b1d067c67419fbe02096
|
|
@@ -23,9 +23,16 @@ $(document).ready(function() {
|
|
|
23
23
|
hljs.highlightBlock(el);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
$('.vivus-documentation
|
|
27
|
-
|
|
28
|
-
$(
|
|
29
|
-
$(el).prepend("<a name='" + i + "'></a>");
|
|
26
|
+
$('.vivus-documentation').find('h1, h2, h3, h4, h5, h6').each(function(i, el) {
|
|
27
|
+
$('#vivus-navigation ul').append("<li class=" + $(el).prop("tagName").toLowerCase() + "><a href='#" + $(el).text().toLowerCase().replace(/ /g, '-') + "'>" + $(el).text() + "</a></li>");
|
|
28
|
+
$(el).prepend("<a name='" + $(el).text().toLowerCase().replace(/ /g, '-') + "'></a>");
|
|
30
29
|
})
|
|
30
|
+
|
|
31
|
+
$('.vivus-documentation *:contains("TODO:")').html(function(_, html) {
|
|
32
|
+
return html.split('TODO:').join("<span class='todo'>TODO:</span>");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$('.vivus-documentation *:contains("NOTE:")').html(function(_, html) {
|
|
36
|
+
return html.split('NOTE:').join("<span class='note'>NOTE:</span>");
|
|
37
|
+
});
|
|
31
38
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("ruby",function(e){var h="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor";var a={cN:"yardoctag",b:"@[A-Za-z]+"};var i={cN:"comment",v:[{b:"#",e:"$",c:[a]},{b:"^\\=begin",e:"^\\=end",c:[a],r:10},{b:"^__END__",e:"\\n$"}]};var c={cN:"subst",b:"#\\{",e:"}",k:g};var d={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:"%[qw]?\\(",e:"\\)"},{b:"%[qw]?\\[",e:"\\]"},{b:"%[qw]?{",e:"}"},{b:"%[qw]?<",e:">",r:10},{b:"%[qw]?/",e:"/",r:10},{b:"%[qw]?%",e:"%",r:10},{b:"%[qw]?-",e:"-",r:10},{b:"%[qw]?\\|",e:"\\|",r:10},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]};var b={cN:"params",b:"\\(",e:"\\)",k:g};var f=[d,i,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]},i]},{cN:"function",bK:"def",e:" |$|;",r:0,c:[e.inherit(e.TM,{b:h}),b,i]},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[d,{b:h}],r:0},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[i,{cN:"regexp",c:[e.BE,c],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];c.c=f;b.c=f;return{k:g,c:f}});hljs.registerLanguage("haml",function(a){return{cI:true,c:[{cN:"doctype",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},{cN:"comment",b:"^\\s*(!=#|=#|-#|/).*$",r:0},{b:"^\\s*(-|=|!=)(?!#)",starts:{e:"\\n",sL:"ruby"}},{cN:"tag",b:"^\\s*%",c:[{cN:"title",b:"\\w+"},{cN:"value",b:"[#\\.]\\w+"},{b:"{\\s*",e:"\\s*}",eE:true,c:[{b:":\\w+\\s*=>",e:",\\s+",rB:true,eW:true,c:[{cN:"symbol",b:":\\w+"},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]}]},{b:"\\(\\s*",e:"\\s*\\)",eE:true,c:[{b:"\\w+\\s*=",e:"\\s+",rB:true,eW:true,c:[{cN:"attribute",b:"\\w+",r:0},{cN:"string",b:'"',e:'"'},{cN:"string",b:"'",e:"'"},{b:"\\w+",r:0}]},]}]},{cN:"bullet",b:"^\\s*[=~]\\s*",r:0},{b:"#{",starts:{e:"}",sL:"ruby"}}]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("css",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};return{cI:true,i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.NM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}});hljs.registerLanguage("handlebars",function(b){var a="each in with if else unless bindattr action collection debugger log outlet template unbound view yield";return{cI:true,sL:"xml",subLanguageMode:"continuous",c:[{cN:"expression",b:"{{",e:"}}",c:[{cN:"begin-block",b:"#[a-zA-Z- .]+",k:a},{cN:"string",b:'"',e:'"'},{cN:"end-block",b:"\\/[a-zA-Z- .]+",k:a},{cN:"variable",b:"[a-zA-Z-.]+",k:a}]}]}});hljs.registerLanguage("coffeescript",function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module exports global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f=c.inherit(c.TM,{b:a});var e={cN:"subst",b:/#\{/,e:/}/,k:b};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[c.BE]},{b:/'/,e:/'/,c:[c.BE]},{b:/"""/,e:/"""/,c:[c.BE,e]},{b:/"/,e:/"/,c:[c.BE,e]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[e,c.HCM]},{b:"//[gim]*",r:0},{b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"}]},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{k:b,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\(",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:true,i:/[:="\[\]]/,c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true,r:0}])}});hljs.registerLanguage("scss",function(a){var c="[a-zA-Z-][a-zA-Z0-9_-]*";var d={cN:"function",b:c+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]};var b={cN:"hexcolor",b:"#[0-9A-Fa-f]+"};var e={cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[d,b,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"important",b:"!important"}]}};return{cI:true,i:"[=/|']",c:[a.CLCM,a.CBLCLM,{cN:"function",b:c+"\\(",e:"\\)",c:["self",a.NM,a.ASM,a.QSM]},{cN:"id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{cN:"pseudo",b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{cN:"pseudo",b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{cN:"value",b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{cN:"value",b:":",e:";",c:[b,a.NM,a.QSM,a.ASM,{cN:"important",b:"!important"}]},{cN:"at_rule",b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[d,a.QSM,a.ASM,b,a.NM,{cN:"preprocessor",b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
url('/assets/lmmono10-regular-webfont.woff') format('woff'),
|
|
6
|
-
url('/assets/lmmono10-regular-webfont.ttf') format('truetype'),
|
|
7
|
-
url('/assets/lmmono10-regular-webfont.svg#latin_modern_mono_caps10Rg') format('svg');
|
|
8
|
-
font-weight: normal;
|
|
9
|
-
font-style: normal;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@font-face {
|
|
13
|
-
font-family: 'droid_sans_monoregular';
|
|
14
|
-
src: url('/assets/DroidSansMono-webfont.eot');
|
|
15
|
-
src: url('/assets/DroidSansMono-webfont.eot?#iefix') format('embedded-opentype'),
|
|
16
|
-
url('/assets/DroidSansMono-webfont.woff') format('woff'),
|
|
17
|
-
url('/assets/DroidSansMono-webfont.ttf') format('truetype'),
|
|
18
|
-
url('/assets/DroidSansMono-webfont.svg#droid_sans_monoregular') format('svg');
|
|
19
|
-
font-weight: normal;
|
|
20
|
-
font-style: normal;
|
|
21
|
-
}
|
|
1
|
+
@import "core/constants";
|
|
2
|
+
@import "core/mixins";
|
|
3
|
+
@import "core/mediaqueries";
|
|
4
|
+
@import "core/typography";
|
|
22
5
|
|
|
23
6
|
body#vivus {
|
|
24
7
|
margin: 0;
|
|
25
8
|
padding: 0;
|
|
26
9
|
|
|
27
|
-
@import
|
|
10
|
+
@import 'module/nav';
|
|
11
|
+
@import 'module/block';
|
|
28
12
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@media only screen and (max-width: $small_max) {
|
|
2
|
+
$media: "small";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// Below 320px add some optimisations to the small layout
|
|
6
|
+
//
|
|
7
|
+
@media only screen and (max-width: $tiny_max) {
|
|
8
|
+
@import "layouts/mediaqueries/tiny";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// This is the default layout (applied at the top of this file), but we re-define it here
|
|
12
|
+
// to ensure the $media variable is available and any special styles are added.
|
|
13
|
+
//
|
|
14
|
+
// This catches most tablets (ipads, nexus 7's, etc) in portrait and landscape modes,
|
|
15
|
+
// plus most laptops and common screen sizes.
|
|
16
|
+
//
|
|
17
|
+
@media only screen and (min-width: $medium_min) and (max-width: $medium_max) {
|
|
18
|
+
$media: "medium";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// An extra wide layout for people with big screens (like the dev team). Adds some extra white
|
|
22
|
+
// space, slightly larger fonts, wider grid, etc.
|
|
23
|
+
//
|
|
24
|
+
@media only screen and (min-width: $large_min) {
|
|
25
|
+
$media: "large";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@mixin respond-to($media) {
|
|
29
|
+
@if $media == "small" {
|
|
30
|
+
@media only screen and (max-width: $small_max) {
|
|
31
|
+
@content;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@else if $media == "medium" {
|
|
36
|
+
@media only screen and (min-width: $medium_min) and (max-width: $medium_max) {
|
|
37
|
+
@content;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@else if $media == "large" {
|
|
42
|
+
@media only screen and (min-width: $large_min) {
|
|
43
|
+
@content;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'latin_modern_mono';
|
|
3
|
+
src: url('/assets/lmmono10-regular-webfont.eot');
|
|
4
|
+
src: url('/assets/lmmono10-regular-webfont.eot?#iefix') format('embedded-opentype'),
|
|
5
|
+
url('/assets/lmmono10-regular-webfont.woff') format('woff'),
|
|
6
|
+
url('/assets/lmmono10-regular-webfont.ttf') format('truetype'),
|
|
7
|
+
url('/assets/lmmono10-regular-webfont.svg#latin_modern_mono_caps10Rg') format('svg');
|
|
8
|
+
font-weight: normal;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: 'droid_sans_monoregular';
|
|
14
|
+
src: url('/assets/DroidSansMono-webfont.eot');
|
|
15
|
+
src: url('/assets/DroidSansMono-webfont.eot?#iefix') format('embedded-opentype'),
|
|
16
|
+
url('/assets/DroidSansMono-webfont.woff') format('woff'),
|
|
17
|
+
url('/assets/DroidSansMono-webfont.ttf') format('truetype'),
|
|
18
|
+
url('/assets/DroidSansMono-webfont.svg#droid_sans_monoregular') format('svg');
|
|
19
|
+
font-weight: normal;
|
|
20
|
+
font-style: normal;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#vivus-body {
|
|
2
|
-
margin-left:
|
|
3
|
-
|
|
2
|
+
margin-left: 250px;
|
|
3
|
+
max-width: 950px;
|
|
4
|
+
padding: 30px;
|
|
5
|
+
|
|
6
|
+
@include respond-to("small") {
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
}
|
|
4
10
|
|
|
5
11
|
ul.vivus-sections {
|
|
6
12
|
margin: 0;
|
|
@@ -8,44 +14,66 @@
|
|
|
8
14
|
|
|
9
15
|
& > li {
|
|
10
16
|
list-style: none;
|
|
11
|
-
border-bottom: 1px solid #eee;
|
|
12
17
|
margin-bottom: 40px;
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
font-family: 'latin_modern_mono';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.vivus-source {
|
|
19
|
+
&.vivus-source {
|
|
19
20
|
margin: 0 0 20px 0;
|
|
20
21
|
font-size: 12px;
|
|
21
22
|
font-style: italic;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
&.vivus-documentation {
|
|
25
26
|
margin: 0 0 40px 0;
|
|
26
27
|
font-size: 15px;
|
|
28
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
29
|
+
|
|
30
|
+
> h1 {
|
|
31
|
+
color: #C93312;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
> h2 {
|
|
35
|
+
margin-top: 50px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
> ul, ol {
|
|
39
|
+
list-style-position: inside;
|
|
40
|
+
margin-bottom: 40px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.todo {
|
|
44
|
+
color: #C93312;
|
|
45
|
+
}
|
|
27
46
|
|
|
28
47
|
code {
|
|
29
48
|
font-size: 13px;
|
|
30
49
|
color: #660000;
|
|
31
|
-
font-family: droid_sans_monoregular, mono, sans;
|
|
50
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
32
51
|
@import 'syntax-highlighting';
|
|
33
52
|
}
|
|
34
53
|
}
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
&.vivus-example {
|
|
56
|
+
@include clearfix;
|
|
37
57
|
margin: 0 0 40px 0;
|
|
58
|
+
padding: 10px 0;
|
|
38
59
|
font-size: 15px;
|
|
60
|
+
border-bottom: 1px solid #eee;
|
|
61
|
+
|
|
62
|
+
.vivus-title {
|
|
63
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
64
|
+
padding-bottom: 10px;
|
|
65
|
+
border-bottom: 1px solid #eee;
|
|
66
|
+
}
|
|
39
67
|
}
|
|
40
68
|
|
|
41
|
-
|
|
69
|
+
&.vivus-code {
|
|
70
|
+
display: none;
|
|
42
71
|
.vivus-title {
|
|
43
|
-
font-
|
|
44
|
-
text-transform: none;
|
|
72
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
45
73
|
}
|
|
46
74
|
|
|
47
75
|
& > pre {
|
|
48
|
-
font-family: droid_sans_monoregular, mono, sans;
|
|
76
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
49
77
|
word-wrap: break-word;
|
|
50
78
|
margin: 0px;
|
|
51
79
|
padding: 10px;
|
|
@@ -1,20 +1,74 @@
|
|
|
1
1
|
#vivus-navigation {
|
|
2
2
|
float: left;
|
|
3
|
-
max-width:
|
|
3
|
+
max-width: 250px;
|
|
4
4
|
width: 100%;
|
|
5
|
-
|
|
5
|
+
height: 100%;
|
|
6
|
+
margin: 0;
|
|
7
|
+
background-color: #24281A;
|
|
8
|
+
z-index: 1000000;
|
|
9
|
+
overflow-y: scroll;
|
|
10
|
+
|
|
11
|
+
@include respond-to("small") {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
6
14
|
|
|
7
15
|
max-height: 100%;
|
|
8
16
|
position: fixed;
|
|
9
17
|
left: 0;
|
|
10
18
|
top: 0;
|
|
11
19
|
|
|
20
|
+
font-family: "Open Sans", droid_sans_monoregular, mono, sans;
|
|
21
|
+
|
|
12
22
|
ul {
|
|
13
|
-
padding:
|
|
23
|
+
padding: 0;
|
|
14
24
|
margin: 0;
|
|
25
|
+
color: #D5D5D3;
|
|
15
26
|
|
|
16
27
|
li {
|
|
28
|
+
margin-bottom: 5px;
|
|
17
29
|
list-style: none;
|
|
30
|
+
|
|
31
|
+
a {
|
|
32
|
+
line-height: 1.45;
|
|
33
|
+
text-decoration: none;
|
|
34
|
+
color: #D5D5D3;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: #F3DF6C;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.h1 {
|
|
42
|
+
font-size: 15px;
|
|
43
|
+
|
|
44
|
+
margin: 20px 0 5px 20px;
|
|
45
|
+
|
|
46
|
+
a {
|
|
47
|
+
color: #F3DF6C;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.h2 {
|
|
52
|
+
font-size: 13px;
|
|
53
|
+
color: #C3CED0;
|
|
54
|
+
margin: 0 0 5px 30px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.h3 {
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.h4 {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.h5 {
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.h6 {
|
|
70
|
+
|
|
71
|
+
}
|
|
18
72
|
}
|
|
19
73
|
}
|
|
20
74
|
}
|
|
@@ -12,15 +12,14 @@ class Vivus::StylesController < Vivus::ApplicationController
|
|
|
12
12
|
private
|
|
13
13
|
|
|
14
14
|
def find_stylesheets
|
|
15
|
-
|
|
16
|
-
extensions = ['**/*.sass', '**/*.scss']
|
|
17
|
-
extensions.each do |extension|
|
|
18
|
-
Dir.glob("app/assets/stylesheets/#{extension}") do |path|
|
|
19
|
-
files << path if is_a_file?(path)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
15
|
+
sprockets = Rails.application.assets
|
|
22
16
|
|
|
23
|
-
@
|
|
17
|
+
@css_paths = %w{application.css}
|
|
18
|
+
@css_paths += Rails.application.config.assets.precompile.select { |item|
|
|
19
|
+
item.is_a?(String) && item[-4,4] == ".css"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@stylesheets = @css_paths.map{|file_path| Stylesheet.new(css: sprockets[file_path].body)}
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def is_a_file? file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'rdiscount'
|
|
2
|
+
|
|
3
|
+
class Description
|
|
4
|
+
def initialize (block)
|
|
5
|
+
@block = block[2]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def partial
|
|
9
|
+
"description"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def render
|
|
13
|
+
RDiscount.new(strip_block_marker(@block), :smart, :filter_html).to_html.html_safe
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def strip_block_marker(block)
|
|
19
|
+
block.gsub("\n * ", "\n").gsub("\n *", "\n").strip
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
|
|
3
|
+
class Example
|
|
4
|
+
def initialize (match)
|
|
5
|
+
@block = match[2]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def partial
|
|
9
|
+
"example"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def render
|
|
13
|
+
ERB.new(strip_block_marker(@block)).result
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def code
|
|
17
|
+
match[2]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def strip_block_marker(block)
|
|
23
|
+
block.gsub(/\n\s*\*\s*/m, "\n").strip
|
|
24
|
+
end
|
|
25
|
+
end
|
data/app/models/stylesheet.rb
CHANGED
|
@@ -1,67 +1,23 @@
|
|
|
1
1
|
class Stylesheet
|
|
2
2
|
def initialize(options)
|
|
3
|
-
@
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def path
|
|
7
|
-
@path
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def display_path
|
|
11
|
-
@path.gsub("app/assets/stylesheets/", "")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def body
|
|
15
|
-
File.read(@path)
|
|
3
|
+
@css = options[:css]
|
|
16
4
|
end
|
|
17
5
|
|
|
18
6
|
def parse
|
|
19
|
-
|
|
20
|
-
@source = @path
|
|
21
|
-
@comment = []
|
|
22
|
-
@html = []
|
|
23
|
-
@in_a_comment = false
|
|
24
|
-
@in_a_html_example = false
|
|
25
|
-
|
|
26
|
-
File.readlines(@path).each do |line|
|
|
27
|
-
# as long as the line starts with //, we're in a comment
|
|
28
|
-
if line.start_with?("//")
|
|
29
|
-
# If the comment begins with the Vivus mark
|
|
30
|
-
if line.start_with?("// Vivus")
|
|
31
|
-
@in_a_comment = true
|
|
7
|
+
documentation = []
|
|
32
8
|
|
|
33
|
-
|
|
9
|
+
regex = /\/\* (Description|Example)(.*?)\*\//m
|
|
10
|
+
matches = @css.to_enum(:scan, regex).map { Regexp.last_match }
|
|
34
11
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
else
|
|
42
|
-
|
|
43
|
-
if @in_a_html_example
|
|
44
|
-
@html << line.gsub(/\/\/ /, '')
|
|
45
|
-
else
|
|
46
|
-
@comment << line.gsub(/\/\//, '')
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
else
|
|
51
|
-
# No longer in a comment
|
|
52
|
-
if @in_a_comment
|
|
53
|
-
@in_a_comment = false
|
|
54
|
-
if @source != nil && @comment != [] && @html != []
|
|
55
|
-
@blocks << Block.new(@source, @comment.delete_if(&:empty?), @html.delete_if(&:empty?))
|
|
56
|
-
|
|
57
|
-
@comment = []
|
|
58
|
-
@html = []
|
|
59
|
-
end
|
|
60
|
-
end
|
|
12
|
+
matches.each do |match|
|
|
13
|
+
case match[1]
|
|
14
|
+
when "Description"
|
|
15
|
+
documentation << Description.new(match)
|
|
16
|
+
when "Example"
|
|
17
|
+
documentation << Example.new(match)
|
|
61
18
|
end
|
|
62
19
|
end
|
|
63
|
-
@blocks
|
|
64
|
-
end
|
|
65
|
-
|
|
66
20
|
|
|
21
|
+
documentation
|
|
22
|
+
end
|
|
67
23
|
end
|
|
@@ -8,60 +8,46 @@
|
|
|
8
8
|
<ul class="vivus-sections">
|
|
9
9
|
<% @stylesheets.each do |stylesheet| %>
|
|
10
10
|
<% stylesheet.parse.each do |block| %>
|
|
11
|
-
|
|
12
|
-
<section class="vivus-documentation">
|
|
13
|
-
<%#= send_file("#{Rails.root.to_s}/#{block.source}" ,:disposition => 'inline') %>
|
|
14
|
-
<h3 class="vivus-source"><%= link_to block.source, "#{root_path}/#{block.source}" %></h3>
|
|
15
|
-
<%= block.comments.html_safe %>
|
|
16
|
-
</section>
|
|
17
|
-
|
|
18
|
-
<section class="vivus-example">
|
|
19
|
-
<h3 class="vivus-title">Example</h3>
|
|
20
|
-
<%= block.html.html_safe %>
|
|
21
|
-
</section>
|
|
22
|
-
|
|
23
|
-
<section class="vivus-code">
|
|
24
|
-
<h3 class="vivus-title">Code</h3>
|
|
25
|
-
<pre><%= block.html %></pre>
|
|
26
|
-
</section>
|
|
27
|
-
</li>
|
|
11
|
+
<%= render partial: "shared/#{block.partial}", locals: {data: block.render} %>
|
|
28
12
|
<% end %>
|
|
29
13
|
<% end %>
|
|
30
14
|
|
|
31
15
|
<% if @stylesheets.collect{|s| s.parse}.flatten.blank? %>
|
|
32
16
|
<li>
|
|
33
17
|
<h2>Let's begin!</h2>
|
|
34
|
-
<p>Above each block of code in your CSS, start documenting your styleguide by writing
|
|
18
|
+
<p>Above each block of code in your CSS, start documenting your styleguide by writing co
|
|
35
19
|
<p>The important bits are:</p>
|
|
36
20
|
<ul>
|
|
37
|
-
<li><code>//
|
|
38
|
-
<li><code>//
|
|
21
|
+
<li><code>// Description</code> indicates this is a Vivus comment, and will be parsed accord
|
|
22
|
+
<li><code>// Example</code> marks the start and end of the HTML example code that
|
|
39
23
|
</ul>
|
|
40
24
|
<br />
|
|
41
25
|
<pre>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
26
|
+
|
|
27
|
+
/* Description
|
|
28
|
+
*
|
|
29
|
+
* Section title, as in "Buttons" or "Tables"
|
|
30
|
+
* ==========================================
|
|
31
|
+
* Write some documentation explaining the use / concept of the CSS
|
|
32
|
+
* you've got below. This bit will be markdown rendered.
|
|
33
|
+
*
|
|
34
|
+
* - You can use three backticks (`) to indicate a code block
|
|
35
|
+
* - Code blocks will be syntax highlighted
|
|
36
|
+
*
|
|
37
|
+
* When you've documented it nicely, use the Example markers to
|
|
38
|
+
* indicate a block of HTML that uses the CSS.
|
|
39
|
+
*
|
|
40
|
+
* Keeps your documentation right near the CSS.
|
|
41
|
+
* So, if you update / refactor the CSS, update the HTML example if
|
|
42
|
+
* need be.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/* Example
|
|
47
|
+
* <div class="example">
|
|
48
|
+
* <a href="#" class="button">Some text<a>
|
|
49
|
+
* </div>
|
|
50
|
+
*/
|
|
65
51
|
</pre>
|
|
66
52
|
</li>
|
|
67
53
|
<% end %>
|
data/lib/vivus.rb
CHANGED
data/lib/vivus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,55 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vivus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mark Cipolla
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 4.0.3
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 4.0.3
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: rdiscount
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: better_errors
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - '>='
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - '>='
|
|
38
|
+
- - ">="
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
40
|
version: '0'
|
|
55
41
|
description: Styleguides can be a pain to keep as a living documentation for your
|
|
@@ -62,6 +48,9 @@ executables: []
|
|
|
62
48
|
extensions: []
|
|
63
49
|
extra_rdoc_files: []
|
|
64
50
|
files:
|
|
51
|
+
- MIT-LICENSE
|
|
52
|
+
- README.rdoc
|
|
53
|
+
- Rakefile
|
|
65
54
|
- app/assets/fonts/DroidSansMono-webfont.eot
|
|
66
55
|
- app/assets/fonts/DroidSansMono-webfont.svg
|
|
67
56
|
- app/assets/fonts/DroidSansMono-webfont.ttf
|
|
@@ -71,8 +60,12 @@ files:
|
|
|
71
60
|
- app/assets/fonts/lmmono10-regular-webfont.ttf
|
|
72
61
|
- app/assets/fonts/lmmono10-regular-webfont.woff
|
|
73
62
|
- app/assets/javascripts/vivus/application.js
|
|
63
|
+
- app/assets/javascripts/vivus/highlight.pack.js
|
|
74
64
|
- app/assets/stylesheets/vivus/application.css.scss
|
|
75
|
-
- app/assets/stylesheets/vivus/
|
|
65
|
+
- app/assets/stylesheets/vivus/core/constants.scss
|
|
66
|
+
- app/assets/stylesheets/vivus/core/mediaqueries.scss
|
|
67
|
+
- app/assets/stylesheets/vivus/core/mixins.scss
|
|
68
|
+
- app/assets/stylesheets/vivus/core/typography.scss
|
|
76
69
|
- app/assets/stylesheets/vivus/module/block.scss
|
|
77
70
|
- app/assets/stylesheets/vivus/module/nav.scss
|
|
78
71
|
- app/assets/stylesheets/vivus/module/syntax-highlighting.scss
|
|
@@ -80,25 +73,29 @@ files:
|
|
|
80
73
|
- app/controllers/vivus/styles_controller.rb
|
|
81
74
|
- app/helpers/vivus/application_helper.rb
|
|
82
75
|
- app/models/block.rb
|
|
76
|
+
- app/models/description.rb
|
|
77
|
+
- app/models/example.rb
|
|
83
78
|
- app/models/stylesheet.rb
|
|
84
79
|
- app/views/layouts/vivus/application.html.erb
|
|
80
|
+
- app/views/shared/_description.html.erb
|
|
81
|
+
- app/views/shared/_example.html.erb
|
|
85
82
|
- app/views/vivus/styles/_nav.html.erb
|
|
86
83
|
- app/views/vivus/styles/index.html.erb
|
|
87
84
|
- app/views/vivus/styles/show.html.erb
|
|
88
85
|
- config/application.rb
|
|
89
86
|
- config/routes.rb
|
|
90
87
|
- lib/tasks/vivus_tasks.rake
|
|
88
|
+
- lib/vivus.rb
|
|
91
89
|
- lib/vivus/engine.rb
|
|
92
90
|
- lib/vivus/version.rb
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- Rakefile
|
|
96
|
-
- README.rdoc
|
|
91
|
+
- test/dummy/README.rdoc
|
|
92
|
+
- test/dummy/Rakefile
|
|
97
93
|
- test/dummy/app/assets/javascripts/application.js
|
|
98
94
|
- test/dummy/app/assets/stylesheets/application.css
|
|
99
95
|
- test/dummy/app/controllers/application_controller.rb
|
|
100
96
|
- test/dummy/app/helpers/application_helper.rb
|
|
101
97
|
- test/dummy/app/views/layouts/application.html.erb
|
|
98
|
+
- test/dummy/config.ru
|
|
102
99
|
- test/dummy/config/application.rb
|
|
103
100
|
- test/dummy/config/boot.rb
|
|
104
101
|
- test/dummy/config/database.yml
|
|
@@ -114,13 +111,10 @@ files:
|
|
|
114
111
|
- test/dummy/config/initializers/wrap_parameters.rb
|
|
115
112
|
- test/dummy/config/locales/en.yml
|
|
116
113
|
- test/dummy/config/routes.rb
|
|
117
|
-
- test/dummy/config.ru
|
|
118
114
|
- test/dummy/public/404.html
|
|
119
115
|
- test/dummy/public/422.html
|
|
120
116
|
- test/dummy/public/500.html
|
|
121
117
|
- test/dummy/public/favicon.ico
|
|
122
|
-
- test/dummy/Rakefile
|
|
123
|
-
- test/dummy/README.rdoc
|
|
124
118
|
- test/dummy/script/rails
|
|
125
119
|
- test/integration/navigation_test.rb
|
|
126
120
|
- test/test_helper.rb
|
|
@@ -134,17 +128,17 @@ require_paths:
|
|
|
134
128
|
- lib
|
|
135
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
130
|
requirements:
|
|
137
|
-
- -
|
|
131
|
+
- - ">="
|
|
138
132
|
- !ruby/object:Gem::Version
|
|
139
133
|
version: '0'
|
|
140
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
135
|
requirements:
|
|
142
|
-
- -
|
|
136
|
+
- - ">="
|
|
143
137
|
- !ruby/object:Gem::Version
|
|
144
138
|
version: '0'
|
|
145
139
|
requirements: []
|
|
146
140
|
rubyforge_project:
|
|
147
|
-
rubygems_version: 2.
|
|
141
|
+
rubygems_version: 2.2.2
|
|
148
142
|
signing_key:
|
|
149
143
|
specification_version: 4
|
|
150
144
|
summary: Generates a styleguide for your SASS/SCSS
|