GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Version 1.0.5 released.


git-svn-id: svn://hamptoncatlin.com/haml/tags/rel_1-0-5@306 
7063305b-7217-0410-af8c-cdc13e5119b9
nex3 (author)
Thu Jan 25 20:30:38 -0800 2007
commit  ab492ba8076f75b0ceec2951d77ec56b97cb1f1d
tree    1d6423e99fb512c37258eddcec699935de77700b
parent  d3482dc7d64feae952d3a01646dfe5a5fd9ac984
...
154
155
156
157
 
158
159
160
...
171
172
173
174
 
175
176
177
...
181
182
183
184
 
185
186
187
...
154
155
156
 
157
158
159
160
...
171
172
173
 
174
175
176
177
...
181
182
183
 
184
185
186
187
0
@@ -154,7 +154,7 @@ causes the tag to be self-closed.
0
 For example:
0
 
0
   %br/
0
- %meta{:http-equiv => 'Content-Type', :content => 'text/html'}/
0
+ %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
0
 
0
 is compiled to:
0
 
0
@@ -171,7 +171,7 @@ by chaining the class names together with periods.
0
 They are placed immediately after the tag and before an attributes hash.
0
 For example:
0
 
0
- div#things
0
+ %div#things
0
     %span#rice Chicken Fried
0
     %p.beans{ :food => 'true' } The magical fruit
0
     %h1.class.otherclass#id La La La
0
@@ -181,7 +181,7 @@ is compiled to:
0
   <div id='things'>
0
     <span id='rice'>Chicken Fried</span>
0
     <p class='beans' food='true'>The magical fruit</p>
0
- <h1 class='class' id='id'>La La La</h1>
0
+ <h1 class='class otherclass' id='id'>La La La</h1>
0
   </div>
0
 
0
 And,
...
59
60
61
62
 
63
64
65
...
73
74
75
76
 
 
 
 
 
77
78
79
...
59
60
61
 
62
63
64
65
...
73
74
75
 
76
77
78
79
80
81
82
83
0
@@ -59,7 +59,7 @@ if is_task?('package', 'repackage', 'clobber_package')
0
     
0
     readmes = FileList.new('*') { |list| list.exclude(/[a-z]/) }.to_a
0
     spec.executables = ['haml']
0
- spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile'].to_a + readmes
0
+ spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes
0
     spec.homepage = 'http://haml.hamptoncatlin.com/'
0
     spec.has_rdoc = true
0
     spec.extra_rdoc_files = readmes
0
@@ -73,7 +73,11 @@ if is_task?('package', 'repackage', 'clobber_package')
0
     spec.test_files = FileList['test/**/*_test.rb'].to_a
0
   end
0
   
0
- Rake::GemPackageTask.new(spec) { |pkg| }
0
+ Rake::GemPackageTask.new(spec) do |pkg|
0
+ pkg.need_zip = true
0
+ pkg.need_tar_gz = true
0
+ pkg.need_tar_bz2 = true
0
+ end
0
 end
0
 
0
 # ----- Benchmarking -----
...
1
 
...
 
1
0
@@ -1 +1 @@
0
-1.0.2
0
+1.0.5
...
214
215
216
 
 
 
 
 
 
 
 
 
217
218
219
220
 
 
 
 
 
 
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
0
@@ -214,7 +214,22 @@ module Haml
0
       end
0
       result.to_s
0
     end
0
+
0
+ # Returns whether or not the current template is a Haml template.
0
+ #
0
+ # This function, unlike other Haml::Helpers functions,
0
+ # also works in other ActionView templates,
0
+ # where it will always return false.
0
+ def is_haml?
0
+ @haml_stack ? @haml_stack.size > 0 : false
0
+ end
0
     
0
     include ActionViewMods if self.const_defined? "ActionViewMods"
0
   end
0
 end
0
+
0
+class ActionView::Base # :nodoc:
0
+ def is_haml?
0
+ false
0
+ end
0
+end
...
1
2
3
 
4
5
6
...
31
32
33
34
 
 
 
 
 
35
36
37
38
 
39
40
41
...
1
2
3
4
5
6
7
...
32
33
34
 
35
36
37
38
39
40
41
42
 
43
44
45
46
0
@@ -1,6 +1,7 @@
0
 begin
0
   require 'rubygems'
0
   require 'active_support'
0
+ require 'action_controller'
0
   require 'action_view'
0
   action_view_included = true
0
 rescue LoadError
0
@@ -31,11 +32,15 @@ if action_view_included
0
         end
0
         
0
         def concat(string, binding = nil) # :nodoc:
0
- buffer.buffer.concat(string)
0
+ if is_haml?
0
+ buffer.buffer.concat(string)
0
+ else
0
+ old_concat(string, binding)
0
+ end
0
         end
0
         
0
         def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &proc) # :nodoc:
0
- if block_given?
0
+ if block_given? && is_haml?
0
             oldproc = proc
0
             proc = bind_proc do |*args|
0
               concat "\n"
...
93
94
95
96
 
97
98
99
...
93
94
95
 
96
97
98
99
0
@@ -93,7 +93,7 @@ class HelperTest < Test::Unit::TestCase
0
     # two behaviors.
0
     
0
     result = render("- form_tag 'foo' do\n %p bar\n %strong baz", :action_view)
0
- new_rails = "<form action=\"foo\" method=\"post\">\n <p>foo</p>\n</form>\n"
0
+ new_rails = "<form action=\"foo\" method=\"post\">\n <p>bar</p>\n <strong>baz</strong>\n</form>"
0
     old_rails = ""
0
     assert(result == new_rails || result == old_rails)
0
   end
...
50
51
52
53
 
54
55
56
...
50
51
52
 
53
54
55
56
0
@@ -50,7 +50,7 @@
0
     <li>z</li>
0
   </ul>
0
   <h1>I can catch errors!</h1>
0
- Oh no! "uninitialized constant Foo" happened!
0
+ Oh no! "undefined method `silly' for String:Class" happened!
0
   <p>
0
     "false" is:
0
     false
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@
0
   </head>
0
   <body>
0
     <!-- You're In my house now! -->
0
- <div class='header'>
0
+Foo <div class='header'>
0
       Yes, ladies and gentileman. He is just that egotistical.
0
       Fantastic! This should be multi-line output
0
       The question is if this would translate! Ahah!
...
6
7
8
 
9
10
11
...
6
7
8
9
10
11
12
0
@@ -6,6 +6,7 @@
0
   </head>
0
   <body>
0
     <!-- You're In my house now! -->
0
+ <% concat "Foo", Proc.new {} %>
0
     <div class='header'>
0
       Yes, ladies and gentileman. He is just that egotistical.
0
       Fantastic! This should be multi-line output
...
80
81
82
 
 
 
 
 
 
 
 
83
84
85
...
80
81
82
83
84
85
86
87
88
89
90
91
92
93
0
@@ -80,6 +80,14 @@ class TemplateTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_rhtml_still_renders
0
+ # Make sure it renders normally
0
+ res = @base.render("../rhtml/standard")
0
+ assert !(res.nil? || res.empty?)
0
+
0
+ # Register Haml stuff in @base...
0
+ @base.render("standard")
0
+
0
+ # Does it still render?
0
     res = @base.render("../rhtml/standard")
0
     assert !(res.nil? || res.empty?)
0
   end
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@
0
       %li= i
0
   %h1 I can catch errors!
0
   - begin
0
- - Foo.silly
0
+ - String.silly
0
   - rescue NameError => e
0
     = "Oh no! \"#{e}\" happened!"
0
   %p
...
5
6
7
 
8
9
10
...
5
6
7
8
9
10
11
0
@@ -5,6 +5,7 @@
0
     %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}/
0
   %body
0
     / You're In my house now!
0
+ - concat "Foo"
0
     .header
0
       Yes, ladies and gentileman. He is just that egotistical.
0
       Fantastic! This should be multi-line output

Comments

    No one has commented yet.