Carlos Rosas commited on
Commit
95aae57
·
verified ·
1 Parent(s): 5f32076

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -129,19 +129,20 @@ def format_references(text):
129
  ref_number = 1
130
 
131
  import re
 
 
 
132
  for match in re.finditer(ref_pattern, text):
133
- # Add text before the reference up to the period
134
  text_before = text[current_pos:match.start()].rstrip()
135
- if text_before.endswith('.'):
136
- text_before = text_before[:-1] # Remove the period temporarily
137
  parts.append(text_before)
138
 
139
  # Extract reference components
140
  ref_id = match.group(1)
141
  ref_text = match.group(2).strip()
142
 
143
- # Add the reference with period and line break
144
- tooltip_html = f'<span class="tooltip">[{ref_number}]<span class="tooltiptext"><strong>{ref_id}</strong>: {ref_text}</span></span>.<br>'
145
  parts.append(tooltip_html)
146
 
147
  current_pos = match.end()
@@ -172,8 +173,8 @@ css = """
172
  .tooltip {
173
  position: relative;
174
  display: inline-block;
175
- color: navy; /* Changed from #2563eb to navy */
176
- font-weight: bold; /* Make it bold for better visibility */
177
  cursor: pointer;
178
  }
179
  .tooltip .tooltiptext {
 
129
  ref_number = 1
130
 
131
  import re
132
+ # Remove leading dots from lines
133
+ text = re.sub(r'^\s*\.\s*', '', text, flags=re.MULTILINE)
134
+
135
  for match in re.finditer(ref_pattern, text):
136
+ # Add text before the reference
137
  text_before = text[current_pos:match.start()].rstrip()
 
 
138
  parts.append(text_before)
139
 
140
  # Extract reference components
141
  ref_id = match.group(1)
142
  ref_text = match.group(2).strip()
143
 
144
+ # Add the reference with period and line break
145
+ tooltip_html = f'<span class="tooltip"><strong>[{ref_number}]</strong><span class="tooltiptext"><strong>{ref_id}</strong>: {ref_text}</span></span>.<br>'
146
  parts.append(tooltip_html)
147
 
148
  current_pos = match.end()
 
173
  .tooltip {
174
  position: relative;
175
  display: inline-block;
176
+ color: #007FFF;
177
+ font-weight: bold;
178
  cursor: pointer;
179
  }
180
  .tooltip .tooltiptext {