Skip to content

Commit ddcfcfa

Browse files
committed
Add comments
1 parent ebd88f3 commit ddcfcfa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tbx/core/utils/formatting.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
def convert_bold_links_to_pink(html_text):
55
"""Convert <b> tags inside links into <span class="text-coral">."""
66
soup = BeautifulSoup(html_text, "html.parser")
7+
# Limit the changes to anchor tags (<a>).
78
for anchor_tag in soup.find_all("a"):
9+
# Find all bold tags (<b>) and convert them to span tags (<span>).
810
for bold_tag in anchor_tag.find_all("b"):
911
tag_content = "".join([str(c) for c in bold_tag.contents])
1012
html_text = html_text.replace(
@@ -16,7 +18,9 @@ def convert_bold_links_to_pink(html_text):
1618
def convert_italic_links_to_purple(html_text):
1719
"""Convert <i> tags inside links into <span class="text-nebuline">."""
1820
soup = BeautifulSoup(html_text, "html.parser")
21+
# Limit the changes to anchor tags (<a>).
1922
for anchor_tag in soup.find_all("a"):
23+
# Find all italic tags (<i>) and convert them to span tags (<span>).
2024
for italic_tag in anchor_tag.find_all("i"):
2125
tag_content = "".join([str(c) for c in italic_tag.contents])
2226
html_text = html_text.replace(

0 commit comments

Comments
 (0)