Skip to content

Latest commit

 

History

History
251 lines (135 loc) · 6.48 KB

CHANGELOG.md

File metadata and controls

251 lines (135 loc) · 6.48 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.7.0

Added

  • Antlers::ComponentCache keeps what a component rendered for a while. A component class with cache_seconds is made and rendered once for each set of props, locale and context. Later renders reuse its HTML until its time is up. An app sets the context for each request with ComponentCache.with_context, like the site it came to.
  • ComponentCache.skip! stops every component rendering now from being kept, for something one visitor should see. Loading translations clears the cache.

1.6.0

Added

  • Translation blocks for writing that reads better whole in each language than as separate strings, like a card's text. Each <{ translation: 'de' }> starts the next language, like an elsif, and one <{ :translation }> closes them all. The visitor's locale renders, or its language for a region like de-AT, or else the first, which is the template's own language. Translations don't nest
  • <{ else: }> in an <{ if: }> starts what shows when its value is false
  • A node can divide on a segment, starting its next part rather than nesting another inside it, which translation blocks do for each language
  • Translations.choose(languages) gives which of some languages the current locale reads

1.5.13

Added

  • A symbol's text can show values from the template, like {@email}, so a sentence with a value in it is translated whole. Values are escaped like any other
  • A locale can translate a symbol by its name, like de: { receipt_emailed: ... }

1.5.12

Changed

  • Translations.locales is worked out once for each set of translations, rather than on every request

1.5.11

Changed

  • A template is compiled to Ruby on its first render, like ERB, rather than walking its nodes on every render. HTML, variables, fors and ifs run as plain Ruby, and a for's values are Ruby locals rather than locals set on the binding. Components and other nodes still render themselves. A list of 10 users renders about 4 times faster, with a third of the objects
  • Reading a value's path no longer makes a new array for each key

1.5.10

Changed

  • Each {expression} is read once and remembered, rather than on every render. A render only looks up the variable, so a page with many values, like a table of 77 rows, renders about a quarter faster

1.5.9

Fixed

  • A <{ :slot }> inside another component's slot renders what its own component was given. It rendered that slot again until the stack overflowed, like a Page that passes its slot on inside <{ Layout: }>, or to a plain Ruby class that takes slot:

1.5.8

Added

  • Each node rendered inside another renders inside a NodeEvent when LowEvent has one. The request's tree then times it with the events it causes

1.5.7

Changed

  • if: treats a blank string, like '' or ' ', as false, as well as nil and false, so <{ if: @user.website }> shows nothing for a field left empty

1.5.6

Fixed

  • Rendering appends each child's output to the block's, where it copied everything rendered so far for every child, so a long for: loop, like a page's 250 comments, rendered in time that grew with the square of its length

1.5.5

Changed

  • An end tag that doesn't name its block, like <{ :if }>, has the name :nameless in the lexer's segments, as Lexeme::NAMELESS_END, where it had 'level_1'

Fixed

  • A component with a <{ :slot }> can be used without one, like <{ Card }>, and its slot renders nothing, where it raised undefined method 'children' for nil

1.5.4

Fixed

  • An if inside an if, or a for inside a for, closes with its own end tag, where it closed the outer one and the template didn't parse

1.5.3

Added

  • A form's HTML attributes, like <{ form: '/cart' class='add-to-cart' }>

Fixed

  • Components get the render context of the template they're in
  • method: 'GET' and anything else after a form's action went into its action, so <{ form: '/search' method: 'GET' }> posted to /search' method: 'GET

1.5.2

Added

  • A child node's RenderEvent has its parent's request, when the installed lowevent's RenderEvent takes one

1.5.1

Changed

  • Rendering a template takes about a third less time, as the lexer compiles its patterns once, rather than for each part of a template

1.5.0

Changed

  • Breaking: PropNode is SoloNode, and its element and lexeme are :solo, as every node can have props, while a solo node is one without a slot, like <{ Card title='Hi' }>
  • A lexeme's match? and lexeme get the directive as it's written, as segment:, so an app can read its own syntax
  • Breaking: metadata: is context: in Antlers.render and every node's render, as it's whatever the app passes down to its nodes

1.4.0

Changed

  • Escape variables with CGI.escapeHTML and drop the erb dependency, which took about 0.3s to load
  • Breaking: Limit allowed methods on basic types

1.3.1

Added

  • Pass params when their parent event has them

1.3.0

Added

  • Support translations ({"Hello"} and {:app_name})

1.2.2

Changed

  • Identify values like true, false, nil, :draft with Lowkey::ValueParser

1.2.0

Added

  • Support keywords without a value
  • Raise error for missing closing tag

Changed

  • Preserve whitespace

1.1.0

Added

  • Support metadata

Changed

  • Remove hard dependency on lowevent

1.0.0

Added

  • Release V1 API

0.9.0

Added

  • Support props on slots

0.8.2

Changed

  • Use plugs gem to manage supported elements

0.8.0

Added

  • Support if condition
  • Support variables in deerheads syntax

0.7.0

Added

  • Make arguments omittable
  • Namespace support

0.6.0

Added

  • Basic form support

0.5.0

Added

  • Pass props to initialize when method is present

Changed

  • Standardise falling back to a user defined string

0.4.0

Added

  • Support key/value iteration of hashes in for loop (<{ for: key, value in: @items }>)
  • Support method chain syntax { variable.method }

0.3.0

Added

  • Introduce for loop (<{ for: user in: @users }>)

Changed

  • Rename Antlers.parse to Antlers.ast

0.2.0

Added

  • Support props
  • Support slots
  • Support variables

0.1.0

Added

  • Add lexer
  • Add parser

0.0.0

Added

  • Basic template