16
Feb
2005

Helma Macros 2.0

This is a proposal by Hannes, as a result of many discussions in the last year(s):


We use plain HTML/XML syntax and don't introduce
any Helma-specific tags, just three attributes:

* h:macro is used to mark a tag as macro. Any tag containing a h:macro
attribute will be replaced by the output of that macro, with the
contents of the tag passed to the macro function as second argument.

* h:name is used as identifier of subskins within a skin. Any names
can be used, but "prefix", "suffix" and "default" are handled in the
way Helma currently does.

* h:msg is used for automatic translation as proposed 
by Robert and Matthias. Everything within those tags 
would be replaced by a localized message 
(details to be determined).

Put into practice, a simple macro that loops through 
stories in a site object could look like this:

<div h:macro="site.loop">
   <h3 h:name="prefix" h:msg="storylistHeader">Story Listing</h3>
   <ul>
     <li h:name="listitem" h:macro="story.title">Story Title</li>
   </ul>
   <p h:name="default" h:msg="storylistEmpty">No stories</p>
</ul>

All the macro had to do here is get the "listitem" 
subskin and call it on each story it wants to render. 
prefix and default are handled by Helma. The only 
unsolved piece here is how to render the <ul></ul>,
but I think Helma could do automatic parent element
rendering by using a "skin stack" to know when it
enters/leaves a skin fragment.

So far this looks pretty good to me, but I haven't had
coffee yet today. What do you think?


I AM EXCITED !!! - that's what i think :)

originally i prefered a syntax that goes like this:

<hop:macro name="Page.someMacro">
pass this part as the second parameter (e.g. as a skin)
</hop:macro>
but the more i think about this, sticking to (x)html, and just extend it by a view attributes is the much better way.

<input h:macro="html" name="foo" type="text" />
could result in:

function html_macro(param, tag, content) {
  case (tag) {
    switch "input":
      if (param.type == "text") {
        Html.input(param, ...)...
      }
  }
}
blog comments powered by Disqus
logo

Mat's Blog

California Dreaming

Users Status

You are not logged in.

Search

 

Get Firefox

Get Firefox!

Currently Reading


William Gibson, Jarreth Merz, Matthias Scherwenikas
Neuromancer, 3 Audio-CDs

Archive

February 2005
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 
 
 1 
 2 
 4 
 6 
 7 
 8 
 9 
10
11
12
13
14
15
17
19
20
21
22
23
24
25
26
 
 
 
 
 
 

Recent Updates

und wie sieht es mit...
und wie sieht es mit deiner privaten Hochzeit aus? ;-) wünsche...
flog - 23. Oct, 20:49
Danke!
Danke Matthias für deinen Beitrag zu diesem Schritt....
Sierra - 22. Oct, 12:44
Ja, das Offline Problem...
Ja, das Offline Problem ist auch mein Hauptproblem....
matthias - 23. Sep, 14:36
ich verwende am Mac ausschließlich...
ich verwende am Mac ausschließlich die Browser...
smeidu - 23. Sep, 14:22
Stimmt -
Den Eindruck kann ich nur bestätigen; in der Bedienung...
N_Haase - 29. Jul, 13:24
Dach
und da oben am Dach, da sollte doch seit Jahren eine...
Sierra - 12. Jun, 10:47
but yammer accepts
no Austrian mobile numbers :(
cqeb - 15. Dec, 23:45
das verpasse ich leider......
das verpasse ich leider... http://twitter.com/flog/st atus/998712029
flog - 10. Nov, 21:38

Status

Online for 2675 days
Last update: 3. Mar, 15:52

Credits

vi knallgrau GmbH

powered by Antville powered by Helma


Creative Commons License

xml version of this page

twoday.net AGB