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

+11 -4
View File
@@ -1,9 +1,16 @@
"""
Find tags with a "dj-var" attribute and replace its content with the
value enclosed in {{ }}.
var_formatter.py
This module contains a function `format` that modifies a BeautifulSoup object in place.
The `format` function searches for all elements with the attribute "dj-var". For each found element, it replaces the
element's content with a Django template variable that has the same name as the value of the "dj-var" attribute.
Then it removes the "dj-var" attribute from the element.
Example:
If an element is <p dj-var="greeting">Hello, world!</p>,
after processing, it becomes <p>{{ greeting }}</p>.
"""
from bs4 import BeautifulSoup