I'm looking for means of creating a reusable form template, for lack of a better term. Is it possible to write format bodycopy in such a manner that it would be reusable, or is there an alternative approach to be taken to accomplish this?
Formatting individual forms w/bodycoypy is straightforward enough, I could always write:
<dt class="awesome-form-label">%question_label_123_q1%</dt> <dd class="awesome-form-input">%question_field_123_q1%</dd>
then step back and enjoy the semantic awesomeness* (this isn't the holy grail of a markup, but rather a silly doodle just for argument's sake). However, when I get to styling the next question, I have to resort to copy-pasting it - and there will be a lot of copypasta when I'm done with one form. Now if I were to apply this particular markup across an entire site, not only would I be cursing explicit ID references when I do so, but I will be also cursed by my successor when it's time to upgrade to, I dunno, html6.
With a more conventional templating language I'd expect to be able to use implicit references:
-
{{#each question}}
- {{question_label}}
- {{question_field}} {{/each}}
I could then keep reusing this anywhere on the site over and over. I love how [default] forms are parametric and can be managed without writing html [by someone other than me so I can do other things], and I want to maintain this workflow with custom markup. How can that be done?