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,7 @@
1
+ .blog-more-posts { .w; .hr-section; .non-list;
2
+ ul { overflow: hidden; }
3
+ li { width: 20%; float: left; display: block; padding: 10px 0; }
4
+ h4, p { margin: 0; padding: 0 10px 0 0; font-size: 1em; line-height: 1.5em; }
5
+ a { color: #444; }
6
+ p.date { color: #888; font-size: 0.9em; }
7
+ }
@@ -0,0 +1,32 @@
1
+ .blog-more-posts {
2
+ .w;
3
+ .hr-section;
4
+ .non-list;
5
+
6
+ ul {
7
+ overflow: hidden;
8
+ }
9
+
10
+ li {
11
+ width: 20%;
12
+ float: left;
13
+ display: block;
14
+ padding: 10px 0;
15
+ }
16
+
17
+ h4, p {
18
+ margin: 0;
19
+ padding: 0 10px 0 0;
20
+ font-size: 1em;
21
+ line-height: 1.5em;
22
+ }
23
+
24
+ a {
25
+ color: #444;
26
+ }
27
+
28
+ p.date {
29
+ color: #888;
30
+ font-size: 0.9em;
31
+ }
32
+ }
@@ -0,0 +1,29 @@
1
+ . [document]
2
+ . . [ruleset]
3
+ . . . [S] .blog-more-posts
4
+ . . . [M] .w
5
+ . . . [M] .hr-section
6
+ . . . [M] .non-list
7
+ . . . [ruleset]
8
+ . . . . [S] ul
9
+ . . . . [R] overflow: hidden
10
+ . . . [ruleset]
11
+ . . . . [S] li
12
+ . . . . [R] width: 20%
13
+ . . . . [R] float: left
14
+ . . . . [R] display: block
15
+ . . . . [R] padding: 10px 0
16
+ . . . [ruleset]
17
+ . . . . [S] h4
18
+ . . . . [S] p
19
+ . . . . [R] margin: 0
20
+ . . . . [R] padding: 0 10px 0 0
21
+ . . . . [R] font-size: 1em
22
+ . . . . [R] line-height: 1.5em
23
+ . . . [ruleset]
24
+ . . . . [S] a
25
+ . . . . [R] color: #444
26
+ . . . [ruleset]
27
+ . . . . [S] p.date
28
+ . . . . [R] color: #888
29
+ . . . . [R] font-size: 0.9em
@@ -0,0 +1,7 @@
1
+ .blog-more-posts { .w; .hr-section; .non-list;
2
+ ul { overflow: hidden; }
3
+ li { width: 20%; float: left; display: block; padding: 10px 0; }
4
+ h4, p { margin: 0; padding: 0 10px 0 0; font-size: 1em; line-height: 1.5em; }
5
+ a { color: #444; }
6
+ p.date { color: #888; font-size: 0.9em; }
7
+ }
@@ -0,0 +1,4 @@
1
+ p:thu { color: red; }
2
+ .b {
3
+ a:ud { border-bottom: 0; }
4
+ }
@@ -0,0 +1,20 @@
1
+ /* Facet filter */
2
+ .facet-filter { .w; .non-list;
3
+ h3 { font-size: 1.2em; font-weight: normal; margin: 0 10px 10px 10px; padding: 0 0 10px 0;
4
+ border-bottom: solid 1px #ddd; line-height: 0.8em; }
5
+ .c { overflow: hidden; background: white; padding: 10px 1px 15px 1px; border: solid 1px #ccc;
6
+ .border-radius(4px); .box-shadow(#ddd 0px 3px); border-top: solid 2px @red; }
7
+ ul a { clear: both; display: block; overflow: hidden; padding: 1px 9px;
8
+ strong { float: left; }
9
+ em { float: right; font-style: normal; font-weight: normal; color: #888; }
10
+ :hover { text-decoration: none; background: #eee;
11
+ }
12
+ }
13
+ a.toggle { text-align: center; display: block; padding: 0 0 0 0; margin: -8px auto 0 auto;
14
+ width: 50%; background: white; color: #888; .border-radius(10px);
15
+ height: 18px; line-height: 18px; border-bottom: solid 1px #ccc;
16
+ font-size: 0.9em;
17
+ strong { font-weight: normal; }
18
+ :hover { text-decoration: none; color: #444; }
19
+ }
20
+ }
@@ -0,0 +1,9 @@
1
+ /* Item overview */
2
+ .item-overview { float: left; width: 50%; .min-height(160px); padding-bottom: 10px;
3
+ > .c { .hr-section; }
4
+ h3 { border-bottom: 0; }
5
+ .product-thumb { float: left; margin: 0 10px 10px 0; .image-link-big; }
6
+ .mini-specs { margin: 10px 0 10px 129px;
7
+ li { padding-top: 2px; padding-bottom: 2px; }
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ /*item overview actions*/
2
+ .item-overview-actions { .non-list; clear: both;
3
+ li {float: left;}
4
+ li.compare-link { float: right; }
5
+ li.compare-link .button-purple span { text-transform: uppercase; font-size: 10px !important; }
6
+ li.price {font-size: 18px; font-weight: bold; margin-top: 2px;}
7
+ }
@@ -0,0 +1,5 @@
1
+ /*item overview actions*/
2
+ p {
3
+ a { }
4
+ li.compare-linkaa { }
5
+ }
@@ -0,0 +1,24 @@
1
+ .blog-features { .hr-section; .non-list; .split-60; margin: 0; overflow: hidden;
2
+ .ad-rect { text-align: center; padding-top: 10px; }
3
+ li { padding-top: 10px; border-bottom: solid 1px #ccc; overflow: hidden;
4
+ h4, p { margin: 0; padding: 0; }
5
+ p.image {
6
+ img { float: right; width: 150px; height: 110px; background: #cecccc; padding: 2px;
7
+ border: solid 1px (#cecccc * 0.8); margin: 0 0 10px 10px; }
8
+ a:hover img { border: solid 2px (@link-color * 1.5); padding: 1px; }
9
+ }
10
+ p.date { text-transform: uppercase; color: #888; letter-spacing: 1px;
11
+ font-size: 0.8em; font-weight: bold; padding-bottom: 5px; }
12
+ h4 { font-size: 1.4em; }
13
+ p.description { margin: 10px 0; }
14
+ }
15
+ li:last-child { border-bottom: 0; }
16
+ }
17
+
18
+ .blog-more-posts { .w; .hr-section; .non-list;
19
+ ul { overflow: hidden; }
20
+ li { width: 20%; float: left; display: block; padding: 10px 0; }
21
+ h4, p { margin: 0; padding: 0 10px 0 0; font-size: 1em; line-height: 1.5em; }
22
+ a { color: #444; }
23
+ p.date { color: #888; font-size: 0.9em; }
24
+ }
@@ -0,0 +1,24 @@
1
+ .blog-features { .hr-section; .non-list; .split-60; margin: 0; overflow: hidden;
2
+ .ad-rect { text-align: center; padding-top: 10px; }
3
+ li { padding-top: 10px; border-bottom: solid 1px #ccc; overflow: hidden;
4
+ h4, p { margin: 0; padding: 0; }
5
+ p.image {
6
+ img { float: right; width: 150px; height: 110px; background: #cecccc; padding: 2px;
7
+ border: solid 1px (#cecccc * 0.8); margin: 0 0 10px 10px; }
8
+ a:hover img { border: solid 2px (@link-color * 1.5); padding: 1px; }
9
+ }
10
+ p.date { text-transform: uppercase; color: #888; letter-spacing: 1px;
11
+ font-size: 0.8em; font-weight: bold; padding-bottom: 5px; }
12
+ h4 { font-size: 1.4em; }
13
+ p.description { margin: 10px 0; }
14
+ }
15
+ li:last-child { border-bottom: 0; }
16
+ }
17
+
18
+ .blog-more-posts { .w; .hr-section; .non-list;
19
+ ul { overflow: hidden; }
20
+ li { width: 20%; float: left; display: block; padding: 10px 0; }
21
+ h4, p { margin: 0; padding: 0 10px 0 0; font-size: 1em; line-height: 1.5em; }
22
+ a { color: #444; }
23
+ p.date { color: #888; font-size: 0.9em; }
24
+ }
@@ -0,0 +1,95 @@
1
+ .blog-features {
2
+ .hr-section;
3
+ .non-list;
4
+ .split-60;
5
+ margin: 0;
6
+ overflow: hidden;
7
+
8
+ .ad-rect {
9
+ text-align: center;
10
+ padding-top: 10px;
11
+ }
12
+
13
+ li {
14
+ padding-top: 10px;
15
+ border-bottom: solid 1px #ccc;
16
+ overflow: hidden;
17
+
18
+ h4, p {
19
+ margin: 0;
20
+ padding: 0;
21
+ }
22
+
23
+ p.image {
24
+
25
+ img {
26
+ float: right;
27
+ width: 150px;
28
+ height: 110px;
29
+ background: #cecccc;
30
+ padding: 2px;
31
+ border: solid 1px (#cecccc * 0.8);
32
+ margin: 0 0 10px 10px;
33
+ }
34
+
35
+ a:hover img {
36
+ border: solid 2px (@link-color * 1.5);
37
+ padding: 1px;
38
+ }
39
+ }
40
+
41
+ p.date {
42
+ text-transform: uppercase;
43
+ color: #888;
44
+ letter-spacing: 1px;
45
+ font-size: 0.8em;
46
+ font-weight: bold;
47
+ padding-bottom: 5px;
48
+ }
49
+
50
+ h4 {
51
+ font-size: 1.4em;
52
+ }
53
+
54
+ p.description {
55
+ margin: 10px 0;
56
+ }
57
+ }
58
+
59
+ li:last-child {
60
+ border-bottom: 0;
61
+ }
62
+ }
63
+
64
+ .blog-more-posts {
65
+ .w;
66
+ .hr-section;
67
+ .non-list;
68
+
69
+ ul {
70
+ overflow: hidden;
71
+ }
72
+
73
+ li {
74
+ width: 20%;
75
+ float: left;
76
+ display: block;
77
+ padding: 10px 0;
78
+ }
79
+
80
+ h4, p {
81
+ margin: 0;
82
+ padding: 0 10px 0 0;
83
+ font-size: 1em;
84
+ line-height: 1.5em;
85
+ }
86
+
87
+ a {
88
+ color: #444;
89
+ }
90
+
91
+ p.date {
92
+ color: #888;
93
+ font-size: 0.9em;
94
+ }
95
+ }
@@ -0,0 +1,82 @@
1
+ . [document]
2
+ . . [ruleset]
3
+ . . . [S] .blog-features
4
+ . . . [M] .hr-section
5
+ . . . [M] .non-list
6
+ . . . [M] .split-60
7
+ . . . [R] margin: 0
8
+ . . . [R] overflow: hidden
9
+ . . . [ruleset]
10
+ . . . . [S] .ad-rect
11
+ . . . . [R] text-align: center
12
+ . . . . [R] padding-top: 10px
13
+ . . . [ruleset]
14
+ . . . . [S] li
15
+ . . . . [R] padding-top: 10px
16
+ . . . . [R] border-bottom: solid 1px #ccc
17
+ . . . . [R] overflow: hidden
18
+ . . . . [ruleset]
19
+ . . . . . [S] h4
20
+ . . . . . [S] p
21
+ . . . . . [R] margin: 0
22
+ . . . . . [R] padding: 0
23
+ . . . . [ruleset]
24
+ . . . . . [S] p.image
25
+ . . . . . [ruleset]
26
+ . . . . . . [S] img
27
+ . . . . . . [R] float: right
28
+ . . . . . . [R] width: 150px
29
+ . . . . . . [R] height: 110px
30
+ . . . . . . [R] background: #cecccc
31
+ . . . . . . [R] padding: 2px
32
+ . . . . . . [R] border: solid 1px (#cecccc * 0.8)
33
+ . . . . . . [R] margin: 0 0 10px 10px
34
+ . . . . . [ruleset]
35
+ . . . . . . [S] a:hover img
36
+ . . . . . . [R] border: solid 2px (@link-color * 1.5)
37
+ . . . . . . [R] padding: 1px
38
+ . . . . [ruleset]
39
+ . . . . . [S] p.date
40
+ . . . . . [R] text-transform: uppercase
41
+ . . . . . [R] color: #888
42
+ . . . . . [R] letter-spacing: 1px
43
+ . . . . . [R] font-size: 0.8em
44
+ . . . . . [R] font-weight: bold
45
+ . . . . . [R] padding-bottom: 5px
46
+ . . . . [ruleset]
47
+ . . . . . [S] h4
48
+ . . . . . [R] font-size: 1.4em
49
+ . . . . [ruleset]
50
+ . . . . . [S] p.description
51
+ . . . . . [R] margin: 10px 0
52
+ . . . [ruleset]
53
+ . . . . [S] li:last-child
54
+ . . . . [R] border-bottom: 0
55
+ . . [ruleset]
56
+ . . . [S] .blog-more-posts
57
+ . . . [M] .w
58
+ . . . [M] .hr-section
59
+ . . . [M] .non-list
60
+ . . . [ruleset]
61
+ . . . . [S] ul
62
+ . . . . [R] overflow: hidden
63
+ . . . [ruleset]
64
+ . . . . [S] li
65
+ . . . . [R] width: 20%
66
+ . . . . [R] float: left
67
+ . . . . [R] display: block
68
+ . . . . [R] padding: 10px 0
69
+ . . . [ruleset]
70
+ . . . . [S] h4
71
+ . . . . [S] p
72
+ . . . . [R] margin: 0
73
+ . . . . [R] padding: 0 10px 0 0
74
+ . . . . [R] font-size: 1em
75
+ . . . . [R] line-height: 1.5em
76
+ . . . [ruleset]
77
+ . . . . [S] a
78
+ . . . . [R] color: #444
79
+ . . . [ruleset]
80
+ . . . . [S] p.date
81
+ . . . . [R] color: #888
82
+ . . . . [R] font-size: 0.9em
@@ -0,0 +1,21 @@
1
+ .blog-features { .hr-section; .non-list; .split-60; margin: 0; overflow: hidden;
2
+ .ad-rect { text-align: center; padding-top: 10px; }
3
+ li { padding-top: 10px; border-bottom: solid 1px #ccc; overflow: hidden;
4
+ h4, p { margin: 0; padding: 0; }
5
+ p.image {
6
+ img { float: right; width: 150px; height: 110px; background: #cecccc; padding: 2px; border: solid 1px (#cecccc * 0.8); margin: 0 0 10px 10px; }
7
+ a:hover img { border: solid 2px (@link-color * 1.5); padding: 1px; }
8
+ }
9
+ p.date { text-transform: uppercase; color: #888; letter-spacing: 1px; font-size: 0.8em; font-weight: bold; padding-bottom: 5px; }
10
+ h4 { font-size: 1.4em; }
11
+ p.description { margin: 10px 0; }
12
+ }
13
+ li:last-child { border-bottom: 0; }
14
+ }
15
+ .blog-more-posts { .w; .hr-section; .non-list;
16
+ ul { overflow: hidden; }
17
+ li { width: 20%; float: left; display: block; padding: 10px 0; }
18
+ h4, p { margin: 0; padding: 0 10px 0 0; font-size: 1em; line-height: 1.5em; }
19
+ a { color: #444; }
20
+ p.date { color: #888; font-size: 0.9em; }
21
+ }
@@ -0,0 +1,4 @@
1
+ #menu a,div { color: red; font-weight: bold; }
2
+ /* More */
3
+ #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; }
4
+ a:hover { .corner(5px); background: url(foo.png); /* Superstar */ 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,33 @@
1
+ #menu a, div {
2
+ color: red;
3
+ font-weight: bold;
4
+ }
5
+
6
+
7
+ /* More */
8
+ #menu ul li > div, td, tr, #menu a:hover div #lol yes yes .something span.clear-fix, table {
9
+ text-align: center;
10
+ .black;
11
+ font-weight: bold;
12
+ border: solid 2px #882828;
13
+ cursor: default;
14
+ background-repeat: no-repeat;
15
+ }
16
+
17
+ a:hover {
18
+ .corner(5px);
19
+ background: url(foo.png);
20
+
21
+ /* Superstar */
22
+ span {
23
+ font-weight: bold;
24
+ }
25
+
26
+ span, a:hover, a:active, a:hover span, a:active span {
27
+ text-decoration: underline;
28
+
29
+ strong em {
30
+ color: blue;
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,37 @@
1
+ . [document]
2
+ . . [ruleset]
3
+ . . . [S] #menu a
4
+ . . . [S] div
5
+ . . . [R] color: red
6
+ . . . [R] font-weight: bold
7
+ . . /* More */
8
+ . . [ruleset]
9
+ . . . [S] #menu ul li > div
10
+ . . . [S] td
11
+ . . . [S] tr
12
+ . . . [S] #menu a:hover div #lol yes yes .something span.clear-fix
13
+ . . . [S] table
14
+ . . . [R] text-align: center
15
+ . . . [M] .black
16
+ . . . [R] font-weight: bold
17
+ . . . [R] border: solid 2px #882828
18
+ . . . [R] cursor: default
19
+ . . . [R] background-repeat: no-repeat
20
+ . . [ruleset]
21
+ . . . [S] a:hover
22
+ . . . [M] .corner(5px)
23
+ . . . [R] background: url(foo.png)
24
+ . . . /* Superstar */
25
+ . . . [ruleset]
26
+ . . . . [S] span
27
+ . . . . [R] font-weight: bold
28
+ . . . [ruleset]
29
+ . . . . [S] span
30
+ . . . . [S] a:hover
31
+ . . . . [S] a:active
32
+ . . . . [S] a:hover span
33
+ . . . . [S] a:active span
34
+ . . . . [R] text-decoration: underline
35
+ . . . . [ruleset]
36
+ . . . . . [S] strong em
37
+ . . . . . [R] color: blue