fortitude 0.0.7 → 0.0.9

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/CHANGES.md +73 -0
  3. data/CONTRIBUTORS.md +17 -0
  4. data/ext/com/fortituderuby/ext/fortitude/FortitudeNativeLibrary.java +23 -7
  5. data/ext/fortitude_native_ext/fortitude_native_ext.c +91 -54
  6. data/lib/fortitude/doctypes/html4.rb +4 -0
  7. data/lib/fortitude/doctypes/html5.rb +4 -0
  8. data/lib/fortitude/doctypes/unknown_doctype.rb +4 -0
  9. data/lib/fortitude/doctypes/xhtml10.rb +4 -0
  10. data/lib/fortitude/doctypes/xhtml11.rb +4 -0
  11. data/lib/fortitude/erector.rb +1 -0
  12. data/lib/fortitude/errors.rb +16 -0
  13. data/lib/fortitude/extensions/fortitude_ruby_ext.rb +27 -12
  14. data/lib/fortitude/method_templates/assign_locals_from_template.rb.smpl +2 -0
  15. data/lib/fortitude/method_templates/need_assignment_template.rb.smpl +2 -2
  16. data/lib/fortitude/method_templates/simple_compiled_template.rb +94 -0
  17. data/lib/fortitude/method_templates/tag_method_template.rb.smpl +4 -4
  18. data/lib/fortitude/method_templates/text_method_template.rb.smpl +2 -2
  19. data/lib/fortitude/rails/railtie.rb +5 -1
  20. data/lib/fortitude/rails/rendering_methods.rb +66 -47
  21. data/lib/fortitude/rails/template_handler.rb +0 -1
  22. data/lib/fortitude/rendering_context.rb +2 -2
  23. data/lib/fortitude/tags/tag.rb +4 -3
  24. data/lib/fortitude/version.rb +1 -1
  25. data/lib/fortitude/widget.rb +1 -1
  26. data/lib/fortitude/widget/content.rb +1 -1
  27. data/lib/fortitude/widget/integration.rb +12 -3
  28. data/lib/fortitude/widget/localization.rb +1 -37
  29. data/lib/fortitude/widget/needs.rb +41 -12
  30. data/lib/fortitude/widget/rendering.rb +25 -7
  31. data/lib/fortitude/widget/start_and_end_comments.rb +1 -0
  32. data/lib/fortitude/widget/tags.rb +2 -1
  33. data/lib/fortitude/widget/widget_class_inheritable_attributes.rb +1 -0
  34. data/lib/fortitude_jruby_native_ext.jar +0 -0
  35. data/spec/helpers/system_helpers.rb +4 -0
  36. data/spec/rails/class_loading_system_spec.rb +10 -2
  37. data/spec/rails/development_mode_system_spec.rb +91 -0
  38. data/spec/rails/erector_coexistence_system_spec.rb +16 -0
  39. data/spec/rails/layouts_system_spec.rb +8 -3
  40. data/spec/rails/rendering_system_spec.rb +24 -2
  41. data/spec/rails/templates/class_loading_system_spec/app/controllers/class_loading_system_spec_controller.rb +6 -2
  42. data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/_foo.rb +5 -0
  43. data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/bar.html.rb +5 -0
  44. data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/bar.rb +5 -0
  45. data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/foo.rb +5 -0
  46. data/spec/rails/templates/development_mode_system_spec/app/controllers/development_mode_system_spec_controller.rb +4 -0
  47. data/spec/rails/templates/development_mode_system_spec/app/views/base.rb +5 -0
  48. data/spec/rails/templates/development_mode_system_spec/app/views/development_mode_system_spec/form.rb +11 -0
  49. data/spec/rails/templates/erector_coexistence_system_spec/app/controllers/erector_coexistence_system_spec_controller.rb +16 -0
  50. data/spec/rails/templates/erector_coexistence_system_spec/app/views/erector_widget.rb +5 -0
  51. data/spec/rails/templates/erector_coexistence_system_spec/app/views/fortitude_widget.rb +5 -0
  52. data/spec/rails/templates/localization_system_spec/app/views/localization_system_spec/content_method.rb +2 -0
  53. data/spec/rails/templates/rendering_system_spec/app/controllers/rendering_system_spec_controller.rb +14 -1
  54. data/spec/rails/templates/rendering_system_spec/app/helpers/application_helper.rb +5 -0
  55. data/spec/rails/templates/rendering_system_spec/app/views/widget_to_render_class_only.rb +5 -0
  56. data/spec/rails/templates/rendering_system_spec/app/views/widget_to_render_with_helper.rb +5 -0
  57. data/spec/system/doctypes_system_spec.rb +30 -8
  58. data/spec/system/erector_compatibility_system_spec.rb +27 -0
  59. data/spec/system/localization_system_spec.rb +4 -0
  60. data/spec/system/needs_system_spec.rb +31 -0
  61. data/spec/system/rebuild_notifications_system_spec.rb +180 -85
  62. data/spec/system/setting_inheritance_system_spec.rb +47 -0
  63. data/spec/system/static_method_system_spec.rb +2 -0
  64. data/spec/system/tag_rendering_system_spec.rb +41 -0
  65. data/spec/system/void_tags_system_spec.rb +1 -0
  66. data/spec/system/yield_system_spec.rb +188 -0
  67. metadata +27 -5
  68. data/lib/fortitude/method_templates/simple_template.rb +0 -50
  69. data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/_underscore_widget.rb +0 -11
@@ -149,5 +149,21 @@ you simply need to convert these to "p :class => :some_class" or
149
149
  @tag_name = tag_name
150
150
  end
151
151
  end
152
+
153
+ class NoBlockToYieldTo < Base
154
+ attr_reader :widget
155
+
156
+ def initialize(widget)
157
+ super(%{You're trying to call 'yield' (or 'yield_from_widget', or the Erector-compatibility method 'call_block')
158
+ from the widget #{widget}; however, there is nothing to yield to. Fortitude
159
+ looks for something to yield to in this order:
160
+ 1. A block passed to a yield at render time directly (usually via the 'widget' call);
161
+ 2. A block passed to the constructor of the widget;
162
+ 3. The layout the widget is being rendered in.
163
+ None of these exist here, and so calling 'yield', 'yield_from_widget', or 'call_block' is an
164
+ undefined operation.})
165
+ @widget = widget
166
+ end
167
+ end
152
168
  end
153
169
  end
@@ -25,7 +25,7 @@ end
25
25
  const_set(constant_name, value)
26
26
  end
27
27
 
28
- def fortitude_append_as_attributes(output, prefix)
28
+ def fortitude_append_as_attributes(output, prefix, allows_bare_attributes)
29
29
  raise ArgumentError, "You can only append to a String" unless output.kind_of?(String)
30
30
 
31
31
  target = ::Hash::TARGET_BASE.dup
@@ -39,20 +39,35 @@ end
39
39
  end
40
40
 
41
41
  new_prefix.original_concat(::Hash::FORTITUDE_HYPHEN)
42
- value.fortitude_append_as_attributes(target, new_prefix)
42
+ value.fortitude_append_as_attributes(target, new_prefix, allows_bare_attributes)
43
43
  else
44
- target.original_concat(::Hash::FORTITUDE_SPACE)
44
+ if value == nil || value == false
45
+ # nothing
46
+ else
47
+ target.original_concat(::Hash::FORTITUDE_SPACE)
45
48
 
46
- case prefix
47
- when String then target.original_concat(prefix)
48
- when nil then nil
49
- else raise ArgumentError, "You can only use a String as a prefix"
50
- end
49
+ case prefix
50
+ when String then target.original_concat(prefix)
51
+ when nil then nil
52
+ else raise ArgumentError, "You can only use a String as a prefix"
53
+ end
51
54
 
52
- fortitude_append_to(key, target)
53
- target.original_concat(::Hash::FORTITUDE_EQUALS_QUOTE)
54
- fortitude_append_to(value, target)
55
- target.original_concat(::Hash::FORTITUDE_QUOTE)
55
+ fortitude_append_to(key, target)
56
+
57
+ if value == true
58
+ if allows_bare_attributes
59
+ # nothing here
60
+ else
61
+ target.original_concat(::Hash::FORTITUDE_EQUALS_QUOTE)
62
+ fortitude_append_to(key, target)
63
+ target.original_concat(::Hash::FORTITUDE_QUOTE)
64
+ end
65
+ else
66
+ target.original_concat(::Hash::FORTITUDE_EQUALS_QUOTE)
67
+ fortitude_append_to(value, target)
68
+ target.original_concat(::Hash::FORTITUDE_QUOTE)
69
+ end
70
+ end
56
71
  end
57
72
  end
58
73
 
@@ -1,4 +1,6 @@
1
1
  def assign_locals_from(assigns)
2
+ return assign_locals_from(assigns) if self.class.ensure_needs_methods_are_valid!
3
+
2
4
  @_fortitude_raw_assigns = assigns
3
5
  @_fortitude_raw_assigns = @_fortitude_raw_assigns.delete_if { |k,v| ! self.class.is_valid_ruby_method_name?(k) } # :if extra_assigns == :use
4
6
  @_fortitude_default_assigns = { }
@@ -2,9 +2,9 @@
2
2
  @_fortitude_extra_assigns.delete(:#{need}) # :if [ :error, :use ].include?(extra_assigns)
3
3
 
4
4
  value = assigns.fetch(:#{need}, NOT_PRESENT_NEED)
5
- if value == NOT_PRESENT_NEED
5
+ if value.equal?(NOT_PRESENT_NEED)
6
6
  value = assigns.fetch('#{need}', NOT_PRESENT_NEED)
7
- if value == NOT_PRESENT_NEED
7
+ if value.equal?(NOT_PRESENT_NEED)
8
8
  value = nil # :if ! has_default
9
9
  missing << :#{need} # :if ! has_default
10
10
  have_missing = true # :if ! has_default
@@ -0,0 +1,94 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext/hash'
3
+
4
+ module Fortitude
5
+ module MethodTemplates
6
+ class SimpleCompiledTemplate
7
+ class << self
8
+ def template(name)
9
+ @templates ||= { }
10
+ @templates[name] ||= new(File.join(File.dirname(__FILE__), "#{name}.rb.smpl"))
11
+ end
12
+ end
13
+
14
+ def initialize(source_file)
15
+ @source_file = source_file
16
+ method_text_lines = [
17
+ "def result",
18
+ " output = ''"
19
+ ]
20
+ pending_fixed_strings = [ ]
21
+
22
+ File.read(source_file).split(/\r\n|\r|\n/).each do |line|
23
+ needs_end = false
24
+ line = line.chomp
25
+
26
+ if line =~ /^(.*)\#\s*\:if\s*(.*?)\s*$/i
27
+ if pending_fixed_strings.length > 0
28
+ method_text_lines << " output << <<EOS"
29
+ method_text_lines += pending_fixed_strings
30
+ method_text_lines << "EOS"
31
+ pending_fixed_strings = [ ]
32
+ end
33
+
34
+ line = $1
35
+ condition = $2
36
+ method_text_lines << " if #{condition}"
37
+ method_text_lines << " output << <<EOS"
38
+ method_text_lines << line
39
+ method_text_lines << "EOS"
40
+ method_text_lines << " end"
41
+ else
42
+ pending_fixed_strings << line
43
+ end
44
+ end
45
+
46
+ if pending_fixed_strings.length > 0
47
+ method_text_lines << " output << <<EOS"
48
+ method_text_lines += pending_fixed_strings
49
+ method_text_lines << "EOS"
50
+ pending_fixed_strings = [ ]
51
+ end
52
+
53
+ method_text_lines << " output"
54
+ method_text_lines << "end"
55
+
56
+ @method_text = method_text_lines.join("\n")
57
+ @evaluation_object = EvaluationObject.new
58
+ metaclass = (class << @evaluation_object; self; end)
59
+ metaclass.class_eval(method_text_lines.join("\n"))
60
+ end
61
+
62
+ class EvaluationObject
63
+ def initialize
64
+ @hash = nil
65
+ end
66
+
67
+ def hash=(h)
68
+ @hash = h.symbolize_keys
69
+ end
70
+
71
+ def define_hash_method!(name)
72
+ symbol_name = name.to_sym
73
+ string_name = name.to_s
74
+
75
+ metaclass = (class << self; self; end)
76
+ metaclass.send(:define_method, name) do
77
+ @hash[symbol_name]
78
+ end
79
+ end
80
+
81
+ def method_missing(name, *args)
82
+ define_hash_method!(name)
83
+ send(name, *args)
84
+ end
85
+ end
86
+
87
+ def result(bindings)
88
+ @evaluation_object.hash = bindings
89
+ out = @evaluation_object.result
90
+ out
91
+ end
92
+ end
93
+ end
94
+ end
@@ -23,7 +23,7 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
23
23
  this_tag.validate_attributes(self, content_or_attributes) # :if needs_attribute_rules
24
24
  this_tag.validate_id_uniqueness(self, content_or_attributes) # :if needs_id_uniqueness
25
25
  o.#{concat_method}(#{partial_open_const})
26
- content_or_attributes.fortitude_append_as_attributes(o, nil)
26
+ content_or_attributes.fortitude_append_as_attributes(o, nil, #{allows_bare_attributes})
27
27
 
28
28
  if block_given?
29
29
  _fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
@@ -36,7 +36,7 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
36
36
  elsif (! attributes)
37
37
  _fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
38
38
  o.#{concat_method}(#{open_const})
39
- rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get("@html_safe") # :if record_emitting_tag
39
+ rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get('@html_safe') # :if record_emitting_tag
40
40
  content_or_attributes.to_s.fortitude_append_escaped_string(o) # :if escape_direct_content
41
41
  o.#{concat_method}(content_or_attributes.to_s) # :if ! escape_direct_content
42
42
  if block_given?
@@ -49,10 +49,10 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
49
49
  this_tag.validate_attributes(self, attributes) # :if needs_attribute_rules
50
50
  this_tag.validate_id_uniqueness(self, attributes) # :if needs_id_uniqueness
51
51
  o.#{concat_method}(#{partial_open_const})
52
- attributes.fortitude_append_as_attributes(o, nil)
52
+ attributes.fortitude_append_as_attributes(o, nil, #{allows_bare_attributes})
53
53
  o.#{concat_method}(#{partial_open_end_const})
54
54
 
55
- rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get("@html_safe") # :if record_emitting_tag
55
+ rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get('@html_safe') # :if record_emitting_tag
56
56
  content_or_attributes.to_s.fortitude_append_escaped_string(o) # :if escape_direct_content
57
57
  o.#{concat_method}(content_or_attributes.to_s) # :if ! escape_direct_content
58
58
  if block_given?
@@ -1,7 +1,7 @@
1
1
  def tag_text(s)
2
2
  @_fortitude_rendering_context.about_to_output_non_whitespace! # :if format_output
3
3
 
4
- unless s.instance_variable_get("@html_safe") # :if record_emitting_tag
4
+ unless s.instance_variable_get('@html_safe') # :if record_emitting_tag
5
5
  @_fortitude_rendering_context.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, s, nil) { } # :if record_emitting_tag
6
6
  end # :if record_emitting_tag
7
7
 
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  def tag_rawtext(s)
12
12
  @_fortitude_rendering_context.about_to_output_non_whitespace! # :if format_output
13
- @_fortitude_output_buffer_holder.output_buffer.original_concat(s)
13
+ @_fortitude_output_buffer_holder.output_buffer.original_concat(s) if s != nil
14
14
  end
15
15
 
16
16
  alias_method :text, :tag_text
@@ -151,13 +151,17 @@ module Fortitude
151
151
  if File.directory?(directory)
152
152
  filename = File.basename(full_path)
153
153
 
154
- regexp1 = /^#{Regexp.escape(filename)}\./
154
+ regexp1 = /^_?#{Regexp.escape(filename)}\./
155
155
  regexp2 = /\.rb$/i
156
156
  applicable_entries = Dir.entries(directory).select do |entry|
157
157
  ((entry == filename) || (entry =~ regexp1 && entry =~ regexp2)) && File.file?(File.join(directory, entry))
158
158
  end
159
159
  return nil if applicable_entries.length == 0
160
160
 
161
+ # Prefer those without an underscore
162
+ without_underscore = applicable_entries.select { |e| e !~ /^_/ }
163
+ applicable_entries = without_underscore if without_underscore.length > 0
164
+
161
165
  entry_to_use = applicable_entries.sort_by { |e| e.length }.reverse.first
162
166
  return File.join(directory, entry_to_use)
163
167
  end
@@ -1,4 +1,5 @@
1
1
  require 'active_support/concern'
2
+ require 'action_controller/metal/renderers'
2
3
 
3
4
  module Fortitude
4
5
  module Rails
@@ -19,55 +20,60 @@ module Fortitude
19
20
  ::Fortitude::RenderingContext.new(options)
20
21
  end
21
22
 
22
- # This is our support for render :widget. Although, originally, it looked like creating a new subclass
23
- # of ActionView::Template was going to be the correct thing to do here, it turns out it isn't: the entire
24
- # template system is predicated around the idea that you have a template, which is compiled to output
25
- # Ruby source code, and then that gets evaluated to actually generate output.
26
- #
27
- # Because <tt>render :widget => ...</tt> takes an already-instantiated widget as input, this simply isn't
28
- # possible: you can't reverse-engineer an arbitrary Ruby object into source code, and, without source code,
29
- # the whole templating paradigm doesn't make sense.
30
- #
31
- # So, instead, we simply transform <tt>render :widget => ...</tt> into a <tt>render :text => ...</tt> of the
32
- # widget's output, and let Rails take it away from there.
23
+ def self._fortitude_render_widget(controller, widget, options)
24
+ if ::Fortitude::Erector.is_erector_widget_class?(widget) || ::Fortitude::Erector.is_erector_widget_class?(widget.class)
25
+ return ::Erector::Rails.render(widget, controller.view_context, { }, false, options)
26
+ end
27
+
28
+ if widget.kind_of?(Class)
29
+ if widget < ::Fortitude::Widget
30
+ widget = widget.new(widget.extract_needed_assigns_from(controller.view_context.assigns))
31
+ else
32
+ raise "You tried to render something using 'render :widget' that is a class, but not a subclass of Fortitude::Widget: #{widget.inspect}"
33
+ end
34
+ end
35
+
36
+ if (! widget.kind_of?(::Fortitude::Widget))
37
+ raise "You tried to render something using 'render :widget' that is neither an instance of a subclass of Fortitude::Widget, nor a class that inherits from Fortitude::Widget: #{widget.inspect}"
38
+ end
39
+
40
+ rendering_context = controller.create_fortitude_rendering_context(:helpers_object => controller.view_context)
41
+ widget.render_to(rendering_context)
42
+
43
+ passed_options = options.dup
44
+ passed_options.delete(:widget)
45
+ passed_options[:text] = rendering_context.output_buffer_holder.output_buffer.to_s
46
+ passed_options[:layout] = true unless passed_options.has_key?(:layout)
47
+
48
+ return controller.render_to_string(passed_options)
49
+ end
50
+
51
+ def self._fortitude_register_renderer!
52
+ ::ActionController.add_renderer_without_fortitude(:widget) do |widget, options|
53
+ ::Fortitude::Rails::RenderingMethods._fortitude_render_widget(self, widget, options)
54
+ end
55
+ end
56
+
33
57
  def render_with_fortitude(*args, &block)
34
- if (options = args[0]).kind_of?(Hash)
35
- if (widget = options[:widget])
36
- rendering_context = fortitude_rendering_context_for(self, nil)
37
- widget.render_to(rendering_context)
38
-
39
- options = options.dup
40
- options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
41
- options[:layout] = true unless options.has_key?(:layout)
42
-
43
- new_args = [ options ] + args[1..-1]
44
- return render_without_fortitude(*new_args, &block)
45
- elsif (widget_block = options[:inline]) && (options[:type] == :fortitude)
46
- options.delete(:inline)
47
-
48
- rendering_context = fortitude_rendering_context_for(self, nil)
49
- widget_class = Class.new(Fortitude::Widgets::Html5)
50
- widget_class.use_instance_variables_for_assigns(true)
51
- widget_class.extra_assigns(:use)
52
- widget_class.send(:define_method, :content, &widget_block)
53
-
54
- assigns = { }
55
- instance_variables.each do |ivar_name|
56
- value = instance_variable_get(ivar_name)
57
- assigns[$1.to_sym] = value if ivar_name =~ /^@(.*)$/
58
- end
59
- assigns = assigns.merge(options[:locals] || { })
60
-
61
- widget = widget_class.new(assigns)
62
- widget.render_to(rendering_context)
63
-
64
- options = options.dup
65
- options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
66
- options[:layout] = true unless options.has_key?(:layout)
67
-
68
- new_args = [ options ] + args[1..-1]
69
- return render_without_fortitude(*new_args, &block)
58
+ if (options = args[0]).kind_of?(Hash) && (widget_block = options[:inline]) && (options[:type] == :fortitude)
59
+ options.delete(:inline)
60
+
61
+ rendering_context = fortitude_rendering_context_for(self, nil)
62
+ widget_class = Class.new(Fortitude::Widgets::Html5)
63
+ widget_class.use_instance_variables_for_assigns(true)
64
+ widget_class.extra_assigns(:use)
65
+ widget_class.send(:define_method, :content, &widget_block)
66
+
67
+ assigns = { }
68
+ instance_variables.each do |ivar_name|
69
+ value = instance_variable_get(ivar_name)
70
+ assigns[$1.to_sym] = value if ivar_name =~ /^@([^_].*)$/
70
71
  end
72
+ assigns = assigns.merge(options[:locals] || { })
73
+
74
+ widget = widget_class.new(assigns)
75
+ new_args = [ options.merge(:widget => widget) ] + args[1..-1]
76
+ return render_without_fortitude(*new_args, &block)
71
77
  end
72
78
 
73
79
  return render_without_fortitude(*args, &block)
@@ -75,3 +81,16 @@ module Fortitude
75
81
  end
76
82
  end
77
83
  end
84
+
85
+ ::ActionController.module_eval do
86
+ class << self
87
+ def add_renderer_with_fortitude(key, *args, &block)
88
+ add_renderer_without_fortitude(key, *args, &block)
89
+ ::Fortitude::Rails::RenderingMethods._fortitude_register_renderer!
90
+ end
91
+
92
+ alias_method_chain :add_renderer, :fortitude
93
+ end
94
+ end
95
+
96
+ ::Fortitude::Rails::RenderingMethods._fortitude_register_renderer!
@@ -4,7 +4,6 @@ module Fortitude
4
4
  module Rails
5
5
  class TemplateHandler
6
6
  def call(template, &block)
7
- require_dependency template.identifier
8
7
  widget_class_name = "views/#{template.identifier =~ %r(views/([^.]*)(\..*)?\.rb) && $1}".camelize
9
8
  is_partial = !! (File.basename(template.identifier) =~ /^_/)
10
9
 
@@ -179,8 +179,8 @@ module Fortitude
179
179
 
180
180
  NEWLINE = "\n"
181
181
 
182
- def yield_from_widget(*args)
183
- raise "No layout to yield to!" unless @yield_block
182
+ def yield_from_widget(widget, *args)
183
+ raise Fortitude::Errors::NoBlockToYieldTo.new(widget) unless @yield_block
184
184
  result = @yield_block.call(*args)
185
185
  @output_buffer_holder.output_buffer << result if @render_yield_result
186
186
  result
@@ -1,5 +1,5 @@
1
1
  require 'fortitude/tags/tag_support'
2
- require 'fortitude/method_templates/simple_template'
2
+ require 'fortitude/method_templates/simple_compiled_template'
3
3
 
4
4
  # Note on handling tags that have no content inside them:
5
5
  #
@@ -118,7 +118,7 @@ module Fortitude
118
118
  def define_method_on!(mod, options = {})
119
119
  options.assert_valid_keys(
120
120
  :record_emitting_tag, :enforce_attribute_rules, :enable_formatting,
121
- :enforce_id_uniqueness, :close_void_tags)
121
+ :enforce_id_uniqueness, :close_void_tags, :allows_bare_attributes)
122
122
 
123
123
  unless mod.respond_to?(:fortitude_tag_support_included?) && mod.fortitude_tag_support_included?
124
124
  mod.send(:include, ::Fortitude::Tags::TagSupport)
@@ -148,11 +148,12 @@ module Fortitude
148
148
  yield_call = "yield"
149
149
  end
150
150
 
151
- text = Fortitude::MethodTemplates::SimpleTemplate.template('tag_method_template').result(
151
+ text = Fortitude::MethodTemplates::SimpleCompiledTemplate.template('tag_method_template').result(
152
152
  :name => name.to_s, :method_name => generated_method_name.to_s, :yield_call => yield_call, :concat_method => CONCAT_METHOD,
153
153
  :record_emitting_tag => (!! options[:record_emitting_tag]),
154
154
  :needs_attribute_rules => !! options[:enforce_attribute_rules],
155
155
  :needs_id_uniqueness => !! options[:enforce_id_uniqueness],
156
+ :allows_bare_attributes => (!! options[:allows_bare_attributes]),
156
157
  :needs_formatting => needs_formatting, :content_allowed => @content_allowed,
157
158
  :newline_before => @newline_before,
158
159
  :escape_direct_content => @escape_direct_content,
@@ -1,3 +1,3 @@
1
1
  module Fortitude
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.9"
3
3
  end