csslite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a0926053be5f531c62d583ac6028bf531b62d2ec
4
+ data.tar.gz: acd2c724c2038ce68249b340288b04cd43a1ed2f
5
+ SHA512:
6
+ metadata.gz: 7038098a453391e3e3c5f3d711b5d2d5d85a9f736deb8250700d28f4e8c750776f1571668aa6890c451e612e3e5b453262bddc9a2b42712eff31a2b4dfd47471
7
+ data.tar.gz: f616aef04a6cff282cf19a8caea84ac789e5987ad7433450e8993f833f3ae40162781b44d6d3f3fd3520c87cafe14f18e853480f4908526b84785bb4c967b67d
@@ -0,0 +1,3 @@
1
+ �N.�Y�ڒ��z�V�s��ɏ��d)ok��^G��?. v��^�ѝ>�^���ؙ�a^w��S܍K "�4���C���d��˕�UHh�ܨ�����0�CKn�0[
2
+ G��FJ�DV��L�h�^�
3
+ dla2Sr%�S���z���Ϯ�逮��7v���:h�i��^�'vY���\����=�x�/��~��m��R�k/����ټT�؎����
@@ -0,0 +1,3 @@
1
+ N�j?��� ����6�Ÿh�I?��!�<�eS�$��*��T��T�B��o��R
2
+ j�j�^��!;�����X/�\��W����ɺ�4��^Ez��*2��Ȭ�Y
3
+ Y5�X�
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: csslite.rb
4
+
5
+
6
+ class CSSLite
7
+
8
+ def initialize(s)
9
+
10
+ # parse the CSS
11
+
12
+ @a = s.split(/}/)[0..-2].map do |entry|
13
+
14
+ raw_selector,raw_styles = entry.split(/{/,2)
15
+
16
+ h = raw_styles.strip.split(/;/).inject({}) do |r, x|
17
+ k, v = x.split(/:/,2).map(&:strip)
18
+ r.merge(k.to_sym => v)
19
+ end
20
+
21
+ [raw_selector.split(/,\s*/).map(&:strip), h]
22
+ end
23
+
24
+ end
25
+
26
+ def propagate(root_element)
27
+
28
+ # add each CSS style attribute to the element
29
+ # e.g. @a = [[['line'],{stroke: 'green'}]]
30
+
31
+ @a.each do |x|
32
+
33
+ selectors, style = x
34
+
35
+ selectors.each do |selector|
36
+
37
+ style.each do |k,v|
38
+
39
+ root_element.css(selector).each do |element|
40
+
41
+ element.style[k] = v unless override == false and element.style.has_key? k
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: csslite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDkwNTE3MTMzNloXDTE4MDkwNTE3MTMzNlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBALdnOBoacBkR6d/fvk4QyU9otVqHWYrWb4L28+BvV6CRPWzaDLbHpALoK/BU
19
+ 6i5ZbAWTZgN8Nqyg9L2CHbcjR4N5UH2M6wm10OMGLtmizrDIDKdZi8/94IL6c+oH
20
+ rg6mvsN5lNqoKfRPnqLFhtL03oaAlp4dtInq8MnBrF5XuUoqjXo3iVSN2GAHx8oe
21
+ BFkY3glRnaJQCop8H1EqwxTPSyoaHH8Pc3qqwDMGzfFFUQF9V4Gch8P7VnBoOY5v
22
+ rI1K/zZ9K1XOVu+cAwYFqsCqPfr3/je93PZfJFndq4+XW8URM/BgyGPzKhDxiOLR
23
+ 2mbs4BDQZTvsa3+ox7l4YrxoEiMCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUCYfD7/tYbV2SsloRdVT94qrk/nswJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAHew7DDiL
27
+ iQ+rSrJLyd6VXWWqm4aDzXipNgpzNkEBU7MccyyNsLiOh07jE2vuwqd78mnRKlEs
28
+ l7tzU0AFNFnNcaiva95lcy8BjP7g9F3pibc+OmUhVqHJAZFaiv0P2klTQnQia/fD
29
+ Utzgr0N61fRD9aA/dx7PJWXdS0LO2rr0qFFx3XadKTrpmDDJz+o59KVy+NLhFvr6
30
+ 4fjdPNox5cyDYMQI0/YJjMr267a27s+fHfG6BxV1DJqZCTV4tzdyDwoDCfXh7WUd
31
+ 9gIs6nm8KnBHUmzrn9afy/5KR51QuJ9cQmRMA+Dwkp8jTv1PhX51X58V2yt4eEYg
32
+ oKq4EGm16laTPw==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-09-05 00:00:00.000000000 Z
35
+ dependencies: []
36
+ description:
37
+ email: james@jamesrobertson.eu
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/csslite.rb
43
+ homepage: https://github.com/jrobertson/csslite
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.6.8
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: An experimental gem to parse CSS and propagate the style attributes for the
67
+ associated nodes using the selectors
68
+ test_files: []
@@ -0,0 +1 @@
1
+ ,���϶3*��ė���xR�x'(i? a)z,��4r�JJ&Ql��v1�?�b����$�=ǀ�'��,y�����u��&͡j;���0�`��1}ˈ��h�]Ý7�.�\ؑ7ͧD�oh�Q�Cڠ�m��P�Y��+������q�����U��2�|4F�|z��|1��Wc"���lZn������[�98G�̎z�F�<���\�&a�m%�o�2%��k������|�J�2xx��\{�F��ћ�����0