style-guide 0.7.0 → 0.7.2
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.
data/lib/style_guide/partial.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "tilt"
|
1
2
|
require "nokogiri"
|
2
3
|
require "github/markdown"
|
3
4
|
|
@@ -15,11 +16,11 @@ module StyleGuide
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def title
|
18
|
-
@title ||= File.basename(path,
|
19
|
+
@title ||= File.basename(path, File.extname(path)).titleize.strip
|
19
20
|
end
|
20
21
|
|
21
22
|
def content
|
22
|
-
|
23
|
+
rendered.gsub(/\</, "<").gsub(/\>/, ">").html_safe
|
23
24
|
end
|
24
25
|
|
25
26
|
def description
|
@@ -48,6 +49,10 @@ module StyleGuide
|
|
48
49
|
|
49
50
|
private
|
50
51
|
|
52
|
+
def rendered
|
53
|
+
@rendered ||= Tilt.new(path).render
|
54
|
+
end
|
55
|
+
|
51
56
|
def style_guide_scope
|
52
57
|
[:style_guide, section.id.to_sym]
|
53
58
|
end
|
@@ -59,7 +64,7 @@ module StyleGuide
|
|
59
64
|
end
|
60
65
|
|
61
66
|
def parsed
|
62
|
-
@parsed ||= Nokogiri::HTML.parse(
|
67
|
+
@parsed ||= Nokogiri::HTML.parse(rendered)
|
63
68
|
end
|
64
69
|
end
|
65
70
|
end
|
data/lib/style_guide/section.rb
CHANGED
data/lib/style_guide/version.rb
CHANGED
@@ -46,7 +46,8 @@ describe StyleGuide::Partial do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "#content" do
|
49
|
-
|
49
|
+
let(:tilt) { double(:tilt, :render => "reading is for chumps") }
|
50
|
+
before { Tilt.stub(:new => tilt) }
|
50
51
|
|
51
52
|
subject { partial.content }
|
52
53
|
|
@@ -87,8 +88,8 @@ describe StyleGuide::Partial do
|
|
87
88
|
|
88
89
|
describe "#classes" do
|
89
90
|
let(:content) { %(<div class="noseclip"><img class="earplug noseclip"></div>) }
|
90
|
-
|
91
|
-
before {
|
91
|
+
let(:tilt) { double(:tilt, :render => content) }
|
92
|
+
before { Tilt.stub(:new => tilt) }
|
92
93
|
|
93
94
|
subject { partial.classes }
|
94
95
|
|
@@ -97,8 +98,8 @@ describe StyleGuide::Partial do
|
|
97
98
|
|
98
99
|
describe "#ids" do
|
99
100
|
let(:content) { %(<div id="stent"><img id="cholesterol"></div>) }
|
100
|
-
|
101
|
-
before {
|
101
|
+
let(:tilt) { double(:tilt, :render => content) }
|
102
|
+
before { Tilt.stub(:new => tilt) }
|
102
103
|
|
103
104
|
subject { partial.ids }
|
104
105
|
|