Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arjixwastaken/pyml
A python HTML builder library.
https://github.com/arjixwastaken/pyml
html html-builder python
Last synced: 2 months ago
JSON representation
A python HTML builder library.
- Host: GitHub
- URL: https://github.com/arjixwastaken/pyml
- Owner: ArjixWasTaken
- License: mit
- Created: 2021-11-19T20:05:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-24T12:42:23.000Z (about 3 years ago)
- Last Synced: 2024-09-23T02:18:13.310Z (3 months ago)
- Topics: html, html-builder, python
- Language: Python
- Homepage: https://pypi.org/project/PyML/
- Size: 35.2 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyML
A python HTML builder library.# Goals
- [x] Fully functional html builder similar to the javascript node manipulation.
- [x] Implement an html parser that returns a Document instance with the proper properties and children.
- [ ] Prettify JavaScript to fit in with the prettified html.
- [ ] Add more API methods.
- [ ] Add CSS selector support.
- [ ] Add styling configuration.# Usage
If you have ever manipulated html using JavaScript then this should be really intuitive.
You just use the document to create a node.
You then modify the node with the properties and children that you want.
And insert that node into the document.```python
from PyML import Documentdoc = Document()
doc.title = "Example title!"print(doc)
```
results in
```html
Example title!
```
# Parsing html as a Document
Note: The parser is very experimental, that means that it might not be able to properly parse some html.
```python
from PyML.parser import doc_from_stringhtml = """
Example title!
"""
doc = doc_from_string(html)
print(doc.title)
print(doc.find("img").properties["src"])
```# Contributing
Anybody is free to contribute if they want, just make sure you follow the points listed below:
- Don't rename/move methods/objects without consulting me first.
- Don't introduce new functionality without explaining in-depth why we need said functionality (unless its from the [Goals](#goals) section)
- Your code must be PEP-8 compliable.