diff --git a/CHANGELOG.md b/CHANGELOG.md index ec3c556fab..460df3d767 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.4.0] - August 15, 2018: + +* Adds support for `table`, `tbody`, `tfoot`, `thead`, `tr`, `td`, `th`, and `caption` + ## [0.3.1] - August 15, 2018: * Fixed issue where `p` was not rendered with the `defaultTextStyle`. diff --git a/README.md b/README.md index a65e117425..cfe891b2bd 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # flutter_html -A Flutter widget for rendering static html tags as Flutter widgets. +A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 60 different html tags!) ## Installing: Add the following to your `pubspec.yaml` file: dependencies: - flutter_html: ^0.3.1 + flutter_html: ^0.4.0 ## Currently Supported HTML Tags: @@ -19,6 +19,7 @@ Add the following to your `pubspec.yaml` file: * `blockquote` * `body` * `br` + * `caption` * `cite` * `code` * `data` @@ -61,8 +62,15 @@ Add the following to your `pubspec.yaml` file: * `small` * `span` * `strong` + * `table` + * `tbody` + * `td` * `template` + * `tfoot` + * `th` + * `thead` * `time` + * `tr` * `u` * `var` @@ -79,22 +87,12 @@ Add the following to your `pubspec.yaml` file: * `audio` * `bdi` * `bdo` - * `caption` - * `col` - * `colgroup` * `details` * `source` * `sub` * `summary` * `sup` * `svg` - * `table` - * `tbody` - * `td` - * `tfoot` - * `th` - * `thead` - * `tr` * `track` * `video` * `wbr` @@ -115,6 +113,8 @@ Add the following to your `pubspec.yaml` file: * `big` (deprecated) * `button` * `canvas` + * `col` + * `colgroup` * `datalist` * `dialog` * `dir` (deprecated) diff --git a/lib/html_parser.dart b/lib/html_parser.dart index bd6e1b7fb8..11811ca921 100644 --- a/lib/html_parser.dart +++ b/lib/html_parser.dart @@ -17,6 +17,7 @@ class HtmlParser { "blockquote", "body", "br", + "caption", "cite", "code", "data", @@ -42,7 +43,7 @@ class HtmlParser { "img", "ins", "kbd", - "li", //partial + "li", "main", "mark", "nav", @@ -60,8 +61,15 @@ class HtmlParser { "small", "span", "strong", + "table", + "tbody", + "td", "template", + "tfoot", + "th", + "thead", "time", + "tr", "u", "ul", //partial "var", @@ -150,6 +158,11 @@ class HtmlParser { ); case "br": return Container(height: 14.0); + case "caption": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.center, + ); case "cite": return RichText( text: TextSpan( @@ -536,14 +549,49 @@ class HtmlParser { ], style: defaultTextStyle, )); + case "table": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.start, + ); + case "tbody": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.start, + ); + case "td": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.center, + ); case "template": return Container(); + case "tfoot": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.start, + ); + case "th": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.center, + ); + case "thead": + return Column( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.start, + ); case "time": return RichText( text: TextSpan( children: _parseInlineElement(node), style: defaultTextStyle, )); + case "tr": + return Row( + children: _parseNodeList(node.nodes), + crossAxisAlignment: CrossAxisAlignment.center, + ); case "u": return RichText( text: TextSpan( diff --git a/pubspec.yaml b/pubspec.yaml index 4a75845050..478b2bab9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_html -description: A Flutter widget for rendering static html tags as Flutter widgets. -version: 0.3.1 +description: A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 60 different html tags!) +version: 0.4.0 author: Matthew Whitaker homepage: https://github.com/Sub6Resources/flutter_html