livingstyleguide 1.0.6 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cbcec7f0167e25bb21a1800fbb1182f1e17af12
4
- data.tar.gz: 49b40194d63fc6ed94b6adfa2f64cac8d09726e8
3
+ metadata.gz: d5d64f5ecac23f7aa496d41d29fe7c52ff57cf13
4
+ data.tar.gz: 1b4b9b3063fe8e43c40bade3ee2ea7712c59802b
5
5
  SHA512:
6
- metadata.gz: d6663050da0e050928c2c6aadf6a18292e412cf80d47da7d9644a23ee0f5496160df9f47c1ed249f01d3bae1b40f4b1a6bc4867c3f78352f2fc9b169f48bf93e
7
- data.tar.gz: 23ca79ab95de43d9fb3d797a382c558bd24885ca85994636e17154fd5cca241177c175c8c6c867b7e33ec97e45548b7ed50318a7a5a3fd0c244f120835041539
6
+ metadata.gz: c2f9f46707af29a9101565aa8251b049bfaec4f67b5569c8556147582c62ec3a3478244be0922ea17d56f9f63ecdf32b2fbd30b9252c5a5d4e2f699c3fb11a1d
7
+ data.tar.gz: fc7b35a8f96ea4ebfadb52518828bb3d5d563595a2b264f742dffadbc1a3de0affad49e3fe1d1298015eff4ea56d0dd0ee74d743499122c2a99dba695dde0c17
@@ -7,7 +7,8 @@ module LivingStyleGuide
7
7
  default_language: 'example',
8
8
  title: 'Living Style Guide',
9
9
  header: '<h1 class="livingstyleguide--page-title">Living Style Guide</h1>',
10
- footer: '<div class="livingstyleguide--footer"><a class="livingstyleguide--logo" href="http://livingstyleguide.org">Made with the LivingStyleGuide gem.</a></div>'
10
+ footer: '<div class="livingstyleguide--footer"><a class="livingstyleguide--logo" href="http://livingstyleguide.org">Made with the LivingStyleGuide gem.</a></div>',
11
+ root: '/'
11
12
  }
12
13
 
13
14
  def self.default_options
@@ -72,9 +73,7 @@ module LivingStyleGuide
72
73
  end
73
74
 
74
75
  def head
75
- (@engine.options[:javascript_before] || []).map do |src|
76
- %Q(<script src="#{src}"></script>)
77
- end.join("\n")
76
+ javascript_tags_for(@engine.options[:javascript_before]).join("\n")
78
77
  end
79
78
 
80
79
  def header
@@ -84,12 +83,22 @@ module LivingStyleGuide
84
83
 
85
84
  def footer
86
85
  contents = [@engine.options[:footer]]
87
- contents << (@engine.options[:javascript_after] || []).map do |src|
88
- %Q(<script src="#{src}"></script>)
89
- end
86
+ contents << javascript_tags_for(@engine.options[:javascript_after])
90
87
  contents.join("\n")
91
88
  end
92
89
 
90
+ private
91
+ def javascript_tags_for(list)
92
+ return [] unless list
93
+ list.map do |src|
94
+ if src =~ /\.js$/
95
+ %Q(<script src="#{src}"></script>)
96
+ else
97
+ %Q(<script>#{src}</script>)
98
+ end
99
+ end
100
+ end
101
+
93
102
  end
94
103
 
95
104
  end
@@ -46,6 +46,8 @@ module ::Tilt
46
46
  end
47
47
  @options[:syntax] = @options.has_key?(:styleguide_sass) ? :sass : :scss
48
48
  @options[:source] ||= File.basename(file, '.html.lsg')
49
+ @options[:filename] = file
50
+ @options[:root] ||= root
49
51
  end
50
52
 
51
53
  private
@@ -75,10 +77,22 @@ module ::Tilt
75
77
  if @scope.respond_to?(:environment)
76
78
  @scope.environment.root
77
79
  else
78
- File.dirname(@file)
80
+ find_root_path
79
81
  end
80
82
  end
81
83
 
84
+ private
85
+ def find_root_path
86
+ path = File.dirname(@file)
87
+ while path.length > 0 do
88
+ if File.exists?(File.join(path, 'Gemfile')) or File.exists?(File.join(path, '.git'))
89
+ break
90
+ end
91
+ path = File.expand_path('..', path)
92
+ end
93
+ path
94
+ end
95
+
82
96
  private
83
97
  def style_variables
84
98
  return unless @options.has_key?(:style)
@@ -20,9 +20,6 @@ module LivingStyleGuide
20
20
  nil
21
21
  end
22
22
 
23
- def root
24
- end
25
-
26
23
  def find_relative(uri, base, options)
27
24
  nil
28
25
  end
@@ -64,9 +61,9 @@ module LivingStyleGuide
64
61
 
65
62
  def all_variables
66
63
  variables = []
67
- test = /^#{File.dirname(@options[:filename])}/
64
+ test = /^#{File.expand_path(@options[:living_style_guide].options[:root])}/
68
65
  @options[:living_style_guide].files.each do |file|
69
- if file =~ test
66
+ if File.expand_path(file) =~ test
70
67
  sass = File.read(file)
71
68
  variables << sass.scan(%r(\$([a-z\-_]+)\s*:))
72
69
  end
@@ -1,3 +1,3 @@
1
1
  module LivingStyleGuide
2
- VERSION = '1.0.6'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -8,9 +8,11 @@ $livingstyleguide--base-font: 'Georgia', 'Times New Roman', serif !default;
8
8
  $livingstyleguide--base-font-size: 14px !default;
9
9
  $livingstyleguide--base-font-weight: normal !default;
10
10
  $livingstyleguide--base-line-height: 1.4 !default;
11
- $livingstyleguide--headline-font: $livingstyleguide--base-font !default;
11
+ $livingstyleguide--base-text-align: left !default;
12
12
  $livingstyleguide--page-title-font-size: 30px !default;
13
+ $livingstyleguide--headline-font: $livingstyleguide--base-font !default;
13
14
  $livingstyleguide--headline-font-size: 22px !default;
15
+ $livingstyleguide--headline-text-align: left !default;
14
16
  $livingstyleguide--sub-headline-font-size: 16px !default;
15
17
  $livingstyleguide--sub-sub-headline-font-size: $livingstyleguide--base-font-size !default;
16
18
  $livingstyleguide--headline-font-weight: bold !default;
@@ -9,6 +9,7 @@
9
9
  font-weight: $livingstyleguide--base-font-weight;
10
10
  line-height: $livingstyleguide--base-line-height;
11
11
  margin: $livingstyleguide--gap-width auto;
12
+ text-align: $livingstyleguide--base-text-align;
12
13
  width: $livingstyleguide--width;
13
14
  -webkit-font-smoothing: antialiased;
14
15
  }
@@ -16,7 +17,7 @@
16
17
  .livingstyleguide--unordered-list-item,
17
18
  .livingstyleguide--ordered-list-item {
18
19
  @extend %livingstyleguide--reset;
19
- display: block;
20
+ display: list-item;
20
21
  list-style: disc;
21
22
  margin: ceil($livingstyleguide--gap-width / 2) 0 ceil($livingstyleguide--gap-width / 2) (2 * $livingstyleguide--gap-width);
22
23
  }
@@ -33,6 +34,7 @@
33
34
  font-weight: $livingstyleguide--headline-font-weight;
34
35
  line-height: $livingstyleguide--headline-line-height;
35
36
  margin: (3 * $livingstyleguide--gap-width) auto $livingstyleguide--gap-width;
37
+ text-align: $livingstyleguide--headline-text-align;
36
38
  width: $livingstyleguide--width;
37
39
  -webkit-font-smoothing: antialiased;
38
40
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livingstyleguide
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Hagenburger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2014-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minisyntax