Skip to content

Commit

Permalink
Merge pull request #30 from ykmnkmi/dev
Browse files Browse the repository at this point in the history
Merge dev.
  • Loading branch information
ykmnkmi authored Sep 27, 2024
2 parents 2028d07 + b4a408b commit 472a48c
Show file tree
Hide file tree
Showing 27 changed files with 714 additions and 706 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ on:
push:
branches:
- main
- dev
paths:
- .github/workflows/**
- lib/**
- test/**
- analysis_options.yaml
- pubspec.yaml
pull_request:

defaults:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test_web.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: test
name: test_web

on:
push:
branches:
- main
- dev
paths:
- .github/workflows/**
- lib/**
- test/**
- analysis_options.yaml
- pubspec.yaml
pull_request:

defaults:
Expand Down
95 changes: 47 additions & 48 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,86 @@
## 0.6.1-dev.2 ([diff](https://github.com/ykmnkmi/jinja.dart/compare/88996f8..main))
- added:
## 0.6.1-dev.5 ([diff](https://github.com/ykmnkmi/jinja.dart/compare/88996f8..main))
- Added:
- `UndefinedError` exception
- `UndefinedFactory` typedef
- `Environment`:
- `Environment({undefined})` argument
- `undefined` field
- `Environment({UndefinedFactory undefined})` argument
- `UndefinedFactory undefined` field
- `Template`:
- `Template({undefined})` argument
- `Template({UndefinedFactory undefined})` argument
- Filters:
- `null` (`none` alias)

## 0.6.0 ([diff](https://github.com/ykmnkmi/jinja.dart/compare/c12244e6..88996f8))
- bump SDK version to 3.3.0.
- update dependencies.
- internal changes.
- Bump SDK version to 3.3.0.
- Update dependencies.
- Internal changes.
- `chrome` platform tests.
- added:
- statements:
- Added:
- Statements:
- `import`
- `from`
- `Template`:
- `Template.fromNode({globals})` argument
- `globals` field
- restored:
- conditional and variable `extends` statement variants
- choice, ignore missing and variable `include` statement variants
- changed:
- Restored:
- Conditional and variable `extends` statement variants
- Choice, ignore missing and variable `include` statement variants
- Changed:
- `Environment`:
- `Environment.lex()` return from `List<Token>` to `Iterable<Token>`
- `Environment.scan(tokens)` argument type from `List<Token>` to `Iterable<Token>`
- removed:
- exceptions:
- Removed:
- Exceptions:
- `FilterArgumentError`
- `*args` and `**kwargs` support

## 0.5.0
- minimal SDK version: 3.0.0.
- internal changes.
- added:
- Minimal SDK version: 3.0.0.
- Internal changes.
- Added:
- `Template`:
- `Template.fromNode(Environment environment, {String? path, required Node body})` constructor
- statements:
- Statements:
- `macro`
- `call`
- filters:
- Filters:
- `items`
- `title`
- changed:
- Changed:
- `Environment`:
- `Environment({modifiers})` argument type from `List<NodeVisitor>` to `List<Node Function(Node)>`
- `modifiers` type from `List<NodeVisitor>` to `List<Node Function(Node)>`
- `scan(...)` return type from `List<Node>` to `Node`
- `parse(...)` return type from `List<Node>` to `Node`
- `Template`:
- `Template({modifiers})` argument type from `List<NodeVisitor>` to `List<Node Function(Node)>`
- filters:
- Filters:
- `truncate` arguments are now positional
- removed:
- Removed:
- `Template`:
- `Template.fromNodes(...)` constructor
- statements:
- Statements:
- `autoescape`
- filters:
- Filters:
- `forceescape`
- `safe`
- `unsafe`
- tests:
- Tests:
- `escaped`

## 0.4.2
- internal changes.
- Internal changes.

## 0.4.1
- update links.
- Update links.

## 0.4.0
- minimal SDK version: 2.18.0.
- added:
- Minimal SDK version: 2.18.0.
- Added:
- `passContext` and `passEnvironment` functions
- `print` to globals `{{ do print(name) }}`
- `Environment`
- `Environment({lineCommentPrefix, lineStatementPrefix, newLine, autoReload, modifiers, templates})`
constructor arguments
- `Environment({lineCommentPrefix, lineStatementPrefix, newLine, autoReload, modifiers, templates})` constructor arguments
- `autoReload` field
- `lexer` field
- `lineCommentPrefix` field
Expand All @@ -91,21 +92,20 @@
- `scan` method
- `parse` method
- `Template`
- `Template({path, lineCommentPrefix, lineStatementPrefix, newLine, modifiers, templates})`
constructor arguments
- `Template({path, lineCommentPrefix, lineStatementPrefix, newLine, modifiers, templates})` constructor arguments
- `renderTo` method
- exceptions are public now:
- Exceptions (was internal):
- `TemplateError`
- `TemplateSyntaxError`
- `TemplateAssertionError`
- `TemplateNotFound`
- `TemplatesNotFound`
- `TemplateRuntimeError`
- `FilterArgumentError`
- statements:
- Statements:
- `do`
- `with`
- filters:
- Filters:
- `dictsort`
- `replace`
- `reverse`
Expand All @@ -118,11 +118,11 @@
- `item`
- `map`
- `tojson`
- test:
- Test:
- `filter`
- `test`
- changed:
- `FieldGetter` typedef renamed to `AttributeGetter`
- Changed:
- `FieldGetter` type definition renamed to `AttributeGetter`
- `default` filter compare values with `null`, no boolean argument
- `defined` and `undefined` tests compare values with `null`
- `Environment`
Expand All @@ -135,20 +135,19 @@
- `Loader.listSources` method renamed to `listTemplates`
- `MapLoader.mapping` field renamed to `sources`
- `FileSystemLoader`
- `FileSystemLoader({paths})` argument now non-nullable, defaults to `['templates']`
- `FileSystemLoader({paths})` argument is now non-nullable, defaults to `['templates']`
- moved to `package:jinja/loaders.dart` library
- `package:jinja/get_field.dart` library renamed to `package:jinja/reflection.dart`
- `getField` function renamed to `getAttribute`
- removed:
- Removed:
- `Undefined` type and `missing` object
- `Environment.undefined` method
- `Template.render` method
- `FileSystemLoader`:
- `FileSystemLoader({path, autoReload})` arguments
- `autoReload` field
- `directory` field
- slices and negative indexes
- conditional and variable `extends` statement variants
- choice, ignore missing and variable `include` statement variants
- internal changes
- _work in progress_
- Slices and negative indexes
- Conditional and variable `extends` statement variants
- Choice, ignore missing and variable `include` statement variants
- Internal changes
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,30 @@ See also examples with [conduit][conduit_example] and

## Status:
### TODO:
- Informative error messages
- Template name 🔥
- Source span 🔥
- `Template` class:
- `generate` method
- `stream` method
- Relative template Paths
- Relative template paths
- Async Support
- Template Inheritance
- Super Blocks
- `{{ super.super() }}`
- List of Control Structures
- Extends
- Execute non-`block` statements and expressions
```jinja
{% extends 'base.html' %}
{% set title = 'Index' %}
{% macro header() %}
<h1>{{ title }}</h1>
{% endmacro %} ```
{% block body %}
{{ header() }}
{% endblock %}
```
- Expressions
- Dart Methods and Properties
- `!.`/`?.`
Expand All @@ -70,7 +89,6 @@ See also examples with [conduit][conduit_example] and
- ...
- List of Global Functions
- `lipsum`
- `dict`
- `cycler`
- `joiner`
- Extensions
Expand Down Expand Up @@ -127,6 +145,7 @@ See also examples with [conduit][conduit_example] and
- `('tuple', 'of', 'values')`
- `{'dict': 'of', 'key': 'and', 'value': 'pairs'}`
- `true` / `false`
- `null`
- Math
- `+`
- `-`
Expand Down Expand Up @@ -157,10 +176,11 @@ See also examples with [conduit][conduit_example] and
- If Expression
- `{{ list.last if list }}`
- `{{ user.name if user else 'Guest' }}`
- Dart Methods and Properties (with reflection)
- Dart Methods and Properties (if reflection is on)
- `{{ string.toUpperCase() }}`
- `{{ list.add(item) }}`
- List of Global Functions
- ~~`dict`~~
- `print`
- `range`
- `list`
Expand Down
4 changes: 2 additions & 2 deletions lib/reflection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import 'dart:mirrors' show MirrorSystem, reflect;
/// Reflection based object attribute getter.
Object? getAttribute(String field, Object? object) {
var symbol = MirrorSystem.getSymbol(field);
var mirror = reflect(object).getField(symbol);
return mirror.reflectee;
var fieldMirror = reflect(object).getField(symbol);
return fieldMirror.reflectee;
}
Loading

0 comments on commit 472a48c

Please sign in to comment.