added doc comments to all formatters

This commit is contained in:
truePhilipp committed 2024-05-07 17:36:54 +02:00
1 parent 5fc200a75b
commit cf55e8952b
12 files changed
+197 -4

No files matched your search

@@ -1,3 +1,16 @@
"""
static_formatter.py
This module contains a function `format` that modifies a BeautifulSoup object in place.
The function searches for all elements with the attribute "dj-static". The value of "dj-static" is expected to be a
string representing a tag and a static file path separated by a semicolon. For each found element, it replaces the value
of the specified tag with a Django template static command, using the specified static file path.
Then it removes the "dj-static" attribute from the element.
Example:
If an element is <img dj-static="src;images/pic.jpg">,
after processing, it becomes <img src="{% static 'images/pic.jpg' %}">.
"""
from bs4 import BeautifulSoup