Forum: Ruby on Rails Builder::XmlMarkup and dashes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
08fbedeb4ba773a4861c2537ee5c95d6?d=identicon&s=25 stevemolitor@gmail.com (Guest)
on 2007-06-11 05:33
(Received via mailing list)
Has anyone hacked Builder::XmlMarkup to dasherize underscore tags by
default? I know I can use tag!, but I'd like to find a way for it to
translate underscores to dashes automatically.  In other words:

xml.department_manager do
  "fred
end

#=> <department-manager>fred</department-manager>

I tried hacking Builder::XmlBase.method_missing but got myself all
twisted up!

Thanks.

Steve
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-06-11 08:09
(Received via mailing list)
On 6/10/07, stevemolitor@gmail.com <stevemolitor@gmail.com> wrote:
>
> Has anyone hacked Builder::XmlMarkup to dasherize underscore tags by
> default? I know I can use tag!, but I'd like to find a way for it to
> translate underscores to dashes automatically.  In other words:
>
> xml.department_manager do
>   "fred
> end

xml.tag! 'department-manger', 'fred'

--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
08fbedeb4ba773a4861c2537ee5c95d6?d=identicon&s=25 stevemolitor@gmail.com (Guest)
on 2007-06-12 17:44
(Received via mailing list)
Right, I know about 'tag!' but I was hoping to rig things such that
XmlMarkup always called 'dasherize' on element names.

Steve
This topic is locked and can not be replied to.