bemhtml-syntax's People
bemhtml-syntax's Issues
Document all mis-indented results
Expose all options in API not just cli
this._ not replaced when used in arg to apply*()
block b, default: applyCtx(this._.extend(this.ctx, { elem: 'bla' }))
Match old converter API
-Qr --quote-reserved object keys
Convert local
- implement
- add tests
Templates that trip kcompiler
Is it ok to throw error or do we want some compiler magic to handle these?
- Problem is with non-standard args to
applyCtx
:
block dropdown-menu {
elem menu, default: {
applyCtx(this._inDropdownMenu = true, {
block: 'bla'
});
}
}
- Problem with computed prop in the arg to
applyNext
:
block button, mod round yes {
default: applyNext(
this.ctx.mods['only-icon'] = 'bla'
)
}
Flatten nested templates with single sub
- implement
- add tests
Add tests for bem-xjst4 compatibility flags
-
assertHasBlock
assert that every template has sub-predicate matchingblock
-
assertNoThisElem
assert there're no predicates matchingthis.elem
bem/bem-xjst#89 -
applySetsMode
assert that everyapply
sets the mode as its first argument bem/bem-xjst#91 -
applyCheckFields
warn whenapply
assignsblock
,elem
,mods
,elemMods
bem/bem-xjst#73 -
returnFromDef
ensure there's alwaysreturn
indef
mode. Insertreturn ''
when there is none -
assertNoBuf
assertthis._buf
is never used in templates
mix: [...] to mix()(function...)
Guess it could be very useful for migration to bem-xjst-next.
Related bem/bem-xjst#121
Replace this._ with this
- implement
- add tests
Test on real-world projects
Try jscs at post-compile stage for beautification
Regexp is broken after convert
Input file suggest-item_type_nav
with BEMHTML:
block suggest-item, mod type nav {
default: {
var url = this.ctx.data[4];
applyNext({_url: (url.match(/^\w[\w-]*:\/\//g) ? '' : 'http://') + url});
}
}
Run [email protected]
:
$ bemhtml-syntax -i suggest-item_type_nav
Actual:
block('suggest-item').mod('type', 'nav')(
def()(function() {
var url = this.ctx.data[4];
return applyNext({
_url: (url.match('^\w[\w-]*:\/\/' // regexp turned to string
g) ? '' : 'http://') + url
});
}))
Expected:
block('suggest-item').mod('type', 'nav')(
def()(function() {
var url = this.ctx.data[4];
return applyNext({
_url: (url.match(/^\w[\w-]*:\/\//g) ? '' : 'http://') + url
});
}))
Make use of existing tests in `granny` if possible
Discuss with Mishanga
Drop !this.elem
- implement
- add tests
-Q --quote-keys object keys
-q --quotes style
Add intermediate grammars to compilation pipeline
Either in this order in the API or as pre- and post- processing steps invoked from Transformer
grammar:
-
ometa DropNotElem
-
ometa CollapseSub
-
ometa Transformer
Replace `BEMHTML.apply()` with `this.reapply()` preserving args
- implement
- should only be changed at top-level inside template body, DO NOT replace in closures
- add test
before
block my-block, this._.isSimple(this.ctx): {
return BEMHTML.apply(bla, a = 1);
}
after
block('my-block').match(function() {
return this._.isSimple(this.ctx)
})(function() {
return this.reapply(bla, a = 1);
})
Convert `def`+`applyCtx` without `this.ctx` inside into `replace()`
- implement
- add tests
Document possible options at README.md
Proper indentation
- add a post-compilation pass that removes excessive
\n
in#spacesAndComments
- each sub-template should start on a separate line
Make converter compatible with bem-xjst 4+
see https://github.yandex-team.ru/lego/islands/pull/509
Compatibility with the latest bem-xjst should be available with relevant flag in the API
- assert that every template has sub-predicate matching
block
- assert there're no predicates matching
this.elem
bem/bem-xjst#89 - assert that every
apply
sets the mode as its first argument bem/bem-xjst#91 - warn when
apply
assignsblock
,elem
,mods
,elemMods
bem/bem-xjst#73 - convert
def()
+applyCtx
withthis.ctx
inside intowrap()
see article7 in https://github.yandex-team.ru/lego/islands/pull/509 - ensure there's always
return
indef
mode. Insertreturn ''
when there is none - assert
this._buf
is never used in templates
Return apply* in the last stmt position
- implement
- add tests
Transform apply, applyNext, applyCtx, local args
- implement
- add tests
Wrap preds with this.elem in elemMatch
- implement forced elemMatch
- throw when bem-xjst4 compatible flag
{elemMatch: false}
- add tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.