cloudhead-less 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.8
1
+ 0.8.10
data/less.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{less}
5
- s.version = "0.8.8"
5
+ s.version = "0.8.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["cloudhead"]
data/lib/less/engine.rb CHANGED
@@ -4,7 +4,7 @@ module Less
4
4
  COMPOUND = {'font' => true, 'background' => false, 'border' => false }
5
5
  REGEX = {
6
6
  :path => /([#.][->#.\w ]+)?( ?> ?)?/, # #header > .title
7
- :selector => /[-\w #.,>*:\(\)]/, # .cow .milk > a
7
+ :selector => /[-\w #.,*>:\(\)]/, # .cow .milk > a
8
8
  :variable => /@([-\w]+)/, # @milk-white
9
9
  :property => /@[-\w]+|[-a-z]+/, # font-size
10
10
  :color => /#([a-zA-Z0-9]{3,6})\b/, # #f0f0f0
@@ -39,7 +39,7 @@ module Less
39
39
  end
40
40
  node.delete key if matched # Delete the property if it's LESS-specific
41
41
  end
42
-
42
+
43
43
  #
44
44
  # Evaluate mixins
45
45
  #
@@ -69,8 +69,8 @@ module Less
69
69
  # Units are: 1px, 1em, 1%, #111
70
70
  @tree = @tree.traverse :leaf do |key, value, path, node|
71
71
  node[ key ] = value.gsub /(#{REGEX[:operand]}(\s?)[-+\/*](\4))+(#{REGEX[:operand]})/ do |operation|
72
- # Disallow operations certain compound declarations
73
- if COMPOUND[key]
72
+ # Disallow operations on certain compound declarations
73
+ if COMPOUND[ key ]
74
74
  next value
75
75
  else
76
76
  raise CompoundOperationError, "#{key}: #{value}"
@@ -138,17 +138,17 @@ module Less
138
138
  # less: color: black;
139
139
  # hashify: "color" => "black"
140
140
  #
141
- hash = self.gsub(/\t+/, ' '). # Tabs
142
- gsub(/\r\n/, "\n"). # m$
143
- gsub(/\/\/.*/, ''). # Comments //
141
+ hash = self.gsub(/\r\n/, "\n"). # m$
142
+ gsub(/\/\/.*\n/, ''). # Comments //
144
143
  gsub(/\/\*.*?\*\//m, ''). # Comments /*
145
- gsub(/"/, "'"). # " => '
146
- gsub(/("|')(.+?)(\1)/) { $1 + CGI.escape( $2 ) + $1 }. # Escape string values
147
- gsub(/(#{REGEX[:property]}):\s*(.+?)\s*(;|(?=\}))/,'"\1"=>"\2",'). # Rules
144
+ gsub(/\s+/, ' '). # Replace \t\n
145
+ gsub(/"/, "'"). # " to '
146
+ gsub(/("|')(.*?)(\1)/) { $1 + CGI.escape( $2 ) + $1 }. # Escape string values
147
+ gsub(/(#{REGEX[:property]}): *([^\{\}]+?) *(;|(?=\}))/,'"\1"=>"\2",'). # Rules
148
148
  gsub(/\}/, "},"). # Closing }
149
- gsub(/( *)(#{REGEX[:selector]}+?)[ \n]*(?=\{)/m, '\1"\2"=>'). # Selectors
149
+ gsub(/([, ]*)(#{REGEX[:selector]}+?)[ \n]*(?=\{)/, '\1"\2"=>'). # Selectors
150
150
  gsub(/([.#][->\w .#]+);/, '"\\1" => :mixin,') # Mixins
151
- eval "{" + hash + "}" # Return {hash}
151
+ eval "{#{ hash }}" # Return {hash}
152
152
  end
153
153
  end
154
154
  end
data/spec/spec.css CHANGED
@@ -12,14 +12,18 @@
12
12
  .root:hover a { display: block; }
13
13
  body { font-size: 10px; font-family: 'Lucida Grande', 'Helvetica', Verdana, sans-serif; margin: -5px 0 5px 10px; border: solid 1px #000; text-shadow: #333 -1px 1px 2px; -moz-border-radius: 3px; color: #ccc; background-color: #aaa; border-color: #888; }
14
14
  .operations > div { width: 80px; }
15
- .operations { width: 110px; border-width: 16px; font-size: 66; line-height: 7px; color: #eeeeee; colorb: #333333; colorc: #777777; }
15
+ .operations { font: 12px/16px; width: 110px; border-width: 16px; font-size: 66; line-height: 7px; color: #eeeeee; colorb: #333333; colorc: #777777; }
16
16
  td, tr, table { border-width: 4px; }
17
+ blockquote:before, blockquote:after, q:before, q:after { content: ''; }
18
+ a:link, a:hover { color: brown; }
17
19
  ul li:first-child { border-top: none; }
18
20
  ul li:first-child, ul li:last-child { background-color: #333; }
19
21
  .p:first-letter { color: red; }
20
22
  :focus { outline: 0; content: '*}#f~ '; }
21
23
  q:lang(no) { quotes: '~' '~'; }
22
24
  blockquote:before { color: red; }
25
+ div { color: purple; }
26
+ .duplicate { width: 11px; color: blue; }
23
27
  .transparent_box { background-color: #FFF; filter: alpha(opacity=60); opacity: 0.6; }
24
28
  .space { color: purple; font-color: yellow; }
25
29
  .no-semi-column { color: orange; }
data/spec/spec.less CHANGED
@@ -92,6 +92,14 @@ td, tr, table {
92
92
  }
93
93
 
94
94
  // More complex CSS selectors
95
+ blockquote:before, blockquote:after, q:before, q:after { content: ""; }
96
+ a:link,
97
+ a:hover {
98
+ color:brown;
99
+ }
100
+ div > a, a span {
101
+ color: grey;
102
+ }
95
103
  ul li:first-child {
96
104
  border-top: none;
97
105
  }
@@ -112,6 +120,22 @@ blockquote:before {
112
120
  color: red;
113
121
  }
114
122
 
123
+ // Duplicates
124
+ div {
125
+ width: 9px;
126
+ }
127
+ div {
128
+ color: purple;
129
+ }
130
+ .duplicate {
131
+ width: 9px;
132
+ height: 11px;
133
+ }
134
+ .duplicate {
135
+ width: 11px;
136
+ color: blue;
137
+ }
138
+
115
139
  /*input[type="text"] {
116
140
  background-color: blue;
117
141
  }*/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudhead-less
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloudhead