|
Revision 16024, 1.9 kB
(checked in by cho45, 5 years ago)
|
|
dotfiles 更新
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/env ruby |
|---|
| 2 | # |
|---|
| 3 | # secondlife - http://rails2u.com/ |
|---|
| 4 | # distributed under the MIT licence. |
|---|
| 5 | # |
|---|
| 6 | |
|---|
| 7 | CSS_ORDER = %w( |
|---|
| 8 | display |
|---|
| 9 | float |
|---|
| 10 | clear |
|---|
| 11 | position |
|---|
| 12 | top |
|---|
| 13 | right |
|---|
| 14 | bottom |
|---|
| 15 | left |
|---|
| 16 | font |
|---|
| 17 | font-family |
|---|
| 18 | font-style |
|---|
| 19 | font-variant |
|---|
| 20 | font-weight |
|---|
| 21 | font-stretch |
|---|
| 22 | font-size |
|---|
| 23 | font-size-adjust |
|---|
| 24 | visibility |
|---|
| 25 | z-index |
|---|
| 26 | direction |
|---|
| 27 | unicode-bidi |
|---|
| 28 | width |
|---|
| 29 | min-width |
|---|
| 30 | max-width |
|---|
| 31 | height |
|---|
| 32 | min-height |
|---|
| 33 | max-height |
|---|
| 34 | line-height |
|---|
| 35 | vertical-align |
|---|
| 36 | overflow |
|---|
| 37 | clip |
|---|
| 38 | margin |
|---|
| 39 | margin-top |
|---|
| 40 | margin-right |
|---|
| 41 | margin-bottom |
|---|
| 42 | margin-left |
|---|
| 43 | padding |
|---|
| 44 | padding-top |
|---|
| 45 | padding-right |
|---|
| 46 | padding-bottom |
|---|
| 47 | padding-left |
|---|
| 48 | border |
|---|
| 49 | border-style |
|---|
| 50 | border-color |
|---|
| 51 | border-width |
|---|
| 52 | border-top |
|---|
| 53 | border-bottom |
|---|
| 54 | border-right |
|---|
| 55 | border-left |
|---|
| 56 | border-top-style |
|---|
| 57 | border-right-style |
|---|
| 58 | border-bottom-style |
|---|
| 59 | border-left-style |
|---|
| 60 | border-top-color |
|---|
| 61 | border-right-color |
|---|
| 62 | border-bottom-color |
|---|
| 63 | border-left-color |
|---|
| 64 | border-top-width |
|---|
| 65 | border-right-width |
|---|
| 66 | border-bottom-width |
|---|
| 67 | border-left-width |
|---|
| 68 | outline |
|---|
| 69 | content |
|---|
| 70 | compact |
|---|
| 71 | run-in |
|---|
| 72 | quotes |
|---|
| 73 | marker-offset |
|---|
| 74 | list-style |
|---|
| 75 | list-style-type |
|---|
| 76 | list-style-image |
|---|
| 77 | list-style-position |
|---|
| 78 | size |
|---|
| 79 | marks |
|---|
| 80 | page-break-before |
|---|
| 81 | page-break-after |
|---|
| 82 | page-break-inside |
|---|
| 83 | page |
|---|
| 84 | orphans |
|---|
| 85 | widows |
|---|
| 86 | background |
|---|
| 87 | background-color |
|---|
| 88 | background-image |
|---|
| 89 | background-repeat |
|---|
| 90 | background-attachment |
|---|
| 91 | background-position |
|---|
| 92 | color |
|---|
| 93 | text-indent |
|---|
| 94 | text-align |
|---|
| 95 | text-decoration |
|---|
| 96 | text-shadow |
|---|
| 97 | letter-spacing |
|---|
| 98 | word-spacing |
|---|
| 99 | text-transform |
|---|
| 100 | white-space |
|---|
| 101 | table-layout |
|---|
| 102 | empty-cells |
|---|
| 103 | speak-header |
|---|
| 104 | cursor |
|---|
| 105 | volume |
|---|
| 106 | speak |
|---|
| 107 | pause-before |
|---|
| 108 | pause-after |
|---|
| 109 | pause |
|---|
| 110 | cue-before |
|---|
| 111 | cue-after |
|---|
| 112 | cue |
|---|
| 113 | play-during |
|---|
| 114 | azimuth |
|---|
| 115 | elevation |
|---|
| 116 | speech-rate |
|---|
| 117 | voice-family |
|---|
| 118 | pitch |
|---|
| 119 | pitch-range |
|---|
| 120 | stress |
|---|
| 121 | richness |
|---|
| 122 | speak-punctuation |
|---|
| 123 | speak-numeral |
|---|
| 124 | ) |
|---|
| 125 | |
|---|
| 126 | def property_order(line) |
|---|
| 127 | if m = line.match(/^\s*_?(.+?)\s*:/) |
|---|
| 128 | CSS_ORDER.each_with_index do |property, index| |
|---|
| 129 | return index if property == m[1].downcase |
|---|
| 130 | end |
|---|
| 131 | end |
|---|
| 132 | if line.include? '{' |
|---|
| 133 | return -1 |
|---|
| 134 | elsif line.include? '}' |
|---|
| 135 | return CSS_ORDER.length + 2 |
|---|
| 136 | end |
|---|
| 137 | CSS_ORDER.length + 1 |
|---|
| 138 | end |
|---|
| 139 | |
|---|
| 140 | result = ARGF.read.gsub(%r{/\*([^*]*)\*/}m, '').to_a.map {|l| l.chomp.sub(/\s*:\s*/, ": ") }.sort_by do |line| |
|---|
| 141 | property_order line |
|---|
| 142 | end |
|---|
| 143 | |
|---|
| 144 | puts result.join("\n") |
|---|