paggio 0.2.0 → 0.2.1

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: f45cce4c5e22a829c92ab432750b660ccbb3c5ce
4
- data.tar.gz: b35cfc68c4599a09d058b58d30561faad7088127
3
+ metadata.gz: 041672051d1e25dcb0b8ea5d07dfbe1463b4998e
4
+ data.tar.gz: a4d28bc9bce57ab6f01a25eb045763911e1de053
5
5
  SHA512:
6
- metadata.gz: f09353b8bf0a32cf35ec40ba71fbb0a7054068ed9c854597ca7dd567a2d19541a5bcda03fea9bacef434b4a36ddd3e0a58187ca0b467b8f8a9fd34ebf359fba0
7
- data.tar.gz: 462b363f533688c41e2b799a7e246c736cd69fe99579f89c3122fbaad3f1327567d885a6ab870c5f485d3feb57ee2bd89553ee583d4ccff39f680aadaa721fb1
6
+ metadata.gz: 857af8dbb7c271043e7b86b8bcc4930fef8fa7ed9c99804cd77ca381e051239763e89fe12ae7ef047d047b9c5790ea582861576330f57641cbe62cfa115ac331
7
+ data.tar.gz: 33461a196fc4226c197338258a4581fc96b8f93a2394dd3ce798a0da7cb801fe5aed241fd43130891965bb66890a58a584cbf9e4471e5003cc60adb227e69e7d
@@ -5,3 +5,7 @@ rvm:
5
5
  - "2.0.0"
6
6
  - jruby
7
7
  - rbx
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: rbx
@@ -11,7 +11,7 @@
11
11
  class Paggio; class CSS < BasicObject
12
12
 
13
13
  class Definition < BasicObject
14
- Style = ::Struct.new(:name, :value, :important?)
14
+ Style = ::Struct.new(:name, :value, :important)
15
15
 
16
16
  def initialize(&block)
17
17
  @style = []
@@ -11,7 +11,7 @@
11
11
  class Paggio; class CSS < BasicObject
12
12
 
13
13
  class Unit
14
- COMPATIBLE = %i[in pt mm cm px pc]
14
+ COMPATIBLE = %w[in pt mm cm px pc].map(&:to_sym)
15
15
 
16
16
  attr_reader :type, :number
17
17
 
@@ -38,7 +38,7 @@ class Unit
38
38
  [@number, @type].hash
39
39
  end
40
40
 
41
- %i[em ex ch rem vh vw vmin vmax px mm cm in pt pc].each {|name|
41
+ %w[em ex ch rem vh vw vmin vmax px mm cm in pt pc].map(&:to_sym).each {|name|
42
42
  define_method name do
43
43
  Unit.new(convert(self, name), name)
44
44
  end
@@ -152,7 +152,7 @@ end
152
152
  end; end
153
153
 
154
154
  class Numeric
155
- %i[em ex ch rem vh vw vmin vmax px mm cm in pt pc].each {|name|
155
+ %w[em ex ch rem vh vw vmin vmax px mm cm in pt pc].map(&:to_sym).each {|name|
156
156
  define_method name do
157
157
  Paggio::CSS::Unit.new(self, name)
158
158
  end
@@ -173,7 +173,7 @@ Formatter.for CSS do |f, item|
173
173
  f.print "#{rule.selector} {"
174
174
  f.indent {
175
175
  rule.definition.each {|style|
176
- f.print "#{style.name}: #{style.value}#{' !important' if style.important?};"
176
+ f.print "#{style.name}: #{style.value}#{' !important' if style.important};"
177
177
  }
178
178
  }
179
179
  f.print '}'
@@ -8,6 +8,8 @@
8
8
  # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
9
  #++
10
10
 
11
+
12
+ require 'paggio/html/helpers'
11
13
  require 'paggio/html/element'
12
14
 
13
15
  class Paggio
@@ -8,6 +8,14 @@
8
8
  # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
9
  #++
10
10
 
11
+ require 'paggio/html/element/a'
12
+ require 'paggio/html/element/base'
13
+ require 'paggio/html/element/blockquote'
14
+ require 'paggio/html/element/button'
15
+ require 'paggio/html/element/canvas'
16
+ require 'paggio/html/element/img'
17
+ require 'paggio/html/element/input'
18
+
11
19
  class Paggio; class HTML < BasicObject
12
20
 
13
21
  class Element < BasicObject
@@ -23,15 +31,6 @@ class Element < BasicObject
23
31
  end
24
32
  end
25
33
 
26
- def self.defhelper(name, &block)
27
- define_method name do |*args, &body|
28
- instance_exec(*args, &block)
29
-
30
- self.do(&block) if body
31
- self
32
- end
33
- end
34
-
35
34
  def initialize(owner, name, attributes = {})
36
35
  @owner = owner
37
36
  @name = name
@@ -89,37 +88,6 @@ class Element < BasicObject
89
88
  "#<HTML::Element(#{@name.upcase}): #{@children.inspect[1 .. -2]}>"
90
89
  end
91
90
  end
92
-
93
- class Img < self
94
- defhelper :src do |url|
95
- @attributes[:src] = url.to_s
96
- end
97
- end
98
-
99
- class A < self
100
- defhelper :href do |url|
101
- @attributes[:href] = url.to_s
102
- end
103
-
104
- defhelper :text do |string|
105
- self << string
106
- end
107
- end
108
-
109
- class Input < self
110
- { type: :type,
111
- name: :name,
112
- value: :value,
113
- size: :size,
114
- place_holder: :placeholder,
115
- read_only: :readonly,
116
- required: :required
117
- }.each {|name, attribute|
118
- defhelper name do |value|
119
- @element[attribute] = value
120
- end
121
- }
122
- end
123
91
  end
124
92
 
125
93
  end; end
@@ -0,0 +1,42 @@
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 A < self
14
+ { href: :href,
15
+ url: :href,
16
+
17
+ rel: :rel,
18
+ relative: :rel,
19
+
20
+ target: :target,
21
+
22
+ type: :type,
23
+
24
+ lang: :hreflang,
25
+ language: :hreflang,
26
+
27
+ media: :media,
28
+ }.each {|name, attribute|
29
+ defhelper name do |value|
30
+ @attributes[attribute] = value.to_s
31
+ end
32
+ }
33
+
34
+ defhelper! :download
35
+ defhelper! :ping
36
+
37
+ defhelper :text do |string|
38
+ self << string
39
+ end
40
+ end
41
+
42
+ end; end; end
@@ -0,0 +1,25 @@
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 Base < self
14
+ { href: :href,
15
+ url: :href,
16
+
17
+ target: :target,
18
+ }.each {|name, attribute|
19
+ defhelper name do |value|
20
+ @attributes[attribute] = value.to_s
21
+ end
22
+ }
23
+ end
24
+
25
+ end; end; end
@@ -0,0 +1,19 @@
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 Blockquote < self
14
+ defhelper :cite do |value|
15
+ @attributes[:cite] = value.to_s
16
+ end
17
+ end
18
+
19
+ end; end; end
@@ -0,0 +1,33 @@
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 Button < self
14
+ { form: :form,
15
+ name: :name,
16
+ type: :type,
17
+ value: :value,
18
+
19
+ action: :formaction,
20
+ encoding: :formenctype,
21
+ method: :formmethod,
22
+ target: :formtarget,
23
+ }.each {|name, attributes|
24
+ defhelper name do |value|
25
+ @attributes[attribute] = value.to_s
26
+ end
27
+ }
28
+
29
+ defhelper! :autofocus
30
+ defhelper! :disabled
31
+ end
32
+
33
+ end; end; end
@@ -0,0 +1,23 @@
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 Canvas < self
14
+ { width: :width,
15
+ height: :height
16
+ }.each {|name, attribute|
17
+ defhelper name do |value|
18
+ @attributes[attribute] = value.to_s
19
+ end
20
+ }
21
+ end
22
+
23
+ end; end; end
@@ -0,0 +1,35 @@
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 Img < self
14
+ { src: :src,
15
+ url: :src,
16
+
17
+ alt: :alt,
18
+ description: :alt,
19
+
20
+ height: :height,
21
+ width: :width,
22
+
23
+ map: :usemap,
24
+ }.each {|name, attribute|
25
+ defhelper name do |value|
26
+ @attributes[attribute] = value.to_s
27
+ end
28
+ }
29
+
30
+ defhelper :map! do
31
+ @attributes[:ismap] = true
32
+ end
33
+ end
34
+
35
+ end; end; end
@@ -0,0 +1,28 @@
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 Input < self
14
+ { type: :type,
15
+ name: :name,
16
+ value: :value,
17
+ size: :size,
18
+ place_holder: :placeholder,
19
+ read_only: :readonly,
20
+ required: :required,
21
+ }.each {|name, attribute|
22
+ defhelper name do |value|
23
+ @attributes[attribute] = value
24
+ end
25
+ }
26
+ end
27
+
28
+ end; end; end
@@ -0,0 +1,30 @@
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
12
+
13
+ class Element < BasicObject
14
+ def self.defhelper(name, &block)
15
+ define_method name do |*args, &body|
16
+ instance_exec(*args, &block)
17
+
18
+ self.do(&body) if body
19
+ self
20
+ end
21
+ end
22
+
23
+ def self.defhelper!(name, attribute = name)
24
+ defhelper "#{name}!" do
25
+ @attributes[attribute] = true
26
+ end
27
+ end
28
+ end
29
+
30
+ end; end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new {|s|
2
2
  s.name = 'paggio'
3
- s.version = '0.2.0'
3
+ s.version = '0.2.1'
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.0
4
+ version: 0.2.1
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-15 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: meh@schizofreni.co
@@ -26,6 +26,14 @@ files:
26
26
  - lib/paggio/formatter.rb
27
27
  - lib/paggio/html.rb
28
28
  - lib/paggio/html/element.rb
29
+ - lib/paggio/html/element/a.rb
30
+ - lib/paggio/html/element/base.rb
31
+ - lib/paggio/html/element/blockquote.rb
32
+ - lib/paggio/html/element/button.rb
33
+ - lib/paggio/html/element/canvas.rb
34
+ - lib/paggio/html/element/img.rb
35
+ - lib/paggio/html/element/input.rb
36
+ - lib/paggio/html/helpers.rb
29
37
  - lib/paggio/markdown.rb
30
38
  - lib/paggio/now.rb
31
39
  - lib/paggio/script.rb