Skip to content

Releases: abstra-app/sugar

v0.2.0a1

21 Mar 03:52

Choose a tag to compare

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

v0.1.0a1

21 Mar 02:24

Choose a tag to compare

First alpha release of Sugar.

A template language that compiles to HTML + CSS + JS using indentation-based syntax inspired by Pug, Stylus, and CoffeeScript.

Features

  • HTML: elements, classes, attributes, inline elements, void elements, comments
  • CSS: selectors, properties, nesting, pseudo-selectors, at-rules
  • JS: functions, arrows, for/if/while, classes, try/catch, object literals, auto-semicolons

Usage

from abstra_sugar import sugar

html = sugar(open("page.sugar").read())