Updated HTML_Builder
This commit is contained in:
parent
546abbc49f
commit
75138eb416
4 changed files with 46 additions and 16 deletions
|
@ -1,18 +1,31 @@
|
||||||
# 2.0.2
|
# Change Log
|
||||||
|
|
||||||
|
## 2.0.3
|
||||||
|
|
||||||
|
* Added example
|
||||||
|
* Updated README
|
||||||
|
|
||||||
|
## 2.0.2
|
||||||
|
|
||||||
* Run `dartfmt -w .`
|
* Run `dartfmt -w .`
|
||||||
|
|
||||||
# 2.0.1
|
## 2.0.1
|
||||||
|
|
||||||
* Added pedantic dart rules
|
* Added pedantic dart rules
|
||||||
|
|
||||||
# 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
* Migrated to work with Dart SDK 2.12.x NNBD
|
* Migrated to work with Dart SDK 2.12.x NNBD
|
||||||
|
|
||||||
# 1.0.4
|
## 1.0.4
|
||||||
|
|
||||||
* Added `rebuild`, `rebuildRecursive`, and `NodeBuilder`.
|
* Added `rebuild`, `rebuildRecursive`, and `NodeBuilder`.
|
||||||
|
|
||||||
# 1.0.3
|
## 1.0.3
|
||||||
|
|
||||||
* Dart 2 ready!
|
* Dart 2 ready!
|
||||||
|
|
||||||
# 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
Changed `h` and the `Node` constructor to take `Iterable`s of children,
|
Changed `h` and the `Node` constructor to take `Iterable`s of children,
|
||||||
instead of just `List`s.
|
instead of just `List`s.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# angel3_html_builder
|
# Angel3 Html Builder
|
||||||
[](https://pub.dartlang.org/packages/angel3_html_builder)
|
|
||||||
|
[](https://pub.dartlang.org/packages/angel3_html_builder)
|
||||||
[](https://dart.dev/null-safety)
|
[](https://dart.dev/null-safety)
|
||||||
[](https://gitter.im/angel_dart/discussion)
|
[](https://gitter.im/angel_dart/discussion)
|
||||||
|
|
||||||
|
@ -9,7 +10,8 @@ Build HTML AST's and render them to HTML.
|
||||||
|
|
||||||
This can be used as an internal DSL, i.e. for a templating engine.
|
This can be used as an internal DSL, i.e. for a templating engine.
|
||||||
|
|
||||||
# Installation
|
## Installation
|
||||||
|
|
||||||
In your `pubspec.yaml`:
|
In your `pubspec.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -17,7 +19,8 @@ dependencies:
|
||||||
angel3_html_builder: ^2.0.0
|
angel3_html_builder: ^2.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:angel3_html_builder/angel3_html_builder.dart';
|
import 'package:angel3_html_builder/angel3_html_builder.dart';
|
||||||
|
|
||||||
|
@ -25,13 +28,12 @@ void main() {
|
||||||
// Akin to React.createElement(...);
|
// Akin to React.createElement(...);
|
||||||
var $el = h('my-element', p: {}, c: []);
|
var $el = h('my-element', p: {}, c: []);
|
||||||
|
|
||||||
|
|
||||||
// Attributes can be plain Strings.
|
// Attributes can be plain Strings.
|
||||||
h('foo', p: {
|
h('foo', p: {
|
||||||
'bar': 'baz'
|
'bar': 'baz'
|
||||||
});
|
});
|
||||||
|
|
||||||
i // Null attributes do not appear.
|
// Null attributes do not appear.
|
||||||
h('foo', p: {
|
h('foo', p: {
|
||||||
'does-not-appear': null
|
'does-not-appear': null
|
||||||
});
|
});
|
||||||
|
@ -41,7 +43,7 @@ i // Null attributes do not appear.
|
||||||
'appears': true,
|
'appears': true,
|
||||||
'does-not-appear': false
|
'does-not-appear': false
|
||||||
});
|
});
|
||||||
:
|
|
||||||
// Or, a String or Map.
|
// Or, a String or Map.
|
||||||
h('foo', p: {
|
h('foo', p: {
|
||||||
'style': 'background-color: white; color: red;'
|
'style': 'background-color: white; color: red;'
|
||||||
|
@ -51,7 +53,7 @@ i // Null attributes do not appear.
|
||||||
'style': {
|
'style': {
|
||||||
'background-color': 'white',
|
'background-color': 'white',
|
||||||
'color': 'red'
|
'color': 'red'
|
||||||
/ }
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Or, a String or Iterable.
|
// Or, a String or Iterable.
|
||||||
|
|
15
packages/html_builder/example/main.dart
Normal file
15
packages/html_builder/example/main.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:angel3_html_builder/elements.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
var dom = html(lang: 'en', c: [
|
||||||
|
head(c: [
|
||||||
|
title(c: [text('Hello, world!')])
|
||||||
|
]),
|
||||||
|
body(c: [
|
||||||
|
h1(c: [text('Hello, world!')]),
|
||||||
|
p(c: [text('Ok')])
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
print(dom);
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
name: angel3_html_builder
|
name: angel3_html_builder
|
||||||
description: Build HTML AST's and render them to HTML. This can be used as an internal DSL, i.e. for a templating engine.
|
description: Build HTML AST's and render them to HTML. This can be used as an internal DSL, i.e. for a templating engine.
|
||||||
version: 2.0.2
|
version: 2.0.3
|
||||||
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/html_builder
|
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/html_builder
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
Loading…
Reference in a new issue