File size: 577 Bytes
c759ad8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
"""Simple test for create_highlighted_url function."""

from urllib.parse import urlparse
from citations import create_highlighted_url

def extract_base_url(full_url: str) -> str:
    """Extract base URL without fragments."""
    parsed = urlparse(full_url)
    return f"{parsed.scheme}://{parsed.netloc}{parsed.path}"

# Paste your URL and text here
full_url = "https://80000hours.org/articles/future-generations/"
quote_text = '''- Risks from'''

base_url = extract_base_url(full_url)
result = create_highlighted_url(base_url, quote_text)
print(result)