Metadata-Version: 2.1
Name: django-roman
Version: 0.2.2
Summary: A Django template filter to convert Arabic numerals to Roman numerals
Home-page: https://github.com/richardcornish/django-roman
Author: Richard Cornish
Author-email: rich@richardcornish.com
License: BSD
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
License-File: LICENSE

Django Roman
************

|PyPI version|_ |Build status|_ |Documentation status|_

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

.. |Build status| image::
   https://github.com/richardcornish/django-roman/actions/workflows/main.yml/badge.svg
.. _Build status: https://github.com/richardcornish/django-roman/actions/workflows/main.yml

.. |Documentation status| image::
   https://readthedocs.org/projects/django-roman/badge/?version=latest
.. _Documentation status: https://django-roman.readthedocs.io/en/latest/?badge=latest

**Django Roman** is a `Django <https://www.djangoproject.com/>`_ `template tag <https://docs.djangoproject.com/en/dev/howto/custom-template-tags/>`_ application to convert `Arabic numerals <https://en.wikipedia.org/wiki/Arabic_numerals>`_ into `Roman numerals <https://en.wikipedia.org/wiki/Roman_numerals>`_.

Original Roman numeral conversion code `adapted <https://diveintopython3.net/refactoring.html>`_ from `Dive Into Python 3 <https://diveintopython3.net/>`_ by Mark Pilgrim.

* `Package <https://pypi.org/project/django-roman/>`_
* `Source <https://github.com/richardcornish/django-roman>`_
* `Documentation <https://django-roman.readthedocs.io/>`_
* `Tests <https://github.com/richardcornish/django-roman/actions/workflows/main.yml>`_

Install
=======

.. code-block:: bash

   $ pip install django-roman

Add to ``settings.py``.

.. code-block:: python

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

Usage
=====

Convert Arabic numerals to Roman numerals with the ``roman`` template filter.

.. code-block:: django

   {% load roman_tags %}

   {{ "Party like it's 1999."|roman }}

Result:

.. code-block:: html

   Party like it's <span class="numerals numerals-roman">MCMXCIX</span>.

Can also be imported as a standalone Python module:

.. code-block:: python

   >>> from roman import roman
   >>> roman(1999)
   'MCMXCIX'
   >>> roman("1999")
   'MCMXCIX'
   >>> from roman import arabic
   >>> arabic("MCMXCIX")
   1999


