Forum: Ruby on Rails markaby or erb?

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.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 John Wells (Guest)
on 2006-04-25 03:00
(Received via mailing list)
Guys,

We're embarking on a new dev project, and I'm curious....why would one
choose markaby over erb? I for one am no fan of the erb syntax, but
aside from that it's similar to other technologies I've used in the
past: PHP, JSP, ASP, etc.

Why would one choose markaby over erb? What are the benefits? What are
the drawbacks? Is there anything remarkable one can do that the other
can't?

Look for general experience and insight.

Thank you!
JB
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-04-25 04:35
(Received via mailing list)
On 25 Apr 2006 00:58:50 -0000, John Wells
<devlists-rubyonrails@devlists.com> wrote:
> Look for general experience and insight.
>

One nice thing about Markaby is that it won't let you (well, not
easily) write invalid XHTML.  The Ruby parser will complain first.
Also, if much of your ERb template was Ruby code anyway, it might be
easier to write and read in Markaby.

Personally, I don't really feel that the API has stabilized yet, and I
haven't used it for any 'real' projects.  I really like the idea,
though, and I think it will be awesome before it gets to 1.0.  I know
others have already made extensive use of it, though, so hopefully
someone else will chime in.

--Wilson.
0b6c03456c7606f5b95629228eb7a85a?d=identicon&s=25 jeem (Guest)
on 2006-04-25 04:47
(Received via mailing list)
John Wells <devlists-rubyonrails@...> writes:

>
> Look for general experience and insight.
>
> Thank you!
> JB

I'm considering using both.  Erb is more natural for a page which is
mostly
just html, but starts to look real nasty when the page has lots of ruby.
If you take the mostly-ruby page and use markaby, it'll come
out real nice and elegant.

jeem
Dc2203c05ad9f8f5d5da509c637b058e?d=identicon&s=25 guyboanas (Guest)
on 2006-04-25 18:06
jeem wrote:
> John Wells <devlists-rubyonrails@...> writes:
>
>>
>> Look for general experience and insight.
>>
>> Thank you!
>> JB
>
> I'm considering using both.  Erb is more natural for a page which is
> mostly
> just html, but starts to look real nasty when the page has lots of ruby.
> If you take the mostly-ruby page and use markaby, it'll come
> out real nice and elegant.
>
> jeem

I have a query. Previously I've used Markaby as a plugin but now want to
install the gem version. With the gem, how do I ensure in Rails that
Markaby is called by the various layouts in .mab format?

guy
5498d1507784752a878d7cf33be13f6a?d=identicon&s=25 Scott Mathieson (uberkorp)
on 2006-04-25 18:23
(Received via mailing list)
you need to set up the handling in environment.rb

# Enable Markaby Templates
require 'markaby'
ActionView::Base::register_template_handler 'mab', Markaby::View

will do the trick

be warned, i've had some issues with the latest version (0.4) that i
havent
been able to resolve/get resolved - i've currently reverted to the 0.3
tag as
a plugin which works as expected; iirc the gem is now 0.4 (it gets
installed
with camping) - it broke flash for me (multiple outputting of messages
along
with the key name, i.e 'noticeSomeMessageSomeMessage' instead of
'SomeMessage')
6edd67c92a1dab5eb23fed79f3c18564?d=identicon&s=25 David Heinemeier Hansson (Guest)
on 2006-04-25 18:45
(Received via mailing list)
> I'm considering using both.  Erb is more natural for a page which is mostly
> just html, but starts to look real nasty when the page has lots of ruby.
> If you take the mostly-ruby page and use markaby, it'll come
> out real nice and elegant.

ERb is giving you feedback about the quality of your templates. If it
starts to "look real nasty", your templates have too much logic, and
you should refactor. Either by pulling true template logic into
helpers or by pulling controller/model logic out of there. Usually a
combination of the two.

Using something like Markaby to cover up the information that ERb is
giving you about the state of your templates doesn't seem like the way
to go to me. Choose Markaby because you feel its a better way of
structuring HTML, not because it makes it easier to gloss over the
fact that your templates are overburdened with concerns.
--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com   -- Online project management
http://www.backpackit.com   -- Personal information manager
http://www.rubyonrails.com  -- Web-application framework
This topic is locked and can not be replied to.