Skip to content

Commit 29a7167

Browse files
committed
licence and readme
1 parent a4d6806 commit 29a7167

File tree

2 files changed

+74
-4
lines changed

2 files changed

+74
-4
lines changed

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Odya
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

readme.md

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,74 @@
11
# Flask-HTML
2-
HTML generator for Flask applications.
2+
![Flask](https://img.shields.io/static/v1?label=under&message=Development&color=yellow&logo=flask)
3+
![GitHub top language](https://img.shields.io/github/languages/top/Odya-LLC/flask_html)
4+
![LICENCE](https://img.shields.io/github/license/Odya-LLC/flask_html)
5+
![Odya](https://img.shields.io/static/v1?label=Developed_by&message=Odya&color=green&logo=python)
36

7+
8+
9+
HTML generator for Flask applications. Make your HTML code more readable and easier to maintain.
410
## Installation
511
```bash
6-
pip install git+https://github.com/Odya-LLC/flask_html.git@main
12+
pip install flask_html
713
```
814

915
## Usage
1016
```python
1117
from flask_html import Page, Head
1218
from flask_html.tags import Style, Body, Div, P
19+
from flask import request
1320
@app.route('/')
1421
def index():
15-
head = Head('Title', ['link to css'],['link to js'], [{"meta property": "value"}])
22+
head = Head('Title', [],['https://code.jquery.com/jquery-3.6.1.min.js'], [{"meta_property": "value"}])
1623
page = Page(head)
24+
page.register_js("""
25+
$(document).ready(function(){
26+
$("body").append("<p>hello world</p>");
27+
})
28+
29+
""")
1730
body = Body(page, styles=Style(color="red", padding_top="15px"),classes=['class1', 'class2'], id='body_id',elements=[
1831
Div(styles=Style(margin="10px"), classes=['class1', 'class2'], id='div_id', elements=[
1932
P(styles=Style(color="blue"), classes=['class1', 'class2'], id='p_id', elements=[
2033
"Hello World"
2134
])
2235
])
2336
])
24-
return page.render(body)
37+
return page.render(body, request)
2538
```
39+
40+
## Elements
41+
42+
### Example of Div elements
43+
```python
44+
"""Div HTML element
45+
46+
Args:
47+
styles (Style, optional): Inline css styles. Defaults to None.
48+
classes (List[str], optional): List of class names. Defaults to [].
49+
id (str, optional): Unique ID. Defaults to None.
50+
elements (List[object], optional): List of child elements. Defaults to [].
51+
props (Dict[str, str], optional): Additional tag properties. Defaults to {}.
52+
"""
53+
Div(styles=None, classes=[], id=None, elements=[], props={})
54+
```
55+
### All elements
56+
57+
- Div
58+
- P
59+
- B
60+
- H1-H6
61+
- A
62+
- Img
63+
- Span
64+
- Ul
65+
- Li
66+
- Button
67+
- Input
68+
- Form
69+
- Header
70+
- Footer
71+
- Nav
72+
73+
## License
74+
This project is licensed under the MIT License (see the `LICENSE` file for details).

0 commit comments

Comments
 (0)