Forum: Ruby on Rails Rails and HTML 4.01 (not XHTML)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
hdante (Guest)
on 2007-06-10 03:29
(Received via mailing list)

 I've tried to change my layouts to HTML 4.01 DOCTYPE, but then the
page didn't pass w3 validation. Validation fails in the line that
corresponds to the following:

   <%= stylesheet_link_tag "depot", :media => "all" %>

 This is rendered as

   <link href="/stylesheets/depot.css?1181336605" media="all"
rel="Stylesheet" type="text/css" />

 Change the final "/>" to ">" and the page is validated.

 Are you sure HTML 4.01 is allowed ? How can I make
stylesheet_link_tag and other constructs to correctly produce HTML
4.01 output ? It would be really nice if I fully converted my pages to
HTML 4.01.

 Any help ? Thanks,
unknown (Guest)
on 2008-04-17 08:08
(Received via mailing list)
calling back an old one - perhaps better than starting a new thread for
unfinished topic though.
so how does one successfully use a HTML 4.01 strict DOCTYPE with rails
helpers and hope to validate? i added the following to my
file which seems to do the trick for stylesheets but this is trying a

  def other_stylesheet_link_tag(*sources)
    out = stylesheet_link_tag sources
    out.sub(/\ \/\>$/, '>')

stylesheet_link_tag calls stylesheet_tag which calls tag

tag has an open argument to leave tags open, but unfortunately there
any way to access it from stylesheet_link_tag. any other suggestions?

Fernando P. (Guest)
on 2008-09-22 17:39
Too funny that I just figured out the same thing. Why is Rails
generating this additional character?
This topic is locked and can not be replied to.