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.
(Guest)
on 2007-06-11 07: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
Rick O. (Guest)
on 2007-06-11 10:09
(Received via mailing list)
On 6/10/07, removed_email_address@domain.invalid 
<removed_email_address@domain.invalid> 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 O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
(Guest)
on 2007-06-12 19: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.