chore(release): promote development to master #258
@@ -39,4 +39,14 @@ describe('renderLegalHtml', () => {
|
|||||||
expect(html).toContain('<title>Публичная оферта — Эрудит</title>');
|
expect(html).toContain('<title>Публичная оферта — Эрудит</title>');
|
||||||
expect(html).toContain('href="https://erudit-game.ru/offer/"');
|
expect(html).toContain('href="https://erudit-game.ru/offer/"');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('scopes the shrink-to-fit first-column table rule to the offer only', () => {
|
||||||
|
// The offer opts into the nowrap product-name column via body.offer; other legal pages (the
|
||||||
|
// privacy data table) must NOT get it, or their prose first column cannot wrap.
|
||||||
|
expect(renderOfferHtml('# x')).toContain('<body class="offer">');
|
||||||
|
const generic = renderLegalHtml('# x', { title: 't', canonical: 'c' });
|
||||||
|
expect(generic).toContain('<body>');
|
||||||
|
expect(generic).not.toContain('<body class=');
|
||||||
|
expect(generic).toContain('.offer td:first-child');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-6
@@ -15,7 +15,7 @@ import { marked } from 'marked';
|
|||||||
* page carries its own minimal light/dark styling so it needs neither the app bundle
|
* page carries its own minimal light/dark styling so it needs neither the app bundle
|
||||||
* nor `app.css`.
|
* nor `app.css`.
|
||||||
*/
|
*/
|
||||||
export function renderLegalHtml(markdown: string, opts: { title: string; canonical: string }): string {
|
export function renderLegalHtml(markdown: string, opts: { title: string; canonical: string; bodyClass?: string }): string {
|
||||||
const body = marked.parse(markdown, { async: false }) as string;
|
const body = marked.parse(markdown, { async: false }) as string;
|
||||||
return `<!doctype html>
|
return `<!doctype html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
@@ -94,11 +94,14 @@ export function renderLegalHtml(markdown: string, opts: { title: string; canonic
|
|||||||
td {
|
td {
|
||||||
border: 1px solid var(--cell-border);
|
border: 1px solid var(--cell-border);
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
|
/* Top-align: the privacy data table's prose cells differ in height per row. */
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
/* The product-name column shrinks to its content and never wraps; the price columns share the
|
/* Offer only: the product-name column shrinks to its content and never wraps; the price columns
|
||||||
rest of the width (width:1% is the shrink-to-fit idiom paired with the table's width:100%). */
|
share the rest of the width (width:1% is the shrink-to-fit idiom paired with width:100%). Other
|
||||||
th:first-child,
|
legal tables (the privacy data table) keep the default auto layout so their prose cells wrap. */
|
||||||
td:first-child {
|
.offer th:first-child,
|
||||||
|
.offer td:first-child {
|
||||||
width: 1%;
|
width: 1%;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -110,7 +113,7 @@ export function renderLegalHtml(markdown: string, opts: { title: string; canonic
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body${opts.bodyClass ? ' class="' + opts.bodyClass + '"' : ''}>
|
||||||
<main>
|
<main>
|
||||||
${body}
|
${body}
|
||||||
</main>
|
</main>
|
||||||
@@ -127,5 +130,6 @@ export function renderOfferHtml(markdown: string): string {
|
|||||||
return renderLegalHtml(markdown, {
|
return renderLegalHtml(markdown, {
|
||||||
title: 'Публичная оферта — Эрудит',
|
title: 'Публичная оферта — Эрудит',
|
||||||
canonical: 'https://erudit-game.ru/offer/',
|
canonical: 'https://erudit-game.ru/offer/',
|
||||||
|
bodyClass: 'offer',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user