youssefreda9 commited on
Commit
463c715
·
1 Parent(s): 83087ce

fix: use fullwidth brackets for ref delimiter to avoid [O Muhammad] collision

Browse files
Files changed (2) hide show
  1. quran.py +2 -2
  2. src/index.html +6 -6
quran.py CHANGED
@@ -358,8 +358,8 @@ def search_bayan(query_text: str,
358
  last = fmt_num(ayah_nums[-1])
359
  ref = f"{sura_name}: {first}-{last}"
360
 
361
- full_verse_formatted = f"({combined_body}) [{ref}]"
362
- matched_segment = f"({matched_segment}) [{ref}]"
363
 
364
  is_exact = best_score >= 0.999
365
  return {
 
358
  last = fmt_num(ayah_nums[-1])
359
  ref = f"{sura_name}: {first}-{last}"
360
 
361
+ full_verse_formatted = f"({combined_body}) 【{ref}】"
362
+ matched_segment = f"({matched_segment}) 【{ref}】"
363
 
364
  is_exact = best_score >= 0.999
365
  return {
src/index.html CHANGED
@@ -1241,10 +1241,10 @@
1241
  return;
1242
  }
1243
 
1244
- // Parse matched_segment: "(verse text) [surah: ayah]"
1245
  const seg = data.matched_segment || '';
1246
- const refMatch = seg.match(/\[([^\]]+)\]/);
1247
- const verseText = seg.replace(/\s*\[[^\]]+\]\s*$/, '').replace(/^\(/, '').replace(/\)$/, '');
1248
  const reference = refMatch ? refMatch[1] : '';
1249
 
1250
  _quranVerseClean = verseText;
@@ -1282,10 +1282,10 @@
1282
  return;
1283
  }
1284
 
1285
- // Parse translation: "(text (ayah)) [SurahName: ayah]"
1286
  const seg = data.matched_segment || '';
1287
- const refMatch = seg.match(/\[([^\]]+)\]/);
1288
- const transText = seg.replace(/\s*\[[^\]]+\]\s*$/, '').replace(/^\(/, '').replace(/\)$/, '');
1289
  const transRef = refMatch ? refMatch[1] : '';
1290
 
1291
  textEl.textContent = transText;
 
1241
  return;
1242
  }
1243
 
1244
+ // Parse matched_segment: "(verse text) 【surah: ayah】"
1245
  const seg = data.matched_segment || '';
1246
+ const refMatch = seg.match(/【([^】]+)】/);
1247
+ const verseText = seg.replace(/\s*【[^】]+】\s*$/, '').replace(/^\(/, '').replace(/\)$/, '');
1248
  const reference = refMatch ? refMatch[1] : '';
1249
 
1250
  _quranVerseClean = verseText;
 
1282
  return;
1283
  }
1284
 
1285
+ // Parse translation: "(text (ayah)) 【SurahName: ayah】"
1286
  const seg = data.matched_segment || '';
1287
+ const refMatch = seg.match(/【([^】]+)】/);
1288
+ const transText = seg.replace(/\s*【[^】]+】\s*$/, '').replace(/^\(/, '').replace(/\)$/, '');
1289
  const transRef = refMatch ? refMatch[1] : '';
1290
 
1291
  textEl.textContent = transText;