marked-conductor 1.0.17 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +2 -0
  4. data/lib/conductor/config.rb +24 -24
  5. data/lib/conductor/filter.rb +49 -23
  6. data/lib/conductor/version.rb +1 -1
  7. data/src/_README.md +2 -0
  8. metadata +1 -62
  9. data/html/Array.html +0 -160
  10. data/html/Conductor/Command.html +0 -271
  11. data/html/Conductor/Condition.html +0 -791
  12. data/html/Conductor/Config.html +0 -170
  13. data/html/Conductor/Env.html +0 -220
  14. data/html/Conductor/Script.html +0 -288
  15. data/html/Conductor.html +0 -363
  16. data/html/FalseClass.html +0 -138
  17. data/html/Filter.html +0 -269
  18. data/html/Hash.html +0 -160
  19. data/html/Object.html +0 -138
  20. data/html/README_rdoc.html +0 -86
  21. data/html/String.html +0 -1409
  22. data/html/TrueClass.html +0 -138
  23. data/html/YuiCompressor/Yui.html +0 -447
  24. data/html/YuiCompressor.html +0 -93
  25. data/html/created.rid +0 -16
  26. data/html/css/fonts.css +0 -167
  27. data/html/css/rdoc.css +0 -687
  28. data/html/fonts/Lato-Light.ttf +0 -0
  29. data/html/fonts/Lato-LightItalic.ttf +0 -0
  30. data/html/fonts/Lato-Regular.ttf +0 -0
  31. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  32. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  33. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  34. data/html/images/add.png +0 -0
  35. data/html/images/arrow_up.png +0 -0
  36. data/html/images/brick.png +0 -0
  37. data/html/images/brick_link.png +0 -0
  38. data/html/images/bug.png +0 -0
  39. data/html/images/bullet_black.png +0 -0
  40. data/html/images/bullet_toggle_minus.png +0 -0
  41. data/html/images/bullet_toggle_plus.png +0 -0
  42. data/html/images/date.png +0 -0
  43. data/html/images/delete.png +0 -0
  44. data/html/images/find.png +0 -0
  45. data/html/images/loadingAnimation.gif +0 -0
  46. data/html/images/macFFBgHack.png +0 -0
  47. data/html/images/package.png +0 -0
  48. data/html/images/page_green.png +0 -0
  49. data/html/images/page_white_text.png +0 -0
  50. data/html/images/page_white_width.png +0 -0
  51. data/html/images/plugin.png +0 -0
  52. data/html/images/ruby.png +0 -0
  53. data/html/images/tag_blue.png +0 -0
  54. data/html/images/tag_green.png +0 -0
  55. data/html/images/transparent.png +0 -0
  56. data/html/images/wrench.png +0 -0
  57. data/html/images/wrench_orange.png +0 -0
  58. data/html/images/zoom.png +0 -0
  59. data/html/index.html +0 -110
  60. data/html/js/darkfish.js +0 -97
  61. data/html/js/navigation.js +0 -105
  62. data/html/js/navigation.js.gz +0 -0
  63. data/html/js/search.js +0 -110
  64. data/html/js/search_index.js +0 -1
  65. data/html/js/search_index.js.gz +0 -0
  66. data/html/js/searcher.js +0 -229
  67. data/html/js/searcher.js.gz +0 -0
  68. data/html/table_of_contents.html +0 -539
  69. data/test.md +0 -14
data/html/TrueClass.html DELETED
@@ -1,138 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class TrueClass - Marked Conductor</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "./";
11
- var index_rel_prefix = "./";
12
- </script>
13
-
14
- <script src="./js/navigation.js" defer></script>
15
- <script src="./js/search.js" defer></script>
16
- <script src="./js/search_index.js" defer></script>
17
- <script src="./js/searcher.js" defer></script>
18
- <script src="./js/darkfish.js" defer></script>
19
-
20
- <link href="./css/fonts.css" rel="stylesheet">
21
- <link href="./css/rdoc.css" rel="stylesheet">
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="./index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="./table_of_contents.html#pages">Pages</a>
34
- <a href="./table_of_contents.html#classes">Classes</a>
35
- <a href="./table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
-
58
- <div id="class-metadata">
59
-
60
-
61
- <div id="parent-class-section" class="nav-section">
62
- <h3>Parent</h3>
63
-
64
- <p class="link"><a href="Object.html">Object</a>
65
- </div>
66
-
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
73
-
74
- <ul class="link-list" role="directory">
75
- <li ><a href="#method-i-bool-3F">#bool?</a>
76
- </ul>
77
- </div>
78
-
79
- </div>
80
- </nav>
81
-
82
- <main role="main" aria-labelledby="class-TrueClass">
83
- <h1 id="class-TrueClass" class="class">
84
- class TrueClass
85
- </h1>
86
-
87
- <section class="description">
88
-
89
- <p>True class</p>
90
-
91
- </section>
92
-
93
- <section id="5Buntitled-5D" class="documentation-section">
94
-
95
-
96
-
97
-
98
-
99
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
100
- <header>
101
- <h3>Public Instance Methods</h3>
102
- </header>
103
-
104
- <div id="method-i-bool-3F" class="method-detail ">
105
- <div class="method-header">
106
- <div class="method-heading">
107
- <span class="method-name">bool?</span><span
108
- class="method-args">()</span>
109
- <span class="method-click-advice">click to toggle source</span>
110
- </div>
111
- </div>
112
-
113
- <div class="method-description">
114
-
115
-
116
- <div class="method-source-code" id="bool-3F-source">
117
- <pre><span class="ruby-comment"># File lib/conductor/boolean.rb, line 5</span>
118
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool?</span>
119
- <span class="ruby-keyword">true</span>
120
- <span class="ruby-keyword">end</span></pre>
121
- </div>
122
- </div>
123
-
124
-
125
- </div>
126
-
127
- </section>
128
-
129
- </section>
130
- </main>
131
-
132
-
133
- <footer id="validator-badges" role="contentinfo">
134
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
135
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
136
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
137
- </footer>
138
-
@@ -1,447 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class YuiCompressor::Yui - Marked Conductor</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- var index_rel_prefix = "../";
12
- </script>
13
-
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
19
-
20
- <link href="../css/fonts.css" rel="stylesheet">
21
- <link href="../css/rdoc.css" rel="stylesheet">
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="../index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="../table_of_contents.html#pages">Pages</a>
34
- <a href="../table_of_contents.html#classes">Classes</a>
35
- <a href="../table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
-
58
- <div id="class-metadata">
59
-
60
-
61
- <div id="parent-class-section" class="nav-section">
62
- <h3>Parent</h3>
63
-
64
- <p class="link"><a href="../Object.html">Object</a>
65
- </div>
66
-
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <div id="method-list-section" class="nav-section">
72
- <h3>Methods</h3>
73
-
74
- <ul class="link-list" role="directory">
75
- <li ><a href="#method-c-new">::new</a>
76
- <li ><a href="#method-i-compress">#compress</a>
77
- <li ><a href="#method-i-process_comments_and_strings">#process_comments_and_strings</a>
78
- <li ><a href="#method-i-restore_preserved_comments_and_strings">#restore_preserved_comments_and_strings</a>
79
- </ul>
80
- </div>
81
-
82
- </div>
83
- </nav>
84
-
85
- <main role="main" aria-labelledby="class-YuiCompressor::Yui">
86
- <h1 id="class-YuiCompressor::Yui" class="class">
87
- class YuiCompressor::Yui
88
- </h1>
89
-
90
- <section class="description">
91
-
92
- <p>Compress CSS rules using a variety of techniques</p>
93
-
94
- </section>
95
-
96
- <section id="5Buntitled-5D" class="documentation-section">
97
-
98
-
99
-
100
- <section class="attribute-method-details" class="method-section">
101
- <header>
102
- <h3>Attributes</h3>
103
- </header>
104
-
105
- <div id="attribute-i-input_size" class="method-detail">
106
- <div class="method-heading attribute-method-heading">
107
- <span class="method-name">input_size</span><span
108
- class="attribute-access-type">[R]</span>
109
- </div>
110
-
111
- <div class="method-description">
112
-
113
- </div>
114
- </div>
115
- <div id="attribute-i-output_size" class="method-detail">
116
- <div class="method-heading attribute-method-heading">
117
- <span class="method-name">output_size</span><span
118
- class="attribute-access-type">[R]</span>
119
- </div>
120
-
121
- <div class="method-description">
122
-
123
- </div>
124
- </div>
125
- </section>
126
-
127
-
128
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
129
- <header>
130
- <h3>Public Class Methods</h3>
131
- </header>
132
-
133
- <div id="method-c-new" class="method-detail ">
134
- <div class="method-header">
135
- <div class="method-heading">
136
- <span class="method-name">new</span><span
137
- class="method-args">()</span>
138
- <span class="method-click-advice">click to toggle source</span>
139
- </div>
140
- </div>
141
-
142
- <div class="method-description">
143
-
144
-
145
- <div class="method-source-code" id="new-source">
146
- <pre><span class="ruby-comment"># File lib/conductor/yui-compressor.rb, line 10</span>
147
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
148
- <span class="ruby-ivar">@preservedTokens</span> = []
149
- <span class="ruby-ivar">@comments</span> = []
150
- <span class="ruby-ivar">@input_size</span> = <span class="ruby-value">0</span>
151
- <span class="ruby-ivar">@output_size</span> = <span class="ruby-value">0</span>
152
- <span class="ruby-keyword">end</span></pre>
153
- </div>
154
- </div>
155
-
156
-
157
- </div>
158
-
159
- </section>
160
-
161
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
162
- <header>
163
- <h3>Public Instance Methods</h3>
164
- </header>
165
-
166
- <div id="method-i-compress" class="method-detail ">
167
- <div class="method-header">
168
- <div class="method-heading">
169
- <span class="method-name">compress</span><span
170
- class="method-args">(css, line_length = 0)</span>
171
- <span class="method-click-advice">click to toggle source</span>
172
- </div>
173
- </div>
174
-
175
- <div class="method-description">
176
-
177
-
178
- <div class="method-source-code" id="compress-source">
179
- <pre><span class="ruby-comment"># File lib/conductor/yui-compressor.rb, line 17</span>
180
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compress</span>(<span class="ruby-identifier">css</span>, <span class="ruby-identifier">line_length</span> = <span class="ruby-value">0</span>)
181
- <span class="ruby-ivar">@input_size</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">length</span>
182
-
183
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">process_comments_and_strings</span>(<span class="ruby-identifier">css</span>)
184
-
185
- <span class="ruby-comment"># Normalize all whitespace strings to single spaces. Easier to work with that way.</span>
186
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/\s+/</span>, <span class="ruby-string">&#39; &#39;</span>)
187
-
188
- <span class="ruby-comment"># Remove the spaces before the things that should not have spaces before them.</span>
189
- <span class="ruby-comment"># But, be careful not to turn &quot;p :link {...}&quot; into &quot;p:link{...}&quot;</span>
190
- <span class="ruby-comment"># Swap out any pseudo-class colons with the token, and then swap back.</span>
191
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/(?:^|\})[^{:]+\s+:+[^{]*\{/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
192
- <span class="ruby-identifier">match</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;:&#39;</span>, <span class="ruby-string">&#39;___PSEUDOCLASSCOLON___&#39;</span>)
193
- <span class="ruby-keyword">end</span>
194
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/\s+([!{};:&gt;+()\],])/</span>, <span class="ruby-string">&#39;\1&#39;</span>)
195
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/([!{}:;&gt;+(\[,])\s+/</span>, <span class="ruby-string">&#39;\1&#39;</span>)
196
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-string">&#39;___PSEUDOCLASSCOLON___&#39;</span>, <span class="ruby-string">&#39;:&#39;</span>)
197
-
198
- <span class="ruby-comment"># special case for IE</span>
199
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/:first-(line|letter)(\{|,)/</span>, <span class="ruby-string">&#39;:first-\1 \2&#39;</span>)
200
-
201
- <span class="ruby-comment"># no space after the end of a preserved comment</span>
202
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">%r{\*/ }</span>, <span class="ruby-string">&#39;*/&#39;</span>)
203
-
204
- <span class="ruby-comment"># If there is a @charset, then only allow one, and push to the top of the file.</span>
205
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/^(.*)(@charset &quot;[^&quot;]*&quot;;)/i</span>, <span class="ruby-string">&#39;\2\1&#39;</span>)
206
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/^(\s*@charset [^;]+;\s*)+/i</span>, <span class="ruby-string">&#39;\1&#39;</span>)
207
-
208
- <span class="ruby-comment"># Put the space back in some cases, to support stuff like</span>
209
- <span class="ruby-comment"># @media screen and (-webkit-min-device-pixel-ratio:0){</span>
210
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/\band\(/i</span>, <span class="ruby-string">&#39;and (&#39;</span>)
211
-
212
- <span class="ruby-comment"># remove unnecessary semicolons</span>
213
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/;+\}/</span>, <span class="ruby-string">&#39;}&#39;</span>)
214
-
215
- <span class="ruby-comment"># Replace 0(%, em, ex, px, in, cm, mm, pt, pc) with just 0.</span>
216
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/([\s:])([+-]?0)(?:%|em|ex|px|in|cm|mm|pt|pc)/i</span>, <span class="ruby-string">&#39;\1\2&#39;</span>)
217
-
218
- <span class="ruby-comment"># Replace 0 0 0 0; with 0.</span>
219
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/:(?:0 )+0(;|\})/</span>, <span class="ruby-string">&#39;:0\1&#39;</span>)
220
-
221
- <span class="ruby-comment"># Restore background-position:0 0; if required</span>
222
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/(background-position|transform-origin|webkit-transform-origin|moz-transform-origin|o-transform-origin|ms-transform-origin):0(;|\})/i</span>) {
223
- <span class="ruby-node">&quot;#{::Regexp.last_match(1).downcase}:0 0#{::Regexp.last_match(2)}&quot;</span> }
224
-
225
- <span class="ruby-comment"># Replace 0.6 with .6, but only when preceded by : or a space.</span>
226
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/(:|\s)0+\.(\d+)/</span>, <span class="ruby-string">&#39;\1.\2&#39;</span>)
227
-
228
- <span class="ruby-comment"># Shorten colors from rgb(51,102,153) to #336699</span>
229
- <span class="ruby-comment"># This makes it more likely that it&#39;ll get further compressed in the next step.</span>
230
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/rgb\s*\(\s*([0-9,\s]+)\s*\)/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">_match</span><span class="ruby-operator">|</span>
231
- <span class="ruby-string">&#39;#&#39;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-operator">::</span><span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>(<span class="ruby-value">1</span>).<span class="ruby-identifier">scan</span>(<span class="ruby-regexp">/\d+/</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value">16</span>).<span class="ruby-identifier">rjust</span>(<span class="ruby-value">2</span>, <span class="ruby-string">&#39;0&#39;</span>) }.<span class="ruby-identifier">join</span>
232
- <span class="ruby-keyword">end</span>
233
-
234
- <span class="ruby-comment"># Shorten colors from #AABBCC to #ABC. Note that we want to make sure</span>
235
- <span class="ruby-comment"># the color is not preceded by either &quot;, &quot; or =. Indeed, the property</span>
236
- <span class="ruby-comment"># filter: chroma(color=&quot;#FFFFFF&quot;);</span>
237
- <span class="ruby-comment"># would become</span>
238
- <span class="ruby-comment"># filter: chroma(color=&quot;#FFF&quot;);</span>
239
- <span class="ruby-comment"># which makes the filter break in IE.</span>
240
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/([^&quot;&#39;=\s])(\s?)\s*#([0-9a-f])\3([0-9a-f])\4([0-9a-f])\5/i</span>, <span class="ruby-string">&#39;\1\2#\3\4\5&#39;</span>)
241
-
242
- <span class="ruby-comment"># border: none -&gt; border:0</span>
243
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/(border|border-top|border-right|border-bottom|border-right|outline|background):none(;|\})/i</span>) {
244
- <span class="ruby-node">&quot;#{::Regexp.last_match(1).downcase}:0#{::Regexp.last_match(2)}&quot;</span> }
245
-
246
- <span class="ruby-comment"># shorter opacity IE filter</span>
247
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i</span>, <span class="ruby-string">&#39;alpha(opacity=&#39;</span>)
248
-
249
- <span class="ruby-comment"># Remove empty rules.</span>
250
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">%r{[^\};\{/]+\{\}}</span>, <span class="ruby-string">&#39;&#39;</span>)
251
-
252
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">line_length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
253
- <span class="ruby-comment"># Some source control tools don&#39;t like it when files containing lines longer</span>
254
- <span class="ruby-comment"># than, say 8000 characters, are checked in. The linebreak option is used in</span>
255
- <span class="ruby-comment"># that case to split long lines after a specific column.</span>
256
- <span class="ruby-identifier">startIndex</span> = <span class="ruby-value">0</span>
257
- <span class="ruby-identifier">index</span> = <span class="ruby-value">0</span>
258
- <span class="ruby-identifier">length</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">length</span>
259
- <span class="ruby-keyword">while</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">length</span>
260
- <span class="ruby-identifier">index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
261
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">css</span>[<span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">===</span> <span class="ruby-string">&#39;}&#39;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">startIndex</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">line_length</span>
262
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">index</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">index</span>, <span class="ruby-identifier">length</span>)
263
- <span class="ruby-identifier">startIndex</span> = <span class="ruby-identifier">index</span>
264
- <span class="ruby-keyword">end</span>
265
- <span class="ruby-keyword">end</span>
266
- <span class="ruby-keyword">end</span>
267
-
268
- <span class="ruby-comment"># Replace multiple semi-colons in a row by a single one</span>
269
- <span class="ruby-comment"># See SF bug #1980989</span>
270
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/;+/</span>, <span class="ruby-string">&#39;;&#39;</span>)
271
-
272
- <span class="ruby-comment"># restore preserved comments and strings</span>
273
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">restore_preserved_comments_and_strings</span>(<span class="ruby-identifier">css</span>)
274
-
275
- <span class="ruby-comment"># top and tail whitespace</span>
276
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">strip!</span>
277
-
278
- <span class="ruby-ivar">@output_size</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">length</span>
279
- <span class="ruby-identifier">css</span>
280
- <span class="ruby-keyword">end</span></pre>
281
- </div>
282
- </div>
283
-
284
-
285
- </div>
286
-
287
- <div id="method-i-process_comments_and_strings" class="method-detail ">
288
- <div class="method-header">
289
- <div class="method-heading">
290
- <span class="method-name">process_comments_and_strings</span><span
291
- class="method-args">(css_text)</span>
292
- <span class="method-click-advice">click to toggle source</span>
293
- </div>
294
- </div>
295
-
296
- <div class="method-description">
297
-
298
-
299
- <div class="method-source-code" id="process_comments_and_strings-source">
300
- <pre><span class="ruby-comment"># File lib/conductor/yui-compressor.rb, line 119</span>
301
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process_comments_and_strings</span>(<span class="ruby-identifier">css_text</span>)
302
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">css_text</span>.<span class="ruby-identifier">clone</span>
303
-
304
- <span class="ruby-identifier">startIndex</span> = <span class="ruby-value">0</span>
305
- <span class="ruby-identifier">endIndex</span> = <span class="ruby-value">0</span>
306
- <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
307
- <span class="ruby-identifier">max</span> = <span class="ruby-value">0</span>
308
- <span class="ruby-identifier">token</span> = <span class="ruby-string">&#39;&#39;</span>
309
- <span class="ruby-identifier">totallen</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">length</span>
310
- <span class="ruby-identifier">placeholder</span> = <span class="ruby-string">&#39;&#39;</span>
311
-
312
- <span class="ruby-comment"># collect all comment blocks</span>
313
- <span class="ruby-keyword">while</span> (<span class="ruby-identifier">startIndex</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp">%r{/\*}</span>, <span class="ruby-identifier">startIndex</span>))
314
- <span class="ruby-identifier">endIndex</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp">%r{\*/}</span>, <span class="ruby-identifier">startIndex</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>)
315
- <span class="ruby-identifier">endIndex</span> = <span class="ruby-identifier">totallen</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">endIndex</span>
316
- <span class="ruby-identifier">token</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">startIndex</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">endIndex</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
317
- <span class="ruby-ivar">@comments</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">token</span>)
318
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">startIndex</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@comments</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(
319
- <span class="ruby-identifier">endIndex</span>, <span class="ruby-identifier">totallen</span>).<span class="ruby-identifier">to_s</span>
320
- <span class="ruby-identifier">startIndex</span> <span class="ruby-operator">+=</span> <span class="ruby-value">2</span>
321
- <span class="ruby-keyword">end</span>
322
-
323
- <span class="ruby-comment"># preserve strings so their content doesn&#39;t get accidentally minified</span>
324
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/(&quot;([^\\&quot;]|\\.|\\)*&quot;)|(&#39;([^\\&#39;]|\\.|\\)*&#39;)/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
325
- <span class="ruby-identifier">quote</span> = <span class="ruby-identifier">match</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>]
326
- <span class="ruby-identifier">string</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>)
327
-
328
- <span class="ruby-comment"># maybe the string contains a comment-like substring?</span>
329
- <span class="ruby-comment"># one, maybe more? put&#39;em back then</span>
330
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_/</span>
331
- <span class="ruby-ivar">@comments</span>.<span class="ruby-identifier">each_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
332
- <span class="ruby-identifier">string</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_#{index}___/</span>, <span class="ruby-ivar">@comments</span>[<span class="ruby-identifier">index</span>])
333
- <span class="ruby-keyword">end</span>
334
- <span class="ruby-keyword">end</span>
335
-
336
- <span class="ruby-comment"># minify alpha opacity in filter strings</span>
337
- <span class="ruby-identifier">string</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i</span>, <span class="ruby-string">&#39;alpha(opacity=&#39;</span>)
338
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">string</span>)
339
-
340
- <span class="ruby-identifier">quote</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___YUICSSMIN_PRESERVED_TOKEN_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">quote</span>
341
- <span class="ruby-keyword">end</span>
342
-
343
- <span class="ruby-comment"># used to jump one index in loop</span>
344
- <span class="ruby-identifier">ie5_hack</span> = <span class="ruby-keyword">false</span>
345
- <span class="ruby-comment"># strings are safe, now wrestle the comments</span>
346
- <span class="ruby-ivar">@comments</span>.<span class="ruby-identifier">each_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
347
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">ie5_hack</span>
348
- <span class="ruby-identifier">ie5_hack</span> = <span class="ruby-keyword">false</span>
349
- <span class="ruby-keyword">next</span>
350
- <span class="ruby-keyword">end</span>
351
-
352
- <span class="ruby-identifier">token</span> = <span class="ruby-ivar">@comments</span>[<span class="ruby-identifier">index</span>]
353
- <span class="ruby-identifier">placeholder</span> = <span class="ruby-string">&#39;___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_&#39;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">index</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span>
354
-
355
- <span class="ruby-comment"># ! in the first position of the comment means preserve</span>
356
- <span class="ruby-comment"># so push to the preserved tokens keeping the !</span>
357
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">===</span> <span class="ruby-string">&#39;!&#39;</span>
358
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">token</span>)
359
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/#{placeholder}/i</span>, <span class="ruby-string">&#39;___YUICSSMIN_PRESERVED_TOKEN_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span>)
360
- <span class="ruby-keyword">next</span>
361
- <span class="ruby-keyword">end</span>
362
-
363
- <span class="ruby-comment"># \ in the last position looks like hack for Mac/IE5</span>
364
- <span class="ruby-comment"># shorten that to /*\*/ and the next one to /**/</span>
365
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">-1</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">===</span> <span class="ruby-string">&#39;\\&#39;</span>
366
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">push</span>(<span class="ruby-string">&#39;\\&#39;</span>)
367
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/#{placeholder}/</span>, <span class="ruby-string">&#39;___YUICSSMIN_PRESERVED_TOKEN_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span>)
368
- <span class="ruby-comment"># keep the next comment but remove its content</span>
369
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">push</span>(<span class="ruby-string">&#39;&#39;</span>)
370
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_#{index + 1}___/</span>,
371
- <span class="ruby-string">&#39;___YUICSSMIN_PRESERVED_TOKEN_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span>)
372
- <span class="ruby-identifier">ie5_hack</span> = <span class="ruby-keyword">true</span>
373
- <span class="ruby-keyword">next</span>
374
- <span class="ruby-keyword">end</span>
375
-
376
- <span class="ruby-comment"># keep empty comments after child selectors (IE7 hack)</span>
377
- <span class="ruby-comment"># e.g. html &gt;/**/ body</span>
378
- <span class="ruby-keyword">if</span> (<span class="ruby-identifier">token</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">===</span> <span class="ruby-value">0</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">startIndex</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp">/#{placeholder}/</span>))
379
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">startIndex</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2</span>
380
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">css</span>[<span class="ruby-identifier">startIndex</span> <span class="ruby-operator">-</span> <span class="ruby-value">3</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">===</span> <span class="ruby-string">&#39;&gt;&#39;</span>
381
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">push</span>(<span class="ruby-string">&#39;&#39;</span>)
382
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">/#{placeholder}/</span>, <span class="ruby-string">&#39;___YUICSSMIN_PRESERVED_TOKEN_&#39;</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-string">&#39;___&#39;</span>)
383
- <span class="ruby-keyword">end</span>
384
- <span class="ruby-keyword">end</span>
385
- <span class="ruby-keyword">end</span>
386
-
387
- <span class="ruby-comment"># in all other cases kill the comment</span>
388
- <span class="ruby-identifier">css</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp">%r{/\*#{placeholder}\*/}</span>, <span class="ruby-string">&#39;&#39;</span>)
389
- <span class="ruby-keyword">end</span>
390
-
391
- <span class="ruby-identifier">css</span>
392
- <span class="ruby-keyword">end</span></pre>
393
- </div>
394
- </div>
395
-
396
-
397
- </div>
398
-
399
- <div id="method-i-restore_preserved_comments_and_strings" class="method-detail ">
400
- <div class="method-header">
401
- <div class="method-heading">
402
- <span class="method-name">restore_preserved_comments_and_strings</span><span
403
- class="method-args">(clean_css)</span>
404
- <span class="method-click-advice">click to toggle source</span>
405
- </div>
406
- </div>
407
-
408
- <div class="method-description">
409
-
410
-
411
- <div class="method-source-code" id="restore_preserved_comments_and_strings-source">
412
- <pre><span class="ruby-comment"># File lib/conductor/yui-compressor.rb, line 212</span>
413
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">restore_preserved_comments_and_strings</span>(<span class="ruby-identifier">clean_css</span>)
414
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">clean_css</span>.<span class="ruby-identifier">clone</span>
415
- <span class="ruby-identifier">css_length</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">length</span>
416
- <span class="ruby-ivar">@preservedTokens</span>.<span class="ruby-identifier">each_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
417
- <span class="ruby-comment"># slice these back into place rather than regex, because</span>
418
- <span class="ruby-comment"># complex nested strings cause the replacement to fail</span>
419
- <span class="ruby-identifier">placeholder</span> = <span class="ruby-node">&quot;___YUICSSMIN_PRESERVED_TOKEN_#{index}___&quot;</span>
420
- <span class="ruby-identifier">startIndex</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">placeholder</span>, <span class="ruby-value">0</span>)
421
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">startIndex</span> <span class="ruby-comment"># skip if nil</span>
422
-
423
- <span class="ruby-identifier">endIndex</span> = <span class="ruby-identifier">startIndex</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">placeholder</span>.<span class="ruby-identifier">length</span>
424
-
425
- <span class="ruby-identifier">css</span> = <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">startIndex</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@preservedTokens</span>[<span class="ruby-identifier">index</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">css</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">endIndex</span>, <span class="ruby-identifier">css_length</span>).<span class="ruby-identifier">to_s</span>
426
- <span class="ruby-keyword">end</span>
427
-
428
- <span class="ruby-identifier">css</span>
429
- <span class="ruby-keyword">end</span></pre>
430
- </div>
431
- </div>
432
-
433
-
434
- </div>
435
-
436
- </section>
437
-
438
- </section>
439
- </main>
440
-
441
-
442
- <footer id="validator-badges" role="contentinfo">
443
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
444
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
445
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
446
- </footer>
447
-