cpc1 afwijking
This commit is contained in:
@@ -55,7 +55,7 @@ def _(file_dropdown, jpmc_transcript_to_md, mo):
|
|||||||
preview = mo.md("")
|
preview = mo.md("")
|
||||||
if file_dropdown.value:
|
if file_dropdown.value:
|
||||||
md_content = jpmc_transcript_to_md(file_dropdown.value)
|
md_content = jpmc_transcript_to_md(file_dropdown.value)
|
||||||
preview = mo.md(md_content)
|
preview = mo.md(md_content[:1000])
|
||||||
|
|
||||||
preview
|
preview
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ def cpc_smb_to_markdown(cpc_path: Path) -> str:
|
|||||||
|
|
||||||
for line in content.splitlines():
|
for line in content.splitlines():
|
||||||
line = line.strip().replace('\n', ' ')
|
line = line.strip().replace('\n', ' ')
|
||||||
|
|
||||||
|
# Handle edge case: "CPC1, (She/ Her,) LOCATION: Hello." -> "CPC1: Hello."
|
||||||
|
match = re.match(r'^"?([A-Za-z0-9]+),\s*\(.*?\)\s*LOCATION:\s*(.*?)"?$', line)
|
||||||
|
if match:
|
||||||
|
line = f"{match.group(1)}: {match.group(2)}"
|
||||||
|
|
||||||
# Remove surrounding quotes
|
# Remove surrounding quotes
|
||||||
if line.startswith('"') and line.endswith('"'):
|
if line.startswith('"') and line.endswith('"'):
|
||||||
line = line[1:-1].strip()
|
line = line[1:-1].strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user