Respect / Template

Experimental, HTML-only templating engine
Other
38 stars 6 forks source link

Decorator API #4

Closed augustohp closed 12 years ago

augustohp commented 12 years ago

The first decorator API sucked, this second tend to suck less but still there is something bothering me into the Traversable decorator, but lets go to considerations: @alganet what you think of this idea at all?

PS: I know this is slow, but it keeps things simple. This was the most simple way to implement them I came up with ...

Some things this API should be able to do, and are not coded yet:

alganet commented 12 years ago

We have essentially 3 kinds of data to put into templates (coudn't think of any other):

We can't predict how the data will behave before checking out the destination element. For example, a custom Date object could have three properties (for day, month and year) that will lead to three SELECT elements on the template if fed to a specific fieldset. But the same object, implementing __toString could be fed to an SPAN tag and lead to the string representation of that tag.

Summing up: I don't know!

augustohp commented 12 years ago