Code Monkey home page Code Monkey logo

Comments (9)

a-moses avatar a-moses commented on August 18, 2024

👍

from compiler.

aMarCruz avatar aMarCruz commented on August 18, 2024

@GianlucaGuarini , yes, it is already fixed my local copy, but now having problems with compiler logic.
Please tell if I'm wrong...
The file test/tag/named-child.tag (one of various errors) is:

<named-child-parent>
  <named-child name="tags-child"></named-child>
</named-child-parent>
<named-child>I have a name</named-child>

now, the compiler is generating:

riot.tag2('named-child-parent', '<named-child name="tags-child"></named-child>', '', '', function(opts) {
});
riot.tag2('named-child', '', '', '', function(opts) {
  I have a name    // <================ Parse error here when executing riot.tag2
});

I think this is the intention:

<named-child-parent>
  <named-child name="tags-child"></named-child>
</named-child-parent>
<named-child><p>I have a name</p></named-child>

The compiler is generating, I think correctly:

riot.tag2('named-child-parent', '<named-child name="tags-child"></named-child>', '', '', function(opts) {
});
riot.tag2('named-child', '<p>I have a name</p>', '', '', function(opts) {
});

In the first form, named-child is a custom tag with no html content inside, only bad javascript. I'm wrong? If so, how to detect the difference. I'm reading the old code right now to understand this.

EDIT: This is from specs/node.js test

from compiler.

GianlucaGuarini avatar GianlucaGuarini commented on August 18, 2024

@aMarCruz you can indent that tag, I have already updated the analyzer to detect this kind of issue https://github.com/riot/cli/blob/master/test/tags/analyzer/one-line.tag

from compiler.

aMarCruz avatar aMarCruz commented on August 18, 2024

You mean indenting <named-child>? i.e. the rule of 0 indentation for custom tags? the compiler is recognizing indented tags now, but is ok back to 0, it is simpler.

btw: call to riot.tag2 by the compiler was done mainly for precompiled expressions, this is transparent to users and sets brackets automatically, but may complicate the tests. I must mantain this, or back to riot.tag? Isee riot.tag2 in your tests, maybe is late to quest.
Now I think the way for precompiled expressions is a postprocessor, separated from riot, to not complicate the current code.

from compiler.

GianlucaGuarini avatar GianlucaGuarini commented on August 18, 2024

You mean indenting <named-child>?

yes

btw: call to riot.tag2 by the compiler was done mainly for precompiled expressions, this is transparent to users and sets brackets automatically, but may complicate the tests. I must mantain this, or back to riot.tag? Isee riot.tag2 in your tests, maybe is late to quest.

No it's never too late ;) just try to freeze the compiler api in order to make a new riot release
I think the compiler should mainly output riot compliant code, and riot-cli just prints the output in a file. Honestly I didn't really get why you needed riot.tag2 but if it's needed for the new compiler that's ok for me

from compiler.

aMarCruz avatar aMarCruz commented on August 18, 2024

riot.tag2 was for differentiate compiler code from users code, in precompiled expressions. It is not necessary now, except for auto-setting brackets, but it can do on riot.tag, or remove the feature, your decision.
Working in adjust the indent 0 regretion.

from compiler.

GianlucaGuarini avatar GianlucaGuarini commented on August 18, 2024

You can either keep riot.tag2 but we need to update the doc, or remove it handling it in runtime. I am fine with both solutions

from compiler.

aMarCruz avatar aMarCruz commented on August 18, 2024

Well, keep riot2 please, the distinction can be useful in the future.
The working on the fixes for browser is at ~80%, I'm out of home this weekend, upon returning I will finish the code, and begin the docs.

from compiler.

GianlucaGuarini avatar GianlucaGuarini commented on August 18, 2024

@aMarCruz thank you I will try to fix the ie issue in our unit test

from compiler.

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.