haml 1.8.2 → 2.0.0
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.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/FAQ +138 -0
 - data/MIT-LICENSE +1 -1
 - data/{README → README.rdoc} +66 -3
 - data/Rakefile +111 -147
 - data/VERSION +1 -1
 - data/bin/css2sass +0 -0
 - data/bin/haml +0 -0
 - data/bin/html2haml +0 -0
 - data/bin/sass +0 -0
 - data/init.rb +6 -1
 - data/lib/haml.rb +464 -201
 - data/lib/haml/buffer.rb +117 -63
 - data/lib/haml/engine.rb +63 -44
 - data/lib/haml/error.rb +16 -6
 - data/lib/haml/exec.rb +37 -7
 - data/lib/haml/filters.rb +213 -68
 - data/lib/haml/helpers.rb +95 -60
 - data/lib/haml/helpers/action_view_extensions.rb +1 -1
 - data/lib/haml/helpers/action_view_mods.rb +54 -6
 - data/lib/haml/html.rb +6 -6
 - data/lib/haml/precompiler.rb +254 -133
 - data/lib/haml/template.rb +3 -6
 - data/lib/haml/template/patch.rb +9 -2
 - data/lib/haml/template/plugin.rb +52 -23
 - data/lib/sass.rb +157 -12
 - data/lib/sass/constant.rb +22 -22
 - data/lib/sass/constant/color.rb +13 -13
 - data/lib/sass/constant/literal.rb +7 -7
 - data/lib/sass/constant/number.rb +9 -9
 - data/lib/sass/constant/operation.rb +4 -4
 - data/lib/sass/constant/string.rb +3 -3
 - data/lib/sass/css.rb +104 -31
 - data/lib/sass/engine.rb +120 -39
 - data/lib/sass/error.rb +1 -1
 - data/lib/sass/plugin.rb +14 -3
 - data/lib/sass/plugin/merb.rb +6 -2
 - data/lib/sass/tree/attr_node.rb +5 -5
 - data/lib/sass/tree/directive_node.rb +2 -7
 - data/lib/sass/tree/node.rb +1 -12
 - data/lib/sass/tree/rule_node.rb +39 -31
 - data/lib/sass/tree/value_node.rb +1 -1
 - data/test/benchmark.rb +67 -80
 - data/test/haml/engine_test.rb +284 -84
 - data/test/haml/helper_test.rb +51 -15
 - data/test/haml/results/content_for_layout.xhtml +1 -2
 - data/test/haml/results/eval_suppressed.xhtml +2 -4
 - data/test/haml/results/filters.xhtml +44 -15
 - data/test/haml/results/helpers.xhtml +2 -3
 - data/test/haml/results/just_stuff.xhtml +2 -6
 - data/test/haml/results/nuke_inner_whitespace.xhtml +34 -0
 - data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
 - data/test/haml/results/original_engine.xhtml +3 -7
 - data/test/haml/results/partials.xhtml +1 -0
 - data/test/haml/results/tag_parsing.xhtml +1 -6
 - data/test/haml/results/very_basic.xhtml +2 -4
 - data/test/haml/results/whitespace_handling.xhtml +13 -21
 - data/test/haml/template_test.rb +8 -15
 - data/test/haml/templates/_partial.haml +1 -0
 - data/test/haml/templates/filters.haml +48 -7
 - data/test/haml/templates/just_stuff.haml +1 -2
 - data/test/haml/templates/nuke_inner_whitespace.haml +26 -0
 - data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
 - data/test/haml/templates/tag_parsing.haml +0 -3
 - data/test/haml/test_helper.rb +15 -0
 - data/test/sass/engine_test.rb +80 -34
 - data/test/sass/plugin_test.rb +1 -1
 - data/test/sass/results/import.css +2 -2
 - data/test/sass/results/mixins.css +95 -0
 - data/test/sass/results/multiline.css +24 -0
 - data/test/sass/templates/import.sass +4 -1
 - data/test/sass/templates/importee.sass +4 -0
 - data/test/sass/templates/mixins.sass +76 -0
 - data/test/sass/templates/multiline.sass +20 -0
 - metadata +65 -51
 - data/lib/haml/util.rb +0 -18
 - data/test/haml/runner.rb +0 -16
 - data/test/profile.rb +0 -65
 
    
        metadata
    CHANGED
    
    | 
         @@ -1,35 +1,33 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
     | 
    
         
            -
            rubygems_version: 0.9.4
         
     | 
| 
       3 
     | 
    
         
            -
            specification_version: 1
         
     | 
| 
       4 
2 
     | 
    
         
             
            name: haml
         
     | 
| 
       5 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       6 
     | 
    
         
            -
              version:  
     | 
| 
       7 
     | 
    
         
            -
            date: 2008-02-24 00:00:00 -08:00
         
     | 
| 
       8 
     | 
    
         
            -
            summary: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.
         
     | 
| 
       9 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
       10 
     | 
    
         
            -
            - lib
         
     | 
| 
       11 
     | 
    
         
            -
            email: haml@googlegroups.com
         
     | 
| 
       12 
     | 
    
         
            -
            homepage: http://haml.hamptoncatlin.com/
         
     | 
| 
       13 
     | 
    
         
            -
            rubyforge_project: 
         
     | 
| 
       14 
     | 
    
         
            -
            description: Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML that's designed to express the structure of XHTML or XML documents in a non-repetitive, elegant, easy way, using indentation rather than closing tags and allowing Ruby to be embedded with ease. It was originally envisioned as a plugin for Ruby on Rails, but it can function as a stand-alone templating engine.
         
     | 
| 
       15 
     | 
    
         
            -
            autorequire: 
         
     | 
| 
       16 
     | 
    
         
            -
            - haml
         
     | 
| 
       17 
     | 
    
         
            -
            - sass
         
     | 
| 
       18 
     | 
    
         
            -
            default_executable: 
         
     | 
| 
       19 
     | 
    
         
            -
            bindir: bin
         
     | 
| 
       20 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       21 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Version::Requirement 
         
     | 
| 
       22 
     | 
    
         
            -
              requirements: 
         
     | 
| 
       23 
     | 
    
         
            -
              - - ">"
         
     | 
| 
       24 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
         
     | 
| 
       25 
     | 
    
         
            -
                  version: 0.0.0
         
     | 
| 
       26 
     | 
    
         
            -
              version: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0
         
     | 
| 
       27 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       28 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
       29 
     | 
    
         
            -
            cert_chain: 
         
     | 
| 
       30 
     | 
    
         
            -
            post_install_message: 
         
     | 
| 
       31 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Nathan Weizenbaum
         
     | 
| 
       32 
8 
     | 
    
         
             
            - Hampton Catlin
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2008-05-23 00:00:00 -07:00
         
     | 
| 
      
 14 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 15 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            description: Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML that's designed to express the structure of XHTML or XML documents in a non-repetitive, elegant, easy way, using indentation rather than closing tags and allowing Ruby to be embedded with ease. It was originally envisioned as a plugin for Ruby on Rails, but it can function as a stand-alone templating engine.
         
     | 
| 
      
 18 
     | 
    
         
            +
            email: haml@googlegroups.com
         
     | 
| 
      
 19 
     | 
    
         
            +
            executables: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - haml
         
     | 
| 
      
 21 
     | 
    
         
            +
            - html2haml
         
     | 
| 
      
 22 
     | 
    
         
            +
            - sass
         
     | 
| 
      
 23 
     | 
    
         
            +
            - css2sass
         
     | 
| 
      
 24 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 27 
     | 
    
         
            +
            - VERSION
         
     | 
| 
      
 28 
     | 
    
         
            +
            - MIT-LICENSE
         
     | 
| 
      
 29 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 30 
     | 
    
         
            +
            - FAQ
         
     | 
| 
       33 
31 
     | 
    
         
             
            files: 
         
     | 
| 
       34 
32 
     | 
    
         
             
            - lib/sass.rb
         
     | 
| 
       35 
33 
     | 
    
         
             
            - lib/sass
         
     | 
| 
         @@ -55,7 +53,6 @@ files: 
     | 
|
| 
       55 
53 
     | 
    
         
             
            - lib/sass/css.rb
         
     | 
| 
       56 
54 
     | 
    
         
             
            - lib/sass/engine.rb
         
     | 
| 
       57 
55 
     | 
    
         
             
            - lib/haml
         
     | 
| 
       58 
     | 
    
         
            -
            - lib/haml/util.rb
         
     | 
| 
       59 
56 
     | 
    
         
             
            - lib/haml/exec.rb
         
     | 
| 
       60 
57 
     | 
    
         
             
            - lib/haml/html.rb
         
     | 
| 
       61 
58 
     | 
    
         
             
            - lib/haml/error.rb
         
     | 
| 
         @@ -88,6 +85,8 @@ files: 
     | 
|
| 
       88 
85 
     | 
    
         
             
            - test/sass/templates/subdir/nested_subdir/nested_subdir.sass
         
     | 
| 
       89 
86 
     | 
    
         
             
            - test/sass/templates/basic.sass
         
     | 
| 
       90 
87 
     | 
    
         
             
            - test/sass/templates/_partial.sass
         
     | 
| 
      
 88 
     | 
    
         
            +
            - test/sass/templates/mixins.sass
         
     | 
| 
      
 89 
     | 
    
         
            +
            - test/sass/templates/multiline.sass
         
     | 
| 
       91 
90 
     | 
    
         
             
            - test/sass/templates/nested.sass
         
     | 
| 
       92 
91 
     | 
    
         
             
            - test/sass/templates/compact.sass
         
     | 
| 
       93 
92 
     | 
    
         
             
            - test/sass/templates/alt.sass
         
     | 
| 
         @@ -107,10 +106,12 @@ files: 
     | 
|
| 
       107 
106 
     | 
    
         
             
            - test/sass/results/compact.css
         
     | 
| 
       108 
107 
     | 
    
         
             
            - test/sass/results/expanded.css
         
     | 
| 
       109 
108 
     | 
    
         
             
            - test/sass/results/alt.css
         
     | 
| 
      
 109 
     | 
    
         
            +
            - test/sass/results/mixins.css
         
     | 
| 
       110 
110 
     | 
    
         
             
            - test/sass/results/complex.css
         
     | 
| 
       111 
111 
     | 
    
         
             
            - test/sass/results/constants.css
         
     | 
| 
       112 
112 
     | 
    
         
             
            - test/sass/results/compressed.css
         
     | 
| 
       113 
113 
     | 
    
         
             
            - test/sass/results/parent_ref.css
         
     | 
| 
      
 114 
     | 
    
         
            +
            - test/sass/results/multiline.css
         
     | 
| 
       114 
115 
     | 
    
         
             
            - test/sass/results/basic.css
         
     | 
| 
       115 
116 
     | 
    
         
             
            - test/sass/engine_test.rb
         
     | 
| 
       116 
117 
     | 
    
         
             
            - test/haml
         
     | 
| 
         @@ -128,11 +129,13 @@ files: 
     | 
|
| 
       128 
129 
     | 
    
         
             
            - test/haml/templates/list.haml
         
     | 
| 
       129 
130 
     | 
    
         
             
            - test/haml/templates/_text_area.haml
         
     | 
| 
       130 
131 
     | 
    
         
             
            - test/haml/templates/_partial.haml
         
     | 
| 
      
 132 
     | 
    
         
            +
            - test/haml/templates/nuke_outer_whitespace.haml
         
     | 
| 
       131 
133 
     | 
    
         
             
            - test/haml/templates/_av_partial_2.haml
         
     | 
| 
       132 
134 
     | 
    
         
             
            - test/haml/templates/helpful.haml
         
     | 
| 
       133 
135 
     | 
    
         
             
            - test/haml/templates/just_stuff.haml
         
     | 
| 
       134 
136 
     | 
    
         
             
            - test/haml/templates/silent_script.haml
         
     | 
| 
       135 
137 
     | 
    
         
             
            - test/haml/templates/very_basic.haml
         
     | 
| 
      
 138 
     | 
    
         
            +
            - test/haml/templates/nuke_inner_whitespace.haml
         
     | 
| 
       136 
139 
     | 
    
         
             
            - test/haml/templates/eval_suppressed.haml
         
     | 
| 
       137 
140 
     | 
    
         
             
            - test/haml/templates/tag_parsing.haml
         
     | 
| 
       138 
141 
     | 
    
         
             
            - test/haml/templates/whitespace_handling.haml
         
     | 
| 
         @@ -146,14 +149,16 @@ files: 
     | 
|
| 
       146 
149 
     | 
    
         
             
            - test/haml/templates/original_engine.haml
         
     | 
| 
       147 
150 
     | 
    
         
             
            - test/haml/templates/breakage.haml
         
     | 
| 
       148 
151 
     | 
    
         
             
            - test/haml/templates/action_view.haml
         
     | 
| 
       149 
     | 
    
         
            -
            - test/haml/ 
     | 
| 
      
 152 
     | 
    
         
            +
            - test/haml/test_helper.rb
         
     | 
| 
       150 
153 
     | 
    
         
             
            - test/haml/results
         
     | 
| 
       151 
154 
     | 
    
         
             
            - test/haml/results/content_for_layout.xhtml
         
     | 
| 
       152 
155 
     | 
    
         
             
            - test/haml/results/just_stuff.xhtml
         
     | 
| 
       153 
156 
     | 
    
         
             
            - test/haml/results/whitespace_handling.xhtml
         
     | 
| 
      
 157 
     | 
    
         
            +
            - test/haml/results/nuke_outer_whitespace.xhtml
         
     | 
| 
       154 
158 
     | 
    
         
             
            - test/haml/results/silent_script.xhtml
         
     | 
| 
       155 
159 
     | 
    
         
             
            - test/haml/results/filters.xhtml
         
     | 
| 
       156 
160 
     | 
    
         
             
            - test/haml/results/standard.xhtml
         
     | 
| 
      
 161 
     | 
    
         
            +
            - test/haml/results/nuke_inner_whitespace.xhtml
         
     | 
| 
       157 
162 
     | 
    
         
             
            - test/haml/results/helpful.xhtml
         
     | 
| 
       158 
163 
     | 
    
         
             
            - test/haml/results/very_basic.xhtml
         
     | 
| 
       159 
164 
     | 
    
         
             
            - test/haml/results/eval_suppressed.xhtml
         
     | 
| 
         @@ -165,41 +170,50 @@ files: 
     | 
|
| 
       165 
170 
     | 
    
         
             
            - test/haml/markaby
         
     | 
| 
       166 
171 
     | 
    
         
             
            - test/haml/markaby/standard.mab
         
     | 
| 
       167 
172 
     | 
    
         
             
            - test/haml/engine_test.rb
         
     | 
| 
       168 
     | 
    
         
            -
            - test/profile.rb
         
     | 
| 
       169 
173 
     | 
    
         
             
            - test/benchmark.rb
         
     | 
| 
       170 
174 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       171 
175 
     | 
    
         
             
            - init.rb
         
     | 
| 
       172 
176 
     | 
    
         
             
            - VERSION
         
     | 
| 
       173 
177 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       174 
     | 
    
         
            -
            - README
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
            - test/haml/html2haml_test.rb
         
     | 
| 
       180 
     | 
    
         
            -
            - test/haml/helper_test.rb
         
     | 
| 
       181 
     | 
    
         
            -
            - test/haml/engine_test.rb
         
     | 
| 
      
 178 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 179 
     | 
    
         
            +
            - FAQ
         
     | 
| 
      
 180 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 181 
     | 
    
         
            +
            homepage: http://haml.hamptoncatlin.com/
         
     | 
| 
      
 182 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       182 
183 
     | 
    
         
             
            rdoc_options: 
         
     | 
| 
       183 
184 
     | 
    
         
             
            - --title
         
     | 
| 
       184 
185 
     | 
    
         
             
            - Haml
         
     | 
| 
       185 
186 
     | 
    
         
             
            - --main
         
     | 
| 
       186 
     | 
    
         
            -
            - README
         
     | 
| 
      
 187 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
       187 
188 
     | 
    
         
             
            - --exclude
         
     | 
| 
       188 
189 
     | 
    
         
             
            - lib/haml/buffer.rb
         
     | 
| 
       189 
190 
     | 
    
         
             
            - --line-numbers
         
     | 
| 
       190 
191 
     | 
    
         
             
            - --inline-source
         
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
            -  
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
            -  
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
      
 192 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 193 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 194 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 195 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 196 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 197 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 198 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 199 
     | 
    
         
            +
              version: 
         
     | 
| 
      
 200 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 201 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 202 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 203 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 204 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 205 
     | 
    
         
            +
              version: 
         
     | 
| 
       202 
206 
     | 
    
         
             
            requirements: []
         
     | 
| 
       203 
207 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
      
 208 
     | 
    
         
            +
            rubyforge_project: haml
         
     | 
| 
      
 209 
     | 
    
         
            +
            rubygems_version: 1.1.1
         
     | 
| 
      
 210 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 211 
     | 
    
         
            +
            specification_version: 2
         
     | 
| 
      
 212 
     | 
    
         
            +
            summary: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.
         
     | 
| 
      
 213 
     | 
    
         
            +
            test_files: 
         
     | 
| 
      
 214 
     | 
    
         
            +
            - test/sass/plugin_test.rb
         
     | 
| 
      
 215 
     | 
    
         
            +
            - test/sass/engine_test.rb
         
     | 
| 
      
 216 
     | 
    
         
            +
            - test/haml/template_test.rb
         
     | 
| 
      
 217 
     | 
    
         
            +
            - test/haml/html2haml_test.rb
         
     | 
| 
      
 218 
     | 
    
         
            +
            - test/haml/helper_test.rb
         
     | 
| 
      
 219 
     | 
    
         
            +
            - test/haml/engine_test.rb
         
     | 
    
        data/lib/haml/util.rb
    DELETED
    
    | 
         @@ -1,18 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # This file contains various useful bits of code
         
     | 
| 
       2 
     | 
    
         
            -
            # that are shared between Haml and Sass.
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            class Hash # :nodoc:
         
     | 
| 
       5 
     | 
    
         
            -
              # Same as Hash#merge!,
         
     | 
| 
       6 
     | 
    
         
            -
              # but recursively merges sub-hashes
         
     | 
| 
       7 
     | 
    
         
            -
              def rec_merge!(other)
         
     | 
| 
       8 
     | 
    
         
            -
                other.each do |key, value|
         
     | 
| 
       9 
     | 
    
         
            -
                  myval = self[key]
         
     | 
| 
       10 
     | 
    
         
            -
                  if value.is_a?(Hash) && myval.is_a?(Hash)
         
     | 
| 
       11 
     | 
    
         
            -
                    myval.rec_merge!(value)
         
     | 
| 
       12 
     | 
    
         
            -
                  else
         
     | 
| 
       13 
     | 
    
         
            -
                    self[key] = value
         
     | 
| 
       14 
     | 
    
         
            -
                  end
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
     | 
    
         
            -
                self
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
            end
         
     | 
    
        data/test/haml/runner.rb
    DELETED
    
    | 
         @@ -1,16 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'active_support'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'action_controller'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'action_view'
         
     | 
| 
       5 
     | 
    
         
            -
            require '../../lib/haml/template'
         
     | 
| 
       6 
     | 
    
         
            -
            require 'fileutils'
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            haml_template_engine = Haml::Template.new(ActionView::Base.new)
         
     | 
| 
       9 
     | 
    
         
            -
            haml_template_engine.render(File.dirname(__FILE__) + '/templates/standard.haml')
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            begin
         
     | 
| 
       12 
     | 
    
         
            -
              eval(File.read("template_test.rb"))
         
     | 
| 
       13 
     | 
    
         
            -
            rescue StandardError => e
         
     | 
| 
       14 
     | 
    
         
            -
              puts e.backtrace
         
     | 
| 
       15 
     | 
    
         
            -
              puts e.inspect
         
     | 
| 
       16 
     | 
    
         
            -
            end
         
     | 
    
        data/test/profile.rb
    DELETED
    
    | 
         @@ -1,65 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'active_support'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'action_controller'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'action_view'
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            require File.dirname(__FILE__) + '/../lib/haml'
         
     | 
| 
       7 
     | 
    
         
            -
            require 'haml/template'
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            require 'profiler'
         
     | 
| 
       10 
     | 
    
         
            -
            require 'stringio'
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            module Haml
         
     | 
| 
       13 
     | 
    
         
            -
              # Used by both Haml::Profiler and Sass::Profiler.
         
     | 
| 
       14 
     | 
    
         
            -
              # Encapsulates profiling behavior.
         
     | 
| 
       15 
     | 
    
         
            -
              module AbstractProfiler
         
     | 
| 
       16 
     | 
    
         
            -
                def self.profile(times, &block)
         
     | 
| 
       17 
     | 
    
         
            -
                  # Runs the profiler, collects information
         
     | 
| 
       18 
     | 
    
         
            -
                  Profiler__::start_profile
         
     | 
| 
       19 
     | 
    
         
            -
                  times.times &block
         
     | 
| 
       20 
     | 
    
         
            -
                  Profiler__::stop_profile
         
     | 
| 
       21 
     | 
    
         
            -
                  
         
     | 
| 
       22 
     | 
    
         
            -
                  # Outputs information to a StringIO, returns result
         
     | 
| 
       23 
     | 
    
         
            -
                  io = StringIO.new
         
     | 
| 
       24 
     | 
    
         
            -
                  Profiler__::print_profile(io)
         
     | 
| 
       25 
     | 
    
         
            -
                  io.pos = 0
         
     | 
| 
       26 
     | 
    
         
            -
                  result = io.read
         
     | 
| 
       27 
     | 
    
         
            -
                  io.close
         
     | 
| 
       28 
     | 
    
         
            -
                  result
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              # A profiler for Haml, mostly for development use. This simply implements
         
     | 
| 
       33 
     | 
    
         
            -
              # the Ruby profiler for profiling haml code.
         
     | 
| 
       34 
     | 
    
         
            -
              class Profiler
         
     | 
| 
       35 
     | 
    
         
            -
              
         
     | 
| 
       36 
     | 
    
         
            -
                # Creates a new profiler that looks for templates in the base
         
     | 
| 
       37 
     | 
    
         
            -
                # directory.
         
     | 
| 
       38 
     | 
    
         
            -
                def initialize(base = File.join(File.dirname(__FILE__), 'haml', 'templates'))
         
     | 
| 
       39 
     | 
    
         
            -
                  unless base.class == ActionView::Base
         
     | 
| 
       40 
     | 
    
         
            -
                    @base = ActionView::Base.new(base)
         
     | 
| 
       41 
     | 
    
         
            -
                  else
         
     | 
| 
       42 
     | 
    
         
            -
                    @base = base
         
     | 
| 
       43 
     | 
    
         
            -
                  end
         
     | 
| 
       44 
     | 
    
         
            -
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # Profiles haml on the given template with the given number of runs.
         
     | 
| 
       47 
     | 
    
         
            -
                # The template name shouldn't have a file extension; this will
         
     | 
| 
       48 
     | 
    
         
            -
                # automatically look for a haml template.
         
     | 
| 
       49 
     | 
    
         
            -
                # 
         
     | 
| 
       50 
     | 
    
         
            -
                # Returns the results of the profiling as a string.
         
     | 
| 
       51 
     | 
    
         
            -
                def profile(runs = 100, template_name = 'standard')      
         
     | 
| 
       52 
     | 
    
         
            -
                  AbstractProfiler.profile(runs) { @base.render template_name }
         
     | 
| 
       53 
     | 
    
         
            -
                end
         
     | 
| 
       54 
     | 
    
         
            -
              end
         
     | 
| 
       55 
     | 
    
         
            -
            end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            module Sass
         
     | 
| 
       58 
     | 
    
         
            -
              class Profiler
         
     | 
| 
       59 
     | 
    
         
            -
                def profile(runs = 100, template_name = 'complex')
         
     | 
| 
       60 
     | 
    
         
            -
                  Haml::AbstractProfiler.profile(runs) do
         
     | 
| 
       61 
     | 
    
         
            -
                    Sass::Engine.new("#{File.dirname(__FILE__)}/sass/templates/#{template_name}.sass").render
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
              end
         
     | 
| 
       65 
     | 
    
         
            -
            end
         
     |