New Features
- Implicit div:
.foo: and #bar: default to <div>
- #id shorthand:
canvas#game: → <canvas id="game">
- Implicit children:
ul > : Item → <li>, select > value=x: X → <option>, tr > : Cell → <td>, thead > : Header → <th>
- Server-side templating:
sugar(code, data) with {expr} interpolation, for/if in HTML
- Components:
card = (title): with slot: for children injection
- CSS mixins:
reset = (): with @reset() expansion
- html! template literals:
html!: inside script blocks compiles sugar to JS template literal strings
- Object literals: indented key/value syntax compiles to
{key: value}
- SugarWarning: warns on non-idiomatic syntax (explicit div, explicit implicit children)
check_source(): public API for linting, returns List[dict] with line/message/level
- Vim/Neovim syntax: comprehensive highlighting for all AST elements
Breaking Changes
- Comments now require
# (space after hash) to distinguish from #id
sugar() accepts optional data dict as second parameter
Install
pip install abstra-sugar==0.2.0a1