paggio 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/lib/paggio/css/definition.rb +1 -1
- data/lib/paggio/css/unit.rb +3 -3
- data/lib/paggio/formatter.rb +1 -1
- data/lib/paggio/html.rb +2 -0
- data/lib/paggio/html/element.rb +8 -40
- data/lib/paggio/html/element/a.rb +42 -0
- data/lib/paggio/html/element/base.rb +25 -0
- data/lib/paggio/html/element/blockquote.rb +19 -0
- data/lib/paggio/html/element/button.rb +33 -0
- data/lib/paggio/html/element/canvas.rb +23 -0
- data/lib/paggio/html/element/img.rb +35 -0
- data/lib/paggio/html/element/input.rb +28 -0
- data/lib/paggio/html/helpers.rb +30 -0
- data/paggio.gemspec +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041672051d1e25dcb0b8ea5d07dfbe1463b4998e
|
4
|
+
data.tar.gz: a4d28bc9bce57ab6f01a25eb045763911e1de053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857af8dbb7c271043e7b86b8bcc4930fef8fa7ed9c99804cd77ca381e051239763e89fe12ae7ef047d047b9c5790ea582861576330f57641cbe62cfa115ac331
|
7
|
+
data.tar.gz: 33461a196fc4226c197338258a4581fc96b8f93a2394dd3ce798a0da7cb801fe5aed241fd43130891965bb66890a58a584cbf9e4471e5003cc60adb227e69e7d
|
data/.travis.yml
CHANGED
data/lib/paggio/css/unit.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
class Paggio; class CSS < BasicObject
|
12
12
|
|
13
13
|
class Unit
|
14
|
-
COMPATIBLE = %
|
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
|
-
%
|
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
|
-
%
|
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
|
data/lib/paggio/formatter.rb
CHANGED
@@ -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 '}'
|
data/lib/paggio/html.rb
CHANGED
data/lib/paggio/html/element.rb
CHANGED
@@ -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
|
data/paggio.gemspec
CHANGED
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.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-
|
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
|