Git Product home page Git Product logo

Comments (5)

Pierre-Monier avatar Pierre-Monier commented on June 4, 2024 2

Thanks for coming back !

Yes, your workaround works, but I'm in a very specific case where I will be very happy that it works as explain in the documentation :).

Also, according to the mustache specification, it should work as I describe

Screenshot 2024-02-14 at 17 31 28

You can see that

Hello Chris
You have just won 10000 dollars!
Well, 6000.0 dollars, after taxes.

is not the same as :

Hello Chris
You have just won 10000 dollars!

Well, 6000.0 dollars, after taxes.

Maybe it is an issue with mustache directly ? In that case, I can move my issue here, but I would be very surprised if it is the case

from mason.

alestiago avatar alestiago commented on June 4, 2024

Hi @Pierre-Monier !

You can already solve this by not including the new line:

{{^publish}}publish_to: none{{/publish}}

dependencies:
  flutter:
    sdk: flutter{{#useGoogleFonts}}
  google_fonts: latest{{/useGoogleFonts}}

Alternatively, you can use Mustache comments to escape the line break:

{{^publish}}publish_to: none{{/publish}}

dependencies:
  flutter:
    sdk: flutter
  {{#useGoogleFonts}}{{!
}}  google_fonts: latest{{!
}}{{/useGoogleFonts}}

In my honest opinion, I think both solutions hinder readability and I would like an option that doesn't hinder the readability as much. Although, a solution that does so may start to deviate from the Mustache specification. I wonder about @felangel thoughts on this.

from mason.

alestiago avatar alestiago commented on June 4, 2024

@Pierre-Monier I agree with your suggestion considering the specification example.

{{#my_var}}
hello
{{/my_var}}

Should evaluate to:

hello

If a new line is desired one would:

{{#my_var}}

hello
{{/my_var}}

This is obviously a breaking change, however, I think we should go forward with it if the specification details so.

from mason.

Pierre-Monier avatar Pierre-Monier commented on June 4, 2024

@alestiago
Sounds great!

Since this is a breaking change, it might be a good occasion to change the conditional syntax, like describe in this issue. I think this new syntax will be a huge improvement.

from mason.

alestiago avatar alestiago commented on June 4, 2024

@felangel any thoughts? How should we move forward here 🙌 👀

from mason.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.