vivus 1.0.6 → 1.0.7

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: 13980c33f9caddae4de3d035348884f27c3f23c2
4
- data.tar.gz: cc900d231364964155a39df81819c8a83e0aa17c
3
+ metadata.gz: e91f68c5d5976fc293b0ddc92a60dee74a50ed96
4
+ data.tar.gz: abdb3ddeea7a3354350d403d518be53d1fb9f336
5
5
  SHA512:
6
- metadata.gz: 418bc84b3972d05a4ac4ad1775986898ccd4d90eda741a6402ef4a26d077f98335251330079d66414afa0421a4661cea7335fd29a63083c0463d5a10e404d567
7
- data.tar.gz: 4a782a7a5e5cdfb12d27dd70b2cdbc6e17295a944bdb94e5f181660e590315f05b5f2214f051912fb116a4f74190a419bdac6497cd2aa914363402b4a65f86a8
6
+ metadata.gz: dfad9b9bf091e40c0bb2650ec29d5d87d140a0cf06a3def21013a4c08ba7d2350ce2ac8bab6841088884a3d06698e06876af9faf5165dd4c0119611d90b25ba4
7
+ data.tar.gz: 5a6ae28163548adf7022ad5053bdf54c01c589b449ef58b51bd07cb3a9ed8ee2cc65469a378b74fe2daed42e3fa6e436babf5c96be84404d815d6e217ec6d72d
@@ -8,24 +8,8 @@ $(document).ready(function() {
8
8
  hljs.highlightBlock(el);
9
9
  });
10
10
 
11
- $('h1.vivus-section-title').each(function(i, el) {
12
- var text = $(el).text().toLowerCase();
13
- var link = text.replace(/ /g, '-');
14
- var anchor = "<a href='#" + link + "'>" + $(el).text() + "</a>";
15
- $('#vivus-navigation > ul').append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "<ul></ul></li>");
16
- $(el).prepend("<a name='" + link + "'></a>");
17
- })
18
-
19
11
  $('h2.vivus-name').each(function(i, el) {
20
- var section = $(el).parents(".vivus-section");
21
- var section_title = section.children("h1.vivus-section-title").text().toLowerCase().replace(/ /g, '-');
22
-
23
- var anchor = "<a href='#" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') + "'>" + $(el).text() + "</a>"
24
-
25
- var navParent = $('#vivus-navigation ul').find("a[href='#" + section_title + "']").parent();
26
-
27
- $(navParent).find("ul").append("<li class=" + $(el).prop("tagName").toLowerCase() + ">" + anchor + "</li>");
28
- $(el).prepend("<a name='" + section_title + "|" + $(el).text().toLowerCase().replace(/ /g, '-') +"'></a>");
12
+ $(el).before("<a name='" + $(el).text().toLowerCase().replace(/ /g, '-') +"'></a>");
29
13
  })
30
14
 
31
15
  $('.vivus-documentation *:contains("TODO:")').html(function(_, html) {
@@ -13,7 +13,7 @@ li.vivus-component {
13
13
  }
14
14
 
15
15
  > h2 {
16
- margin-top: 50px;
16
+ padding-top: 50px;
17
17
  }
18
18
 
19
19
  > ul, ol {
@@ -39,6 +39,12 @@
39
39
 
40
40
  margin: 20px 0 10px 20px;
41
41
 
42
+ &.active {
43
+ margin-left: 0;
44
+ padding-left: 15px;
45
+ border-left: 5px solid #F3DF6C;
46
+ }
47
+
42
48
  a {
43
49
  color: #F3DF6C;
44
50
  }
@@ -1,6 +1,16 @@
1
1
  # Controller for dsiplaying the documentation for the styles
2
2
  class Vivus::StylesController < Vivus::ApplicationController
3
3
  def index
4
+ gather_stylesheets
5
+ end
6
+
7
+ def show
8
+ gather_stylesheets
9
+ end
10
+
11
+ private
12
+
13
+ def gather_stylesheets
4
14
  sprockets = Rails.application.assets
5
15
 
6
16
  @css_paths = %w{application.css}
@@ -12,10 +22,15 @@ class Vivus::StylesController < Vivus::ApplicationController
12
22
  .map{|file_path| Stylesheet.new(css: sprockets[file_path].body)}
13
23
  .map{|stylesheet| stylesheet.parse}
14
24
  .reject{|stylesheet| stylesheet.empty?}
15
- .inject({}){ |a,b| a.merge(b) }
16
- end
25
+ .inject({}){ | accum, data |
26
+ data.each do |section, components|
27
+ accum[section] ||= []
28
+ accum[section] += components
29
+ end
17
30
 
18
- private
31
+ accum
32
+ }
33
+ end
19
34
 
20
35
  def is_a_file? file
21
36
  File.file?(file)
@@ -10,4 +10,8 @@ class Component
10
10
  def display_example
11
11
  ERB.new(example).result if self.example
12
12
  end
13
+
14
+ def slug
15
+ self.name.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-')
16
+ end
13
17
  end
@@ -1,7 +1,23 @@
1
1
  <nav id="vivus-navigation">
2
2
  <ul>
3
- <% @stylesheets.each do |stylesheet| %>
4
- <li><%= link_to stylesheet.display_path, "/vivus/#{stylesheet.path}" %></li>
3
+ <% @stylesheets.each do |group| %>
4
+ <% section = group[0] %>
5
+ <% section_slug = section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') %>
6
+ <% chunks = group[1] %>
7
+
8
+ <li class="h1 <%= "active" if section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') == params[:section] %>">
9
+ <%= link_to section, vivus_section_path(section_slug) %>
10
+
11
+ <% if chunks.present? %>
12
+ <ul>
13
+ <% chunks.each do |chunk| %>
14
+ <li class="h2">
15
+ <%= link_to chunk.name, vivus_section_path(section_slug, anchor: chunk.slug) %>
16
+ </li>
17
+ <% end %>
18
+ </ul>
19
+ <% end %>
20
+ </li>
5
21
  <% end %>
6
22
  </ul>
7
23
  </nav>
@@ -1,25 +1,11 @@
1
- <%#= render partial: "nav" %>
2
- <div id="vivus-navigation">
3
- <ul>
4
-
5
- </ul>
6
- </div>
1
+ <%= render partial: "nav" %>
7
2
  <div id="vivus-body">
8
3
  <ul class="vivus-sections">
9
- <% @stylesheets.each do |title, components| %>
10
- <li class="vivus-section">
11
- <h1 class="vivus-section-title"><%= title %></h1>
12
- <ul class="vivus-components">
13
- <%= render partial: "component", collection: components %>
14
- </ul>
15
- </li>
16
- <% end %>
17
-
18
- <% if @stylesheets.flatten.blank? %>
19
4
  <li class="vivus-section">
20
5
  <h2></h2>
21
6
  <h1 class="vivus-section-title">Let's begin!</h1>
22
- <p>Above each block of code in your CSS, start documenting your styleguide by writing comments.
7
+
8
+ <p>Above each block of code in your CSS, start documenting your styleguide by writing comments.</p>
23
9
  <p>Use the below example as a starting point.</p>
24
10
  <pre>
25
11
  /*
@@ -49,7 +35,6 @@ need be.
49
35
  */
50
36
  </pre>
51
37
  </li>
52
- <% end %>
53
38
  </ul>
54
39
  </div>
55
40
 
@@ -1,8 +1,13 @@
1
1
  <%= render partial: "nav" %>
2
-
3
-
4
- <% @stylesheet.parse.each do |block| %>
5
- <%= block.comments.html_safe %>
6
-
7
- <pre><%= block.html.html_safe %></pre>
8
- <% end %>
2
+ <div id="vivus-body">
3
+ <ul class="vivus-sections">
4
+ <% @stylesheets.select{ |section| section.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') == params[:section]}.each do |title, components| %>
5
+ <li class="vivus-section">
6
+ <h1 class="vivus-section-title"><%= title %></h1>
7
+ <ul class="vivus-components">
8
+ <%= render partial: "component", collection: components %>
9
+ </ul>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
data/config/routes.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  Vivus::Engine.routes.draw do
2
+ get '/:section', to: 'styles#show', as: "vivus_section"
2
3
  root to: "styles#index"
3
4
  end
data/lib/vivus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vivus
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
metadata CHANGED
@@ -1,75 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vivus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
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-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-13 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
19
  version: '4.0'
20
- - - ">="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 4.0.3
22
+ version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.0'
30
- - - ">="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 4.0.3
32
+ version: '5'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rdiscount
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.1'
40
- - - ">="
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 2.1.7.1
42
+ version: '3'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '2.1'
50
- - - ">="
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 2.1.7.1
52
+ version: '3'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: '2.14'
60
- - - ">="
60
+ - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.14.1
62
+ version: '3'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '2.14'
70
- - - ">="
70
+ - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: 2.14.1
72
+ version: '3'
73
73
  description: Styleguides can be a pain to keep as a living documentation for your
74
74
  CSS. By analysing the comments in your SASS files, and by adding markdown to your
75
75
  stylesheets, you can generate a living, breathing documentation styleguide that