Age | Commit message (Collapse) | Author |
|
This is primarily done to make the rustdoc more readable
(by grouping Reader, IntoReader, StringReader and BufReadReader
in the reader module). Ideally IntoReader is already implemented
for your input type and you don't have to concern yourself
with these traits / types at all.
|
|
|
|
|
|
The Tokenizer does not perform any state switching, since
proper state switching requires a feedback loop between
tokenization and DOM tree building. Using the Tokenizer
directly therefore is a bit of a pitfall, since you might
not expect it to e.g. tokenize `<script><b>` as:
StartTag(StartTag { name: "script", .. })
StartTag(StartTag { name: "b", .. })
Since we don't want to make walking into pitfalls
particularly easy, this commit changes the Tokenizer::new
method so that you have to specify the Emitter.
Since this makes new_with_emitter redundant it is removed.
|
|
|
|
|
|
|
|
Previously we mapped the test tokens to our own token type.
Now we do the reverse, which makes more sense as it enables us
to easily add more detailed fields to our own token variants
without having to worry about these fields not being present
in the html5lib test data.
(An alternative would be to normalize the values of these fields
to some arbitrary value so that PartialEq still holds but seeing
such normalized fields in the diff printed by pretty_assertions
on a test failure would be quite confusing).
|
|
|
|
|
|
|
|
|
|
|
|
This change is a backport of 04e6cbe[1] from html5gum.
[1]: https://github.com/untitaker/html5gum/commit/04e6cbe44bb7a388bd61d1c9cfe4c618eb3b0e29
|
|
|
|
|
|
The trait of the standard library is also
called IntoIterator and not Iterable.
|
|
dced8066f77f570dd3e396ec3570c71aa86c454e introduced a Readable impl for
std::io::BufReader. Manually listing impls in a doc comment is a bad idea
since such lists will just get out of date and there's no need for that
since rustdoc automatically lists all implementations on the trait page.
|
|
|
|
|
|
|
|
|
|
|
|
You shouldn't manually have to match tokens yielded by the
tokenizer iterator just to correctly handle state transitions.
A better NaiveParser API will be introduced.
|
|
|
|
Previously `cargo test` failed because it ran the test_html5lib
integration test, which depends on the integration-tests feature
(so you always had to run `cargo test` with
`--features integration-tests` or `--all-features`, which was annoying).
This commit moves the integration tests to another crate,
so that the dependency on the feature can be properly defined
in a way so that `cargo test` just works and runs the test.
|
|
I want to move the test_html5lib integration test to a separate crate
so that it can properly depend on the integration-tests feature in a way
so that `cargo test` just works and runs the integration test.
(Currently `cargo test` fails since test_html5lib depends on that feature.)
However test_html5lib currently depends on the test-generator crate
and test-generator doesn't support Cargo workspaces[1] and appears to
be unmaintained.
This commit therefore drops the test-generator dev-dependency.
[1]: https://github.com/frehberg/test-generator/issues/6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Before the following happened:
% printf '<script><b>test</b></script>' | cargo run --example=switch-state
StartTag(StartTag { self_closing: false, name: "script", attributes: {} })
String("<b>test")
EndTag(EndTag { name: "b" })
EndTag(EndTag { name: "script" })
Which is obviously wrong. After a <script> tag we want to switch to the
ScriptData state (instead of the Data state).
This commit fixes this implementation error, making the above command
produce the expected output of:
StartTag(StartTag { self_closing: false, name: "script", attributes: {} })
String("<b>test</b>")
EndTag(EndTag { name: "script" })
|
|
Closes #11.
|
|
ScriptData states
|
|
|