commit | 7f31979303f916f2aabb9e2091950798abdd9ca1 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch@google.com> | Wed Jan 13 17:21:57 2021 -0800 |
committer | GitHub <noreply@github.com> | Wed Jan 13 17:21:57 2021 -0800 |
tree | 16a82a1b63f9ed5cd8e6351afb4b7be28193574d | |
parent | 137be8db5d5b7f00530fca1591292849ce6779c9 [diff] |
Find test data files from package: URI (#149) In Dart 2.12 the `Platform.packageConfig` changes from `.packages` to `.dart_tool/package_config.json` which causes the data file discovery to fail. Switch to resolving a `package:html` URI and assuming the pub package layout which is more reliable and stable than the package config file location. - Migrate from `Platform.packageConfig` to `Isolate.resolvePackageUri`. - Change the utility methods to be asynchronous and update the `main` for tests to `async`. - Rename from `testDir` to `testDirectory`. - Rename methods away from `get*`
This is a pure Dart HTML5 parser. It's a port of html5lib from Python.
Parsing HTML is easy!
import 'package:html/parser.dart' show parse; import 'package:html/dom.dart'; main() { var document = parse( '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!'); print(document.outerHtml); }
You can pass a String or list of bytes to parse
. There's also parseFragment
for parsing a document fragment, and HtmlParser
if you want more low level control.