Changeset be5d86c in Klonkt
- Timestamp:
- 06/28/2026 02:06:48 PM (2 months ago)
- Branches:
- main
- Children:
- a8b4f10
- Parents:
- 73abbfd
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r73abbfd rbe5d86c 949 949 // Turn #hashtags in reply text into Mastodon-style hashtag links (clickable + federated). 950 950 function linkHashtags(base, html) { 951 return String(html || '').replace(/(^|[\s>])#([ A-Za-z0-9_]+)/g, (m, pre, tag) =>951 return String(html || '').replace(/(^|[\s>])#([\p{L}\p{M}\p{N}_]+)/gu, (m, pre, tag) => 952 952 `${pre}<a href="${base}/tag/${encodeURIComponent(tag.toLowerCase())}" class="mention hashtag" rel="tag">#${tag}</a>`); 953 953 } … … 955 955 function hashtagTags(base, content) { 956 956 const tags = [], seen = new Set(); 957 const re = /class="[^"]*\bhashtag\b[^"]*"[^>]*>#([ A-Za-z0-9_]+)</gi;957 const re = /class="[^"]*\bhashtag\b[^"]*"[^>]*>#([\p{L}\p{M}\p{N}_]+)</giu; 958 958 let m; 959 959 while ((m = re.exec(content || ''))) { … … 979 979 // slug/href stays lowercase ("livemusic"). 980 980 function tagParts(raw) { 981 const words = String(raw || '').trim().split(/[\s_]+/).map((w) => w.replace(/[^ A-Za-z0-9]/g, '')).filter(Boolean);981 const words = String(raw || '').trim().split(/[\s_]+/).map((w) => w.replace(/[^\p{L}\p{M}\p{N}]/gu, '')).filter(Boolean); 982 982 if (!words.length) return null; 983 983 const slug = words.join('').toLowerCase(); … … 1019 1019 const inboxes = []; 1020 1020 const handles = new Set(); 1021 const re = /(^|[\s>])@([ A-Za-z0-9_.-]+@[A-Za-z0-9.-]+)/g;1021 const re = /(^|[\s>])@([\p{L}\p{M}\p{N}_.-]+@[\p{L}\p{M}\p{N}.-]+)/gu; 1022 1022 let m; 1023 1023 while ((m = re.exec(html || ''))) handles.add(m[2]); … … 1032 1032 const profileUrl = actorInfo(actor, actorUri).url || actorUri; // human profile page → the link href 1033 1033 const esc = h.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); 1034 out = out.replace(new RegExp('(^|[\\s>])@' + esc + '(?![ A-Za-z0-9_.-])', 'g'),1034 out = out.replace(new RegExp('(^|[\\s>])@' + esc + '(?![\\p{L}\\p{M}\\p{N}_.-])', 'gu'), 1035 1035 (full, pre) => `${pre}<a href="${profileUrl}" class="u-url mention" data-actor="${actorUri}">@${h}</a>`); 1036 1036 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)