On Fri, 16 Dec 2005, Eero Saynatkari wrote:

>> coming soon to a store near you ;-)
>
> Very nice! (Well, sans underscores:)

glad you like the look of it.  i struggled with the underscore thing and
here's how i got there:


   - wanted access to instance data.  ergo mixin.  ergo can't be clobbering the
     objects methods with a billion others.

   - didn't want a 'blanket' method missing.  i wanted to a way to say that
     only 'tag' methods would be handled in method_missing - not everything.
     otherwise

       syntax_error 42

     makes

       <syntax_error>42</syntax_error>

     fine for small docs.  not for big ones.  mine works like

       def method_missing m, *a, &b
         if m.to_s =~ %r/_$/
           ...
         else
           ...
         end
       end

     so only some methods (those with __) get routed to method_missing

   - needed to address methods/tag like 'p', 'a', 'i' - which can easily be
     methods and/or local vars

   - wanted a way to skim the code and be able to tell which methods were
     generating tags and which were not

   - wanted a way to bounce on the % key in vi and balance tags... well that
     one doesn't have to do with underscores i guess...


anyhow.  i hope people will row to see that being able to __safely__ mixin
these kinds of html generation methods, still being able to find syntax
errors, and being able to quickly tell markup methods from others makes it
o.k.  my boss and i struggled with it - but it was the best approach in the
end when considering the above.

> Will you make libxml2[1] an alternative backend?

i'd be happy to look at it... send me a link if it's not on raa or
rubyforge...

> It is quite a bit faster, which may or may not be important to people.

it is.  this will be used on dynamic websites.

> [1] http://xml-tools.rubyforge.org

oh.  didn't see that at first ;-)

cheers.

-a
-- 
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================