<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>jvoorhis comments on Making it better</title>
    <link>http://www.jvoorhis.com/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>jvoorhis comments</description>
    <item>
      <title>"Making it better": comment by Johan</title>
      <description>&lt;p&gt;Not sure here &amp;#8211; but shouldn&amp;#8217;t one of lang or xml:lang be picked? (depending on how it&amp;#8217;s served; application/xml or text/html)&lt;/p&gt;</description>
      <pubDate>Mon, 12 Dec 2005 01:07:30 NZDT</pubDate>
      <guid>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-92</guid>
      <link>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-92</link>
    </item>
    <item>
      <title>"Making it better": comment by Jeremy Voorhis</title>
      <description>&lt;p&gt;I don&amp;#8217;t like the validator buttons much myself, and wouldn&amp;#8217;t want to impose that upon anyone. It also seems beyond the scope of what the plugin would encompass &amp;#8211; utilities for correctly using and getting more out of html and http, but not necessarily bragging about it :)&lt;/p&gt;</description>
      <pubDate>Sat,  3 Dec 2005 14:00:08 NZDT</pubDate>
      <guid>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-89</guid>
      <link>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-89</link>
    </item>
    <item>
      <title>"Making it better": comment by Chris Anderson</title>
      <description>&lt;p&gt;This looks like a convenient plugin if there ever was one. Maybe an (optional) built-in link to the validator in the footer would discourage miss-use of the doc type declarations.&lt;/p&gt;</description>
      <pubDate>Sat,  3 Dec 2005 01:27:51 NZDT</pubDate>
      <guid>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-88</guid>
      <link>http://www.jvoorhis.com/articles/2005/12/02/making-it-better#comment-88</link>
    </item>
    <item>
      <title>"Making it better" by jvoorhis</title>
      <description>&lt;p&gt;It&amp;#8217;s even easier like this:&lt;/p&gt;


in app/views/layouts/application.rhtml:
&lt;pre&gt;&lt;code&gt;&amp;lt;%= xhtml_doctype :strict %&amp;gt;
&amp;lt;%= html_tag :lang =&amp;gt; Globalize::Locale.active.language.iso_639_1 %&amp;gt;
&amp;lt;%= @content_for_layout %&amp;gt;
&amp;lt;%= end_html_tag %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

and in app/helpers/application_helper.rb:
&lt;div style="overflow: auto;"&gt;
&lt;pre&gt;&lt;code&gt;module ApplicationHelper
  # Renders an xhtml doctype declaration for the document's prolog. Defaults to xhtml transitional.
  # &amp;lt;tt&amp;gt;xhtml_doctype :strict&amp;lt;/tt&amp;gt;
  def xhtml_doctype( doctype=:transitional )
    doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype
    case doctype
    when :transitional
      '&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;'
    when :strict
      '&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;'
    when :frameset
      '&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&amp;gt;'
    end
  end

  # Displays an html tag, complete with xhtml namespace and language. Accepts language as an option, but defaults to English.
  # &amp;lt;tt&amp;gt;html_tag :lang =&amp;gt; 'de'&amp;lt;/tt&amp;gt;
  def html_tag( options={} )
    options[:lang] ||= 'en'
    lang = options.delete( :lang )
    "&amp;lt;html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"#{lang}\" xml:lang=\"#{lang}\" #{options.map { |k,v| "#{k}=\"#{v}\"" }.join( ' ' )}&amp;gt;" 
  end

  # End html tag.
  def end_html_tag; "&amp;lt;/html&amp;gt;" end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

	&lt;p&gt;I plan to release this and some other small http/html-related gems as a plugin soon, so keep an eye out.&lt;/p&gt;

</description>
      <pubDate>Fri,  2 Dec 2005 14:12:00 NZDT</pubDate>
      <guid>&lt;a href="/articles/2005/12/02/making-it-better"&gt;Making it better&lt;/a&gt;</guid>
      <link>&lt;a href="/articles/2005/12/02/making-it-better"&gt;Making it better&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
