Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,8 +97,10 @@ def normalise_hyphens(text):
|
|
| 97 |
return text.replace('\u2011', '-').replace('\u2013', '-').replace('\u2014', '-')
|
| 98 |
|
| 99 |
def encode_text_fragment(text):
|
| 100 |
-
# Encode text for W3C Text Fragments, preserving only hyphens
|
| 101 |
-
#
|
|
|
|
|
|
|
| 102 |
return urllib.parse.quote(text, safe='-')
|
| 103 |
|
| 104 |
def generate_citation_hash(author, year, url, fragment_text, cited_text, username, task_name, current_date, current_time):
|
|
|
|
| 97 |
return text.replace('\u2011', '-').replace('\u2013', '-').replace('\u2014', '-')
|
| 98 |
|
| 99 |
def encode_text_fragment(text):
|
| 100 |
+
# Encode text for W3C Text Fragments, preserving only regular hyphens (U+002D)
|
| 101 |
+
# Non-breaking hyphens (U+2011) are encoded as %E2%80%91
|
| 102 |
+
# En dashes (U+2013) are encoded as %E2%80%93
|
| 103 |
+
# Em dashes (U+2014) are encoded as %E2%80%94
|
| 104 |
return urllib.parse.quote(text, safe='-')
|
| 105 |
|
| 106 |
def generate_citation_hash(author, year, url, fragment_text, cited_text, username, task_name, current_date, current_time):
|