livingstyleguide 2.0.0.alpha.2 → 2.0.0.alpha.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a51a7d18383f9d9667786275263bc1b71af49b0
|
4
|
+
data.tar.gz: a6ef46207a4b6add73873de1a2141629f8da8917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79e37f2e32f51c8478f69d0f958fc0a19a6dc187854ffd604bb9a6688ee0e14735b08167293bf7aa29b03d55d7c8972ad6243971b3a3b30b34016cfa2aadd14a
|
7
|
+
data.tar.gz: 8b9f37570cecc6ebb507cdb703dee17c401e4761c16bfaa2afd92f325fed36a56614a3ef2e5473383c7f5ae59a961287c6603713ae1a45371cb36d5803eb7d5b
|
@@ -39,12 +39,12 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def source
|
42
|
-
@source ||= set_highlights(
|
42
|
+
@source ||= set_highlights(erb.gsub(/<%.*?%>\n?/, ''))
|
43
43
|
end
|
44
44
|
|
45
45
|
def css
|
46
46
|
scss_with_lsg = "#{scss}; @import 'livingstyleguide';"
|
47
|
-
|
47
|
+
render_scss(scss_with_lsg)
|
48
48
|
end
|
49
49
|
|
50
50
|
def id
|
@@ -102,7 +102,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
102
102
|
|
103
103
|
private
|
104
104
|
def parse_filters
|
105
|
-
|
105
|
+
data.gsub('<%', '<%%').gsub(/\G(.*?)((```.+?```)|\Z)/m) do
|
106
106
|
content, code_block = $1, $2
|
107
107
|
content.gsub(/^@([\w\d_-]+)(?: ([^\{\n]+))?(?: *\{\n((?:.|\n)*?)\n\}|\n((?: .*\n)+))?/) do
|
108
108
|
name, arguments, block = $1, $2 || '', $3 || $4
|
@@ -150,6 +150,17 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
150
150
|
"section-#{Digest::SHA256.hexdigest(data)[0...6]}"
|
151
151
|
end
|
152
152
|
end
|
153
|
+
|
154
|
+
private
|
155
|
+
def scss_template
|
156
|
+
::LivingStyleGuide.default_options[:scss_template] || Tilt['scss']
|
157
|
+
end
|
158
|
+
|
159
|
+
private
|
160
|
+
def render_scss(scss)
|
161
|
+
sass_options = options.merge(custom: { sprockets_context: @scope })
|
162
|
+
scss_template.new(file, sass_options){ scss }.render(@scope)
|
163
|
+
end
|
153
164
|
end
|
154
165
|
|
155
166
|
Tilt.register 'lsg', LivingStyleGuide::Document
|
@@ -3,10 +3,15 @@ require 'tilt'
|
|
3
3
|
LivingStyleGuide.add_filter :import do |glob, data = nil|
|
4
4
|
glob << '.lsg' unless glob =~ /\.(\w+|\*)$/
|
5
5
|
glob.gsub!(/[^\/]+$/, '{_,}\\0')
|
6
|
+
if document.file
|
7
|
+
glob = File.join(File.dirname(document.file), glob)
|
8
|
+
end
|
9
|
+
|
6
10
|
if data
|
7
11
|
require 'json'
|
8
12
|
data = JSON.parse("{#{data}}")
|
9
13
|
end
|
14
|
+
|
10
15
|
Dir.glob(glob).map do |file|
|
11
16
|
if file =~ /\.s[ac]ss$/
|
12
17
|
document.depend_on file
|
@@ -4,6 +4,7 @@ if defined?(Rails) and defined?(Rails::Railtie)
|
|
4
4
|
class LivingStyleGuideRailtie < Rails::Railtie
|
5
5
|
initializer 'living_style_guide.assets' do
|
6
6
|
Rails.application.assets.register_engine('.lsg', ::LivingStyleGuide::Document)
|
7
|
+
LivingStyleGuide.default_options[:scss_template] = ::Sass::Rails::ScssTemplate
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
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: 2.0.0.alpha.
|
4
|
+
version: 2.0.0.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nico Hagenburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minisyntax
|