From f5081f2b65f139c6af4a395e8f465119855f32ec Mon Sep 17 00:00:00 2001 From: MatthewWhitaker Date: Sat, 25 Aug 2018 20:33:20 -0600 Subject: [PATCH] Version 0.5.2 --- CHANGELOG.md | 4 ++++ README.md | 6 +++--- lib/html_parser.dart | 21 +++++++++++++++++++++ pubspec.yaml | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d2e0a60cc..b8481b324b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.5.2] - August 25, 2018: + +* Adds support for `bdi` and `bdo` + ## [0.5.1] - August 25, 2018: * Fixed issue with table rows not lining up correctly ([#4](https://github.com/Sub6Resources/flutter_html/issues/4)) diff --git a/README.md b/README.md index 2b31f3e26f..a9ce332f1f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A Flutter widget for rendering static html tags as Flutter widgets. (Will render Add the following to your `pubspec.yaml` file: dependencies: - flutter_html: ^0.5.1 + flutter_html: ^0.5.2 ## Currently Supported HTML Tags: @@ -17,6 +17,8 @@ Add the following to your `pubspec.yaml` file: * `article` * `aside` * `b` + * `bdi` + * `bdo` * `blockquote` * `body` * `br` @@ -86,8 +88,6 @@ Add the following to your `pubspec.yaml` file: > These are elements that are planned, but present a specific challenge that makes them somewhat difficult to implement. * `audio` - * `bdi` - * `bdo` * `details` * `source` * `sub` diff --git a/lib/html_parser.dart b/lib/html_parser.dart index 7f41544b6a..3776f11c4b 100644 --- a/lib/html_parser.dart +++ b/lib/html_parser.dart @@ -14,6 +14,8 @@ class HtmlParser { "article", "aside", "b", + "bdi", + "bdo", "blockquote", "body", "br", @@ -143,6 +145,25 @@ class HtmlParser { fontWeight: FontWeight.bold, ), ); + case "bdi": + return Wrap( + children: _parseNodeList(node.nodes), + ); + case "bdo": + if (node.attributes["dir"] != null) { + return Directionality( + child: Wrap( + children: _parseNodeList(node.nodes), + ), + textDirection: node.attributes["dir"] == "rtl" + ? TextDirection.rtl + : TextDirection.ltr, + ); + } + //Direction attribute is required, just render the text normally now. + return Wrap( + children: _parseNodeList(node.nodes), + ); case "blockquote": return Padding( padding: EdgeInsets.fromLTRB(40.0, 14.0, 40.0, 14.0), diff --git a/pubspec.yaml b/pubspec.yaml index faca9da9d8..536a33a981 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. (Will render over 60 different html tags!) -version: 0.5.1 +version: 0.5.2 author: Matthew Whitaker homepage: https://github.com/Sub6Resources/flutter_html