rails_html_output 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +13 -0
  2. data/init.rb +1 -0
  3. data/lib/rails_html_output.rb +16 -0
  4. metadata +68 -0
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ HTML Output
2
+ ===========
3
+
4
+ This miniscule Rails plugin stops Rails outputting self-closing (XHTML-style) markup
5
+ which is useful if you want to use the Rails tag helpers and produce valid HTML.
6
+
7
+ Works with Rails 2.3 and 3.0.
8
+
9
+ Install
10
+ -------
11
+
12
+ * Rails 3: Add `gem "rails_html_output"` to your `Gemfile`.
13
+ * Rails 2.3: Add `config.gem "rails_html_output"` to your `config/environment.rb`.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'rails_html_output'
@@ -0,0 +1,16 @@
1
+ require 'action_view'
2
+
3
+ module ActionView::Helpers::TagHelper
4
+ # Forces the "open" param to always be true so it never self-closes
5
+ def tag_with_non_self_closing(name, options = nil, open = false, *args)
6
+ tag_without_non_self_closing name, options, true
7
+ end
8
+
9
+ alias_method_chain :tag, :non_self_closing
10
+ end
11
+
12
+ class ActionView::Helpers::InstanceTag
13
+ # We have to re-alias tag_without_error_wrapping because it is previously
14
+ # aliased to the old version of tag, which self-closes
15
+ alias_method :tag_without_error_wrapping, :tag_with_non_self_closing
16
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_html_output
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ version: "1.0"
10
+ platform: ruby
11
+ authors:
12
+ - Jon Leighton <j@jonathanleighton.com>
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-22 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - init.rb
31
+ - lib/rails_html_output.rb
32
+ - README.md
33
+ has_rdoc: true
34
+ homepage: http://jonathanleighton.com/
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Prevents Rails from emitting self-closing XHTML-style tags
67
+ test_files: []
68
+