added doc comments to all formatters
This commit is contained in:
1 parent
5fc200a75b
commit
cf55e8952b
12 files changed
+197
-4
No files matched your search
@@ -1,3 +1,19 @@
|
||||
"""
|
||||
style_raw_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-style-raw". For each found element, it parses the
|
||||
existing style attributes (if any), merges them with the styles specified in "dj-style-raw", and replaces the
|
||||
style attribute with the merged styles. The values of the "dj-style-raw" attribute are expected to be strings with pairs
|
||||
of CSS properties and values separated by semicolons (;), and each pair separated by tildes (~).
|
||||
Unlike the `style_formatter` module, this module does not insert the values into the style attribute in Django template
|
||||
variable format. Then it removes the "dj-style-raw" attribute from the element.
|
||||
|
||||
Example:
|
||||
If an element is <div style="color:red" dj-style-raw="background-color;blue">,
|
||||
after processing, it becomes <div style="color:red;background-color:blue">.
|
||||
"""
|
||||
from bs4 import BeautifulSoup
|
||||
from .style_formatter import parse_style, style_to_string
|
||||
|
||||
|
||||
Reference in new issue
Block a user