Skip to main content

HTML to Django Converter

Project description

HTML To Django

tests workflow stylecheck workflow

Converts HTML files with special attributes to Django templates.

Installation

TODO: pip install instructions

Usage

html_to_django [-h] [-r] path

path can either be a path to a file or a folder. When a file is passed only the file itself will be converted. When a folder is passed, all files ending in .html will be replaced. This searches through the folder recursivley.

Use -r to replace the original files, instead of creating new ones. By default, new ones are created in place next to the existing files, with the extension .n.html.

You can also use the html_to_django_r command if you are unable to pass the -r parameter (e.g. with the Bootstrap Studio "Export Script" setting).

Attributes

To add Django template tags to your HTML files, you need to add special attributes to your HTML tags like this:

<div dj-for="user in users">
    <p>{{ user.name }}</p>
</div>

This will be converted to:

{% for user in users %}
<p>{{ user.name }}</p>
{% endfor %}

A complete list of supported attributes can be found here.

Contributing

To learn how to contribute to this project, please see CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

html_to_django-0.0.1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

html_to_django-0.0.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file html_to_django-0.0.1.tar.gz.

File metadata

  • Download URL: html_to_django-0.0.1.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for html_to_django-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2d1fb8168fe97bb73f2894707906e2ede0cb092920a79fec50af346ec7563045
MD5 463817f5a3c3c62b02608d913a1ae4d4
BLAKE2b-256 d1943035024aa7031416b8706141c72b2d84f351a6f205862bb35e01f8aa4562

See more details on using hashes here.

File details

Details for the file html_to_django-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for html_to_django-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59d72abbc4fe9a1dfa1af26a9d50c3c0b637154d011f47220f75e8310b405abf
MD5 8291a76af115ae6bdd53e8baf6ab7113
BLAKE2b-256 9a813ddd600f61838e6b4c640779a3e436dc2bee41191d36ff903c454d8a92d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page