Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support for html-in-python #2

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,30 @@ def to_component(self):
)
```

#### HTML-in-python

##### Exemple

```
print(<body>
<h1>{title}</h1>
<h2>Hello {user.name}</h2>
</body>)
```

##### Install

```bash
python -m ryzom_codec.install
```

##### Debug

Use this to see how the file is transformed
```bash
python -m ryzom_codec.transform filename
```

#### Demo

An example Django project is available in `src/ryzom_django_example/`, example
Expand Down
2 changes: 2 additions & 0 deletions src/ryzom/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def __getattr__(self, name):
def __init__(self, *content, **attrs):
cls = type(self)
self.content = list(content) or []
if 'content' in attrs:
self.content += attrs['content']

for key in [*attrs.keys()]:
value = attrs[key]
Expand Down
1 change: 1 addition & 0 deletions src/ryzom_codec/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env python
Loading