indent fix
Browse files- src/model.py +5 -5
src/model.py
CHANGED
|
@@ -185,11 +185,11 @@ def extract_and_link_sources(text, evidence_snippets):
|
|
| 185 |
|
| 186 |
# Replace other citation formats
|
| 187 |
for source_id_key, source_data in source_map.items():
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
|
| 194 |
# Handle generic [source_id] placeholder
|
| 195 |
if "source_id" in source_matches:
|
|
|
|
| 185 |
|
| 186 |
# Replace other citation formats
|
| 187 |
for source_id_key, source_data in source_map.items():
|
| 188 |
+
if not (source_id_key.startswith("PMID:") or source_id_key.startswith("DOI:")):
|
| 189 |
+
safe_id = re.escape(source_id_key)
|
| 190 |
+
pattern = f"\\[{safe_id}\\]"
|
| 191 |
+
replacement = f"[{source_data['title']}]({source_data['url']})"
|
| 192 |
+
linked_text = re.sub(pattern, replacement, linked_text)
|
| 193 |
|
| 194 |
# Handle generic [source_id] placeholder
|
| 195 |
if "source_id" in source_matches:
|