Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Boolean values in yaml #18

Open
amcnea opened this issue Aug 30, 2017 · 1 comment
Open

Issue with Boolean values in yaml #18

amcnea opened this issue Aug 30, 2017 · 1 comment
Assignees
Labels

Comments

@amcnea
Copy link

amcnea commented Aug 30, 2017

Parsing of false values doesn't seem to be working correctly per: https://mustache.github.io/mustache.5.html

I am using:

libmustache.x86_64     0.4.3-2.el7.remi
mustache.x86_64         0.4.3-2.el7.remi

From the remi repo in centos7

Using the following command: mustache -e -t test-template.mustache -d test-data.yml -o test.out

I would expect all 3 of the tests to be treated as false.

test-template.mustache:

Begin Test1
{{#test1}}
    Item is true
{{/test1}}
{{^test1}}
    Item is false
{{/test1}}
value: {{test1}}
After Test1

Begin Test2
{{#test2}}
    Item is true
{{/test2}}
{{^test2}}
    Item is false
{{/test2}}
value: {{test2}}
After Test2

Begin Test3
{{#test3}}
    Item is true
{{/test3}}
{{^test3}}
    Item is false
{{/test3}}
value: {{test3}}
After Test3

test-data.yml:

test1: no
test2: false
test3:

output file (test.out):

Begin Test1

    Item is true


value: no
After Test1

Begin Test2

    Item is true


value: false
After Test2

Begin Test3


    Item is false

value:
After Test3
@jbboehr
Copy link
Owner

jbboehr commented Sep 1, 2017

@amcnea It looks like libyaml, unlike json, doesn't provide any sort of type analysis outside of map, sequence and scalar. This sort of code would be needed, for example:
https://github.com/php/pecl-file_formats-yaml/blob/master/parse.c#L673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants