GRMustache.swift icon indicating copy to clipboard operation
GRMustache.swift copied to clipboard

Line breaks

Open yonaskolb opened this issue 8 years ago • 3 comments

Hey, great library! Would it be possible to ignore line breaks in a template when a line only contains a single {{# tag? This would mean you could write:

enum {{enumName}} { 
    {{#enums}}
    case {{name}} = "{{value}}"
    {{/enums}}
}

instead of

enum {{enumName}} { {{#enums}}
    case {{name}} = "{{value}}"{{/enums}}
}

where you would want each case of that enum to be on a seperate line with no empty lines in between.

It greatly cleans up mustache template files, especially if you have many nested loops

yonaskolb avatar Nov 22 '16 20:11 yonaskolb

@groue I would very much appreciate you feedback on this :)

acecilia avatar Nov 11 '19 23:11 acecilia

Well, the source code is here, ready to be modified. Make sure you don't change the runtime just for your convenience, because what's good for you may be a pain for another user. Instead, look at the mustache standard, and plan well your modifications. Ask @fumito-ito if he plans to merge them in the repository before you open a pull request. Happy coding!

groue avatar Nov 12 '19 06:11 groue

@groue thanks for your answer.

So far I have solved this issue by using the technique explained in the following comment https://github.com/groue/GRMustache/issues/46#issuecomment-19498046

acecilia avatar Nov 12 '19 10:11 acecilia