style-guide 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,7 +1,21 @@
1
- Copyright 2012 Pivotal Labs
1
+ The MIT License
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Copyright (c) 2012 Pivotal Labs
4
4
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,4 +1,7 @@
1
1
  module StyleGuide
2
2
  module ApplicationHelper
3
+ def escape_for_display(content)
4
+ content.gsub(/\</, "&lt;").gsub(/\>/, "&gt;").html_safe
5
+ end
3
6
  end
4
7
  end
@@ -1,3 +1,5 @@
1
+ <% content = render(:file => partial.path) %>
2
+
1
3
  <div class="style-guide-partial" id="<%= partial.id %>">
2
4
  <div class="style-guide-partial-title">
3
5
  <%= partial.title %>
@@ -10,7 +12,7 @@
10
12
  <% end %>
11
13
 
12
14
  <div class="style-guide-partial-rendered">
13
- <%= render :file => partial.path %>
15
+ <%= content %>
14
16
  </div>
15
17
 
16
18
  <% if partial.identifiers.any? %>
@@ -23,7 +25,7 @@
23
25
 
24
26
  <input id="style-guide-toggle-<%= partial.id %>" type="checkbox" />
25
27
  <label for="style-guide-toggle-<%= partial.id %>">
26
- <pre class="style-guide-partial-source prettyprint linenums"><%= partial.content %></pre>
28
+ <pre class="style-guide-partial-source prettyprint linenums"><%= escape_for_display(content) %></pre>
27
29
  <div class="style-guide-toggle show">Show source code</div>
28
30
  <div class="style-guide-toggle hide">Hide source code</div>
29
31
  </label>
@@ -19,10 +19,6 @@ module StyleGuide
19
19
  @title ||= File.basename(path, File.extname(path)).titleize.strip
20
20
  end
21
21
 
22
- def content
23
- rendered.gsub(/\</, "&lt;").gsub(/\>/, "&gt;").html_safe
24
- end
25
-
26
22
  def description
27
23
  @description ||= GitHub::Markdown.render_gfm(translated_description)
28
24
  end
@@ -49,10 +45,6 @@ module StyleGuide
49
45
 
50
46
  private
51
47
 
52
- def rendered
53
- @rendered ||= Tilt.new(path).render
54
- end
55
-
56
48
  def style_guide_scope
57
49
  [:style_guide, section.id.to_sym]
58
50
  end
@@ -66,5 +58,9 @@ module StyleGuide
66
58
  def parsed
67
59
  @parsed ||= Nokogiri::HTML.parse(rendered)
68
60
  end
61
+
62
+ def rendered
63
+ @rendered ||= Tilt.new(path).render
64
+ end
69
65
  end
70
66
  end
@@ -1,3 +1,3 @@
1
1
  module StyleGuide
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -45,15 +45,6 @@ describe StyleGuide::Partial do
45
45
  end
46
46
  end
47
47
 
48
- describe "#content" do
49
- let(:tilt) { double(:tilt, :render => "reading is for chumps") }
50
- before { Tilt.stub(:new => tilt) }
51
-
52
- subject { partial.content }
53
-
54
- it { should == "reading is for chumps" }
55
- end
56
-
57
48
  describe "#description" do
58
49
  subject { partial.description }
59
50
 
data/style-guide.gemspec CHANGED
@@ -4,6 +4,7 @@ require "style_guide/version"
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "style-guide"
6
6
  s.version = StyleGuide::VERSION
7
+ s.license = "MIT"
7
8
  s.authors = ["Doc Ritezel"]
8
9
  s.email = ["doc@pivotallabs.com"]
9
10
  s.homepage = "https://github.com/pivotal/style-guide"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: style-guide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -426,7 +426,8 @@ files:
426
426
  - spec/spec_helper.rb
427
427
  - style-guide.gemspec
428
428
  homepage: https://github.com/pivotal/style-guide
429
- licenses: []
429
+ licenses:
430
+ - MIT
430
431
  post_install_message:
431
432
  rdoc_options: []
432
433
  require_paths: