Why do some tags require a : to override in an extend definition while others do not?

14 views
Skip to first unread message

Raklet

unread,
Aug 5, 2011, 11:26:38 PM8/5/11
to hobo...@googlegroups.com
I am new to hobo and am still trying to wrap my head around DRYML.  I wanted to extend a show-page tag and modify the field-list.  I did the following:

<extend tag="show-page" for="Acreage">
  <old-show-page merge>
    <field-list fields="code, note, legal_description, acres, latitude, longitude, address, city, state, zip_code" param/>
  </old-show-page>
</extend>

This code did not override the field-list.  The auto-generated fields in pages.dryml were displayed instead.  Note that there is no ":" after field-list.

When I change the code to include a ":" after field-list, then it displays the new field list defined in the extension.

<extend tag="show-page" for="Acreage">
  <old-show-page merge>
    <field-list: fields="code, note, legal_description, acres, latitude, longitude, address, city, state, zip_code" param/>
  </old-show-page>
</extend>


This led me to wonder if that behavior is the same for all "extend" definitions, so I tried it out on a form tag

<extend tag="form" for="Acreage">
  <old-form merge>
    <field-list fields="code, name, note, legal_description, acres, latitude, longitude, address, city, state, zip_code" param/>
  </old-form>
</extend>

I left out the ":" after field-list, but the extended definition still displayed as intended.   Hmmm, will adding a ":" break it?

<extend tag="form" for="Acreage">
  <old-form merge>
    <field-list: fields="code, name, note, legal_description, acres, latitude, longitude, address, city, state, zip_code" param/>
  </old-form>
</extend>

Nope, the extended tag still displays as it should.

I find it interesting that a "form" tag extension works properly with or without the ":", but the "show-page" tag extension will not work (at least the field-list tag) unless the ":" is present.

Can anyone shed some light on this behavior?  Is it intended or otherwise?

Thanks,

Tyler

kevinpfromnm

unread,
Aug 8, 2011, 1:57:45 PM8/8/11
to hobo...@googlegroups.com
The : tells dryml to replace a particular parameter in the tag.  Depending on the tag, there may or may not be a default parameter, which is what gets content if no parameter is specified.

So:

<form>
  <field-list ... />
</form>

Is equivalent to (roughly):

<form>
  <default:>
    <field-list ... />
  </default:>
</form>

If default, or any other parameter you ask it to replace, is not defined, dryml silenty drops the content.  That's what you're seeing with the show-page.

One other potential point of confusion is that the : is also used as a field attribute shortcut.

<view:title /> is the same as <view field="title" />

Reply all
Reply to author
Forward
0 new messages