Say I have the following tag def:
<def tag="comp" attrs="title">
comp(<%= title %>) {
<header param="hd"/>
<body param="bd"/>
<footer param="ft"/>
}
</def>
And I call it like this:
<comp title="A">
<ft:>
<my-footer/>
</ft>
</comp>
should render: "comp(A) { footer : Myfooter}"
-------------------------------------------
<comp title="B">
<hd:>
<my-header/>
</hd>
<ft:>
<my-footer/>
</ft>
</comp>
should render: "comp(A) { header : MyHeader, footer : Myfooter}"
-------------------------------------------
<comp title="C">
<hd:>
<my-header/>
</hd>
<bd:>
<my-body/>
</bd>
<ft:>
<my-footer/>
</ft>
</comp>
should render: "comp(C) { header : MyHeader, body : MyBody, footer :
Myfooter}"
----
Doesn't seem like DRYML has any standad features to handle this kind
of scenario, very common to outputs outside the HTML domain...
-----------
Inside a tag, the parameters variable contains a hash of Proc, one for
each parameter (tag)
parameters = [:a => Proc(a), :b => Proc(b), ...]
<panel>
<a>hello</a>
<b>blip</b>
</panel>
I imagine a solution like...
<def tag="comp" ...>
comp(<%= title %>) {
<%= join_params(parameters, [:hd, :bd, :ft], ", ") %>
}
</def>
------------------------
Define utility function:
vendor/plugins/myextensions/lib/customhelper.rb
module Hobo
module HoboHelper
# custom DRYML helper functions
def join_params(params, list, join_str)
results = []
list.each do |sym|
param = params[sym]
# how do I pass on the parameters and attributes for a given
param Proc?
results << param.call(param[:parameters], param[:attributes])
end
results.join(join_str)
end
end
end
---
But do the Procs here get called with the right content (their params
and attributes)!?
Can I do something like this? or how do I REALLY achieve this?
# how do I pass on the parameters and attributes for a given param
Proc?
results << param.call(param[:parameters], param[:attributes])
Kristian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---