phug-php / phug

Phug - The Pug Template Engine for PHP
https://phug.selfbuild.fr
MIT License
62 stars 3 forks source link

Not parsing nested or statement correctly #90

Open sandrodz opened 2 years ago

sandrodz commented 2 years ago

Hello,

I encountered an issue with the following code:

mixin h(level, size = xl, align, margin = true, classes = "")
  class= ((size === "xxl" || size === "xl" || size === "l") && margin) ? "mb-s mb-sS@s" : false

I expected to get:

class=mb-s mb-sS@s

But I actually get:

class=false

Thanks!

kylekatarnls commented 2 years ago

Hello,

Indeed it's an issue on operator precedence (=== vs ||) on our side, you can use:

mixin h(level, size = "xl", align = null, margin = true, classes = "")
  a(class=(((size === "xxl") || (size === "xl") || (size === "l")) && margin) ? "mb-s mb-sS@s" : false)
+h