On Thu, 25 Mar 2004 13:00:05 +0900, Sven Schott wrote:

> I know this might be simple but I haven't found a decent(simple Ruby 
> way) of doing this.
> 
> The CGI module outputs all the html tags in upper case. For my own 
> conceited reasons( and I heard this was the preferred method), I would 
> like the tags to be in lower case. The pretty method lines up 
> everything nicely but does nothing else. I have tried appending 
> downcase to the string passed to pretty:
> 

You will have to do downcase ala this (untested).. perhaps more downcasing
is necessary ?


require 'cgi'
class CGI 
module TagMaker 
    def nn_element_def(element)
      <<-END.gsub(/element\.downcase/n, element.downcase).gsub(/element\.upcase/n, element.upcase)
          "<element.downcase" + attributes.collect{|name, value|
            next unless value
            " " + CGI::escapeHTML(name.downcase) +
            if true == value
              ""
            else
              '="' + CGI::escapeHTML(value) + '"'
            end
          }.to_s + ">" +
          if block_given?
            yield.to_s
          else
            ""
          end +
          "</element.downcase>"
      END
    end  
end # module TagMaker 
end # class CGI 


--
Simon Strandgaard