Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes bug in talawa_mobile_md_mdx_format_adjuster.py #2695

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/workflows/talawa_mobile_md_mdx_format_adjuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@
import argparse
import re

def escape_mdx_characters(text):
"""
Escape special characters (<, >, {, }) in Dart docs to make them MDX compatible.

Args:
text (str): The text content to be processed.

Returns:
str: The modified string with escaped MDX characters.
"""
# Replace unescaped <, >, {, } with their escaped equivalents
patterns = {
"<": r"(?<!\\)<",
">": r"(?<!\\)>",
"{": r"(?<!\\){",
"}": r"(?<!\\)}"
}
# def escape_mdx_characters(text):
# """
# Escape special characters (<, >, {, }) in Dart docs to make them MDX compatible.

# Args:
# text (str): The text content to be processed.

# Returns:
# str: The modified string with escaped MDX characters.
# """
# # Replace unescaped <, >, {, } with their escaped equivalents
# patterns = {
# "<": r"(?<!\\)<",
# ">": r"(?<!\\)>",
# "{": r"(?<!\\){",
# "}": r"(?<!\\)}"
# }
Comment on lines -21 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is just commenting the code fixes the issue ??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it will. Try it once....
This part of code is responsible for converting to escaped characters.
Once sir peter commented out the script and when we ran it there were no more escaped characters.


for char, pattern in patterns.items():
text = re.sub(pattern, f"\\{char}", text)
# for char, pattern in patterns.items():
# text = re.sub(pattern, f"\\{char}", text)

return text
# return text

def adjust_dart_code_blocks(text):
"""
Expand Down
Loading