alphasights-sinatra-sprockets 0.0.3 → 0.0.4
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/sinatra/sprockets/helpers.rb +27 -27
- data/lib/sinatra/sprockets/version.rb +1 -1
- metadata +4 -4
|
@@ -6,36 +6,36 @@ module Sinatra
|
|
|
6
6
|
defer reversed ismap seemless muted required
|
|
7
7
|
autofocus novalidate formnovalidate open pubdate).to_set
|
|
8
8
|
BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attribute| attribute.to_sym })
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
def favicon_link_tag(source='favicon.ico', options={})
|
|
11
11
|
tag('link', {
|
|
12
12
|
:rel => 'shortcut icon',
|
|
13
13
|
:type => 'image/vnd.microsoft.icon',
|
|
14
14
|
:href => asset_path(source)
|
|
15
|
-
}.merge(options
|
|
15
|
+
}.merge(options))
|
|
16
16
|
end
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
def image_tag(source, options = {})
|
|
19
|
-
options.
|
|
20
|
-
|
|
21
|
-
options[:src] = asset_path(source)
|
|
22
|
-
|
|
19
|
+
digest = options.key?(:digest) ? options.delete(:digest) : config.digest_assets?
|
|
20
|
+
|
|
21
|
+
options[:src] = asset_path(source, digest: digest)
|
|
22
|
+
|
|
23
23
|
if size = options.delete(:size)
|
|
24
24
|
options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
tag("img", options)
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
def video_tag(sources, options = {})
|
|
31
|
-
options
|
|
32
|
-
|
|
31
|
+
options
|
|
32
|
+
|
|
33
33
|
options[:poster] = asset_path(options[:poster]) if options[:poster]
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
if size = options.delete(:size)
|
|
36
36
|
options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
|
|
37
37
|
end
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
if sources.is_a?(Array)
|
|
40
40
|
content_tag("video", options) do
|
|
41
41
|
sources.map { |source| tag("source", :src => source) }.join
|
|
@@ -45,19 +45,19 @@ module Sinatra
|
|
|
45
45
|
tag("video", options)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
def audio_tag(source, options = {})
|
|
50
|
-
options
|
|
50
|
+
options
|
|
51
51
|
options[:src] = asset_path(source)
|
|
52
52
|
tag("audio", options)
|
|
53
53
|
end
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
def javascript_include_tag(*sources)
|
|
56
56
|
options = sources.extract_options!
|
|
57
57
|
debug = options.key?(:debug) ? options.delete(:debug) : config.debug_assets?
|
|
58
58
|
body = options.key?(:body) ? options.delete(:body) : false
|
|
59
59
|
digest = options.key?(:digest) ? options.delete(:digest) : config.digest_assets?
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
sources.collect do |source|
|
|
62
62
|
if debug && asset = asset_paths.asset_for(source, 'js')
|
|
63
63
|
asset.to_a.map { |dep|
|
|
@@ -70,13 +70,13 @@ module Sinatra
|
|
|
70
70
|
end
|
|
71
71
|
end.join("\n")
|
|
72
72
|
end
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
def stylesheet_link_tag(*sources)
|
|
75
75
|
options = sources.extract_options!
|
|
76
76
|
debug = options.key?(:debug) ? options.delete(:debug) : config.debug_assets?
|
|
77
77
|
body = options.key?(:body) ? options.delete(:body) : false
|
|
78
78
|
digest = options.key?(:digest) ? options.delete(:digest) : config.digest_assets?
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
sources.collect do |source|
|
|
81
81
|
if debug && asset = asset_paths.asset_for(source, 'css')
|
|
82
82
|
asset.to_a.map { |dep|
|
|
@@ -89,17 +89,17 @@ module Sinatra
|
|
|
89
89
|
end
|
|
90
90
|
end.join("\n")
|
|
91
91
|
end
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
def asset_path(source, options={})
|
|
94
94
|
source = source.logical_path if source.respond_to?(:logical_path)
|
|
95
95
|
path = asset_paths.compute_public_path(source, config.prefix, options.merge(:body => true))
|
|
96
96
|
options[:body] ? "#{path}?body=1" : path
|
|
97
97
|
end
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
def tag(name, options = nil, open = false, escape = true)
|
|
100
100
|
"<#{name}#{tag_options(options, escape) if options}#{open ? ">" : " />"}"
|
|
101
101
|
end
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
|
|
104
104
|
if block_given?
|
|
105
105
|
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
|
|
@@ -108,17 +108,17 @@ module Sinatra
|
|
|
108
108
|
content_tag_string(name, content_or_options_with_block, options, escape)
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
private
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
def asset_paths
|
|
115
115
|
@asset_paths ||= AssetPaths.new(Sinatra::Sprockets.config)
|
|
116
116
|
end
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
def config
|
|
119
119
|
Sinatra::Sprockets.config
|
|
120
120
|
end
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
def tag_options(options, escape = true)
|
|
123
123
|
unless options.blank?
|
|
124
124
|
attrs = []
|
|
@@ -142,7 +142,7 @@ module Sinatra
|
|
|
142
142
|
" #{attrs.sort * ' '}" unless attrs.empty?
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
def content_tag_string(name, content, options, escape = true)
|
|
147
147
|
tag_options = tag_options(options, escape) if options
|
|
148
148
|
"<#{name}#{tag_options}>#{escape ? ERB::Util.h(content) : content}</#{name}>"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alphasights-sinatra-sprockets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-03-
|
|
12
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: sprockets
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70221410951920 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,7 +21,7 @@ dependencies:
|
|
|
21
21
|
version: '2.0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70221410951920
|
|
25
25
|
description: Use Sprockets effectively with Sinatra.
|
|
26
26
|
email:
|
|
27
27
|
- jessereiss@gmail.com
|