marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.36k stars 643 forks source link

'and', 'or' getting converted to '&&', '||' by parser #70

Closed patbegg closed 9 years ago

patbegg commented 9 years ago

The parser seems to be converting strings to logical values, for example 'and' is getting converted to '&&', and 'or' to '||'. It seems to be linked to the way html elements are nested. The text is being used in a tag.

Here is some html that breaks it: `

Intuitive Features Wrapped Up In a Smart Interface

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Explore the Features
```

Pay-as-you-go + Monthly Plans Available

Whether you're publishing lots or publishing little we have a plan that's great value and can scale up/down as your needs do, and you're free to cancel anytime.

Choose a plan that's right for you

Start Now - No Obligation 14 Day Free Trial

We don't expect you to make a decision before you've kicked the tyres and shown your boss so we offer a no obligation 14 day free trial to everyone.

Bored of reading and want to try it for yourself? Start your free trial now
        </div>`
patrick-steele-idem commented 9 years ago

@patbegg Can you confirm what version of marko you have installed? This looks to be the same bug that was previously fixed: https://github.com/raptorjs/marko/issues/60

I am not able to reproduce the problem when compiling the following template with the latest version of marko (v2.3.2):

<layout-use template="./layout.marko">
    <layout-put into="foo">
        <div class="c c2 span-8-collapse">
            <div class="c-inner">
                <dl class="summary-list">
                    <dt>
                        <h3>Intuitive Features Wrapped Up In a Smart Interface</h3>
                    </dt>
                    <dd>
                        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                        <span class="blue">&#9656; </span><a href="/features">Explore the Features</a>
                    </dd>

                    <dt>
                        <h3>Pay-as-you-go + Monthly Plans Available</h3>
                    </dt>
                    <dd>
                        <p>Whether you're publishing lots or publishing little we have a plan that's great value and can scale up/down as your needs do, and you're free to cancel anytime.</p>
                        <span class="blue">&#9656; </span><a href="/pricing">Choose a plan that's right for you</a>
                    </dd>
                    <dt>
                        <h3 class="green">Start Now - No Obligation 14 Day Free Trial</h3>
                    </dt>
                    <dd>
                        <p>We don't expect you to make a decision before you've kicked the tyres and shown your boss so we offer a no obligation 14 day free trial to everyone.</p>
                        <span class="green">&#9656; </span><a href="/features#analytics" class="green">Bored of reading and want to try it for yourself? Start your free trial now</a>
                    </dd>
                </dl>
            </div>
        </div>
    </layout-put>
</layout-use>
patbegg commented 9 years ago

I'm using the 'view-engine' and 'view-engine-marko' modules. I think the dependencies are well out of date. Is this still supported: https://github.com/patrick-steele-idem/view-engine-marko.git?

patrick-steele-idem commented 9 years ago

@patbegg The view-engine modules were an attempt to normalize the APIs for rendering templates across multiple template engines and to ensure that all templates are loaded as CommonJS modules, but it never really got any traction. We'll fix bugs (and update dependencies when requested), but if you are just using Marko then I would suggest dropping the usage of the view-engine modules and just use marko directly for loading and rendering templates (no middleman and less overhead). While not officially deprecated, I personally don't think it is worthwhile to continue investing in or using the view-engine modules. If you still want to use view-engine then please let me know and if you find issues please open the issue against the appropriate Git repo.

In the mean time I will look into doing a new release for the view-engine-marko module. Thanks.

patrick-steele-idem commented 9 years ago

Update: A new major version of view-engine-marko was published that tracks marko@^2: view-engine-marko@2.0.0

To upgrade to the latest version:

npm install view-engine-marko@^2 --save

I'm closing the issue for now. Please let me know if you still see issues and we can reopen if needed.