totaljs / framework

Node.js framework
http://www.totaljs.com
Other
4.36k stars 450 forks source link

bug when using html comments and new arrow function syntax #641

Closed Jusys closed 6 years ago

Jusys commented 6 years ago

in total.js view file add following line:

<!--<div data-jc="textbox" data-jc-path="forma._id --> (value) => { return value + ' sfsdfsdf'}">Kodas 2</div>-->

html comment ends where the first --> is. The reminder is sent to the user: (value) => { return value + ' sfsdfsdf'}">Kodas 2</div>-->

This is one more reason to introduce totaljs view engine's own comment system, like I suggested in issue #639.

petersirka commented 6 years ago

I'll try to find a solution for this problem.

Jusys commented 6 years ago

hi, peter. I'm thinking - why you use --> or -> ? I think pipe (|) in this case fits more naturally. Pipe symbol is used for this purpose (piping commands) in most systems I've encountered. Even you use pipes in totaljs' (I've found this in tangular): {{ created | format('yyyy-MM-dd') }} or {{ count | pluralize('no users', '# user', '# users', '#users') }}..

So I think it's cleaner syntax this way: <div data-jc="textbox" data-jc-path="forma._id | (value) => { return value + ' sfsdfsdf'}">Kodas 2</div>

P.S. I'm absolutely new in totaljs (after 2 weeks of research I feel, that I know totaljs even less than in beginning and I begin to lose my patience :) ), so I may not know something, what is holding you back from using pipe in this case.

petersirka commented 6 years ago

Hi, I didn't use | because I didn't like it. | can be a bit operation or double || means or. In Tangular engine is used | for inline helpers because I was inspired with Angular.js v1 template engine.

I have added -> support for yesterday, so if you download jComponent from GitHub or CDN you can use -> instead of --> and of course you can use comments markup.

PS: I'm absolutely old in Total.js, after 5 years of research I feel better than never before :-). But I understand of your flustration, you're not first and not the last one, but real learning curve is less than 3 months for handy developers. You must understand the concept and everything will be fine. Good luck and strong nerves --> it's worth it.

petersirka commented 6 years ago

I'm closing this issue, it's solved with -> instead of -->.