Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maxpoletaev/python-htmlutils

Python helpers for rendering HTML tags
https://github.com/maxpoletaev/python-htmlutils

Last synced: about 1 month ago
JSON representation

Python helpers for rendering HTML tags

Awesome Lists containing this project

README

        

==========
Html utils
==========

.. image:: https://travis-ci.org/zenwalker/python-htmlutils.svg
:target: https://travis-ci.org/zenwalker/python-htmlutils
:alt: Build Status

Usage
=====

tags.tag(content: str, **attrs) -> str
--------------------------------------

Render HTML tags as ``tags.h1('hello', _class='heading')``.

htmlutils.parse_attrs(attrs: str) -> dict
-----------------------------------------

Parse a string like ``class="input" type="text" required`` into ``dict``.

htmlutils.render_attrs(attrs: dict) -> str
------------------------------------------

Render ``dict`` to string like ``class="input" type="text" required``.

Running tests
=============

::

$ python -m unittest tests/test_html.py