GeezerVison is showing github.com — User documentation? · Issue #489 · html5lib/html5lib-python
Description
Is there any tutorial documentation for this package? Something that would answer questions like when parsing an HTML file:
with open(fname, 'rb') as f:
doc = html5lib.parse(f)
for e in list(doc[0]):
print(e.tag)
Why does the result look like this?
{http://www.w3.org/1999/xhtml}meta
{http://www.w3.org/1999/xhtml}title
{http://www.w3.org/1999/xhtml}link
A naive user would expect tag to return the literal value contained in the HTML element, not the tag prefixed with a qualifier of some sort. It would be helpful to have a document that explains why the prefix has been injected and how to configure the library to return unadorned tags.
Reacted by Thomas Güttler, Thiago Lages de Alencar and Juro Oravec
Activity
gsnedders commented on May 6, 2020
Reacted by Thiago Lages de Alencar
davaya commented on May 6, 2020
Thanks - creating a parser object explicitly with the proper args gives the desired results. New users reading the overview might benefit from some rationale (pros and cons) for choosing a particular tree type, and a note pointing out that namespacing is one of the options that can be specified.
It could be argued that new users might not be aware of namespacing and should not get it by default, while those who do need it would know enough to opt in.
guettli commented on Jul 9, 2021
I think basic usage example would be helpful.
Example: parse html, replace the innerHTML of all <a> links to "super foo". And then write it out again.
Up to now the docs are just about parsing.
Please add some example how to process the parsed data.
guettli commented on Jul 9, 2021
Metadata
Metadata
Development
No branches or pull requestsIssue actions