broadfield-dev commited on
Commit
b567446
·
verified ·
1 Parent(s): 0ba847f

Update app_logic.py

Browse files
Files changed (1) hide show
  1. app_logic.py +12 -1
app_logic.py CHANGED
@@ -58,12 +58,23 @@ 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
  # --- `parse_markdown` (Unchanged from previous corrected version) ---
62
  def parse_markdown(markdown_input):
63
  space_info = {"repo_name_md": "", "owner_md": "", "files": []}
64
  current_file_path = None; current_file_content_lines = []
65
  in_file_definition = False; in_code_block = False
66
- lines = markdown_input.strip().split("\n")
 
 
67
  for line_content_orig in lines:
68
  line_content_stripped = line_content_orig.strip()
69
  if line_content_stripped.startswith("### File:"):
 
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(commented_input):
62
+ """Process a commented markdown string by stripping '# ' from each line if any line starts with '# # Space:'."""
63
+ lines = commented_input.strip().split("\n")
64
+ if any(line.strip().startswith("# # Space:") for line in lines):
65
+ cleaned_lines = [line.lstrip("# ") for line in lines]
66
+ return "\n".join(cleaned_lines)
67
+ return commented_input
68
+
69
+
70
  # --- `parse_markdown` (Unchanged from previous corrected version) ---
71
  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()
80
  if line_content_stripped.startswith("### File:"):