GithubHelp home page GithubHelp logo

Comments (28)

lantiga avatar lantiga commented on May 6, 2024

I think it's a good idea, I'll implement it asap.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Done

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

wow, that was FAST! many thanks.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

sorry I got a hiccup to get this working. I did the following steps:

(1) update: sudo npm update -g react.hiccup

(2) verify: that it's the same version as on github: 0.1.3

(3) create a minimal test file test.hiccup.js:
rclass Test = {
render: function() {
return hiccup [div.a-b "123"]
}
}

(4) compile: sjs -m react.hiccup/macros -o test.js test.hiccup.js

and got the following error:

/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , b , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931
(/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950
(/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032
(/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959
(/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)

shell returned 8

Could you please give a hint what I am doing wrong?

thank you

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Argh, I forgot to copy the file under src/ to macro/index.js upon release.
My bad.
For now just do
sjs -m react.hiccup/src/react_hiccup.sjs -o test.js test.hiccup.js
Later I'll fix the release.

On Feb 10, 2014 5:48 PM, "hanthethanh" [email protected] wrote:

sorry I got a hiccup to get this working. I did the following steps:

(1) update: sudo npm update -g react.hiccup

(2) verify: that it's the same version as on github: 0.1.3

(3) create a minimal test file test.hiccup.js:
rclass Test = {
render: function() {
return hiccup [div.a-b "123"]
}
}

(4) compile: sjs -m react.hiccup/macros -o test.js test.hiccup.js

and got the following error:

/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , b , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931
(/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950
(/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032
(/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959
(/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960
(/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)

shell returned 8

Could you please give a hint what I am doing wrong?

thank you

Reply to this email directly or view it on GitHub.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

sorry, my fault. New to npm, didn't know about its cache.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

cleaning cache didn't help, but your hint came to the rescue. thanks again.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

ok, deployed new version on npm, it should work as expected. Thanks

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

sorry to bring up another issue:

this works: hiccup[div.abc-def "123"]
this doesn't work: hiccup[div.abc--def "123"]

why two dashes? Since it's the convention used by BEM

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Uh ok... I didn't know about BEM. I'll reopen the issue.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

can you please also support this: hiccup [div.calendar-view-4weeks "abc"] ? thanks.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Will do asap.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

So, I just released a new version with better parsing of selectors, e.g. -- and numbers are allowed.

Turns out though that sweet.js refuses to parse things like "somestring", like "-4weeks". For some reason "-a4weeks", "-a4" "-4" work fine.

Anway, I'll investigate the issue in sweet.js, if that gets fixed react.hiccup will start working with any combination.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

I have updated and now even this doesn't work: hiccup [ div.abc-def "123"]. I tried with sjs -m react.hiccup/src/react_hiccup.sjs as well, same error. Any hint please?

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

This is odd: react.hiccup version 0.1.6.

sjs -m react.hiccup/macros foo.js

with foo.js containing

hiccup [div.abc-def 123]
=> React.DOM.div({ className: ' abc-def' }, 123);

hiccup [div.abc-def "123"]
=> React.DOM.div({ className: ' abc-def' }, '123');

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

I think I might miss something obvious, however could not figure it out. Here is what I get on my machine:

`
$ cat js/test.hiccup.js
rclass Test = {
render: function() {
return hiccup [div.abc-def 123]
}
}

$ sjs -m react.hiccup/macros -o js/test.js js/test.hiccup.js

/usr/lib/node_modules/sweet.js/lib/parser.js:4982
throw e$1654;
^
Error: Line 1: Unexpected token ,
[... , - , def , 123 ...]
at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
at throwUnexpected$931 (/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
at parsePrimaryExpression$950 (/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at trackLeftHandSideExpressionAllowCall$1032 (/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
at parsePostfixExpression$959 (/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2418:25)

$ head /usr/lib/node_modules/react.hiccup/package.json
{
"name": "react.hiccup",
"version": "0.1.6",
"description": "Hiccup notation for React.js",
"repository": {
"type": "git",
"url": "https://github.com/lantiga/react.hiccup.git"
},
"keywords": [
"notation",
`

Do you have a suggestion what I should try? Thanks.

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

update: I tried different versions to see the difference:

0.1.3: error
0.1.4: OK
0.1.5: OK
0.1.6: error

but 0.1.5 doesn't support -- yet

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Thank you for checking. I think I nailed the issue: it was due to pattern matching for the rclass macro not working correctly with the new hiccup macro version.
I just released 0.1.7, it's working for me. Can you try and see what happens?
Thanks

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

ah, another useful hint, thanks. I have updated to 0.1.7, same error as 0.1.6, but now I leave out the rclass macro and use React.createClass instead. -- works fine now. I figured out the convenience brought by rclass is not worthwhile the trouble it causes.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Can you try out updating the package now?

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

the rclass macro works now, however these selectors don't:

        [div.a__b--c 123]      // ERROR
        [div.a_b-c 123]         // ERROR
        [div.a_b-c 123]         // ERROR
        [div.a-b-c 123]         // ERROR

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

The following works for me, can you provide a sample that demonstrates the error you are getting?

rclass Test = {
render: function() {
return hiccup [div.a-b-c 123]
}
}

rclass Test = {
render: function() {
return hiccup [div.a__b--c 123]
}
}

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024
head /usr/lib/node_modules/react.hiccup/package.json
{
  "name": "react.hiccup",
  "version": "0.1.8",
  "description": "Hiccup notation for React.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/lantiga/react.hiccup.git"
  },
  "keywords": [
    "notation",
cat js/test.hiccup.js
var Test = React.createClass({
    render: function() {
    return hiccup 
        [div
            [div.a__b--c 123]    // ERROR
        ]
    }
});
sjs  -m react.hiccup/macros -o js/test.js js/test.hiccup.js

/usr/lib/node_modules/sweet.js/lib/parser.js:4982
            throw e$1654;
                  ^
Error: Line 3: Unexpected token ,
[... , -- , c , 123 ...]
    at throwError$929 (/usr/lib/node_modules/sweet.js/lib/parser.js:1887:26)
    at throwUnexpected$931 (/usr/lib/node_modules/sweet.js/lib/parser.js:1939:9)
    at parsePrimaryExpression$950 (/usr/lib/node_modules/sweet.js/lib/parser.js:2295:16)
    at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
    at trackLeftHandSideExpressionAllowCall$1032 (/usr/lib/node_modules/sweet.js/lib/parser.js:4227:74)
    at parsePostfixExpression$959 (/usr/lib/node_modules/sweet.js/lib/parser.js:2381:25)
    at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
    at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2430:16)
    at /usr/lib/node_modules/sweet.js/lib/parser.js:4316:48
    at parseUnaryExpression$960 (/usr/lib/node_modules/sweet.js/lib/parser.js:2406:25)

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Ok thanks a lot

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

for now I stick with the following:

  • use React.createClass instead of rclass
  • don't use --
  • use version 0.1.5

since this combination seems to work.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Ok, I think I got it working, the errors you were getting were due to the nesting, which I wasn't testing correctly for. Do you have time for another test?

from react.hiccup.

hth2 avatar hth2 commented on May 6, 2024

sure. It seems to work now with -- and __ combined; I haven't tested the rclass macro since I have decided to go without it. thanks for your prompt support.

from react.hiccup.

lantiga avatar lantiga commented on May 6, 2024

Good. Thanks for the interaction!

from react.hiccup.

Related Issues (10)

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.