Skip to content

Commit

Permalink
New readme
Browse files Browse the repository at this point in the history
  • Loading branch information
odilxon committed Nov 12, 2022
1 parent e9ce7f2 commit 6997a99
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pip install flask_html
```

## Usage

### Simple HTML

```python
from flask_html import Page, Head
from flask_html.core import Style
Expand All @@ -32,6 +35,20 @@ def index():
return page.render(body, request)
```

### Using with listeners

Note: Jquery automatically injected

```python
opts = [Option('{}'.format(x),'Name {}'.format(x)) for x in range(10)]
sel = Select(opts).on('change', 'let val = $(this).val(); alert(val)')
page = Page(Head('Title', ['link to css'],['link to js'], [{"meta_property": "value"}]))
body = Body(page, elements=[
sel
])
return page.render(body, request)
```

## Elements

### Example of Div elements
Expand Down Expand Up @@ -64,7 +81,12 @@ Div(styles=None, classes=[], id=None, elements=[], props={})
- [x] Page
- [x] Element event listeners
- [ ] DOM manipulation
- [ ] Converting js function to python functions
- [ ] More examples

## Contibuting

This package open to contributing. Fork, make changes and open pull request

## License
This project is licensed under the MIT License (see the `LICENSE` file for details).
23 changes: 22 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
```
## Usage
### Simple HTML
```python
from flask_html import Page, Head
from flask_html.core import Style
Expand All @@ -41,6 +43,20 @@ def index():
return page.render(body, request)
```
### Using with listeners
Note: Jquery automatically injected
```python
opts = [Option('{}'.format(x),'Name {}'.format(x)) for x in range(10)]
sel = Select(opts).on('change', 'let val = $(this).val(); alert(val)')
page = Page(Head('Title', ['link to css'],['link to js'], [{"meta_property": "value"}]))
body = Body(page, elements=[
sel
])
return page.render(body, request)
```
## Elements
### Example of Div elements
Expand Down Expand Up @@ -73,15 +89,20 @@ def index():
- [x] Page
- [x] Element event listeners
- [ ] DOM manipulation
- [ ] Converting js function to python functions
- [ ] More examples
## Contibuting
This package open to contributing. Fork, make changes and open pull request
## License
This project is licensed under the MIT License (see the `LICENSE` file for details).
"""

setup(
name='Flask-HTML',
version='1.1.2',
version='1.1.3',
url='https://github.com/Odya-LLC/flask_html',
license='MIT',
author='odya',
Expand Down

0 comments on commit 6997a99

Please sign in to comment.