IPF commited on
Commit
1e1215a
·
verified ·
1 Parent(s): 86a7cca

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -493,16 +493,18 @@ def render_citations(text: str, browser: SimpleBrowser) -> str:
493
  if info and info.get('url'):
494
  # Return clickable index link pointing to reference section
495
  # Aligned with generate_html_example.py style (green via CSS class)
 
496
  return f'<a href="{html.escape(url)}" target="_blank" class="citation-link">[{index}]</a>'
497
 
498
  # Fallback if no URL
499
  return f'<span class="citation-link">[{index}]</span>'
500
- except:
 
501
  pass
502
  return m.group(0)
503
 
504
  # First pass: replace citations with links
505
- result = re.sub(r'【(\d+)†L(\d+)(?:-L(\d+))?】', replace_citation, text)
506
 
507
  # Second pass: Deduplicate adjacent identical citations
508
  # Matches: <a ...>[N]</a> followed by optional whitespace and same link
 
493
  if info and info.get('url'):
494
  # Return clickable index link pointing to reference section
495
  # Aligned with generate_html_example.py style (green via CSS class)
496
+ url = info.get('url')
497
  return f'<a href="{html.escape(url)}" target="_blank" class="citation-link">[{index}]</a>'
498
 
499
  # Fallback if no URL
500
  return f'<span class="citation-link">[{index}]</span>'
501
+ except Exception as e:
502
+ # print(f"Error in replace_citation: {e}, match: {m.group(0)}")
503
  pass
504
  return m.group(0)
505
 
506
  # First pass: replace citations with links
507
+ result = re.sub(r'【(\d+)†.*?】', replace_citation, text)
508
 
509
  # Second pass: Deduplicate adjacent identical citations
510
  # Matches: <a ...>[N]</a> followed by optional whitespace and same link