Skip to content

Only the first line of a partial is indented #401

@vivin

Description

@vivin

I am not sure if I'm doing something wrong or if I have things configured wrong. I'm only seeing the first line of a partial indented, and not subsequent lines. I am a mustache/handlebars noob so it might be possible that I am doing something wrong!

I have the following in my src/main/resources:

./src/main/resources/
└── handlebar
    └── templates
        ├── child.hbs
        └── parent.hbs

The contents of the files are as follows:

parent.hbs

parent line 1
    {{> child}}
parent line 2

child.hbs

child line 1
child line 2

When the template is applied, I see:

parent line 1
    child line 1
child line 2
parent line 2

The code in Java that loads and applies the templates is as follows:

TemplateLoader loader = new ClassPathTemplateLoader();
loader.setPrefix("/handlebar/templates");
loader.setSuffix(".hbs");

Handlebars handlebars = new Handlebars(loader);
System.out.println(template.apply(null));

The version I am using is 2.2.3 (the latest one in Maven central). I tried this with 2.2.2 and got the same behavior. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions