lesstidy 0.0.1.pre

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.
Files changed (47) hide show
  1. data/.gitignore +23 -0
  2. data/LICENSE +20 -0
  3. data/README.md +60 -0
  4. data/Rakefile +54 -0
  5. data/VERSION +1 -0
  6. data/bin/lesstidy +101 -0
  7. data/data/presets/column +9 -0
  8. data/data/presets/terse +5 -0
  9. data/data/presets/wide-column +3 -0
  10. data/lib/lesstidy.rb +20 -0
  11. data/lib/lesstidy/config.rb +33 -0
  12. data/lib/lesstidy/cutil.rb +73 -0
  13. data/lib/lesstidy/document.rb +20 -0
  14. data/lib/lesstidy/grammar/less.treetop +117 -0
  15. data/lib/lesstidy/grammar/less_syntax.rb +30 -0
  16. data/lib/lesstidy/nodes.rb +107 -0
  17. data/lib/lesstidy/preset.rb +4 -0
  18. data/lib/lesstidy/renderer.rb +147 -0
  19. data/lib/lesstidy/style.rb +32 -0
  20. data/lib/lesstidy/style_parser.rb +117 -0
  21. data/test/d.rb +31 -0
  22. data/test/fixtures/a.control.css +7 -0
  23. data/test/fixtures/a.default.css +32 -0
  24. data/test/fixtures/a.inspect.txt +29 -0
  25. data/test/fixtures/a.terse.css +7 -0
  26. data/test/fixtures/fail/c.css +4 -0
  27. data/test/fixtures/fail/search1.css +20 -0
  28. data/test/fixtures/fail/search2.css +9 -0
  29. data/test/fixtures/fail/search3.css +7 -0
  30. data/test/fixtures/fail/search3b.css +5 -0
  31. data/test/fixtures/fail/spec.css +24 -0
  32. data/test/fixtures/spec.control.css +24 -0
  33. data/test/fixtures/spec.default.css +95 -0
  34. data/test/fixtures/spec.inspect.txt +82 -0
  35. data/test/fixtures/spec.terse.css +21 -0
  36. data/test/fixtures/test-2.control.css +4 -0
  37. data/test/fixtures/test-2.default.css +33 -0
  38. data/test/fixtures/test-2.inspect.txt +37 -0
  39. data/test/fixtures/test-2.terse.css +11 -0
  40. data/test/fixtures/test.control.css +1 -0
  41. data/test/fixtures/test.default.css +30 -0
  42. data/test/fixtures/test.inspect.txt +35 -0
  43. data/test/fixtures/test.terse.css +8 -0
  44. data/test/helper.rb +10 -0
  45. data/test/test_blackbox.rb +29 -0
  46. data/test/test_lesstidy.rb +4 -0
  47. metadata +138 -0
@@ -0,0 +1,11 @@
1
+ #menu a, div { color: red; font-weight: bold; }
2
+
3
+ /* More */
4
+ #menu ul li > div, td, tr, #menu a:hover div #lol yes yes .something span.clear-fix, table { text-align: center; .black; font-weight: bold; border: solid 2px #882828; cursor: default; background-repeat: no-repeat; }
5
+ a:hover { .corner(5px); background: url(foo.png);
6
+ /* Superstar */
7
+ span { font-weight: bold; }
8
+ span, a:hover, a:active, a:hover span, a:active span { text-decoration: underline;
9
+ strong em { color: blue; }
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ #menu a,div { color: red; font-weight: bold; } #menu ul li > div, td, tr, #menu a:hover div #lol yes yes .something span.clear-fix, table { text-align: center; .black; font-weight: bold; border: solid 2px #882828; cursor: default; background-repeat: no-repeat; } a:hover { .corner(5px); background: url(foo.png); span { font-weight: bold; } span, a:hover, a:active, a:hover span, a:active span { text-decoration: underline; strong em { color: blue; } } }
@@ -0,0 +1,30 @@
1
+ #menu a, div {
2
+ color: red;
3
+ font-weight: bold;
4
+ }
5
+
6
+ #menu ul li > div, td, tr, #menu a:hover div #lol yes yes .something span.clear-fix, table {
7
+ text-align: center;
8
+ .black;
9
+ font-weight: bold;
10
+ border: solid 2px #882828;
11
+ cursor: default;
12
+ background-repeat: no-repeat;
13
+ }
14
+
15
+ a:hover {
16
+ .corner(5px);
17
+ background: url(foo.png);
18
+
19
+ span {
20
+ font-weight: bold;
21
+ }
22
+
23
+ span, a:hover, a:active, a:hover span, a:active span {
24
+ text-decoration: underline;
25
+
26
+ strong em {
27
+ color: blue;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,35 @@
1
+ . [document]
2
+ . . [ruleset]
3
+ . . . [S] #menu a
4
+ . . . [S] div
5
+ . . . [R] color: red
6
+ . . . [R] font-weight: bold
7
+ . . [ruleset]
8
+ . . . [S] #menu ul li > div
9
+ . . . [S] td
10
+ . . . [S] tr
11
+ . . . [S] #menu a:hover div #lol yes yes .something span.clear-fix
12
+ . . . [S] table
13
+ . . . [R] text-align: center
14
+ . . . [M] .black
15
+ . . . [R] font-weight: bold
16
+ . . . [R] border: solid 2px #882828
17
+ . . . [R] cursor: default
18
+ . . . [R] background-repeat: no-repeat
19
+ . . [ruleset]
20
+ . . . [S] a:hover
21
+ . . . [M] .corner(5px)
22
+ . . . [R] background: url(foo.png)
23
+ . . . [ruleset]
24
+ . . . . [S] span
25
+ . . . . [R] font-weight: bold
26
+ . . . [ruleset]
27
+ . . . . [S] span
28
+ . . . . [S] a:hover
29
+ . . . . [S] a:active
30
+ . . . . [S] a:hover span
31
+ . . . . [S] a:active span
32
+ . . . . [R] text-decoration: underline
33
+ . . . . [ruleset]
34
+ . . . . . [S] strong em
35
+ . . . . . [R] color: blue
@@ -0,0 +1,8 @@
1
+ #menu a, div { color: red; font-weight: bold; }
2
+ #menu ul li > div, td, tr, #menu a:hover div #lol yes yes .something span.clear-fix, table { text-align: center; .black; font-weight: bold; border: solid 2px #882828; cursor: default; background-repeat: no-repeat; }
3
+ a:hover { .corner(5px); background: url(foo.png);
4
+ span { font-weight: bold; }
5
+ span, a:hover, a:active, a:hover span, a:active span { text-decoration: underline;
6
+ strong em { color: blue; }
7
+ }
8
+ }
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'contest'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'lesstidy'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,29 @@
1
+ require 'helper'
2
+
3
+ class TestBlackbox < Test::Unit::TestCase
4
+ Dir[File.join(File.dirname(__FILE__), 'fixtures', '*.control.css')].each do |file|
5
+ name = /^(.*)\.control\.css$/.match(File.basename(file))[1]
6
+ path = File.dirname(file)
7
+ inspect = File.join(path, "#{name}.inspect.txt")
8
+
9
+ should "Work for #{name}" do
10
+ @input = Lesstidy::Document.load file
11
+ control = File.open(inspect) { |f| f.read }
12
+ assert_equal control.strip, @input.inspect.strip
13
+
14
+ # Test default
15
+ output = File.open(File.join(path, "#{name}.default.css")) { |f| f.read }
16
+ assert_equal @input.to_css.strip, output.strip
17
+
18
+ # Test terse
19
+ style = Lesstidy::Style.new "terse"
20
+ control = File.open(File.join(path, "#{name}.terse.css")) { |f| f.read }
21
+ unknown = @input.to_css(style).strip
22
+ assert_equal unknown, control.strip
23
+
24
+ @input2 = Lesstidy::Document.load File.join(path, "#{name}.terse.css")
25
+ assert_equal @input.to_css(style).strip, @input2.to_css(style).strip
26
+ end
27
+ end
28
+ end
29
+
@@ -0,0 +1,4 @@
1
+ require 'helper'
2
+
3
+ class TestLesstidy < Test::Unit::TestCase
4
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lesstidy
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ - pre
10
+ version: 0.0.1.pre
11
+ platform: ruby
12
+ authors:
13
+ - Rico Sta. Cruz
14
+ - Sinefunc, Inc.
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-05-30 00:00:00 +08:00
20
+ default_executable: lesstidy
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: treetop
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: contest
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
46
+ description: LessTidy takes your CSS (or LessCSS) file and rewrites it in a more readable format.
47
+ email: rico@sinefunc.com
48
+ executables:
49
+ - lesstidy
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.md
55
+ files:
56
+ - .gitignore
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - VERSION
61
+ - bin/lesstidy
62
+ - data/presets/column
63
+ - data/presets/terse
64
+ - data/presets/wide-column
65
+ - lib/lesstidy.rb
66
+ - lib/lesstidy/config.rb
67
+ - lib/lesstidy/cutil.rb
68
+ - lib/lesstidy/document.rb
69
+ - lib/lesstidy/grammar/less.treetop
70
+ - lib/lesstidy/grammar/less_syntax.rb
71
+ - lib/lesstidy/nodes.rb
72
+ - lib/lesstidy/preset.rb
73
+ - lib/lesstidy/renderer.rb
74
+ - lib/lesstidy/style.rb
75
+ - lib/lesstidy/style_parser.rb
76
+ - test/d.rb
77
+ - test/fixtures/a.control.css
78
+ - test/fixtures/a.default.css
79
+ - test/fixtures/a.inspect.txt
80
+ - test/fixtures/a.terse.css
81
+ - test/fixtures/fail/c.css
82
+ - test/fixtures/fail/search1.css
83
+ - test/fixtures/fail/search2.css
84
+ - test/fixtures/fail/search3.css
85
+ - test/fixtures/fail/search3b.css
86
+ - test/fixtures/fail/spec.css
87
+ - test/fixtures/spec.control.css
88
+ - test/fixtures/spec.default.css
89
+ - test/fixtures/spec.inspect.txt
90
+ - test/fixtures/spec.terse.css
91
+ - test/fixtures/test-2.control.css
92
+ - test/fixtures/test-2.default.css
93
+ - test/fixtures/test-2.inspect.txt
94
+ - test/fixtures/test-2.terse.css
95
+ - test/fixtures/test.control.css
96
+ - test/fixtures/test.default.css
97
+ - test/fixtures/test.inspect.txt
98
+ - test/fixtures/test.terse.css
99
+ - test/helper.rb
100
+ - test/test_blackbox.rb
101
+ - test/test_lesstidy.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/rstacruz/lesstidy
104
+ licenses: []
105
+
106
+ post_install_message:
107
+ rdoc_options:
108
+ - --charset=UTF-8
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">"
121
+ - !ruby/object:Gem::Version
122
+ segments:
123
+ - 1
124
+ - 3
125
+ - 1
126
+ version: 1.3.1
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.6
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: CSS formatting tool
134
+ test_files:
135
+ - test/d.rb
136
+ - test/helper.rb
137
+ - test/test_blackbox.rb
138
+ - test/test_lesstidy.rb