noahmorrison / chevron

A Python implementation of mustache
MIT License
510 stars 54 forks source link

Booleans (true|false) are rendered as Python booleans (True|False) #101

Open ricanontherun opened 3 years ago

ricanontherun commented 3 years ago

Given the follow template and data file:

template.mustache

true={{true-value}}
false={{false-value}}

data.json

{
  "true-value": true,
  "false-value": false
}

I receive the following output:

$ chevron -d data.json template.mustache
true=True
false=False

In my opinion, this should not work this way, booleans should be rendered in supported JSON format (true|false)

dcmoore-gd commented 3 years ago

Interesting. The chevron tool understands JSON as a data input format, but I don't believe there's any JSON support for output. I think it's all just text really other than the HTML escaping functionality.

ricanontherun commented 3 years ago

The way I see it, input (true|false booleans) should not be transformed into something else (True|False booleans) on output. If you agree, and are looking for some help ... I'd be willing contribute a patch for this. Let me know!

dcmoore-gd commented 3 years ago

I think the only way to do that reliably in something like Mustache is to do those imports as strings instead of booleans.