paggio 0.2.1 → 0.2.2

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: 041672051d1e25dcb0b8ea5d07dfbe1463b4998e
4
- data.tar.gz: a4d28bc9bce57ab6f01a25eb045763911e1de053
3
+ metadata.gz: a2922cca4ead0ea1952265faa7e14cc383999890
4
+ data.tar.gz: 38be1b69622e4927a457fb70b907835053c0ae07
5
5
  SHA512:
6
- metadata.gz: 857af8dbb7c271043e7b86b8bcc4930fef8fa7ed9c99804cd77ca381e051239763e89fe12ae7ef047d047b9c5790ea582861576330f57641cbe62cfa115ac331
7
- data.tar.gz: 33461a196fc4226c197338258a4581fc96b8f93a2394dd3ce798a0da7cb801fe5aed241fd43130891965bb66890a58a584cbf9e4471e5003cc60adb227e69e7d
6
+ metadata.gz: 5af3ef2f52ff3363649fc834a24d0ce4995bf9ed7d81e71bf71d09bf207e9410bcb8d6c43cd6eb5482d1931319df657e2d651600eaebd1b4df2f250f13894609
7
+ data.tar.gz: c062f1fe8f9d8f44eb42b851d92a850398d573289daf4613e2d25e95a2c6ca4bfb4bc732f38ec4ed6d09a7f7229989b71c5821a64799f9426bf3cc7334d168ef
@@ -9,6 +9,7 @@
9
9
  #++
10
10
 
11
11
  require 'paggio/css/unit'
12
+ require 'paggio/css/color'
12
13
  require 'paggio/css/definition'
13
14
 
14
15
  class Paggio
@@ -35,6 +35,10 @@ class Definition < BasicObject
35
35
  Gradient.new(*args)
36
36
  end
37
37
 
38
+ def url(arg)
39
+ "url(#{arg.inspect})"
40
+ end
41
+
38
42
  def background(*args)
39
43
  if Gradient === args.first
40
44
  if args.length > 1
@@ -102,7 +106,11 @@ class Definition < BasicObject
102
106
  case name
103
107
  when :shadow
104
108
  if ::Array === value
105
- value = value.join ', '
109
+ if ::Array === value[0]
110
+ value = value.map { |v| v.join ' ' }.join(', ')
111
+ else
112
+ value = value.join ' '
113
+ end
106
114
  end
107
115
 
108
116
  style '-moz-box-shadow', value
@@ -159,7 +167,6 @@ class Definition < BasicObject
159
167
  self
160
168
  end
161
169
 
162
- private
163
170
  def style(name, value = nil, important = @important)
164
171
  if ::Array === value
165
172
  value = value.join ' '
@@ -172,6 +179,10 @@ private
172
179
  end
173
180
  end
174
181
 
182
+ def style!(name, value = nil)
183
+ style(name, value, true)
184
+ end
185
+
175
186
  class Gradient
176
187
  # TODO: all of it, seriously
177
188
  def initialize(*args)
@@ -32,7 +32,7 @@ class HTML < BasicObject
32
32
  end
33
33
 
34
34
  def <<(what)
35
- @current << what
35
+ (@current || @roots) << what
36
36
  end
37
37
 
38
38
  def root!
@@ -70,8 +70,8 @@ class HTML < BasicObject
70
70
  return super
71
71
  end
72
72
 
73
- if ::String === args.first
74
- content = ::Paggio::Utils.heredoc(args.shift)
73
+ unless args.empty? || ::Hash === args.first
74
+ content = ::Paggio::Utils.heredoc(args.shift.to_s)
75
75
  end
76
76
 
77
77
  element = Element.new(self, name, *args)
@@ -88,7 +88,7 @@ class HTML < BasicObject
88
88
  end
89
89
  end
90
90
 
91
- (@current || @roots) << element
91
+ self << element
92
92
 
93
93
  element
94
94
  end
@@ -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/td'
18
19
 
19
20
  class Paggio; class HTML < BasicObject
20
21
 
@@ -51,7 +52,7 @@ class Element < BasicObject
51
52
 
52
53
  def method_missing(name, content = nil, &block)
53
54
  if content
54
- self << ::Paggio::Utils.heredoc(content)
55
+ self << ::Paggio::Utils.heredoc(content.to_s)
55
56
  end
56
57
 
57
58
  if name.to_s.end_with? ?!
@@ -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 Td < self
14
+ defhelper :columns do |value|
15
+ @attributes[:colspan] = value.to_s
16
+ end
17
+
18
+ defhelper :rows do |value|
19
+ @attributes[:rowspan] = value.to_s
20
+ end
21
+
22
+ defhelper :headers do |*args|
23
+ @attributes[:headers] = args.join(' ')
24
+ end
25
+ end
26
+
27
+ end; end; end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new {|s|
2
2
  s.name = 'paggio'
3
- s.version = '0.2.1'
3
+ s.version = '0.2.2'
4
4
  s.author = 'meh.'
5
5
  s.email = 'meh@schizofreni.co'
6
6
  s.homepage = 'http://github.com/meh/paggio'
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - meh.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-16 00:00:00.000000000 Z
11
+ date: 2014-01-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: meh@schizofreni.co
@@ -33,6 +33,7 @@ files:
33
33
  - lib/paggio/html/element/canvas.rb
34
34
  - lib/paggio/html/element/img.rb
35
35
  - lib/paggio/html/element/input.rb
36
+ - lib/paggio/html/element/td.rb
36
37
  - lib/paggio/html/helpers.rb
37
38
  - lib/paggio/markdown.rb
38
39
  - lib/paggio/now.rb