aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/generator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/guides/rails_guides/generator.rb')
-rw-r--r--railties/guides/rails_guides/generator.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 670d2bc4db..e30dd2d5f7 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -88,6 +88,10 @@ module RailsGuides
warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
end
+ # FIXME: If the doctype is in the layout textile escapes it.
+ # Things should be set up in a way that prevents that, a doctype
+ # belongs to the layout.
+ result = insert_doctype(result)
result = insert_edge_badge(result) if ENV.key?('INSERT_EDGE_BADGE')
f.write result
end
@@ -199,6 +203,13 @@ module RailsGuides
end
end
end
+
+ def insert_doctype(html)
+ <<EOS + html
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+EOS
+ end
def insert_edge_badge(html)
html.sub(/<body[^>]*>/, '\&<img src="images/edge_badge.png" style="position:fixed; right:0px; top:0px; border:none; z-index:100"/>')