File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 44def 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):
1618def 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 (
You can’t perform that action at this time.
0 commit comments