woo 0.1.12 → 0.2.0

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.
@@ -2,13 +2,13 @@
2
2
  // BLOCK
3
3
  // ******************************************************************
4
4
 
5
- $styleguide-padding: 20px 0;
6
-
7
5
  #woo-styleguide {
8
6
 
9
7
  dl.styleguide {
8
+ box-shadow: inset 0 0 0 2px $black;
10
9
  margin: 0;
11
- padding: $styleguide-padding;
10
+ margin-bottom: 1em;
11
+ padding: 2px;
12
12
  position: relative;
13
13
 
14
14
  a[name] {
@@ -16,13 +16,14 @@ $styleguide-padding: 20px 0;
16
16
  padding: 0;
17
17
  margin: 0;
18
18
  }
19
+
19
20
  dt.page-title {
20
- background-color: rgba($white, .95);
21
- color: $black;
21
+ background-color: $black;
22
+ color: $white;
22
23
  display: block;
23
24
  font-size: 2em;
24
25
  font-weight: 100;
25
- margin: 2em 0 0;
26
+ margin: 0;
26
27
  padding: 10px 0;
27
28
  text-align: center;
28
29
  }
@@ -36,12 +37,14 @@ $styleguide-padding: 20px 0;
36
37
 
37
38
  &.notes {
38
39
  background: $notes-section-background-color;
39
- padding-top: 2em;
40
- padding-bottom: 2em;
40
+ padding-top: 0;
41
+ padding-bottom: 0;
42
+
41
43
  .wrapper {
42
44
  background: $notes-background-color;
43
45
  padding: 4em;
44
46
  }
47
+
45
48
  .notes-title {
46
49
  box-shadow: 0 1px 0 0 rgba($black, .08);
47
50
  color: rgba($black, .35);
@@ -56,15 +59,15 @@ $styleguide-padding: 20px 0;
56
59
  color: lighten($black, 15%);
57
60
  font-weight: 200;
58
61
  }
59
-
60
62
  }
63
+
61
64
  &.preview {
62
65
  background: $body-background-color;
63
66
  }
67
+
64
68
  &.location-title {
65
69
  padding: 0;
66
70
  }
67
71
  }
68
72
  }
69
-
70
73
  }
@@ -35,7 +35,7 @@ body {
35
35
  }
36
36
 
37
37
  #woo-styleguide {
38
- background: $black;
38
+ background: rgba($black, .2);
39
39
  padding: 0;
40
40
  margin: 0;
41
41
  font-family: $body-font;
@@ -65,10 +65,13 @@ body {
65
65
 
66
66
  &:hover { color: $primary-color; }
67
67
 
68
- + pre { display: none; }
68
+ + pre {
69
+ display: none;
70
+ margin: 0;
71
+ }
72
+
69
73
  + pre code {
70
- box-shadow: inset 0 -20px 0 #fafaff;
71
- background-color: #f3f3fa;
74
+ background-color: #f3f3f7;
72
75
  font-size: 14px;
73
76
  padding: 4em 20px 4.6em;
74
77
  }
@@ -15,8 +15,12 @@ module Woo
15
15
  page_hash(filepath)
16
16
  end
17
17
 
18
- def render_haml_string(contents)
19
- Haml::Engine.new(contents).render
18
+ def render_contents_string(hash)
19
+ if hash[:lang] == 'haml'
20
+ Haml::Engine.new(hash[:contents]).render
21
+ else
22
+ ERB.new(hash[:contents]).result(binding).html_safe
23
+ end
20
24
  end
21
25
 
22
26
  def load_notes(filepath)
@@ -26,16 +30,15 @@ module Woo
26
30
  end
27
31
 
28
32
  def page_hash(filepath)
29
- lang = filepath.match(/haml$/) ? 'haml' : 'markup'
33
+ lang = filepath.match(/haml$/) ? 'haml' : 'erb'
30
34
  name = File.basename(filepath)
31
35
  .gsub(/^\_|.html.*/, '')
32
36
 
33
37
  {
34
38
  :name => name,
35
39
  :filepath => filepath,
36
- :contents => File.read(filepath).sub(/^-{1,3}$\n.*^-{1,3}$\n/m, ''),
37
- :notes => load_notes(filepath),
38
- :lang => lang
40
+ :markup => {contents: File.read(filepath).sub(/^-{1,3}$\n.*^-{1,3}$\n/m, ''), lang: lang},
41
+ :notes => {contents: load_notes(filepath), lang: lang}
39
42
  }
40
43
  end
41
44
 
@@ -4,18 +4,19 @@
4
4
  %dt.page-title
5
5
  = page[:name].titleize
6
6
  - notes = page[:notes]
7
- - if notes
7
+ - if notes && notes[:content].present?
8
8
  %dd.notes
9
9
  .row
10
10
  .small-12.column
11
11
  .wrapper
12
12
  %h3.notes-title # Notes
13
- = render_haml_string(notes)
13
+ = render_contents_string(notes)
14
14
 
15
+ - the_markup = render_contents_string(page[:markup])
15
16
  %dd.preview
16
- = render_haml_string(page[:contents])
17
+ = the_markup
17
18
 
18
19
  %dd.location-title
19
20
  .location= page[:filepath]
20
- %pre
21
- %code(class="#{page[:lang]}")= page[:contents]
21
+ %pre<
22
+ %code(class="#{page[:lang]}")= "#{the_markup}"
@@ -1,3 +1,3 @@
1
1
  module Woo
2
- VERSION = "0.1.12"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Altman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-03 00:00:00.000000000 Z
12
+ date: 2016-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  version: '0'
257
257
  requirements: []
258
258
  rubyforge_project:
259
- rubygems_version: 2.2.2
259
+ rubygems_version: 2.4.5
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: A mountable styleguide