Spaces:
Sleeping
Sleeping
Update app_logic.py
Browse files- app_logic.py +4 -5
app_logic.py
CHANGED
@@ -58,11 +58,10 @@ def load_token_from_image_and_set_env(image_pil_object: Image.Image, password: s
|
|
58 |
except Exception as e: status_messages_display.append(f"**Unexpected decoding error:** {str(e)}")
|
59 |
return "\n".join(status_messages_display)
|
60 |
|
61 |
-
def process_commented_markdown(
|
62 |
"""Process a commented markdown string by stripping '# ' from each line if any line starts with '# # Space:'."""
|
63 |
-
|
64 |
-
|
65 |
-
cleaned_lines = [line.lstrip("#") for line in lines]
|
66 |
return "\n".join(cleaned_lines)
|
67 |
return commented_input
|
68 |
|
@@ -72,8 +71,8 @@ def parse_markdown(markdown_input):
|
|
72 |
space_info = {"repo_name_md": "", "owner_md": "", "files": []}
|
73 |
current_file_path = None; current_file_content_lines = []
|
74 |
in_file_definition = False; in_code_block = False
|
75 |
-
markdown_clean = process_commented_markdown(markdown_input)
|
76 |
lines = markdown_clean.strip().split("\n")
|
|
|
77 |
|
78 |
for line_content_orig in lines:
|
79 |
line_content_stripped = line_content_orig.strip()
|
|
|
58 |
except Exception as e: status_messages_display.append(f"**Unexpected decoding error:** {str(e)}")
|
59 |
return "\n".join(status_messages_display)
|
60 |
|
61 |
+
def process_commented_markdown(lines):
|
62 |
"""Process a commented markdown string by stripping '# ' from each line if any line starts with '# # Space:'."""
|
63 |
+
if any(line.strip().startswith("# ## File Structure") for line in lines):
|
64 |
+
cleaned_lines = [line.lstrip("# ") for line in lines]
|
|
|
65 |
return "\n".join(cleaned_lines)
|
66 |
return commented_input
|
67 |
|
|
|
71 |
space_info = {"repo_name_md": "", "owner_md": "", "files": []}
|
72 |
current_file_path = None; current_file_content_lines = []
|
73 |
in_file_definition = False; in_code_block = False
|
|
|
74 |
lines = markdown_clean.strip().split("\n")
|
75 |
+
markdown_clean = process_commented_markdown(lines)
|
76 |
|
77 |
for line_content_orig in lines:
|
78 |
line_content_stripped = line_content_orig.strip()
|