انتقل إلى المحتوى الرئيسي
الوصفة رقم 158

دليل الوصفات · الفصل 12 · الكتب المدرسية

خط زمني مصوَّر على صفحتين متقابلتين

قالب صفحتين متقابلتين ينضّد الخط الزمني لكتاب مدرسي: شريط يعبر الكعب، وشبكة تكرّر بطاقة لكل تاريخ، وموصِّل ينزل إلى كل بطاقة.

في هذه الصفحة
المُخرَج
Canvas · PDF
المستوى
متقدم
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.49.0 · postext-pdf ≥ 1.49.0
الترخيص
حُدّثت في 21 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0

ص 48–49 · 1–2 من 2

  • نموذج باللغة الإسبانية: لا توجد طبعة عربية بعد
  • مقاس القص 210 × 280 مم
  • عمود واحد
  • Literata 12.4/17
  • Archivo
  • صفحتان
  • المستوى
  • Postext 1.65.0
  • أُخرجت في 143 ms
  • أسطر الشيفرة: 187

باختصار

صفحتان متقابلتان من كتاب تاريخ تُنضَّدان كأنهما صفحة واحدة: شريط ملوّن يعبر وسط الكتاب، وتتدلّى منه ست بطاقات مصوّرة، والقالب يرسم بطاقة واحدة وخطًّا واحدًا مهما كان عدد التواريخ.

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

الصفحتان 48 و49 من كتاب تاريخ للمرحلة الإعدادية: «طريق الورق»، ألف عام من الصنعة من ورشة تساي لون إلى حجر الطحن عند كيلر. تبدأ الصفحة اليسرى بالعنوان وفقرتين، وتبدأ اليمنى بإطار يشرح كيف كانت الورقة تُصنع باليد. ويمرّ الخط الزمني في الوسط: شريط نيلي لآسيا وشريط بلون الطين المحروق لأوروبا، يبدأ في الصفحة اليسرى ويعبر الكعب. وتحته ست بطاقات لكلٍّ منها رسمها، معلّقة بالشريط بحلقة وخط نازل. لا يرسم القالب إلا بطاقة آسيوية وبطاقة أوروبية وموصِّلًا لكل شريط: تضع الشبكة بطاقة لكل تاريخ في Markdown، ويجد الموصِّل كل بطاقة وضعتها الشبكة. كل الكلمات في Markdown، بالإسبانية والإنجليزية واليابانية، وتعرض هذه الصفحة الطبعة الإسبانية.

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

  • كيف أنضّد خطًّا زمنيًّا على صفحتين متقابلتين، بشريط يعبر الكعب وبطاقات على الصفحتين؟
  • كيف أجعل صفًّا من الصناديق يتقاسم عرضه، فيتّسع الصندوق ذو النص الأطول؟

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

script.js · الأسطر 54–81في الشيفرة الكاملة
const pageTemplates = [{
  id: 'timeline',
  spread: true, // two facing pages laid as one sheet; it opens on a verso
  gutter: mm(10), // the band round the spine that frames keep off
  grid: { columns: 2, rows: ROWS, columnGap: mm(2 * PAGE.inner), rowGap: mm(ROW_GAP) },
  frames: [
    { name: 'title', takes: 'h1' },
    { name: 'lead', flow: true, fit: { minScale: 0.8 } },
    { name: 'box', style: 'box', grid: { col: 2, row: 1, rows: 4 }, height: 'fill',
      padding: { right: mm(66) }, fit: { minScale: 0.85 } },
    { name: 'box-picture', layer: 2, width: mm(56), placement: at('#box', 'top-right', -5, 10) },
    { name: 'band-1', style: 'band-asia', grid: { col: 1, row: 5 }, height: mm(BAND) },
    { name: 'band-2', style: 'band-europe', crossGutter: true, width: 'fill', height: mm(BAND),
      padding: { left: mm(2 * PAGE.inner + 4) }, // the colour crosses the fold, the words do not
      placement: at('#band-1', 'right-of') },
    card('asia', 'card-asia'), card('europe', 'card-europe'),
    { name: 'colophon', style: 'colophon', optional: true, width: mm(170),
      placement: at('page', 'bottom-right', -PAGE.outer, -7) },
  ],
  groups: [
    { name: 'opening', kind: 'stack', grid: { col: 1, row: 1, rows: 4 }, gap: mm(4),
      frames: ['title', 'lead'] },
    // A row of cards under each band, as many as the Markdown has: a longer text makes its
    // row taller, and the other cards of the row stretch to the same height.
    row('asia', 1), row('europe', 2),
  ],
  decoration: { elements: [ground(), ticks('band-1', 'asia'), ticks('band-2', 'europe')] },
}];

المكونات

الخطوط
Literata, Archivo, Noto Serif JP, Noto Sans JP (SIL OFL 1.1)
الأصول
  • forma-800.jpg
  • v105-1000.jpg
  • v1150-1000.jpg
  • v1282-1000.jpg
  • v1844-1000.jpg
  • v610-1000.jpg
  • v751-1000.jpg
  • A Han court official watches a craftsman lift a bamboo mould from a vat. (Generated With Diffusion Models, أصلي)
  • A monk shows two Japanese courtiers how to hold a papermaking mould. (Generated With Diffusion Models, أصلي)
  • Papermakers by a canal in Samarkand, sheets drying on a wall. (Generated With Diffusion Models, أصلي)
  • A paper workshop below the castle of Xàtiva. (Generated With Diffusion Models, أصلي)
  • A Fabriano mill with its water wheel; a sheet held up to the light. (Generated With Diffusion Models, أصلي)
  • A craftsman grinds a spruce log against a stone into wood pulp. (Generated With Diffusion Models, أصلي)
  • Two hands lift a papermaker's mould from a vat of pulp. (Generated With Diffusion Models, أصلي)

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

#1 · ورقة واحدة لصفحتين

script.js · الأسطر 54–81في الشيفرة الكاملة
const pageTemplates = [{
  id: 'timeline',
  spread: true, // two facing pages laid as one sheet; it opens on a verso
  gutter: mm(10), // the band round the spine that frames keep off
  grid: { columns: 2, rows: ROWS, columnGap: mm(2 * PAGE.inner), rowGap: mm(ROW_GAP) },
  frames: [
    { name: 'title', takes: 'h1' },
    { name: 'lead', flow: true, fit: { minScale: 0.8 } },
    { name: 'box', style: 'box', grid: { col: 2, row: 1, rows: 4 }, height: 'fill',
      padding: { right: mm(66) }, fit: { minScale: 0.85 } },
    { name: 'box-picture', layer: 2, width: mm(56), placement: at('#box', 'top-right', -5, 10) },
    { name: 'band-1', style: 'band-asia', grid: { col: 1, row: 5 }, height: mm(BAND) },
    { name: 'band-2', style: 'band-europe', crossGutter: true, width: 'fill', height: mm(BAND),
      padding: { left: mm(2 * PAGE.inner + 4) }, // the colour crosses the fold, the words do not
      placement: at('#band-1', 'right-of') },
    card('asia', 'card-asia'), card('europe', 'card-europe'),
    { name: 'colophon', style: 'colophon', optional: true, width: mm(170),
      placement: at('page', 'bottom-right', -PAGE.outer, -7) },
  ],
  groups: [
    { name: 'opening', kind: 'stack', grid: { col: 1, row: 1, rows: 4 }, gap: mm(4),
      frames: ['title', 'lead'] },
    // A row of cards under each band, as many as the Markdown has: a longer text makes its
    // row taller, and the other cards of the row stretch to the same height.
    row('asia', 1), row('europe', 2),
  ],
  decoration: { elements: [ground(), ticks('band-1', 'asia'), ticks('band-2', 'europe')] },
}];

يجعل spread: true القالبَ ورقةً واحدة بعرض الصفحتين، وتذكر كتلة الصفحة الشيء نفسه بـspread. تبدأ الصفحتان المتقابلتان من صفحة زوجية، لذلك يتلقى التنضيد continuation: { pageIndexOffset: 1, pageNumbering: { startAt: 48 } }: الصفحة الأولى من هذا المقتطف هي الصفحة 48 من الكتاب، وهي صفحة يسرى، فلا تسبقها صفحة بيضاء. للشبكة عمود لكل صفحة، وبين العمودين ضعف الهامش الداخلي، فلا يقترب من الطيّة إلا الشريط. وللشريط الثاني crossGutter وحشوة يسرى من 36 مم: يمتدّ لونه من نهاية الشريط الأول عبر الكعب، وتبدأ كلماته في الصفحة اليمنى، حيث يقرؤها التنضيد.

#2 · بطاقة واحدة تكرّرها شبكة

script.js · الأسطر 46–50في الشيفرة الكاملة
// Each `:::frame{slot="asia"}` of the page is an item of the `asia` grid: the grid lays the
// card frame once per item, three to a row, and names the copies `#asia[1]`, `#asia[2]`…
const card = (name, style) => ({ name, style, minHeight: mm(CARD) }); // auto above that height
const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 3, columnGap: mm(5),
  grid: { col, row: 6, rows: ROWS - 5 }, repeat: { frames: [name] } });

مجموعة من نوع kind: 'grid' مع repeat: { frames: ['asia'] } تضع الإطار asia مرة لكل :::frame{slot="asia"} في الصفحة، ثلاثًا في كل صف، في الخلية col: 1 من شبكة القالب، من الصف 6 إلى الصف 12. تُسمّى النسخ #asia[1] و#asia[2] و#asia[3]، وتأخذ كلٌّ منها label كتلتها، أي التاريخ المكتوب على لسانها. ارتفاع البطاقة minHeight على الأقل، وفوق ذلك auto: إذا طال نص، كنص 1844 في الطبعتين الإسبانية واليابانية، طال صفّه، وامتدّت بطاقات الصف الأخرى إلى الارتفاع نفسه (قيمة rowAlign الافتراضية 'stretch'). وتاريخ رابع في Markdown يفتح صفًّا ثانيًا تحت الأول من غير أن يتغيّر القالب.

#3 · موصِّل لكل شريط

script.js · الأسطر 85–91في الشيفرة الكاملة
// `routing: 'tree'` with `trunk: 0` draws no bar of its own: each drop hangs from the band's
// foot straight down to the middle of a card's top, and `#asia[*]` names every card laid.
function ticks(band, cards) {
  return { kind: 'connector', id: `${cards}-ticks`, routing: 'tree', trunk: 0,
    from: { to: `#${band}`, side: 'bottom', gap: mm(2.4) }, to: { to: `#${cards}[*]`, side: 'top' },
    color: col(cards), width: pt(1), startCap: 'ring', capSize: mm(3.6) };
}

الخطوط النازلة connector واحد لكل شريط في زخرفة القالب (decoration). يصل routing: 'tree' أصلًا واحدًا بفروع كثيرة؛ ومع trunk: 0 لا يرسم قضيبًا خاصًّا به، بل خطًّا مستقيمًا من أسفل الشريط إلى منتصف الحافة العليا لكل بطاقة، ويضع startCap: 'ring' حلقة في رأس كل خط، على بعد 2.4 مم تحت الشريط (gap). والحلقة نقطة مجوّفة تُرسم بعرض الخط، قطرها من الخارج 3.6 مم (capSize)، ويقف الخط عند حافتها فتظهر الأرضية الكريمية في جوفها. يدلّ #asia[*] على كل البطاقات التي وضعتها الشبكة في الصفحة، فإذا أُضيف تاريخ في Markdown أو حُذف أُضيف خطه أو حُذف. تُوضع الموصِّلات بعد الإطارات، فإذا طال صف بقيت الخطوط تصل إلى البطاقات. والأرضية الكريمية زخرفة أيضًا: صندوق مربوط بأسفل منطقة النزف يصل ارتفاعه إلى أسفل #band-1 (size: { height: { to: '#band-1', edge: 'bottom' } })، فيتبع الشريط.

#4 · رسوم بمقاس الطباعة

script.js · الأسطر 253–295في الشيفرة الكاملة
const ART = {
  v105: t({ es: 'Un funcionario de la corte Han mira cómo un artesano saca de la tina un molde '
      + 'de bambú lleno de pasta, junto a corteza, trapos y redes viejas.',
    en: 'A Han court official watches a craftsman lift a bamboo mould full of pulp from a vat, '
      + 'beside bark, rags and old nets.',
    ja: '漢の役人が見守るなか、職人が竹のすき枠を漉き舟から引き上げる。そばに樹皮、ぼろ布、古い網。' }),
  v610: t({ es: 'Un monje enseña a dos cortesanos japoneses a sostener el molde sobre una tina, '
      + 'con ramas de kozo en una estera.',
    en: 'A monk shows two Japanese courtiers how to hold the mould over a tub, with kozo '
      + 'branches on a mat.',
    ja: '僧が二人の宮廷人に、桶の上ですき枠を持つ手つきを見せる。むしろの上に楮の枝。' }),
  v751: t({ es: 'Papeleros de Samarcanda junto a un canal; las hojas se secan al sol contra un '
      + 'muro de adobe.',
    en: 'Samarkand papermakers by a canal; the sheets dry in the sun against a mud-brick wall.',
    ja: '水路のそばで働くサマルカンドの紙すき職人。日干しれんがの壁に紙が張られて乾いている。' }),
  v1150: t({ es: 'Un taller de Xàtiva bajo el castillo: un operario golpea trapos en una pila '
      + 'de piedra y las hojas cuelgan de cuerdas.',
    en: 'A workshop in Xàtiva below the castle: a worker pounds rags in a stone trough and the '
      + 'sheets hang on ropes.',
    ja: '城の下のシャティバの工房。職人が石の槽でぼろ布をたたき、紙が綱につるされている。' }),
  v1282: t({ es: 'Un molino de Fabriano con su rueda hidráulica y sus mazos; un papelero mira '
      + 'una filigrana al trasluz.',
    en: 'A Fabriano mill with its water wheel and hammers; a papermaker holds a watermark up '
      + 'to the light.',
    ja: '水車と木づちのあるファブリアーノの製紙場。職人が紙を光にかざして透かしを見ている。' }),
  v1844: t({ es: 'Un artesano aprieta un tronco de abeto contra una muela que gira; debajo se '
      + 'amontonan las fibras.',
    en: 'A craftsman presses a spruce log against a turning grindstone; the fibres pile up '
      + 'below.',
    ja: '職人がトウヒの丸太を回る砥石に押し当て、その下に木の繊維が積もっていく。' }),
  forma: t({ es: 'Dos manos sacan de la tina el molde con una capa fina de fibras.',
    en: 'Two hands lift the mould from the vat with a thin layer of fibres on it.',
    ja: '両手ですき枠を引き上げる。網の上に繊維の薄い層ができている。' }),
};
const SIZE = { forma: [800, 800, 363] }; // pixels and ppi: 56 mm wide; the cards' are 46 mm
const resources = await Promise.all(Object.entries(ART).map(async ([id, altText]) => {
  const px = SIZE[id] ?? [1000, 667, 550];
  const fileId = `${id}-${px[0]}.jpg`;
  await loadImage(fileId, asset(fileId));
  return { id, typeId: 'picture', kind: 'bitmap', caption: '', altText, createdAt: 0,
    updatedAt: 0,
    bitmap: { fileId, format: 'jpeg', width: px[0], height: px[1], resolution: px[2] } };
}));

عرض الرسوم 1000 بكسل بدقة 550 نقطة في البوصة، أي 46 مم على الصفحة، ولا تُكبَّر الصورة أبدًا. وعرض كل عمود من أعمدة الشبكة الثلاثة المتساوية 56.3 مم في كل صفحة، فيتّسع كل رسم بمقاسه داخل حشوة بطاقته البالغة 3.5 مم، ويبقى سائر البطاقة للنص.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 158 · An illustrated timeline across a double page ═══════
// https://postext.dev/en/cookbook/illustrated-timeline-spread
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Literata, Archivo, Noto Serif JP, Noto Sans JP (SIL OFL 1.1) · Needs postext ≥ 1.49.0
import {
  buildDocument, withLoadedFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'es'; // @lang: the language of the sample document ('es' | 'en' | 'ja')
const RECIPE = 'illustrated-timeline-spread';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: one ink, an accent for each half of the timeline, a pale ground
const palette = {
  ink: '#22201d', // text
  asia: '#2f4f7a', // indigo: the Asian half of the timeline
  europe: '#a2412a', // terracotta: the European half
  ground: '#f1ebdf', // the cream under the cards
  rule: '#c9bfae', // hairlines and the card borders
  muted: '#6b6359', // running heads and the colophon
  paper: '#ffffff',
};
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: 'europe (defaults)', value: { hex: palette.europe, model: 'hex' } },
];
// #endregion

const JA = LANG === 'ja';
const SERIF = JA ? 'Noto Serif JP' : 'Literata';
const SANS = JA ? 'Noto Sans JP' : 'Archivo';
// A Western textbook page is 210 × 280 mm; a Japanese one is AB判, 210 × 257 mm.
const PAGE = { w: 210, h: JA ? 257 : 280, top: 22, bottom: 20, inner: 16, outer: 15 };
const ROWS = 12;
const ROW_GAP = 3;
const ROW = (PAGE.h - PAGE.top - PAGE.bottom - (ROWS - 1) * ROW_GAP) / ROWS; // one grid row, mm
const BAND = 9; // the timeline band, in grid row 5
const CARD_TOP = 5 * (ROW + ROW_GAP); // grid row 6
// The drawn height of a card; 16 mm of the area stay free for a longer text.
const CARD = PAGE.h - PAGE.top - PAGE.bottom - CARD_TOP - 16;
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region cards: one card frame per row, repeated by a grid once for each card of the Markdown
// Each `:::frame{slot="asia"}` of the page is an item of the `asia` grid: the grid lays the
// card frame once per item, three to a row, and names the copies `#asia[1]`, `#asia[2]`…
const card = (name, style) => ({ name, style, minHeight: mm(CARD) }); // auto above that height

يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)

تنويعات

#أربع بطاقات في الصف

مع columns: 4 يحمل كل شريط أربعة تواريخ متجاورة؛ تضيق البطاقات وتطول نصوصها، فتطول الصفوف إلى الأسفل.

-const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 3, columnGap: mm(5),
+const row = (name, col) => ({ name: `${name}-row`, kind: 'grid', columns: 4, columnGap: mm(5),

#أسهم بدل الحلقات

يضع endCap: 'arrow' رأس سهم حيث يلتقي كل خط ببطاقته، ويزيل startCap: 'none' الحلقات.

أخطاء شائعة

  • تضع الشبكة خلية لكل عنصر، والعنصر كتلة :::frame{slot="asia"} مستقلة: نصّا بطاقتين داخل كتلة واحدة يصنعان بطاقة واحدة.
  • #asia من غير [*] هو صندوق الشبكة لا بطاقاتها: الموصِّل إليه يرسم خطًّا واحدًا إلى منتصف الصف.
  • الحجم الذي يمتد إلى حافة مستطيل آخر يُحسب من موضع ربط العنصر نفسه: الأرضية مربوطة بأسفل منطقة النزف وتنمو إلى الأعلى حتى #band-1. والحافة التي تقع خلف موضع الربط تعطي ارتفاعًا يساوي 0.

الحقوق

الوصفة
Ignacio Ferro
النص
  • The paper road, a double-page timeline written for this recipe in Spanish, English and Japanese · Postext Cookbook · CC BY 4.0
الصور
  • A Han court official watches a craftsman lift a bamboo mould from a vat. · Generated With Diffusion Models · أصلي
  • A monk shows two Japanese courtiers how to hold a papermaking mould. · Generated With Diffusion Models · أصلي
  • Papermakers by a canal in Samarkand, sheets drying on a wall. · Generated With Diffusion Models · أصلي
  • A paper workshop below the castle of Xàtiva. · Generated With Diffusion Models · أصلي
  • A Fabriano mill with its water wheel; a sheet held up to the light. · Generated With Diffusion Models · أصلي
  • A craftsman grinds a spruce log against a stone into wood pulp. · Generated With Diffusion Models · أصلي
  • Two hands lift a papermaker's mould from a vat of pulp. · Generated With Diffusion Models · أصلي
الخطوط
Literata (SIL OFL 1.1) · Archivo (SIL OFL 1.1) · Noto Serif JP (SIL OFL 1.1) · Noto Sans JP (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
SandboxPDF