forked from Tadrisino/MathApp_frontend
No diacritics or written ezafe ی in the UI; map without the speech banner, companions cheering along the path; familiar payment sheet with gateway logos and per-channel methods; account deletion moved under «حساب کاربری»
- Text: kasra/fatha/damma/shadda/sukun/hamza-above and «هی» ezafe removed from every user-visible string (comments untouched); tanwin kept. Stale copy fixed (question packs are no longer sold), awkward onboarding sentences rewritten, سؤال → سوال. plainPersian() in MathText cleans the live tutor stream. - Home: the mascot + speech bubble header is gone; the selected companion hops beside the current island and sits at every third bend (CSS transform animations only). - Checkout: order summary, payment-method rows with Zarinpal/Bazaar icons and radio, amount on the pay button, lock trust line, darker overlay. paymentMethods in config.js per channel (web: zarinpal, app: zarinpal+bazaar by default). - Profile: «ورود با حساب دیگر» removed (it was logout); new «حساب کاربری» sheet shows phone/ID and holds «حذف حساب کاربری»; logout is a red row. Delete sheet tells Bazaar subscribers to cancel renewal in Bazaar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ const script = (body: string, table: Record<string, string>, marker: string) =>
|
||||
const mapped = tryMap(body, table);
|
||||
if (mapped) return mapped;
|
||||
const b = body.trim();
|
||||
if (marker === '^') return ` به توانِ (${b}) `;
|
||||
if (marker === '^') return ` به توان (${b}) `;
|
||||
return /^[\w۰-۹]{1,4}$/.test(b) ? b : `_(${b})`;
|
||||
};
|
||||
|
||||
@@ -64,14 +64,24 @@ export function plainMath(text: string): string {
|
||||
s = s.replace(SYMBOL_RE, (_m, n: string) => SYMBOLS[n]);
|
||||
s = s.replace(new RegExp(`\\^${G}`, 'g'), (_m, a: string) => script(a, SUP, '^'));
|
||||
s = s.replace(new RegExp(`_${G}`, 'g'), (_m, a: string) => script(a, SUB, '_'));
|
||||
s = s.replace(/\^\(((?:[^()]|\([^()]*\))*)\)/g, (_m, a: string) => tryMap(a, SUP) ?? ` به توانِ (${a.trim()}) `);
|
||||
s = s.replace(/\^\(((?:[^()]|\([^()]*\))*)\)/g, (_m, a: string) => tryMap(a, SUP) ?? ` به توان (${a.trim()}) `);
|
||||
s = s.replace(/\^([+\-−]?[0-9۰-۹]+)/g, (m, a: string) => tryMap(a, SUP) ?? m);
|
||||
s = s.replace(/(?<=[A-Za-z0-9۰-۹)₀-₉])\^([A-Za-zα-ωΑ-Ω□])(?![A-Za-z0-9۰-۹])/g, (_m, a: string) => tryMap(a, SUP) ?? ` به توانِ ${a} `);
|
||||
s = s.replace(/((?<![A-Za-z0-9_])[A-Za-z]|log|ln|lim|[)∫Σ∏])_([0-9۰-۹]+[A-Za-z]?|[A-Za-z]{1,4}[0-9۰-۹]?)(?![A-Za-z0-9_])/g, (_m, p: string, a: string) => (p === 'log' && [...a].some((c) => !(c in SUB)) ? `log پایهی ${a}` : p + [...a].map((c) => SUB[c] ?? c).join('')));
|
||||
s = s.replace(/(?<=[A-Za-z0-9۰-۹)₀-₉])\^([A-Za-zα-ωΑ-Ω□])(?![A-Za-z0-9۰-۹])/g, (_m, a: string) => tryMap(a, SUP) ?? ` به توان ${a} `);
|
||||
s = s.replace(/((?<![A-Za-z0-9_])[A-Za-z]|log|ln|lim|[)∫Σ∏])_([0-9۰-۹]+[A-Za-z]?|[A-Za-z]{1,4}[0-9۰-۹]?)(?![A-Za-z0-9_])/g, (_m, p: string, a: string) => (p === 'log' && [...a].some((c) => !(c in SUB)) ? `log پایه ${a}` : p + [...a].map((c) => SUB[c] ?? c).join('')));
|
||||
s = s.replace(/\^([+\-−])/g, (_m, a: string) => SUP[a]);
|
||||
s = s.replace(/(?<=[A-Za-z)'])_([+\-−])/g, (_m, a: string) => SUB[a]);
|
||||
s = s.replace(/\^(√[0-9۰-۹A-Za-z]+)/g, ' به توانِ $1 ').replace(/\^([A-Za-z]{2,3})(?![A-Za-z0-9])/g, ' به توانِ $1 ');
|
||||
s = s.replace(/\^(√[0-9۰-۹A-Za-z]+)/g, ' به توان $1 ').replace(/\^([A-Za-z]{2,3})(?![A-Za-z0-9])/g, ' به توان $1 ');
|
||||
s = s.replace(/(?<=\S) {2,}(?=\S)/g, ' ');
|
||||
s = s.replace(/\*\*([\s\S]+?)\*\*/g, '$1').replace(/(?<![_\w])__(.+?)__(?![_\w])/g, '$1').replace(/`/g, '');
|
||||
return s.replace(/^\s{0,3}#{1,6}\s+/gm, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* بیاعراب و بی «ی»ِ اضافه («پایهی سوم» → «پایه سوم»)؛ تنوین («قبلاً») میماند. همان قاعدهی بکاند
|
||||
* (`content/plain_math.py::plain_persian`، روی هر پاسخِ API). اینجا برای پاسخِ استریمیِ دستیار است که پیش از
|
||||
* پاکسازیِ نهاییِ سرور تکهتکه میرسد.
|
||||
*/
|
||||
export function plainPersian(text: string): string {
|
||||
if (!text) return text;
|
||||
return text.replace(/[ٌ-ْٔ]/g, '').replace(/هی(?![-ۿ])/g, 'ه');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user