Metadata-Version: 2.1
Name: htmldoom
Version: 0.6
Summary: An intuitive, high performance HTML rendering framework
Home-page: https://github.com/sayanarijit/htmldoom
Author: Arijit Basu
Author-email: sayanarijit@gmail.com
License: MIT
Keywords: html dom builder
Platform: Any
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Other Audience
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development
Classifier: Operating System :: MacOS
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest (>=4.4.1) ; extra == 'dev'
Requires-Dist: pytest-cov (>=2.7.1) ; extra == 'dev'
Requires-Dist: black (>=19.3b0) ; extra == 'dev'
Requires-Dist: mypy (>=0.710) ; extra == 'dev'
Requires-Dist: lxml (>=4.3.4) ; extra == 'dev'
Requires-Dist: tox (>=3.12.1) ; extra == 'dev'
Provides-Extra: testing
Requires-Dist: pytest (>=4.4.1) ; extra == 'testing'
Requires-Dist: pytest-cov (>=2.7.1) ; extra == 'testing'
Requires-Dist: black (>=19.3b0) ; extra == 'testing'
Requires-Dist: mypy (>=0.710) ; extra == 'testing'
Requires-Dist: lxml (>=4.3.4) ; extra == 'testing'

<h1 align="center">htmldoom</h1><p align="center">An intuitive, high performance HTML rendering framework</p><p align="center"><span><a href="https://pypi.org/project/htmldoom"><img src="https://img.shields.io/pypi/v/htmldoom.svg" alt="PyPI version" /></a></span>&nbsp;<span><a href="https://pypi.org/project/htmldoom"><img src="https://img.shields.io/pypi/pyversions/htmldoom.svg" alt="PyPI version" /></a></span>&nbsp;<span><a href="https://travis-ci.org/sayanarijit/htmldoom"><img src="https://travis-ci.org/sayanarijit/htmldoom.svg?branch=master" alt="Build Status" /></a></span>&nbsp;<span><a href="https://codecov.io/gh/sayanarijit/htmldoom"><img src="https://codecov.io/gh/sayanarijit/htmldoom/branch/master/graph/badge.svg" alt="codecov" /></a></span>&nbsp;<span><a href="https://github.com/python/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black" /></a></span></p><h2>Usage</h2><p><h2>A basic tag</h2><pre>&gt;&gt;&gt; from htmldoom import render, elements as e
&gt;&gt;&gt; 
&gt;&gt;&gt; print(render(e.p(style=&quot;color=&#x27;red&#x27;&quot;)(&quot;This is a paragraph&quot;)))
&lt;p style=&quot;color:&#x27;red&#x27;;&quot;&gt;This is a paragraph&lt;/p&gt;</pre></p><p><h2>A functional style foreach loop with a switch case</h2><pre>&gt;&gt;&gt; from htmldoom import elements as e
&gt;&gt;&gt; from htmldoom import functions as fn
&gt;&gt;&gt; 
&gt;&gt;&gt; tuple(fn.foreach([&quot;good&quot;, &quot;bad&quot;, &quot;evil&quot;])(
...     lambda x: fn.switch({
...         x == &quot;good&quot;: lambda: e.span(style=&quot;color: green&quot;)(f&quot;this is {x}&quot;),
...         x == &quot;bad&quot;: lambda: e.span(style=&quot;color: yellow&quot;)(f&quot;this is {x}&quot;),
...         x == &quot;evil&quot;: lambda: e.span(style=&quot;color: red&quot;)(f&quot;this is {x}&quot;),
...         fn.Case.DEFAULT: lambda: fn.Error.throw(ValueError(x)),
...     })
... ))
(b&#x27;&lt;span style=&quot;color: green&quot;&gt;this is good&lt;/span&gt;&#x27;,
 b&#x27;&lt;span style=&quot;color: yellow&quot;&gt;this is bad&lt;/span&gt;&#x27;,
 b&#x27;&lt;span style=&quot;color: red&quot;&gt;this is evil&lt;/span&gt;&#x27;)
</pre></p><p><a href="https://github.com/sayanarijit/htmldoom/tree/master/examples"><b>Find more examples here</b></a></p><p><h2>Q/A</h2><h3>What is the goal here?</h3><p>The primary goal is to make writing HTML pages cleaner, easier, safer and intuitive using Python.</p><h3>What about performance?</h3><p>Although performance is not the primary goal here, it should not be a roadblock. htmldoom is copying the syntax and some of the rendering properties of <a href="https://elm-lang.org">elm</a>, an existing fast and purely functional programming language that specializes in rendering HTML in virtual doms. Elm does all the optimisation internally, which I&#x27;m believe can be implemented in Python to a great extent.<br />Furthermore, if we follow the <a href="https://developers.google.com/web/tools/lighthouse/audits/dom-size">the DOM size recommendations</a>, i.e.<ul><li>less than 1500 nodes total.</li><li>maximum depth of 32 nodes.</li><li>no parent node with more than 60 child nodes.</li></ul> htmldoom should perform really well.</p></p><p><h2>Plugins and ecosystem</h2><p><ul><li><a href="https://github.com/sayanarijit/moodlmth"><b>moodlmth</b></a><span>: Convert raw HTML pages into python source code</span></li></ul><ul><li><a href="https://github.com/sayanarijit/pyramid_htmldoom"><b>pyramid_htmldoom</b></a><span>: htmldoom rendering library plugin for Pyramid</span></li></ul></p></p><p><h2>Contributing</h2><p>Check out the <a href="https://github.com/sayanarijit/htmldoom/tree/master/CONTRIBUTING.md"> contributing guidelines.</a></p></p>


