bootprint / bootprint-base

Base template for bootprint-module
MIT License
3 stars 1 forks source link

New line issue in the "json" helper #15

Closed marc0l92 closed 3 years ago

marc0l92 commented 6 years ago

Issue description

The 'json' helper function adds an extra new line at the end of the parsed object. This happens because the parsed result is inside the <pre> HTML tag.

Example

{
    "title": "This is an example object",
    "message": "The 'json' helper will add an additional new line after the object"
}

Proposed solution

Remove the new line from the parsed 'json' objects: in the file /handlebars/helpers.js modify the line 171 in order to make it like:

return new Handlebars.SafeString($.html().replace(/\n/g, ''))

If you want I can submit a Pull Request.

nknapp commented 6 years ago

Feel free. But removing "all" newlines seems too much to me. Wouldn't it be enough to remove the last one?

marc0l92 commented 6 years ago

I decided to remove all the new line in order to make the code work also when you decide to upgrade the library that prettify the json object to HTML.