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 @@
"""
command_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-command". The value of "dj-command" is expected to be a
string representing a Django template command. For each found element, it replaces the element's content with the Django
template command, using the value of "dj-command" as the command. Then it removes the element's original tag, leaving
only the Django template command.
Example:
If an element is <div dj-command="url 'index'"></div>,
after processing, it becomes {% url 'index' %}.
"""
from bs4 import BeautifulSoup