htmle 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/htmle.rb +9 -24
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceb65888a6f70db63a990e4f1a0149d2e339b9b6
|
4
|
+
data.tar.gz: 5fa58616d7ae8c0a027c4a4d396edc90cdac2e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f669cf0bb68f5371eb573014f3b9aed5e6ad3f43492b70a6409a6120af7cb581f43860b91e56b411b77989459c98f83121cc69e8d069761ecf06d1b80dc56989
|
7
|
+
data.tar.gz: d645bf0f8c0b71600cbc59aaddcfe43f57cea5793c6ab10e948cab88fac1834f623b4fddbeb49ba3d368da6bb0003d7e566dff9ef42553a72b2b5e827bb31bfb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/htmle.rb
CHANGED
@@ -6,9 +6,12 @@ require 'svgle'
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
DEFAULT_HTML_CSS = <<CSS
|
10
|
+
* {
|
11
|
+
margin: 5 5; padding: 10 10;
|
12
|
+
font-size: 16; color: red;
|
13
|
+
}
|
14
|
+
html {background-color: white;}
|
12
15
|
div {background-color: green; padding: 30 10; margin: 5 5;}
|
13
16
|
|
14
17
|
CSS
|
@@ -16,7 +19,7 @@ CSS
|
|
16
19
|
class Htmle < Domle
|
17
20
|
|
18
21
|
class Box < Element
|
19
|
-
attr2_accessor *%i(class width height)
|
22
|
+
attr2_accessor *%i(class width height background-color)
|
20
23
|
end
|
21
24
|
|
22
25
|
class Html < Box
|
@@ -33,29 +36,11 @@ class Htmle < Domle
|
|
33
36
|
|
34
37
|
private
|
35
38
|
|
36
|
-
def fetch_style(attribute)
|
37
|
-
|
38
|
-
h = super attribute
|
39
|
-
|
40
|
-
%i(margin padding).each do |x|
|
41
|
-
|
42
|
-
if h.has_key? x then
|
43
|
-
|
44
|
-
a = expand_shorthand(h[x])
|
45
|
-
h[x] = ([(sym.to_s + '-')] * 4).zip.%w(top right bottom left).zip(a)
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
39
|
|
54
40
|
def find_add_css()
|
55
41
|
|
56
42
|
# add the default CSS
|
57
|
-
add_css
|
58
|
-
|
43
|
+
add_css DEFAULT_HTML_CSS
|
59
44
|
|
60
45
|
@doc.root.xpath('//style').each {|e| add_css e.text }
|
61
46
|
|
@@ -76,4 +61,4 @@ class Htmle < Domle
|
|
76
61
|
}
|
77
62
|
end
|
78
63
|
|
79
|
-
end
|
64
|
+
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|