Spaces:
Sleeping
Sleeping
Update InitialMarkups.py
Browse files- InitialMarkups.py +8 -2
InitialMarkups.py
CHANGED
|
@@ -616,6 +616,10 @@ def extract_section_under_header(pdf_path):
|
|
| 616 |
bottom_margin = 50
|
| 617 |
headertoContinue1 = False
|
| 618 |
headertoContinue2=False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
|
| 620 |
# Optimized URL handling
|
| 621 |
if pdf_path and ('http' in pdf_path or 'dropbox' in pdf_path):
|
|
@@ -855,7 +859,8 @@ def extract_section_under_header(pdf_path):
|
|
| 855 |
"Layer": "Initial",
|
| 856 |
"Code": stringtowrite,
|
| 857 |
"head above 1": paths[-2],
|
| 858 |
-
"head above 2": paths[0]
|
|
|
|
| 859 |
}
|
| 860 |
data_list_JSON.append(data_entry)
|
| 861 |
|
|
@@ -951,7 +956,8 @@ def extract_section_under_header(pdf_path):
|
|
| 951 |
"Layer": "Initial",
|
| 952 |
"Code": stringtowrite,
|
| 953 |
"head above 1": paths[-2],
|
| 954 |
-
"head above 2": paths[0]
|
|
|
|
| 955 |
}
|
| 956 |
data_list_JSON.append(data_entry)
|
| 957 |
|
|
|
|
| 616 |
bottom_margin = 50
|
| 617 |
headertoContinue1 = False
|
| 618 |
headertoContinue2=False
|
| 619 |
+
|
| 620 |
+
parsed_url = urlparse(pdf_path)
|
| 621 |
+
filename = os.path.basename(parsed_url.path)
|
| 622 |
+
filename = unquote(filename) # decode URL-encoded characters
|
| 623 |
|
| 624 |
# Optimized URL handling
|
| 625 |
if pdf_path and ('http' in pdf_path or 'dropbox' in pdf_path):
|
|
|
|
| 859 |
"Layer": "Initial",
|
| 860 |
"Code": stringtowrite,
|
| 861 |
"head above 1": paths[-2],
|
| 862 |
+
"head above 2": paths[0],
|
| 863 |
+
"MC Connnection": 'Go to ' + paths[0].strip().split()[0] +'/'+ heading_to_search.strip().split()[0] + ' in '+ filename
|
| 864 |
}
|
| 865 |
data_list_JSON.append(data_entry)
|
| 866 |
|
|
|
|
| 956 |
"Layer": "Initial",
|
| 957 |
"Code": stringtowrite,
|
| 958 |
"head above 1": paths[-2],
|
| 959 |
+
"head above 2": paths[0],
|
| 960 |
+
"MC Connnection": 'Go to ' + paths[0].strip().split()[0] +'/'+ heading_to_search.strip().split()[0] + ' in '+ filename
|
| 961 |
}
|
| 962 |
data_list_JSON.append(data_entry)
|
| 963 |
|