semvec/pypi-packages huggingface dataset:
django-smartspaceless 0.1.2
A Django template tag application for minifying block-level HTML elements only
License: BSD License

Django Smart Spaceless
**********************

|PyPI version|_ |Build status|_

.. |PyPI version| image::
   https://badge.fury.io/py/django-smartspaceless.svg
.. _PyPI version: https://pypi.python.org/pypi/django-smartspaceless

.. |Build status| image::
   https://travis-ci.org/richardcornish/django-smartspaceless.svg?branch=master
.. _Build status: https://travis-ci.org/richardcornish/django-smartspaceless

**Django Smart Spaceless** is a `Django <https://www.djangoproject.com/>`_ `template tag <https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/>`_ application for minifying block-level HTML elements only.

It's just like |spaceless|_, but preserves white space between inline HTML elements. Useful for HTML where spaces directly between ``<a>``, ``<strong>``, and other inline elements is likely desired to be preserved. Packages the `django-htmlmin <https://github.com/cobrateam/django-htmlmin>`_ project to be used as a template tag.

.. |spaceless| replace:: ``spaceless``
.. _spaceless: https://docs.djangoproject.com/en/1.11/ref/templates/builtins/#spaceless

* `Package distribution <https://pypi.python.org/pypi/django-smartspaceless>`_
* `Code repository <https://github.com/richardcornish/django-smartspaceless>`_
* `Documentation <https://django-smartspaceless.readthedocs.io/>`_
* `Tests <https://travis-ci.org/richardcornish/django-smartspaceless>`_

Install
=======

.. code-block:: bash

   $ pip install django-smartspaceless

Add to ``settings.py``.

.. code-block:: python

   INSTALLED_APPS = [
       # ...
       'smartspaceless',
   ]

Usage
=====

.. code-block:: django

   {% load smartspaceless_tags %}

   {% smartspaceless %}
   <p><a href="#">Link 1</a></p>
   <p><a href="#">Link 2</a> <a href="#">Link 3</a></p>
   {% endsmartspaceless %}

Result:

.. code-block:: html

   <p><a href="#">Link 1</a></p><p><a href="#">Link 2</a> <a href="#">Link 3</a></p>

The space between ``<a href="#">Link 2</a>`` and ``<a href="#">Link 3</a>`` is preserved. Removing that space would be bad.

Note
====

Please note that `django-htmlmin <https://github.com/cobrateam/django-htmlmin>`_ by default uses the `html5lib <https://github.com/html5lib/html5lib-python>`_ parser, which prepends possibly missing ``<html><head></head><body>`` and appends possibly missing ``</body></html>`` tags in an effort to create valid HTML. The template tag changes this default behavior to use `html.parser <https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser>`_, the HTML parser in Python's standard library, which does not alter HTML fragments.
django-removewww 0.1.2
A Django middleware application that removes the WWW subdomain
License: BSD License

Django Remove WWW
*********************

|PyPI version|_ |Build status|_

.. |PyPI version| image::
   https://badge.fury.io/py/django-removewww.svg
.. _PyPI version: https://pypi.python.org/pypi/django-removewww

.. |Build status| image::
   https://travis-ci.org/richardcornish/django-removewww.svg?branch=master
.. _Build status: https://travis-ci.org/richardcornish/django-removewww

**Django Remove WWW** is a `Django <https://www.djangoproject.com/>`_ `middleware <https://docs.djangoproject.com/en/1.11/topics/http/middleware/>`_ application that removes the WWW subdomain.

The middleware inspects the request's host for the ``www`` subdomain, and redirects if ``REMOVE_WWW`` is ``True``. It silently passes if |prepend_www|_ is also ``True``. For some reason, Django `won't include <https://code.djangoproject.com/ticket/6342>`_ a ``REMOVE_WWW`` setting. Thanks to Daniel Ryan's `GitHub Gist <https://gist.github.com/dryan/290771>`_ for some inspiration.

.. |prepend_www| replace:: ``PREPEND_WWW``
.. _prepend_www: https://docs.djangoproject.com/en/1.11/ref/settings/#prepend-www

* `Package distribution <https://pypi.python.org/pypi/django-removewww>`_
* `Code repository <https://github.com/richardcornish/django-removewww>`_
* `Documentation <https://django-removewww.readthedocs.io/>`_
* `Tests <https://travis-ci.org/richardcornish/django-removewww>`_

Install
=======

.. code-block:: bash

   $ pip install django-removewww

Add to ``settings.py``.

.. code-block:: python

   MIDDLEWARE = [
       # ...
       'removewww.middleware.RemoveWwwMiddleware',
   ]

   REMOVE_WWW = True

Adding to ``INSTALLED_APPS`` is unnecessary unless you want to run the tests.