paggio 0.2.3 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/paggio/css/definition.rb +11 -0
- data/lib/paggio/css/unit.rb +16 -3
- data/lib/paggio/html.rb +0 -1
- data/lib/paggio/html/element.rb +13 -0
- data/lib/paggio/html/element/object.rb +27 -0
- data/paggio.gemspec +8 -7
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03850a7f3bf3978f419ccc6e7189ef8377f43780
|
4
|
+
data.tar.gz: 04c931b87504e60e8716e8e99871141242c7a3fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6b9403e176a1cfc3cbbc106d129592b2ca98049dc2b0263cb96f22b005bbaf6e8558e1a7d539ef8162d25712c421fceae5dee06fa48c44c2c68786a946d639
|
7
|
+
data.tar.gz: 277e56800dbd8144c90701e5bb0f1bb6de6b9548edb76efc768af2f48d64ea0d3abaa78dde069703b14ecd7a5becc508abb697b3406ac15c849d9e5dd4682791
|
@@ -134,6 +134,17 @@ class Definition < BasicObject
|
|
134
134
|
style 'filter', "alpha(opacity=#{(value * 100).to_i})"
|
135
135
|
end
|
136
136
|
|
137
|
+
def animation(*args)
|
138
|
+
style 'animation', args
|
139
|
+
style '-webkit-animation', args
|
140
|
+
end
|
141
|
+
|
142
|
+
def transition(*args)
|
143
|
+
style 'transition', args
|
144
|
+
style '-webkit-transition', args
|
145
|
+
style '-moz-transition', args
|
146
|
+
end
|
147
|
+
|
137
148
|
def method_missing(name, *args, &block)
|
138
149
|
name = name.to_s
|
139
150
|
important = name.end_with? ?!
|
data/lib/paggio/css/unit.rb
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
class Paggio; class CSS < BasicObject
|
12
12
|
|
13
13
|
class Unit
|
14
|
+
TYPES = %w[em ex ch rem vh vw vmin vmax px mm cm in pt pc s deg].map(&:to_sym)
|
14
15
|
COMPATIBLE = %w[in pt mm cm px pc].map(&:to_sym)
|
15
16
|
|
16
17
|
attr_reader :type, :number
|
@@ -25,6 +26,18 @@ class Unit
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def ==(other)
|
29
|
+
unless Unit === other
|
30
|
+
unless other.respond_to? :to_u
|
31
|
+
raise TypeError, "no implicit conversion of #{other.class} into Unit"
|
32
|
+
end
|
33
|
+
|
34
|
+
other = other.to_u
|
35
|
+
end
|
36
|
+
|
37
|
+
unless Unit === other
|
38
|
+
other = Unit.new(other, @type)
|
39
|
+
end
|
40
|
+
|
28
41
|
@number == convert(other, @type)
|
29
42
|
end
|
30
43
|
|
@@ -38,7 +51,7 @@ class Unit
|
|
38
51
|
[@number, @type].hash
|
39
52
|
end
|
40
53
|
|
41
|
-
|
54
|
+
TYPES.each {|name|
|
42
55
|
define_method name do
|
43
56
|
Unit.new(convert(self, name), name)
|
44
57
|
end
|
@@ -113,7 +126,7 @@ class Unit
|
|
113
126
|
end
|
114
127
|
|
115
128
|
def to_s
|
116
|
-
"
|
129
|
+
"#@number#@type"
|
117
130
|
end
|
118
131
|
|
119
132
|
alias to_str to_s
|
@@ -152,7 +165,7 @@ end
|
|
152
165
|
end; end
|
153
166
|
|
154
167
|
class Numeric
|
155
|
-
|
168
|
+
Paggio::CSS::Unit::TYPES.each {|name|
|
156
169
|
define_method name do
|
157
170
|
Paggio::CSS::Unit.new(self, name)
|
158
171
|
end
|
data/lib/paggio/html.rb
CHANGED
data/lib/paggio/html/element.rb
CHANGED
@@ -15,6 +15,7 @@ require 'paggio/html/element/button'
|
|
15
15
|
require 'paggio/html/element/canvas'
|
16
16
|
require 'paggio/html/element/img'
|
17
17
|
require 'paggio/html/element/input'
|
18
|
+
require 'paggio/html/element/object'
|
18
19
|
require 'paggio/html/element/td'
|
19
20
|
|
20
21
|
class Paggio; class HTML < BasicObject
|
@@ -82,6 +83,18 @@ class Element < BasicObject
|
|
82
83
|
self
|
83
84
|
end
|
84
85
|
|
86
|
+
defhelper :style do |hash|
|
87
|
+
@attributes[:style] = hash.map {|name, value|
|
88
|
+
"#{name}: #{value}"
|
89
|
+
}.join(';')
|
90
|
+
end
|
91
|
+
|
92
|
+
defhelper :data do |hash|
|
93
|
+
hash.each {|name, value|
|
94
|
+
@attributes["data-#{name}"] = value.to_s
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
85
98
|
def inspect
|
86
99
|
if @children.empty?
|
87
100
|
"#<HTML::Element(#{@name.upcase})>"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#--
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
6
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
7
|
+
#
|
8
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
9
|
+
#++
|
10
|
+
|
11
|
+
class Paggio; class HTML < BasicObject; class Element < BasicObject
|
12
|
+
|
13
|
+
class Object < self
|
14
|
+
{ type: :type,
|
15
|
+
data: :data,
|
16
|
+
name: :name,
|
17
|
+
|
18
|
+
height: :height,
|
19
|
+
width: :width
|
20
|
+
}.each {|name, attribute|
|
21
|
+
defhelper name do |value|
|
22
|
+
@attributes[attribute] = value
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
end; end; end
|
data/paggio.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
Gem::Specification.new {|s|
|
2
|
-
s.name
|
3
|
-
s.version
|
4
|
-
s.author
|
5
|
-
s.email
|
6
|
-
s.homepage
|
7
|
-
s.platform
|
8
|
-
s.summary
|
2
|
+
s.name = 'paggio'
|
3
|
+
s.version = '0.2.4'
|
4
|
+
s.author = 'meh.'
|
5
|
+
s.email = 'meh@schizofreni.co'
|
6
|
+
s.homepage = 'http://github.com/meh/paggio'
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.summary = 'Ruby, HTML and CSS at war.'
|
9
|
+
s.license = 'WTFPL'
|
9
10
|
|
10
11
|
s.files = `git ls-files`.split("\n")
|
11
12
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paggio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meh.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: meh@schizofreni.co
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- lib/paggio/html/element/canvas.rb
|
35
35
|
- lib/paggio/html/element/img.rb
|
36
36
|
- lib/paggio/html/element/input.rb
|
37
|
+
- lib/paggio/html/element/object.rb
|
37
38
|
- lib/paggio/html/element/td.rb
|
38
39
|
- lib/paggio/html/helpers.rb
|
39
40
|
- lib/paggio/markdown.rb
|
@@ -43,7 +44,8 @@ files:
|
|
43
44
|
- paggio.gemspec
|
44
45
|
- spec/css_spec.rb
|
45
46
|
homepage: http://github.com/meh/paggio
|
46
|
-
licenses:
|
47
|
+
licenses:
|
48
|
+
- WTFPL
|
47
49
|
metadata: {}
|
48
50
|
post_install_message:
|
49
51
|
rdoc_options: []
|
@@ -61,9 +63,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
63
|
version: '0'
|
62
64
|
requirements: []
|
63
65
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
66
|
+
rubygems_version: 2.2.0
|
65
67
|
signing_key:
|
66
68
|
specification_version: 4
|
67
69
|
summary: Ruby, HTML and CSS at war.
|
68
70
|
test_files:
|
69
71
|
- spec/css_spec.rb
|
72
|
+
has_rdoc:
|