mabuseif commited on
Commit
ae40509
·
verified ·
1 Parent(s): 7a7cd35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -93,9 +93,9 @@ def load_css():
93
 
94
  # --- Helper Functions ---
95
  def encode_text_fragment(text):
96
- # Encode text for W3C Text Fragments, preserving hyphens and em dashes
97
- # Use urllib.parse.quote with safe characters to match provided encoding table
98
- return urllib.parse.quote(text, safe='-—')
99
 
100
  def generate_citation_hash(author, year, url, fragment_text, cited_text, username, task_name, current_date, current_time):
101
  data = f"{author}, {year} | {url} | {fragment_text} | {cited_text} | {username} | {task_name} | {current_date} | {current_time}"
@@ -172,7 +172,7 @@ def live_clock():
172
  hour12: false
173
  };
174
  const formatter = new Intl.DateTimeFormat('en-AU', options);
175
- const now = New Date();
176
  const parts = formatter.formatToParts(now);
177
  const date = `${parts[4].value}-${parts[2].value}-${parts[0].value}`;
178
  const time = `${parts[6].value}:${parts[8].value}:${parts[10].value}`;
 
93
 
94
  # --- Helper Functions ---
95
  def encode_text_fragment(text):
96
+ # Encode text for W3C Text Fragments, preserving only hyphens
97
+ # En dashes (–) and em dashes (—) are encoded as %E2%80%93 and %E2%80%94
98
+ return urllib.parse.quote(text, safe='-')
99
 
100
  def generate_citation_hash(author, year, url, fragment_text, cited_text, username, task_name, current_date, current_time):
101
  data = f"{author}, {year} | {url} | {fragment_text} | {cited_text} | {username} | {task_name} | {current_date} | {current_time}"
 
172
  hour12: false
173
  };
174
  const formatter = new Intl.DateTimeFormat('en-AU', options);
175
+ const now = new Date();
176
  const parts = formatter.formatToParts(now);
177
  const date = `${parts[4].value}-${parts[2].value}-${parts[0].value}`;
178
  const time = `${parts[6].value}:${parts[8].value}:${parts[10].value}`;