Update app.py
Browse files
app.py
CHANGED
|
@@ -31,18 +31,43 @@ if uploaded_file and method != "Select a method":
|
|
| 31 |
st.markdown(f"#### {section['header']}")
|
| 32 |
st.markdown(section["content"])
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
elif method == "Outline Method":
|
| 35 |
st.subheader("π Outline Method Output")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
sections = markdown_text.strip().split("\n\n")
|
| 38 |
-
for section in sections:
|
| 39 |
-
lines = section.strip().split("\n")
|
| 40 |
-
if lines:
|
| 41 |
-
title = lines[0]
|
| 42 |
-
content = "\n".join(lines[1:]) if len(lines) > 1 else ""
|
| 43 |
-
with st.container(border=True):
|
| 44 |
-
st.markdown(f"**{title}**")
|
| 45 |
-
st.markdown(content)
|
| 46 |
|
| 47 |
elif method == "Cornell Method":
|
| 48 |
st.subheader("π Cornell Notes Formatted")
|
|
|
|
| 31 |
st.markdown(f"#### {section['header']}")
|
| 32 |
st.markdown(section["content"])
|
| 33 |
|
| 34 |
+
# elif method == "Outline Method":
|
| 35 |
+
# st.subheader("π Outline Method Output")
|
| 36 |
+
|
| 37 |
+
# sections = markdown_text.strip().split("\n\n")
|
| 38 |
+
# for section in sections:
|
| 39 |
+
# lines = section.strip().split("\n")
|
| 40 |
+
# if lines:
|
| 41 |
+
# title = lines[0]
|
| 42 |
+
# content = "\n".join(lines[1:]) if len(lines) > 1 else ""
|
| 43 |
+
# with st.container(border=True):
|
| 44 |
+
# st.markdown(f"**{title}**")
|
| 45 |
+
# st.markdown(content)
|
| 46 |
elif method == "Outline Method":
|
| 47 |
st.subheader("π Outline Method Output")
|
| 48 |
+
|
| 49 |
+
# Split into sections by H2 headings (##)
|
| 50 |
+
sections = markdown_text.strip().split("## ")
|
| 51 |
+
for raw_section in sections:
|
| 52 |
+
if not raw_section.strip():
|
| 53 |
+
continue # Skip empty sections
|
| 54 |
+
|
| 55 |
+
# Extract title and bullet content
|
| 56 |
+
lines = raw_section.strip().splitlines()
|
| 57 |
+
title_line = lines[0] if lines else "Untitled Section"
|
| 58 |
+
content_lines = lines[1:]
|
| 59 |
+
|
| 60 |
+
with st.container(border=True):
|
| 61 |
+
st.markdown(f"### {title_line.strip()}")
|
| 62 |
+
for line in content_lines:
|
| 63 |
+
# Indentation-based visual enhancement
|
| 64 |
+
if line.strip().startswith("- "):
|
| 65 |
+
st.markdown(f"{line}")
|
| 66 |
+
elif line.strip().startswith(" - ") or line.strip().startswith(" - "):
|
| 67 |
+
st.markdown(f" {line}")
|
| 68 |
+
else:
|
| 69 |
+
st.markdown(line)
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
elif method == "Cornell Method":
|
| 73 |
st.subheader("π Cornell Notes Formatted")
|