briandk / transdown

A lightweight syntax for writing and presenting transcripts of qualitative research data.
3 stars 1 forks source link

Design handlebars template #5

Closed briandk closed 9 years ago

briandk commented 9 years ago

The aim of this pull request is to define a handlebars.js template for transcript output.

Part of my idea is that with a single template, we can put that template in multiple places on the site. Then, the workflow for redeploying style changes to the template is:

  1. Tweak the template .handlebars file
  2. (p)Recompile the template at the command line
  3. Commit changes
briandk commented 9 years ago

The next steps are:

Verify the parser can inject HTML properly

This one should be easy. Using the test object, grab the live-preview area and inject the template output into it.

var livePreview = $('#live-preview')
var testTranscript = Handlebars.templates.transcriptTemplate(getTestTranscript());
livePreview.html(testTranscript);

Start work on getting a parser that can output to the transdown object spec

This will be less easy, so it'll take some thinking. I'm wondering if having default object constructors might be helpful. Perhaps we could turn the current transdown-specification.js into a file with a namespace. That namespaces properties would be the hierarchy of the transdown object, except they'd be functions that return empty/default instances of the object specs.

Or, I guess, we could just hand the object specs to the constructor method. See Crockford (p.144 and thereabouts) on handling a situation where we pass in a spec object to specify common properties. Specifically, note how he uses the OR || so that if a property isn't defined in the spec, he can define it there. That can be a good pattern for episode titles, perhaps.

var cat = function (spec) {
    spec.saying = spec.saying || 'meow';
    var that = mammal(spec);”