Austin.
I think you missed my point.
I used the example of a table only because it was an easy example, not because its not solvable in other ways.
In general, you're right; all three of those technologies CAN do exactly what I'm trying to do. Its very trivial for you or I to write that markup and I would be inclined to do it if I was going to be the person responsible for maintaining the site. The thing is I really hate maintaining clients sites for them. Its a lot of overhead for a change that they can do themselves. I tend to build a site once then provide a style guide and show them how to update their content. There is no way I'm going to be able to document for my client the mechanic how to create a table on some arbitrary page using the code you have below. I can just tell him what markup to use but the amount of markup he has to remember far exceeds the data he want to add. A taglib is an EXCELLENT way of hiding that complexity. It also allows me to change the behaviour of that tag after the fact, as requirements change, without editing content.
Or lets say that the site I'm making is about the history of salmon fishing in British Columbia. For various reasons, I want to markup photographs as follows:
<div class="photo">
<div class="title">Fishermen at the Steveston docks, circa 1843</
<img href="..." />
<div class="caption"><p>Yadda yadda yadda.</p><p>Blah blah blah</
</div>
<div class="cite"><spand class="photographer">James Tyson</
<span class="publication">Steveston Chronicle</span><span
class="year">1983</span></div>
</div>
Now, I could ask my content authors to simply write that out every time. The problem is that I perhaps I want to do something a little different in certain circumstances, add a different class if its the first one on the page, for instance. Now I have to write out a lot of rules for authors to remember. Its a lot simpler, IMHO, if I just told them to write the following:
<x:photo imghref="someurl">
<x:title>Fishermen at the <a href="/steveston.rsp">Steveston docs</a>, circa 1843</x:title>
<x:caption><p>Yadda yadda yadda.</p><p>Blah blah blah</p></x:caption>
<x:cite photographer="James Tyson" publication="Steveston Chronicle" year="1983" />
</x:photo>
I can then write my markup from that.
Now lets say that it was decided to change the format so that the citations were all done in foot notes. pretty much all I'd have to do is change the behavior of my <x:photo> and <x:cite> tags and the change would be made.
In my opinion tag libraries are most useful when they are used to reduce complexity for content authors.
Adam
···
On 26-Sep-05, at 1:59 PM, Austin Ziegler wrote:
On 9/26/05, Adam Van Den Hoven <mail@adamvandenhoven.com> wrote:
I've been dabbling with ruby on and off for a year or so and recently
more often. At work we do Java development and I keep thinking that it
would be nice to be able to bring some of the stuff I designed there
into my own work, which I want to do in ruby.
I was wondering if anyone had thought about adding something like the
Java TagLibs to ruby (I guess it would embedded ruby). In my case, it
would make long term maintenance of files MUCH easier as I can give it
to a non-technical person without much documentation. In most cases
people who don't understand programming do understand parts of HTML
markup. If I could hide what is currently inline code behind things
that look like tags, its easier to give maintenance over to
non-technical folks.
Frankly, I think that TagLibs are overblown nonsense
You can
implement much of this with Amrita, I think, which completely separates
code from data. Even with erb/eruby, though, you could do something
like:
<table>
<% max = data.size
data.each_with_index do |el, ix| %>
<tr class="<%= (((ix % 2) == 0) ? "even" : "odd") +
((ix == max) ? " last" : "") %>">
<td><%= el %></td>
</tr>
<% end %>
</table>
There's other ways to do this, but as I don't really do a lot of stuff
that needs this, this is simple enough.
-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca