Skip to content

Latest commit

 

History

History
143 lines (106 loc) · 2.1 KB

bars-spec.md

File metadata and controls

143 lines (106 loc) · 2.1 KB

Bars Specification v1.0.0

Markup

Comment - implemented

{{!<comment>}}
{{!--<code-comment>--}}

Block - implemented

{{#<name> <expression> [<context-map>]}}

{{else[ <name> <expression> [<context-map>]]}}

{{/<name>}}

Built in Block helpers:

  • if <condition>
  • with <object>
  • each <array | object>

Partial - implemented

{{><name> [<expression>] [<context-map>]}}

Partial Router - not implemented

{{>?<name-expression> [<expression>] [<context-map>]}}

The result of the name-expression tell the partail router which partial to render.

Insert - implemented

{{<expression>}}

Bars Expression

Operators - implemented

Parentheses - implemented

(<expression>)

Unary - implemented

! <value>

Binary - implemented

<value> + <value>
<value> - <value>
<value> / <value>
<value> * <value>
<value> % <value>
<value> || <value>
<value> && <value>
<value> < <value>
<value> <= <value>
<value> > <value>
<value> >= <value>
<value> == <value>
<value> != <value>
<value> === <value>
<value> !== <value>

Number Literal - implemented

^-?[0-9]+([.][0-9])?([Ee][+-]?[0-9]+)?$

String Literal - implemented

^'[^\n']*'$

Boolean Literal - implemented

true
false

Null Literal - implemented

null

Insert Value - implemented

<name>
~?/<path>/<to>/<value>
<path>.<to>.<value>

Bars Block Property - implemented

@<property>
~?/<path>/<to>/@<property>

Bars Transform Function - implemented

@<transform>(<expression>, <expression>, ...)

Built in Transform functions:

  • log(arg, arg, ...)
  • number(arg)
  • string(arg)
  • upperCase(str)
  • lowerCase(str)
  • reverse(arr)
  • slice(arr, start, end)
  • sort(arr[, prop])
  • map(arr[, prop])
  • sum(arr[, prop])
  • ave(arr[, prop])

Bars Context Map - implemented

<name>=<expression> <name>=<expression> ...