Skip to content

inheritance doesn't work #244

@kflu

Description

@kflu

The inheritance doesn't work as specified here.

Having three template files:

{{! header.mustache }}
<head>
  <title>{{$title}}Default title{{/title}}</title>
</head>
{{! base.mustache }}
<html>
  {{$header}}{{/header}}
  {{$content}}{{/content}}
</html>
{{! mypage.mustache }}
{{<base}}
  {{$header}}
    {{<header}}
      {{$title}}My page title{{/title}}
    {{/header}}
  {{/header}}

  {{$content}}
    <h1>Hello world</h1>
  {{/content}}
{{/base}}

Run hulk from the command line (something like this, you get the idea):

npm install hogan.js
cat "var Hogan = require('hogan.js');" > script.js
hulk *.mustache >> script.js
cat "templates['mypage'].render()" >> script.js

Run with node: node script.js. The rendered result is empty string.

I noticed that the in hulk compiled JS script, templates['mypage'] correctly references a partial called 'base':

> templates['base']
{ r: [Function],
  c: undefined,
  options: {},
  text: '',
  partials: {},
  subs: { header: [Function], content: [Function] },
  buf: '' }
>
> templates['header']
{ r: [Function],
  c: undefined,
  options: {},
  text: '',
  partials: {},
  subs: { title: [Function] },
  buf: '' }
>
> templates['mypage']
{ r: [Function],
  c: undefined,
  options: {},
  text: '',
  partials: { '<base11': { name: 'base1', partials: [Object], subs: [Object] } },
  subs: {},
  buf: '' }

But it seems there is still something missing to connect the dots.

node version: v5.6.0
hogan.js version: 3.0.2
hulk version: 3.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions