Handlebars.Net icon indicating copy to clipboard operation
Handlebars.Net copied to clipboard

Indentation

Open mdschweda opened this issue 8 years ago • 3 comments

How about an option to preserve indentation for partials?

See Reference: preventIndent

Example

public class {{Name}} {

    {{#each}}
    {{>Property}}

    {{/each}}
}
public {{Type.Name}} {{Name}} {
    get;
    set;
}

Output

var config = new HandlebarsConfiguration { PreventIndent = false };

public class Foo {

    public object Bar {
        get;
        set;
    }

}

var config = new HandlebarsConfiguration { PreventIndent = true };

public class Foo {

public object Bar {
    get;
    set;
}

}

mdschweda avatar Nov 08 '16 12:11 mdschweda

PR always welcome! We already have some plumbing in-place to manage whitespace during the parsing and conversion phases, perhaps that can be leveraged.

rexm avatar Nov 08 '16 14:11 rexm

I'll look into that next week

mdschweda avatar Nov 08 '16 15:11 mdschweda

Any news on this?

tonysneed avatar Oct 14 '17 23:10 tonysneed