Skip to content

Selector Prototypes

padolsey edited this page Apr 3, 2013 · 6 revisions

SIML (0.3.2 onwards) supports selector prototypes, which allow you to define a custom selector with default attributes. You can reference this later in your current SIML scope. For example:

(SIML Editor »)

// Setup protototypes:
link = a.link[href=""][title=""]

// Actual template:
link 'A link with defaults'
link[title="override"] 'With overridden title'
link[href="/override"] 'With overidden href'

That generates:

<a class="link" href="" title="">
  A link with defaults
</a>
<a class="link" href="" title="override">
  With overridden title
</a>
<a class="link" href="/override" title="">
  With overridden href
</a>
Clone this wiki locally