# هوميروس باليونانية متعددة النبر مقابل ترجمته

> مطلع الأوديسة في الصفحات الزوجية وترجمة إفتاليوتيس باليونانية الحديثة في الفردية، مقطّعين بأنماط grc ومرقّمين كل خمسة أبيات.

- نسخة HTML: https://postext.dev/ar/cookbook/homer-polytonic-facing-translation
- وصفة رقم 202 · الحروف والنص · المستوى 2 (متوسط) · المخرجات: Canvas
- الأنواع: الشعر
- تتطلب postext ≥ 1.99.1 · اختُبرت مع 1.99.1 بتاريخ 2026-11-29
- الصفحات: [1](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p01.webp?v=ccab6327), [2](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p02.webp?v=ccab6327), [3](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p03.webp?v=ccab6327), [4](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p04.webp?v=ccab6327), [5](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p05.webp?v=ccab6327), [6](https://postext.dev/cookbook/homer-polytonic-facing-translation/en/p06.webp?v=ccab6327)
- افتح في Sandbox: https://postext.dev/ar/sandbox#recipe=homer-polytonic-facing-translation&lang=en (.postext: https://postext.dev/cookbook/homer-polytonic-facing-translation/en/homer-polytonic-facing-translation.postext)
- آخر تحديث: 2026-11-29
- لغات أخرى: [en](https://postext.dev/en/cookbook/homer-polytonic-facing-translation.md), [es](https://postext.dev/es/cookbook/homer-polytonic-facing-translation.md), [ca](https://postext.dev/ca/cookbook/homer-polytonic-facing-translation.md), [de](https://postext.dev/de/cookbook/homer-polytonic-facing-translation.md), [el](https://postext.dev/el/cookbook/homer-polytonic-facing-translation.md), [fr](https://postext.dev/fr/cookbook/homer-polytonic-facing-translation.md), [it](https://postext.dev/it/cookbook/homer-polytonic-facing-translation.md), [pt](https://postext.dev/pt/cookbook/homer-polytonic-facing-translation.md), [zh](https://postext.dev/zh/cookbook/homer-polytonic-facing-translation.md), [ja](https://postext.dev/ja/cookbook/homer-polytonic-facing-translation.md)

## باختصار

الأبيات الأولى من أوديسة هوميروس باليونانية القديمة، بكل نبراتها وعلامات نفسها، في الصفحات اليسرى، وترجمة شعرية إلى اليونانية الحديثة في اليمنى، كل بيت بمحاذاة البيت الذي يترجمه.

## ما الذي ستنضده

نص كلاسيكي صغير مقاسه 14 × 21,5 سم بخط GFS Didot، الخط متعدد النبر لجمعية الخطوط اليونانية. تفتتحه صفحة من *سيرة هوميروس* البيزنطية التي تنسبها موسوعة السودا إلى هسيخيوس الميليتي، ومعها شاهد قبر هوميروس في جزيرة إيوس. تليها صفحتان متقابلتان مرتين: الأبيات 1 إلى 27 من النشيد الأول من *الأوديسة* في الصفحات الزوجية، وترجمة أرغيريس إفتاليوتيس إلى اليونانية الحديثة بأبيات من خمسة عشر مقطعًا في الفردية، بيتًا ببيت، مع رقم كل خامس بيت في الهامش الخارجي. النصوص الثلاثة في الملك العام ومأخوذة من ويكي مصدر اليونانية. تنضد العناوين الجارية وصفحات الافتتاح العناوين بحروف كبيرة تسقط كل علامة نفس ونبر.

**تجيب هذه الوصفة عن:**

- كيف أنضد اليونانية القديمة متعددة النبر، بتقطيعها وأرقام أبياتها، مقابل ترجمة؟
- كيف أرقّم كل سطر خامس من قصيدة في الهامش وأربط ملاحظاتي بأرقام الأسطر تلك؟
- كيف أنضد الشعر: سطر لكل بيت، وفراغ بين المقاطع، ومسافة بادئة معلّقة للأسطر الملتفّة، وبلا تقسيم كلمات؟
- كيف أحصل على ضبط أسطر وتقسيم كلمات جيدين لنص إسباني أو فرنسي أو ألماني؟

## الجواب المختصر

```js
// script.js, سطرًا 31–51
// locale 'grc' takes the polytonic patterns, which read breathings, circumflexes, the iota
// subscript and the diaeresis as the letters they sit on (Πει-σι-στρά-του, ὀφ-θαλ-μῶν,
// ἀ-ναμ-φί-λε-κτα). Eftaliotis's modern Greek is written polytonic too; under 'el' a
// polytonic word would be divided by the same patterns, so the two pages hyphenate alike.
// The labels are the modern Greek ones (Εικόνα, Πίνακας), as for 'el'.
const LOCALE = 'grc';
// Fontsource cuts each face into files by script, and loadFonts adds latin and greek. The
// accented letters of polytonic Greek (ἀ ὃ ῷ, U+1F00–1FFF) are in a third file, greek-ext:
// each face takes it too before the build, so no letter falls to a system font.
async function loadGreekExtended(faces) {
  const jobs = Object.entries(faces).flatMap(([family, specs]) => specs.map(async (spec) => {
    const id = fontsourceId(family);
    const style = spec.endsWith('i') ? 'italic' : 'normal';
    const file = `${id}-greek-ext-${parseInt(spec, 10)}-${style}.woff2`;
    const url = `${await fontsourceAt(id)}files/${file}`;
    const face = new FontFace(family, `url(${url}) format('woff2')`,
      { weight: String(parseInt(spec, 10)), style, unicodeRange: 'U+1F00-1FFF' });
    document.fonts.add(await face.load());
  }));
  await Promise.all(jobs);
}
```

## المكونات

**تعلّم**

- [تقسيم الكلمات ولغة المستند](https://postext.dev/ar/docs/justification.md#اللغات-المدعومة): تقسيم الكلمات بالواصلة وفق أنماط TeX في تسع لغات منها اليونانية، تُختار بحسب لغة المستند (locale)، التي تحدّد أيضًا عبارات استمرار الجداول ولغة PDF الموسوم.
- [ترقيم الأسطر](https://postext.dev/ar/docs/configuration-notes-references.md#ترقيم-الأسطر): يطبع lineNumbers رقم كل سطر خامس (أو كل N أسطر) في الهامش أو بين العمودين أو في العمود الجانبي: أسطر قصائد :::verse أو كل أسطر النص، ويبدأ العدّ من جديد عند كل قصيدة أو صفحة أو فصل أو قسم أو يستمر على امتداد الكتاب، دون أن يحرّك أي سطر.
- [الشعر سطرًا سطرًا](https://postext.dev/ar/docs/document-format-directives.md#verse): يصفّ :::verse القصيدة كما كُتبت: سطر من الشعر في كل سطر من Markdown، وأسطر فارغة بين المقاطع، والمسافات البادئة إزاحة؛ والسطر الأطول من اللازم يُكمَل بإزاحة معلّقة أو إلى الطرف بعد قوس معقوف، ولا ينفصل عن سطره عند فاصل الصفحة، ويمكن إبقاء المقاطع القصيرة كاملة.

**تستخدم أيضًا**

- [الخطوط قبل الإخراج](https://postext.dev/ar/docs/configuration-programmatic-usage.md#تحميل-الخطوط-قبل-الإخراج)
- [أنماط العناوين](https://postext.dev/ar/docs/configuration-styles.md#أنماط-العناوين)
- [سمات العنوان](https://postext.dev/ar/docs/document-format.md#سمات-العناوين)
- [صفحات افتتاح مصمَّمة](https://postext.dev/ar/docs/configuration-headings.md#الامتداد-والتصميم-المتقدم)
- [النصوص والخطوط والمربعات في تصاميم الصفحة](https://postext.dev/ar/docs/configuration-headers-footers.md#الترويسات-والتذييلات)
- [الترويسات وأرقام الصفحات](https://postext.dev/ar/docs/configuration-headers-footers.md#الترويسات-والتذييلات)
- [الترويسات بحسب دور الصفحة](https://postext.dev/ar/docs/configuration-headers-footers.md#عناصر-النص)
- [فواصل الصفحات والأعمدة](https://postext.dev/ar/docs/document-format-directives.md#pagebreak)
- [هوامش متناظرة](https://postext.dev/ar/docs/configuration-page-layout.md#الهوامش-المتناظرة)
- [لون الورق](https://postext.dev/ar/docs/configuration-page-layout.md#الصفحة)
- [أنماط الفقرات](https://postext.dev/ar/docs/configuration-styles.md#أنماط-الفقرات)
- [البيانات الوصفية للمستند](https://postext.dev/ar/docs/document-format.md#البيانات-التمهيدية-frontmatter)
- [لوحة ألوان دلالية](https://postext.dev/ar/docs/configuration-fonts-colors-viewers.md#لوحة-الألوان)
- [صفحات على اللوحة (Canvas)](https://postext.dev/ar/docs/configuration-programmatic-usage.md#رسم-صفحة-في-صورة-نقطية)
- [قوائم المراجع ومسارد المصطلحات](https://postext.dev/ar/docs/configuration-styles.md#أنماط-الفقرات)
- [ترويسات لكل قسم](https://postext.dev/ar/docs/configuration-styles.md#أنماط-العناوين)

**الإعدادات في لمحة**

- [`bodyText`](https://postext.dev/ar/docs/configuration-text.md#نص-المتن), [`colorPalette`](https://postext.dev/ar/docs/configuration-fonts-colors-viewers.md#لوحة-الألوان), [`footer`](https://postext.dev/ar/docs/configuration-headers-footers.md#الترويسات-والتذييلات), [`header`](https://postext.dev/ar/docs/configuration-headers-footers.md#الترويسات-والتذييلات), [`headingStyles`](https://postext.dev/ar/docs/configuration-styles.md#أنماط-العناوين), [`headings`](https://postext.dev/ar/docs/configuration-headings.md#العناوين), [`layout`](https://postext.dev/ar/docs/configuration-page-layout.md#التخطيط), [`lineNumbers`](https://postext.dev/ar/docs/configuration-notes-references.md#ترقيم-الأسطر), [`locale`](https://postext.dev/ar/docs/configuration-language.md#تقسيم-الكلمات-بالواصلة), [`page`](https://postext.dev/ar/docs/configuration-page-layout.md#الصفحة), [`paragraphStyles`](https://postext.dev/ar/docs/configuration-styles.md#أنماط-الفقرات)

**واجهات API**

- [`buildDocumentWithFonts`](https://postext.dev/ar/docs/configuration-programmatic-usage.md#تحميل-الخطوط-قبل-الإخراج), [`renderPageToCanvas`](https://postext.dev/ar/docs/configuration-programmatic-usage.md#رسم-صفحة-في-صورة-نقطية)

**الخطوط**

- GFS Didot (OFL-1.1)

## طريقة التحضير

### 1 · وسم النص بـgrc وتحميل حروفه المنبورة

الشيفرة هي [الجواب المختصر](https://postext.dev/ar/cookbook/homer-polytonic-facing-translation.md#الجواب-المختصر) أعلاه. يختار `locale: 'grc'` الأنماط متعددة النبر ([التقطيع](https://postext.dev/ar/docs/configuration-language.md))، وهي تقرأ علامة النفس والنبر الدائري واليوتا المكتوبة تحت وعلامة الفصل جزءًا من الحرف الذي تعلوه. تقسم الصفحة 1 Βατρα-χομυομαχία وἐπι-δειξάμενος وτυράν-νου. يقسّم Fontsource كل خط حسب نظام الكتابة، ولا يضيف `loadFonts` إلا ملفي latin وgreek. أما الحروف متعددة النبر المركبة مسبقًا، U+1F00–1FFF، فهي في ملف ثالث هو greek-ext، يضيفه `loadGreekExtended` لكل خط قبل التنضيد. استدعِه بعد `loadFonts`، وإلا عدّ المحرك الخط محمّلًا وتخطى ملف greek.

### 2 · رقم كل خامس بيت في الهامش الخارجي

```js
// script.js, سطرًا 67–73
// Each page of verse is its own :::verse block. The Greek and the translation of a spread
// both open with {lineStart=11}, so the numbers on the two pages agree: restart 'poem'
// counts each block from its own start, and the epitaph, {numbered=false}, is not counted.
const lineNumbers = {
  enabled: true, count: 'verse', interval: 5, restart: 'poem', position: 'outer',
  gap: mm(6), fontFamily: DIDOT, fontSize: em(0.8), color: col('rubric'),
};
```

يرقّم `count: 'verse'` الأبيات وحدها، ويعدّ `restart: 'poem'` كل كتلة `:::verse` من بدايتها. كل صفحة أبيات كتلة مستقلة. يبدأ النص اليوناني والترجمة في الصفحتين المتقابلتين الثانيتين كلاهما بـ`{lineStart=11}`، فتتفق الأرقام على الصفحتين. يرسل `position: 'outer'` الأرقام إلى الهامش الأيسر للصفحة الزوجية والأيمن للفردية ([أرقام الأسطر](https://postext.dev/ar/docs/configuration-text.md)). وشاهد القبر محاط بـ`{numbered=false}` فلا يأخذ رقمًا.

### 3 · صفحات افتتاح وعناوين جارية بالحروف الكبيرة

```js
// script.js, سطرًا 83–124
// textTransform 'uppercase' turns Ὀδύσσεια into ΟΔΥΣΣΕΙΑ and Ῥαψῳδία into ΡΑΨΩΔΙΑ: Greek
// capitals take no breathing, no accent and no iota subscript (a dialytika stays, Ϊ Ϋ).
const caps = (size, tracking, color = 'muted') => ({ fontFamily: DIDOT, fontSize: pt(size),
  letterSpacing: pt(tracking), textTransform: 'uppercase', color: col(color) });
const opener = (title) => ({ enabled: true, minHeight: pt(5 * LEAD), slot: { elements: [
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', align: 'center', ...caps(8, 2, 'rubric'),
    placement: { ...at('container', 'top', 0, LINE), size: { width: 'fill' } } },
  { kind: 'text', id: 'title', content: title, align: 'center', ...caps(17, 3.5, 'ink'),
    placement: { ...at('container', 'top', 0, 2.2 * LINE), size: { width: 'fill' } } },
] } });
// # Ὀδύσσεια {style="original"} opens a verso, {style="translation"} the recto facing it;
// a style sets its own break side (gotcha: style-inherits-break).
const headingStyles = [
  { id: 'original', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'translation', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'life', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: { enabled: true, minHeight: pt(6 * LEAD), slot: { elements: [
      { kind: 'text', id: 'title', content: '{titleText}', align: 'center', ...caps(15, 3, 'ink'),
        placement: { ...at('container', 'top', 0, 1.6 * LINE), size: { width: 'fill' } } },
      { kind: 'text', id: 'source', content: '{attr.source}', align: 'center', fontFamily: DIDOT,
        fontSize: pt(10), color: col('muted'),
        placement: { ...at('container', 'top', 0, 3.2 * LINE), size: { width: 'fill' } } },
    ] } } },
  { id: 'note-page', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(LEAD),
    header: { elements: [] }, advancedDesign: { enabled: true, minHeight: pt(3 * LEAD),
      slot: { elements: [{ kind: 'text', id: 'label', content: '{titleText}', align: 'center',
        ...caps(7.5, 1.6, 'rubric'), placement: { ...at('container', 'top', 0, LINE),
          size: { width: 'fill' } } }] } } },
];
// The author and the title over the versos, the translator over the rectos; folios outside.
const head = (id, content, parity, edge, x, extra = {}) => ({ kind: 'text', id, content, parity,
  pages: 'body', ...caps(7.5, 1.5), ...extra, placement: at('page', edge, x, 12) });
const folio = { textTransform: 'none', letterSpacing: pt(0), fontSize: pt(9), color: col('ink') };
const SHIFT = (INNER - OUTER) / 2; // mm: the text block's centre is off the page's centre
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
  head('verso-head', '{author} · {title}', 'even', 'top', -SHIFT),
  head('recto-head', '{subtitle}', 'odd', 'top', SHIFT),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };
```

يحوّل `textTransform: 'uppercase'` Ὀδύσσεια إلى ΟΔΥΣΣΕΙΑ وῬαψῳδία إلى ΡΑΨΩΔΙΑ: الحروف اليونانية الكبيرة لا تأخذ علامة نفس ولا نبرًا ولا يوتا تحتية، فيحذفها المحرك عند التنضيد. يفتح النمط `original` النص اليوناني في صفحة زوجية، والنمط `translation` الترجمة في الفردية المقابلة. ويفعل `:::pagebreak{parity="even"}` و`{parity="odd"}` الشيء نفسه للصفحتين المتقابلتين الثانيتين. يبقى نص العنوان ونص PDF كما كُتبا، بكل علاماتهما.

## الوصفة كاملة

ملف واحد، مركّب من مجلد الوصفة ومعه نص المثال وأدوات دليل الوصفات المشتركة مضمّنة؛ وهو ينشئ صفحته بنفسه. لتشغيله، ضعه داخل `<script type="module">` في صفحة فارغة أو الصقه في لوحة JS في مثال CodePen جديد (وحدةً). يستورد postext من esm.sh، فلا حاجة إلى تثبيت أو بناء.

- مجلد الوصفة: https://github.com/drnachio/postext/tree/main/cookbook/homer-polytonic-facing-translation

### script.js

```js
// ═══ Postext Cookbook · Nº 202 · Homer in polytonic Greek, facing its translation ═══════
// https://postext.dev/en/cookbook/homer-polytonic-facing-translation
// Code: MIT · Texts: Homer, Hesychius, A. Eftaliotis (PD, el.wikisource) · Pictures: none
// Fonts: GFS Didot (SIL OFL 1.1) · Needs postext ≥ 1.99.1
// The opening of the Odyssey on the versos, Eftaliotis's line-for-line modern Greek on the
// rectos, both numbered every fifth line, after a page of the Byzantine Life of Homer.
import { buildDocumentWithFonts, renderPageToCanvas } from 'https://esm.sh/postext';

const LANG = 'en'; // @lang: the language of the note on the text ('en' | 'es' | 'el')
const RECIPE = 'homer-polytonic-facing-translation';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// Black text on a warm white, and the dull red of a classical text's rubrics.
const palette = {
  ink: '#1c1a18', // the texts
  rubric: '#8c2f23', // line numbers, headings, rules
  muted: '#6b6359', // running heads, the note on the text, the colophon
  paper: '#fcfaf5',
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
  ...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
  { id: 'main-color', name: 'rubric (defaults)', value: { hex: palette.rubric, model: 'hex' } },
];
const DIDOT = 'GFS Didot'; // the Greek Font Society's Didot: polytonic, with its own Latin
const [BODY, LEAD] = [10.2, 15]; // pt
const LINE = (LEAD * 25.4) / 72; // mm: one line, 5.29
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region answer: Ancient Greek is 'grc', with the polytonic accents written in the text
// locale 'grc' takes the polytonic patterns, which read breathings, circumflexes, the iota
// subscript and the diaeresis as the letters they sit on (Πει-σι-στρά-του, ὀφ-θαλ-μῶν,
// ἀ-ναμ-φί-λε-κτα). Eftaliotis's modern Greek is written polytonic too; under 'el' a
// polytonic word would be divided by the same patterns, so the two pages hyphenate alike.
// The labels are the modern Greek ones (Εικόνα, Πίνακας), as for 'el'.
const LOCALE = 'grc';
// Fontsource cuts each face into files by script, and loadFonts adds latin and greek. The
// accented letters of polytonic Greek (ἀ ὃ ῷ, U+1F00–1FFF) are in a third file, greek-ext:
// each face takes it too before the build, so no letter falls to a system font.
async function loadGreekExtended(faces) {
  const jobs = Object.entries(faces).flatMap(([family, specs]) => specs.map(async (spec) => {
    const id = fontsourceId(family);
    const style = spec.endsWith('i') ? 'italic' : 'normal';
    const file = `${id}-greek-ext-${parseInt(spec, 10)}-${style}.woff2`;
    const url = `${await fontsourceAt(id)}files/${file}`;
    const face = new FontFace(family, `url(${url}) format('woff2')`,
      { weight: String(parseInt(spec, 10)), style, unicodeRange: 'U+1F00-1FFF' });
    document.fonts.add(await face.load());
  }));
  await Promise.all(jobs);
}
// #endregion

// #region page: a 14 × 21.5 cm classical text, 28 lines of 15 pt
const TRIM = { width: 140, height: 215 }; // mm
const [TOP, INNER, OUTER, LINES] = [22, 16, 21, 28];
const page = {
  width: mm(TRIM.width), height: mm(TRIM.height), dpi: 150, backgroundColor: col('paper'),
  margins: { top: mm(TOP), bottom: mm(TRIM.height - TOP - LINES * LINE),
    left: mm(INNER), right: mm(OUTER), mirror: true },
};
// 103 mm of measure: the longest line of Eftaliotis, 59 letters, sets in 97 mm at 10.2 pt,
// so no line turns over and the two pages of a spread keep their lines level.
// #endregion

// #region lines: every fifth line numbered at the outer edge, the count kept by each page
// Each page of verse is its own :::verse block. The Greek and the translation of a spread
// both open with {lineStart=11}, so the numbers on the two pages agree: restart 'poem'
// counts each block from its own start, and the epitaph, {numbered=false}, is not counted.
const lineNumbers = {
  enabled: true, count: 'verse', interval: 5, restart: 'poem', position: 'outer',
  gap: mm(6), fontFamily: DIDOT, fontSize: em(0.8), color: col('rubric'),
};
// #endregion

// #region verse: hexameters and fifteen-syllable lines, centred on the longest
// A blank space in the source would start a stanza: neither text has any, so each block
// is one run of lines. A line too long for the measure would turn over and hang 2 em in.
const verseStyle = { id: 'verse', hangingIndent: em(2) };
// #endregion

// #region heads: kicker and title in capitals, which drop breathings and accents
// textTransform 'uppercase' turns Ὀδύσσεια into ΟΔΥΣΣΕΙΑ and Ῥαψῳδία into ΡΑΨΩΔΙΑ: Greek
// capitals take no breathing, no accent and no iota subscript (a dialytika stays, Ϊ Ϋ).
const caps = (size, tracking, color = 'muted') => ({ fontFamily: DIDOT, fontSize: pt(size),
  letterSpacing: pt(tracking), textTransform: 'uppercase', color: col(color) });
const opener = (title) => ({ enabled: true, minHeight: pt(5 * LEAD), slot: { elements: [
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', align: 'center', ...caps(8, 2, 'rubric'),
    placement: { ...at('container', 'top', 0, LINE), size: { width: 'fill' } } },
  { kind: 'text', id: 'title', content: title, align: 'center', ...caps(17, 3.5, 'ink'),
    placement: { ...at('container', 'top', 0, 2.2 * LINE), size: { width: 'fill' } } },
] } });
// # Ὀδύσσεια {style="original"} opens a verso, {style="translation"} the recto facing it;
// a style sets its own break side (gotcha: style-inherits-break).
const headingStyles = [
  { id: 'original', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'translation', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: opener('{titleText}') },
  { id: 'life', breakBefore: { enabled: true, parity: 'odd' }, marginBottom: pt(0),
    advancedDesign: { enabled: true, minHeight: pt(6 * LEAD), slot: { elements: [
      { kind: 'text', id: 'title', content: '{titleText}', align: 'center', ...caps(15, 3, 'ink'),
        placement: { ...at('container', 'top', 0, 1.6 * LINE), size: { width: 'fill' } } },
      { kind: 'text', id: 'source', content: '{attr.source}', align: 'center', fontFamily: DIDOT,
        fontSize: pt(10), color: col('muted'),
        placement: { ...at('container', 'top', 0, 3.2 * LINE), size: { width: 'fill' } } },
    ] } } },
  { id: 'note-page', breakBefore: { enabled: true, parity: 'even' }, marginBottom: pt(LEAD),
    header: { elements: [] }, advancedDesign: { enabled: true, minHeight: pt(3 * LEAD),
      slot: { elements: [{ kind: 'text', id: 'label', content: '{titleText}', align: 'center',
        ...caps(7.5, 1.6, 'rubric'), placement: { ...at('container', 'top', 0, LINE),
          size: { width: 'fill' } } }] } } },
];
// The author and the title over the versos, the translator over the rectos; folios outside.
const head = (id, content, parity, edge, x, extra = {}) => ({ kind: 'text', id, content, parity,
  pages: 'body', ...caps(7.5, 1.5), ...extra, placement: at('page', edge, x, 12) });
const folio = { textTransform: 'none', letterSpacing: pt(0), fontSize: pt(9), color: col('ink') };
const SHIFT = (INNER - OUTER) / 2; // mm: the text block's centre is off the page's centre
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
  head('verso-head', '{author} · {title}', 'even', 'top', -SHIFT),
  head('recto-head', '{subtitle}', 'odd', 'top', SHIFT),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };
// #endregion

const config = () => ({
  locale: LOCALE, // written out, never LANG: the texts are Greek in every edition
  colorPalette, page, lineNumbers, header, headingStyles, footer: { elements: [] },
  layout: { layoutType: 'single' }, // the default is two columns
  bodyText: {
    fontFamily: DIDOT, fontSize: pt(BODY), lineHeight: pt(LEAD), color: col('ink'),
    boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
    firstLineIndent: em(1.5), indentAfterHeading: false, hyphenateAcrossColumns: false,
    maxWordSpacing: 1.6, minWordSpacing: 0.8, maxJustifyTracking: 10,
    verse: { indentStep: em(1) },
  },
  headings: { fontFamily: DIDOT, fontWeight: 400,
    levels: [{ level: 1, breakBefore: { enabled: true, parity: 'any' } }] },
  paragraphStyles: [verseStyle,
    // The note is in the edition's language, hyphenated with that language's patterns.
    { id: 'note', fontSize: pt(9), lineHeight: pt(13), color: col('muted'),
      italicColor: col('muted'), firstLineIndent: em(1.5), hyphenation: { locale: LANG } },
    { id: 'colophon', fontSize: pt(7.5), lineHeight: pt(10), color: col('muted'),
      textAlign: 'center', firstLineIndent: pt(0), marginTop: pt(LEAD),
      hyphenation: { enabled: false } },
  ],
});

// ─── 2 · Content ────────────────────────────────────────────────────────────
// The Life and the two spreads of verse (content.text.<lang>.md), then the note on the text
// in the edition's language (content.<lang>.md).
const markdown = [String.raw`---
title: "Ὀδύσσεια"
author: "Ὅμηρος"
subtitle: "Μετάφραση Ἀργύρη Ἐφταλιώτη"
---

# Βίος Ὁμήρου {style="life" source="Ἡσυχίου τοῦ Μιλησίου, ἐκ τῆς Σούδας"}

ποιήματα δ’ αὐτοῦ ἀναμφίλεκτα Ἰλιὰς καὶ Ὀδύσσεια. ἔγραψε δὲ τὴν Ἰλιάδα οὐχ ἅμα οὐδὲ κατὰ τὸ συνεχές, καθάπερ σύγκειται, ἀλλ’ αὐτὸς μὲν ἑκάστην ῥαψῳδίαν γράψας καὶ ἐπιδειξάμενος ἐν τῷ περινοστεῖν τὰς πόλεις τροφῆς ἕνεκεν ἀπέλιπεν. ὕστερον δὲ συνετέθη καὶ συνετάχθη ὑπὸ πολλῶν καὶ μάλιστα ὑπὸ Πεισιστράτου τοῦ τῶν Ἀθηναίων τυράννου. ἀναφέρεται δὲ εἰς αὐτὸν καὶ ἄλλα τινὰ ποιήματα, Ἀμαζονία, Ἰλιὰς μικρά, Νόστοι, Ἐπικιχλίδες, Ἠθιέπακτος ἤτοι Ἴαμβοι, Βατραχομυομαχία, Ἀραχνομαχία, Γερανομαχία, Κεραμίς, Ἀμφιαράου ἐξέλασις, παίγνια, Οἰχαλίας ἅλωσις, Ἐπιθαλάμια, Κύκλος, Ὕμνοι, Κύπρια.

γηραιὸς δὲ τελευτήσας ἐν τῇ νήσῳ τῇ Ἴῳ τέθαπται, τυφλὸς ἐκ παίδων γεγονώς, τὸ δ’ ἀληθὲς ὅτι οὐχ ἡττήθη ἐπιθυμίας, ἣ διὰ τῶν ὀφθαλμῶν ἄρχεται· καὶ παρὰ τοῦτο ἱστορήθη τυφλός. ἐπιγέγραπται δ’ ἐν τῷ τάφῳ αὐτοῦ τόδε τὸ ἐλεγεῖον, ὃ ὑπὸ τῶν Ἰητῶν ἐποιήθη χρόνῳ·

:::verse{numbered=false}
ἐνθάδε τὴν ἱερὰν κεφαλὴν κατὰ γαῖα καλύπτει,
ἀνδρῶν ἡρώων κοσμήτορα, θεῖον Ὅμηρον.
:::

# Ὀδύσσεια {style="original" kicker="Ῥαψῳδία α"}

:::verse
Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσε·
πολλῶν δ’ ἀνθρώπων ἴδεν ἄστεα καὶ νόον ἔγνω,
πολλὰ δ’ ὅ γ’ ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν,
ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων.
ἀλλ’ οὐδ’ ὣς ἑτάρους ἐρρύσατο, ἱέμενός περ·
αὐτῶν γὰρ σφετέρῃσιν ἀτασθαλίῃσιν ὄλοντο,
νήπιοι, οἳ κατὰ βοῦς Ὑπερίονος Ἠελίοιο
ἤσθιον· αὐτὰρ ὁ τοῖσιν ἀφείλετο νόστιμον ἦμαρ.
τῶν ἁμόθεν γε, θεά, θύγατερ Διός, εἰπὲ καὶ ἡμῖν.
:::

# Ὀδύσσεια {style="translation" kicker="Μετάφραση Ἀργύρη Ἐφταλιώτη"}

:::verse
Τὸν ἄντρα τὸν πολύπραγο τραγούδησέ μου, ὦ Μοῦσα,
ποὺ περισσὰ πλανήθηκε, σὰν κούρσεψε τῆς Τροίας
τὸ ἱερὸ κάστρο, καὶ πολλῶν ἀνθρώπων εἶδε χῶρες
κι ἔμαθε γνῶμες, καὶ πολλὰ στὰ πέλαα βρῆκε πάθια,
γιὰ μιὰ ζωὴ παλεύοντας καὶ γυρισμὸ συντρόφων.
Μὰ πάλε δὲν τοὺς γλύτωσε, κι ἂν τὸ ποθοῦσε, ἐκείνους,
τὶ ἀπὸ δική τους χάθηκαν οἱ κούφιοι ἀμυαλωσύνη,
τοῦ Ἥλιου τοῦ Ὑπερίονα σὰν ἔφαγαν τὰ βόδια,
κι αὐτὸς τοὺς πῆρε τὴ γλυκειὰ τοῦ γυρισμοῦ τους μέρα.
Ἀπ’ ὅπου ἂν τά ’χης, πές μας τα, ὦ θεά, τοῦ Δία κόρη.
:::

:::pagebreak{parity="even"}

:::verse{lineStart=11}
ἔνθ’ ἄλλοι μὲν πάντες, ὅσοι φύγον αἰπὺν ὄλεθρον,
οἴκοι ἔσαν, πόλεμόν τε πεφευγότες ἠδὲ θάλασσαν·
τὸν δ’ οἶον, νόστου κεχρημένον ἠδὲ γυναικός,
νύμφη πότνι’ ἔρυκε Καλυψώ, δῖα θεάων,
ἐν σπέεσι γλαφυροῖσι, λιλαιομένη πόσιν εἶναι.
ἀλλ’ ὅτε δὴ ἔτος ἦλθε περιπλομένων ἐνιαυτῶν,
τῷ οἱ ἐπεκλώσαντο θεοὶ οἶκόνδε νέεσθαι
εἰς Ἰθάκην, οὐδ’ ἔνθα πεφυγμένος ἦεν ἀέθλων
καὶ μετὰ οἷσι φίλοισι· θεοὶ δ’ ἐλέαιρον ἅπαντες
νόσφι Ποσειδάωνος· ὁ δ’ ἀσπερχὲς μενέαινεν
ἀντιθέῳ Ὀδυσῆϊ πάρος ἣν γαῖαν ἱκέσθαι.
ἀλλ’ ὁ μὲν Αἰθίοπας μετεκίαθε τηλόθ’ ἐόντας,
Αἰθίοπας, τοὶ διχθὰ δεδαίαται, ἔσχατοι ἀνδρῶν,
οἱ μὲν δυσομένου Ὑπερίονος, οἱ δ’ ἀνιόντος,
ἀντιόων ταύρων τε καὶ ἀρνειῶν ἑκατόμβης.
ἔνθ’ ὅ γε τέρπετο δαιτὶ παρήμενος· οἱ δὲ δὴ ἄλλοι
Ζηνὸς ἐνὶ μεγάροισιν Ὀλυμπίου ἁθρόοι ἦσαν.
:::

:::pagebreak{parity="odd"}

:::verse{lineStart=11}
Ὅλοι ποὺ τότες τὸν πολὺ τὸ χαλασμὸ ξεφύγαν
γυρίσανε, ἀπὸ πόλεμο καὶ θάλασσα σωσμένοι,
καὶ μόνο ἐκειόνε, σπιτικὸ καὶ ταίρι στερημένο,
ἡ Καλυψὼ ἡ τρισέμορφη θεὰ τόνε κρατοῦσε,
γιατὶ ἄντρα της τὸν ἤθελε στὶς βαθουλὲς σπηλιές της.
Μὰ ὁ γῦρος σὰν τελέστηκε τῶν χρόνων, κι ἦρθε ἡ ὥρα,
ποὺ τό ’χανε οἱ θεοὶ γραφτὸ στὸ Θιάκι νὰ ξανάρθη
στὸ σπιτικό του, μήτ’ ἐκεῖ δὲν τοῦ ’λειψαν οἱ ἀγῶνες,
καὶ σὲ δικοὺς κοντά. Κι οἱ θεοὶ τὸν συμπονοῦσαν ὅλοι,
ἐξὸν τὸν Ποσειδώνα· αὐτὸς βαριὰ ἦταν χολωμένος
μὲ τὸ Δυσσέα τὸ θεϊκό, στὸν τόπο του πρὶν φτάση.
Βρισκόταν στοὺς Αἰθίοπες ὁ Ποσειδώνας τότες,
ποὺ ζοῦνε μοιραστοὶ μακριὰ στοῦ κόσμου τὶς ἀκροῦλες,
στοῦ Ἡλιοῦ τὸ βούλημα οἱ μισοί, στ’ ἀνάβλεμμά του οἱ ἄλλοι,
γιὰ νὰ δεχτῆ ἑκατοβοδιὰ ἀπὸ ταύρους καὶ κριάρια.
Ἐκεῖ γλυκοξεφάντωνε· οἱ θεοὶ ὡς τόσο οἱ ἄλλοι
στοὺς πύργους μαζωχτήκανε τοῦ Δία τοῦ Ὀλυμπήσου,
:::
`, String.raw`# A note on the text {style="note-page"}

:::paragraphs{style="note"}
The opening of the Odyssey, lines 1–27 of Book I, faces the modern Greek of Argyris Eftaliotis (1849–1923), who rendered Homer line for line in the fifteen-syllable verse of the folk songs, so that each line of the translation stands level with its original. Both are polytonic: the Homer in the text of Greek Wikisource, the translation in Eftaliotis’s own spelling, from the same library, with one accent corrected. Before them stand the last two sections of the Life of Homer that the Suda keeps from Hesychius of Miletus (ed. A. Westermann, 1845), with four slips corrected, and the epitaph on Homer’s grave on Ios.
:::

:::paragraphs{style="colophon"}
Set in GFS Didot (SIL OFL) · Texts: Homer, Hesychius and A. Eftaliotis, public domain, from el.wikisource
:::
`].join('\n\n');

// ─── 3 · Fonts ──────────────────────────────────────────────────────────────
const FONTS = { 'GFS Didot': ['400'] }; // DIDOT: every text on the pages; it has one weight

// ─── 4 · Build & show ───────────────────────────────────────────────────────
await loadFonts(FONTS, markdown); // latin and greek
await loadGreekExtended(FONTS); // and the polytonic letters
const doc = await buildDocumentWithFonts({ markdown }, config(), kitFonts(FONTS));
showPages(doc, { title: 'Ὀδύσσεια · Ῥαψῳδία α' });

// ─── Kit ── helpers shared by every Cookbook recipe · postext.dev/cookbook ─────

// ─── Kit · core v1 ── the same in every recipe · postext.dev/cookbook
function mm(value) { return { value, unit: 'mm' }; }
function pt(value) { return { value, unit: 'pt' }; }
function em(value) { return { value, unit: 'em' }; }
/** The sample language's string: t({ en: 'Figure', es: 'Figura' }). */
function t(strings) { return strings[LANG] ?? Object.values(strings)[0]; }
/** A file in this recipe's assets folder, served from the Postext repo by jsDelivr. */
function asset(file) { return `https://cdn.jsdelivr.net/gh/drnachio/postext@main/cookbook/${RECIPE}/assets/${file}`; }

// ─── Kit · fonts v3 ── the same in every recipe · postext.dev/cookbook
// Postext loads the faces a config asks for before layout and asks the kit
// for Fontsource's files, the ones the PDF embeds too.

/** buildDocumentWithFonts' options: the resolver, and FONTS' faces loaded
 *  with the config's. FONTS = { 'Family Name': ['400', '400i', '700'] }. */
function kitFonts(FONTS = {}) {
  const faces = Object.entries(FONTS).flatMap(([family, specs]) => specs.map((spec) =>
    ({ family, weight: parseInt(spec, 10), style: spec.endsWith('i') ? 'italic' : 'normal' })));
  return { resolve: fontsourceResolver, faces };
}

/** A face's files with their ranges: latin, then latin-ext and greek when
 *  `text` needs them (kitSubsetsFor). Null for a face Fontsource lacks. */
async function fontsourceResolver(family, weight, style, { text = '' } = {}) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  if (meta && !(await fontsourceWeights(family, style)).includes(weight)) return null;
  kitStatus('Loading fonts…');
  const at = await fontsourceAt(id);
  return ['latin', ...kitSubsetsFor(text, meta)].map((subset) => ({
    source: `${at}files/${id}-${subset}-${weight}-${style}.woff2`,
    unicodeRange: kitRanges()[subset],
  }));
}

/** Each file's unicode-range (a function: the kit runs after the pen's code). */
function kitRanges() {
  return {
    latin: 'U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,'
      + 'U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD',
    'latin-ext': 'U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,'
      + 'U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF',
    greek: 'U+0370-03FF',
  };
}

/** For the cjk, arabic and comics blocks: loads `faces` (as FONTS) for the
 *  sample `text`; `optional` skips a face Fontsource lacks. Files are added in
 *  the order asked, the last winning a shared character. Resolves to the count. */
async function loadFonts(faces, text = '', { optional = false } = {}) {
  kitStatus('Loading fonts…');
  const ranges = kitRanges();
  const jobs = [];
  for (const [family, specs] of Object.entries(faces)) {
    const id = fontsourceId(family);
    const todo = [...new Set(specs)].map((spec) => [parseInt(spec, 10), spec.endsWith('i') ? 'italic' : 'normal'])
      .filter(([weight, style]) => !hasFace(family, weight, style)); // before any await
    const at = fontsourceAt(id);
    const meta = optional || /[^\0-ÿ]/u.test(text) ? await fontsourceMeta(family) : null;
    const subsets = ['latin', ...kitSubsetsFor(text, meta)];
    for (const [weight, style] of todo) {
      if (optional && !(meta && (await fontsourceWeights(family, style)).includes(weight))) continue;
      for (const subset of subsets) {
        const url = `${await at}files/${id}-${subset}-${weight}-${style}.woff2`;
        const face = new FontFace(family, `url(${url}) format('woff2')`,
          { weight: String(weight), style, unicodeRange: ranges[subset] });
        jobs.push(face.load().catch(() => {
          if (subset === 'latin' && !optional) throw new Error(`Fontsource has no ${family} ${weight} ${style}`);
        }));
      }
    }
  }
  const ready = await Promise.all(jobs).catch((error) => { kitFail(error); throw error; });
  return ready.filter((face) => face && document.fonts.add(face)).length;
}

/** A loaded FontFace covers this face (fonts.check() says yes to any family). */
function hasFace(family, weight, style) {
  for (const face of document.fonts) {
    if (face.status !== 'loaded' || face.style !== style) continue;
    if (face.family.replace(/^["']|["']$/g, '') !== family) continue;
    const [low, high = low] = face.weight.split(' ').map(Number);
    if (weight >= low && weight <= high) return true;
  }
  return false;
}

/** The files beyond latin `text` needs that `meta`'s family ships. */
function kitSubsetsFor(text, meta) {
  return [[/[Ā-˿ᴀ-ᶿḀ-ỿ†ℓⱠ-Ɀ꜠-ꟿ]/u, 'latin-ext'], [/[Ͱ-Ͽ]/u, 'greek']]
    .filter(([re, x]) => re.test(text) && meta?.subsets?.includes(x)).map(([, x]) => x);
}

/** Fontsource's id for a family: 'Source Serif 4' → 'source-serif-4'. */
function fontsourceId(family) { return family.toLowerCase().replace(/\s+/g, '-'); }

/** A package's folder at the one version @5 names now (#766). */
function fontsourceAt(id, u = `https://cdn.jsdelivr.net/npm/@fontsource/${id}@`) {
  return (fontsourceAt.c ??= {})[id] ??= fetch(u + '5/package.json').then((r) => r.json())
    .then((p) => p.version || 5, () => 5).then((v) => `${u}${v}/`);
}

/** The family's Fontsource metadata (weights, styles, subsets), or null. */
function fontsourceMeta(family, id = fontsourceId(family)) {
  return (fontsourceMeta.c ??= {})[id] ??= fetch(`https://api.fontsource.org/v1/fonts/${id}`)
    .then((res) => (res.ok ? res.json() : null), () => null);
}

/** The weights the package ships in `style`: the API pairs none (no Libre
 *  Caslon 700 italic file), so italics are read from latin-italic.css. */
function fontsourceWeights(family, style, id = fontsourceId(family)) {
  return (fontsourceWeights.c ??= {})[id + style] ??= fontsourceMeta(family).then(async (m) => {
    if (!m?.styles.includes(style)) return m ? [] : [400, 700];
    const css = style === 'italic' ? await fetch(`${await fontsourceAt(id)}latin-italic.css`).then((r) => (r.ok ? r.text() : ''), () => '') : '';
    const w = [...css.matchAll(/weight: (\d+)/g)].map((x) => +x[1]);
    return w.length ? w : m.weights;
  });
}

// ─── Kit · viewer v2 ── the same in every recipe · postext.dev/cookbook
/** The pages as spreads on a dark desk, page 1 alone, then verso | recto,
 *  each painted when it scrolls near. Other options go to renderPageToCanvas. */
function showPages(docs, { title, width = 460, ...render } = {}) {
  const root = viewer(title);
  const pages = [docs].flat().flatMap((doc) =>
    doc.pages.map((page) => ({ doc, page, n: (doc.pageIndexOffset ?? 0) + page.index })));
  const spreads = [];
  let verso = null;
  for (const p of pages) {
    if (p.n % 2 === 1) { if (verso) spreads.push([verso, null]); verso = p; }
    else { spreads.push([verso, p]); verso = null; }
  }
  if (verso) spreads.push([verso, null]);
  const density = Math.min(window.devicePixelRatio || 1, 2);
  showPages.painter?.disconnect();
  const painter = new IntersectionObserver((entries) => {
    for (const { isIntersecting, target } of entries) {
      if (!isIntersecting) continue;
      painter.unobserve(target);
      const { doc, page } = target.postext;
      renderPageToCanvas(page, doc, target, { ...render, scale: (width * density) / page.width });
    }
  }, { rootMargin: '800px' });
  showPages.painter = painter;
  root.replaceChildren(...spreads.map((pair) => {
    const spread = document.createElement('div');
    spread.className = 'pt-spread';
    for (const p of pair) {
      const figure = document.createElement('figure');
      if (p) {
        const label = p.page.pageLabel || String(p.n + 1);
        const canvas = document.createElement('canvas');
        canvas.postext = p;
        canvas.style.aspectRatio = `${p.page.width} / ${p.page.height}`;
        canvas.setAttribute('role', 'img');
        canvas.setAttribute('aria-label', `Page ${label}`);
        const folio = document.createElement('figcaption');
        folio.textContent = label;
        figure.append(canvas, folio);
        painter.observe(canvas);
      } else figure.className = 'pt-blank';
      spread.append(figure);
    }
    return spread;
  }));
  kitStatus(`${pages.length} ${pages.length === 1 ? 'page' : 'pages'}`);
  document.documentElement.dataset.postext = 'ready';
  return pages.length;
}

/** The desk, the bar and the error reporting, created once. */
function viewer(title) {
  if (!document.getElementById('pt-kit')) {
    document.head.insertAdjacentHTML('beforeend', `<style id="pt-kit">
      :root { color-scheme: dark; }
      body { margin: 0; background: #0e1014; color: #b9bcc4; font: 13px/1.45 system-ui, sans-serif; }
      #pt-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center;
        gap: 6px 16px; padding: 10px 16px; background: rgb(14 16 20 / .92); backdrop-filter: blur(6px);
        border-bottom: 1px solid #23262d; }
      #pt-bar strong { color: #f4f1ea; font-weight: 600; }
      #pt-actions { display: flex; gap: 12px; margin-left: auto; }
      #pt-actions a, #pt-actions button { color: #d8a21a; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
      #pages { display: grid; justify-items: center; gap: 48px; padding: 32px 16px 72px; }
      .pt-spread { display: flex; }
      .pt-spread figure { margin: 0; width: min(460px, 44vw); }
      .pt-spread canvas { display: block; width: 100%; background: #fff;
        box-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figure:first-child canvas { box-shadow: inset -14px 0 14px -14px rgb(0 0 0 / .18), 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figcaption { margin-top: 10px; text-align: center; font: 600 10px/1 system-ui, sans-serif;
        letter-spacing: .18em; text-transform: uppercase; color: #6c7079; }
      .pt-blank { visibility: hidden; }
      @media (max-width: 760px) {
        .pt-spread { flex-direction: column; gap: 32px; }
        .pt-spread figure { width: min(460px, 92vw); }
        .pt-blank { display: none; }
      }
    </style>`);
    document.body.insertAdjacentHTML('afterbegin',
      '<header id="pt-bar"><strong id="pt-title"></strong><span id="pt-status" role="status"></span><span id="pt-actions"></span></header>');
    document.getElementById('pt-title').textContent = document.title || 'Postext';
    addEventListener('error', (event) => kitFail(event.error ?? event.message));
    addEventListener('unhandledrejection', (event) => kitFail(event.reason));
  }
  if (title) document.getElementById('pt-title').textContent = title;
  return document.getElementById('pages')
    ?? document.body.appendChild(Object.assign(document.createElement('main'), { id: 'pages' }));
}

function kitStatus(text) {
  viewer();
  document.getElementById('pt-status').textContent = text;
}

function kitFail(error) {
  document.documentElement.dataset.postext = 'error';
  kitStatus(`Error: ${error?.message ?? error}`);
}

// ─── /Kit ───────────────────────────────────────────────────────────────────────
```

## أخطاء شائعة

- **يرث نمط العنوان فاصل الصفحة من مستواه.** يأخذ مُدخل headingStyles كل حقل يتركه من مستوى عنوانه، بما فيه breakBefore. فصفحة المحتويات أو صفحة بيانات النشر المنسّقة على H1 بعد :::pagebreak ترث الزوجية 'odd' وتقع بعد صفحة فارغة. أعطِ هذا النمط breakBefore: { enabled: false }.

- من دون ملف greek-ext يقع كل حرف صوتي منبور على خط من خطوط النظام نادرًا ما يتناسب. يفحص الالتقاط كل حرف على الملفات المحمّلة (C36) ويرفض مثل هذه الصفحة.
- لـGFS Didot وزن واحد ولا مائل لها: سيميل المُصيّر أي توكيد آليًا. لذلك تُنضد الملاحظة على النص بالقائم.
- مزوّد خطوط PDF في الطقم لا يحمّل إلا latin وgreek، فتعرض هذه الوصفة اللوحة ولا تقدّم PDF.
- يجب ألا يتجاوز أي بيت من الترجمة عرض السطر. فالبيت الذي ينكسر يدفع بقية الصفحة سطرًا إلى الأسفل، وتكف الصفحتان عن التقابل بيتًا ببيت؛ و103 مم بقياس 10,2 نقطة تتسع لأطول أبيات إفتاليوتيس، 59 حرفًا.

## الحقوق

- الوصفة: Ignacio Ferro ([@drnachio](https://github.com/drnachio))
- النص: Odyssey, Book I, lines 1–27, in the polytonic text of el.wikisource (revision 165777): Homer ([المصدر](https://el.wikisource.org/wiki/Οδύσσεια/α)), ملكية عامة
- النص: The modern Greek translation of the same lines, line for line, from el.wikisource (revision 166701), with one accent corrected: Argyris Eftaliotis ([المصدر](https://el.wikisource.org/wiki/Οδύσσεια_(Μετάφραση_Εφταλιώτη)/α)), ملكية عامة
- النص: Life of Homer, §§ 6–7 and the epitaph, from the Suda (ed. A. Westermann, 1845), via el.wikisource (revision 152483), with four slips corrected: Hesychius of Miletus ([المصدر](https://el.wikisource.org/wiki/Ησυχίου_Βίος_Ομήρου)), ملكية عامة
- النص: The note on the text and the colophon: Postext Cookbook, أصلي
- الخطوط: GFS Didot (OFL-1.1)
- الشيفرة: MIT · محتوى المثال: CC-BY-4.0

## وصفات ذات صلة

- [رقم 083 · قصائد تانغ مقابل نظمها الإنجليزي](https://postext.dev/ar/cookbook/tang-poems-facing-english.md): تفتح كل قصيدة من عصر تانغ صفحة فردية ملوّنة، ويفتح نظم Giles الإنجليزي الصفحة الزوجية المقابلة: نمط عنوان يقفز إلى صفحة زوجية والآخر إلى فردية. · المستوى 2 (متوسط) · الشعر
- [رقم 044 · طبعة محقّقة: أرقام الأسطر وحواشٍ مرتبطة بها](https://postext.dev/ar/cookbook/critical-edition-line-numbers.md): قصيدة Lycidas لملتون بنص 1645: تعدّ lineNumbers أسطر الشعر وتطبع رقم كل سطر خامس في العمود الجانبي، وكل حاشية تبدأ برقم سطرها منضّدًا شارةً. · المستوى 3 (متقدم) · الشعر
- [رقم 043 · ترجمة متقابلة، مقطعًا بمقطع](https://postext.dev/ar/cookbook/bilingual-facing-verse.md): كل قصيدة إطار بلا حدود فيه عمودان: فاصل عمود ثابت يفتح النص الإنجليزي عند عنوانه، و:::space يُبقي كل مقطع على مستوى أصله. · المستوى 2 (متوسط) · الشعر
