fix(landing): sharp в образе через NODE_PATH; итерация критика 3 — переносы
Next 16 грузит sharp обычным require и NEXT_SHARP_PATH не читает: без sharp /_next/image отдавал исходный JPEG. Критик 3 (9/10): точка-разделитель нот и «·» в скобке недели не висят в начале/конце строки, имя и фамилия латиницей не разрываются.
This commit is contained in:
@@ -52,7 +52,7 @@ export function Label({ item, roastDate, wide = false }: { item: Item; roastDate
|
||||
<div className={wide ? 'lg:px-8' : 'flex flex-col'}>
|
||||
{item.notes.length > 0 && (
|
||||
<Row label={label.notes} wide={wide}>
|
||||
<span className="tag text-ink">{item.notes.map(keep).join(' •\u00A0')}</span>
|
||||
<span className="tag text-ink">{item.notes.map(keep).join('\u00A0• ')}</span>
|
||||
</Row>
|
||||
)}
|
||||
{item.spec && (
|
||||
|
||||
@@ -38,7 +38,7 @@ export function WeekStrip({ week }: { week: RoastWeek }) {
|
||||
<span className="week-bracket-line" aria-hidden="true" />
|
||||
<div className="week-bracket-note">
|
||||
<p className="tag text-cherry">
|
||||
{cupNote.day} · {cupNote.label}
|
||||
{cupNote.day}{'\u00A0·\u00A0'}{cupNote.label}
|
||||
</p>
|
||||
<p className="text-small text-ink">{typo(cupNote.caption)}</p>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,8 @@ describe('typo', () => {
|
||||
expect(typo('Иргачеффе вкусный')).toBe('Иргачеффе вкусный');
|
||||
});
|
||||
it('неразрывный дефис в фамилии', () => {
|
||||
expect(typo('Scott Soltys-Curry')).toBe('Scott Soltys‑Curry');
|
||||
expect(typo('Scott Soltys-Curry')).toBe('Scott\u00A0Soltys\u2011Curry');
|
||||
expect(typo('Фото: Mona Jain, Tina Guina')).toBe('Фото: Mona\u00A0Jain, Tina\u00A0Guina');
|
||||
});
|
||||
it('слеш не уходит на новую строку', () => {
|
||||
expect(typo('Curry / Unsplash')).toBe(`Curry${N}/ Unsplash`);
|
||||
|
||||
@@ -5,6 +5,8 @@ const SHORT = 'а|в|во|и|к|ко|на|не|но|о|об|от|до|по|с|с
|
||||
const SHORT_RE = new RegExp(`(^|[\\s(«—–-])(${SHORT}) `, 'giu');
|
||||
const UNIT_RE = /(\d) (кг|г|шт|BYN|мин|дн\.?|день|дня)(?=$|[\s.,:;!?)»])/gu;
|
||||
const NAME_HYPHEN_RE = /([A-Z][a-z]+)-([A-Z][a-z]+)/g;
|
||||
// имя и фамилия латиницей не разрываются: «Scott Soltys-Curry»
|
||||
const NAME_PAIR_RE = /\b([A-Z][a-z]+) (?=[A-Z][a-z]+)/g;
|
||||
|
||||
export function typo(text: string): string {
|
||||
// дважды: «и в Минске» — после замены первого слова второе стоит уже после NBSP
|
||||
@@ -13,6 +15,7 @@ export function typo(text: string): string {
|
||||
return out
|
||||
.replace(UNIT_RE, `$1${NBSP}$2`)
|
||||
.replace(NAME_HYPHEN_RE, '$1\u2011$2')
|
||||
.replace(NAME_PAIR_RE, `$1${NBSP}`)
|
||||
.replace(/ \//g, `${NBSP}/`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user