Ремонт: свести кухню в один файл (диваны/столы/техника), убрать старый Интерьер кухня.md
All checks were successful
Deploy Remont Site / deploy (push) Successful in 17s

- Гостиная-кухня.md: добавлены обновлённые столы (Ozon, табуреты) и секция «Варианты техники»
- генератор: карточки только для таблиц с фото; прочие прайс-таблицы → таблица; URL → компактные ссылки

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cosmo
2026-07-15 17:52:54 +00:00
parent def9a6e327
commit e78b7d2be8
4 changed files with 62 additions and 69 deletions

View File

@@ -328,7 +328,14 @@ a.rooms-link:hover .room-name { color: var(--sage-deep); }
.table-wrap th, .table-wrap td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap th { font-weight: 600; color: var(--sage-deep); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap td:first-child { font-weight: 500; color: var(--ink); white-space: nowrap; }
.table-wrap td img { width: 84px; border-radius: 8px; }
.table-wrap .tlink {
display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
color: var(--sage-deep); font-weight: 600; text-decoration: none;
}
.table-wrap .tlink svg { width: 13px; height: 13px; }
.table-wrap .tlink:hover { text-decoration: underline; }
/* ---------- футер ---------- */
.footer { border-top: 1px solid var(--line); padding: 46px 0 60px; color: var(--ink-soft); font-size: 14px; }

View File

@@ -123,6 +123,12 @@ function parseTable(rows) {
function tableIsPriced(tbl) {
return tbl.headers.some((h) => /цена|price||руб/i.test(h));
}
function tableHasPhoto(tbl) {
return tbl.headers.some((h) => /фото|photo|картин|image/i.test(h))
|| tbl.rows.some((r) => r.some((c) => parseWiki(c)));
}
// карточки — только для «прайс + фото» (диваны, столы); прочие прайс-таблицы (техника) → обычная таблица
function tableIsCards(tbl) { return tableIsPriced(tbl) && tableHasPhoto(tbl); }
function colIndex(headers, re) { return headers.findIndex((h) => re.test(h)); }
function renderCards(tbl) {
@@ -157,12 +163,18 @@ function renderCards(tbl) {
return `<div class="options">${cards}</div>`;
}
function tableCell(c) {
const w = parseWiki(c);
if (w) return `<img src="${imgSrc(w)}" alt="" loading="lazy">`;
if (/^https?:\/\/\S+$/.test(c)) return `<a href="${esc(c)}" target="_blank" rel="noopener" class="tlink">Открыть <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M7 17 17 7M8 7h9v9"/></svg></a>`;
return inline(c);
}
function renderTable(tbl) {
const head = tbl.headers.map((h) => `<th>${inline(h)}</th>`).join('');
const body = tbl.rows.map((r) =>
`<tr>${r.map((c) => `<td>${parseWiki(c) ? `<img src="${imgSrc(parseWiki(c))}" alt="" loading="lazy">` : inline(c)}</td>`).join('')}</tr>`
`<tr>${r.map((c) => `<td>${tableCell(c)}</td>`).join('')}</tr>`
).join('\n');
return `<div class="table-wrap"><table><thead><tr>${head}</tr></thead><tbody>${body}</tbody></table></div>`;
return `<div class="table-wrap reveal"><table><thead><tr>${head}</tr></thead><tbody>${body}</tbody></table></div>`;
}
function renderImages(imgs) {
@@ -225,7 +237,7 @@ function renderSection(sec) {
if (b.t === 'h') {
let count = null;
if (next) {
if (next.t === 'table' && tableIsPriced(next)) count = next.rows.length;
if (next.t === 'table' && tableIsCards(next)) count = next.rows.length;
else if (next.t === 'list') count = next.items.length;
else if (next.t === 'images' && body[i + 2] && body[i + 2].t === 'list') count = body[i + 2].items.length;
}
@@ -238,7 +250,7 @@ function renderSection(sec) {
out.push(renderImages(b.imgs));
}
} else if (b.t === 'table') {
out.push(tableIsPriced(b) ? renderCards(b) : renderTable(b));
out.push(tableIsCards(b) ? renderCards(b) : renderTable(b));
} else if (b.t === 'list') {
out.push(renderVariants(b.items));
} else if (b.t === 'quote') {