Skip to content

Commit

Permalink
SVG Support. Closes #144
Browse files Browse the repository at this point in the history
  • Loading branch information
washad authored and Knio committed Aug 4, 2019
1 parent 0d26dcb commit 227e072
Show file tree
Hide file tree
Showing 9 changed files with 764 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ nosetests.xml
.pydevproject
*.sublime-workspace
*.sublime-project

.idea
.idea/
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,19 @@ td(raw('<a href="example.html">Example</a>'))
```

Without the raw call, this code would render escaped HTML with lt, etc.


SVG
---

The `dominate.svg` module contains SVG tags similar to how `dominate.tags` contains HTML tags. SVG elements will automatically convert `_` to `-` for dashed elements. For example:

```python
from dominate.svg import *
print(circle(stroke_width=5))
```

```html
<circle stroke-width="5"></circle>
```

3 changes: 1 addition & 2 deletions dominate/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
__version__ = '2.3.5'

__version__ = '2.4.0'
2 changes: 1 addition & 1 deletion dominate/dom_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, *args, **kwargs):
self.add(*args)

for attr, value in kwargs.items():
self.set_attribute(*dom_tag.clean_pair(attr, value))
self.set_attribute(*type(self).clean_pair(attr, value))

self._ctx = None
self._add_to_ctx()
Expand Down
Loading

0 comments on commit 227e072

Please sign in to comment.