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

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

صفحة ألغاز بإجابات مقلوبة

صفحة الألغاز في مجلة للأطفال: كلمات متقاطعة، وبحث عن الكلمات، ولغز، وقصة للترتيب وغيرها، كلٌّ في بطاقة وإجاباته مطبوعة مقلوبة تحته.

في هذه الصفحة
المُخرَج
Canvas · PDF
المستوى
متوسط
Postext
اختُبرت مع Postext 1.59.0
تتطلب ≥ 1.59.0 · postext-pdf ≥ 1.59.0
الترخيص
حُدّثت في 24 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 210 × 280 مم
  • عمودان, فاصل 7 مم بين الأعمدة
  • Nunito 10.5/15
  • Baloo 2
  • Fredoka
  • صفحتان
  • المستوى
  • Postext 1.59.0
  • أُخرجت في 71 ms
  • أسطر الشيفرة: 129

باختصار

صفحة الألغاز في مجلة للأطفال عن البحر. لكل لعبة بطاقتها، وإجاباتها مطبوعة مقلوبة تحتها، فيدير القارئ المجلة ليتحقق منها.

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

صفحة الألغاز في Splash!، مجلة للأطفال عن البحر، على صفحتين بمقاس A4 بعمودين. تملأ لوحة الشعاب المرجانية أعلى الصفحة الأولى، والعنوان فوق الماء المفتوح. وتحتها تأخذ كل لعبة بطاقة بلون القشدة برقم مرجاني: كلمات متقاطعة من ستة حيوانات بحرية وتعريفاتها، وبحث عن الكلمات يخفي ثماني كلمات أفقيًا وعموديًا وقطريًا ومعكوسة، ولغز بثلاثة خيارات يُحاط الصحيح منها بدائرة، وحياة سلحفاة تُرتَّب مراحلها، ومعلومة مبعثرة الكلمات، وصغار حيوانات تُوصَل بأسمائها. وتحت كل لعبة، داخل بطاقتها، تُطبع الإجابات مقلوبة بحروف رمادية صغيرة، كما خبّأتها مجلات الألغاز دائمًا.

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

  • كيف أصنع شبكة بحث عن كلمات أو كلمات متقاطعة من قائمة كلمات؟
  • كيف أطبع الإجابات مقلوبة أسفل التمرين؟

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

script.js · الأسطر 33–59في الشيفرة الكاملة
// placement 'inverted' sets each puzzle's key after it in a box turned 180°, inside the
// puzzle's card, so a page break never parts a puzzle from its answers. The key is made
// from the puzzle: the crossword's words by number, the ringed option, the right order.
const puzzle = {
  id: 'puzzle',
  box: 'card', // the card each puzzle sits on (a calloutStyles id)
  number: { shape: 'disc', fontFamily: DISPLAY, background: col('coral') },
  instruction: { fontFamily: TEXT, bold: false },
  options: { marker: 'circle', labels: 'none' }, // a ring to colour in, no letters
  grid: { fontFamily: LABEL, rule: col('sea'), cell: em(1.45) },
  match: { color: col('sea') },
  area: { kind: 'lines', color: col('sea') },
  answers: { color: col('coral'), fontFamily: LABEL },
  solutions: { placement: 'inverted', box: 'turned' },
  marginTop: mm(0), marginBottom: mm(0),
};
const card = { id: 'card', title: '', background: col('card'), borderRadius: mm(4),
  padding: { top: mm(3.5), right: mm(4), bottom: mm(3), left: mm(4) },
  titleStyle: { fontFamily: DISPLAY, fontSize: pt(15), fontWeight: 700, color: col('ink') },
  body: { fontFamily: TEXT, fontSize: pt(10.5), lineHeight: pt(15), color: col('ink'),
    firstLineIndent: pt(0) },
  marginTop: mm(0), marginBottom: mm(5), keepTogether: true };
const turned = { id: 'turned', title: '', backgroundEnabled: false, border: { enabled: false },
  padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
  body: { fontFamily: LABEL, fontSize: pt(8.5), lineHeight: pt(11), color: col('muted'),
    firstLineIndent: pt(0) },
  marginTop: mm(2), marginBottom: mm(0) };

المكونات

الخطوط
Baloo 2, Nunito, Fredoka (SIL OFL 1.1)
الأصول
  • hatchling-600.jpg
  • reef-1600x792.jpg
  • A coral reef with a smiling sea turtle, an octopus, a clownfish, a pufferfish and a seahorse under sunbeams. (Generated With Diffusion Models, أصلي)
  • A baby sea turtle hatching from its egg on the sand. (Generated With Diffusion Models, أصلي)

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

#1 · كل لعبة في بطاقة، وإجاباتها مقلوبة

الشيفرة هي الجواب المختصر أعلاه. يسمّي box في نمط التمرين نمطَ صندوق، فتُنضَّد كل لعبة على بطاقة، رقمها في قرص وعنوانها في السطر الأول من تعليمتها. ويضع placement: 'inverted' الإجابات بعد كل لعبة في صندوق مُدار 180° داخل البطاقة، فلا تقع اللعبة وإجاباتها في صفحتين مختلفتين أبدًا؛ وتبقى الشبكات وسطر الكتابة داخل الحشوة الداخلية للبطاقة.

#2 · دع المحرّك يبني الشبكات

لا يحمل Markdown إلا الكلمات: - OCTOPUS: Eight arms and three hearts للكلمات المتقاطعة، و- SHELL للبحث عن الكلمات. يرصّ المحرك الكلمات المتقاطعة بحيث تتقاطع كل كلمة مع أخرى، ويرقّم البدايات بترتيب القراءة. ويخفي كلمات البحث في الاتجاهات التي تسمّيها الكتلة (directions="across down diagonal backwards")، ويملأ الباقي بحروف الكلمات نفسها. وللشبكتين بذرة ثابتة، فتخرج كل شبكة كما هي في كل تنضيد وفي كل مُخرَج، وتبني الطبعة الإسبانية شبكتها من كلماتها.

#3 · شعاب مرجانية عبر العمودين

script.js · الأسطر 63–82في الشيفرة الكاملة
const BAND = 104; // mm from the top edge: the painting's height at the page's width
const opener = { enabled: true, minHeight: mm(BAND - 16 + 6), slot: { elements: [
  { kind: 'image', id: 'reef', resourceId: 'reef', decorative: true, reserve: false,
    placement: { anchor: { to: 'page', edge: 'top-left' },
      size: { width: mm(210), height: mm(BAND) } } },
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', fontFamily: LABEL, fontSize: pt(11),
    fontWeight: 600, color: col('paper'), textTransform: 'uppercase', letterSpacing: pt(2),
    box: { backgroundColor: col('coral'), borderRadius: mm(2),
      padding: { top: mm(0.8), bottom: mm(0.8), left: mm(2.4), right: mm(2.2) } },
    placement: { anchor: { to: 'page', edge: 'top-left' }, offset: { x: mm(16), y: mm(14) } } },
  { kind: 'text', id: 'title', content: '{titleText}', fontFamily: DISPLAY, fontSize: pt(56),
    fontWeight: 800, lineHeight: 1, color: col('paper'),
    placement: { anchor: { to: '#kicker', edge: 'below' }, offset: { x: mm(0), y: mm(3) } } },
  { kind: 'text', id: 'sub', content: '{attr.sub}', fontFamily: TEXT, fontSize: pt(12),
    fontWeight: 700, color: col('paper'), overflow: 'wrap', align: 'left',
    box: { backgroundColor: col('ink'), borderRadius: mm(2),
      padding: { top: mm(1.5), bottom: mm(1.5), left: mm(3), right: mm(3) } },
    placement: { anchor: { to: '#title', edge: 'below' }, offset: { x: mm(0), y: mm(2) },
      size: { width: mm(110) } } },
] } };

يمتد الافتتاح على العمودين (span: 'page')، فتبدأ الألعاب تحت اللوحة في كل عمود. والصورة مقصوصة على نسب الشريط ومثبتة بالصفحة، فتمتد إلى النزف من الأعلى والجانبين؛ والمقدمة في صندوق داكن لتُقرأ فوق الماء.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 174 · A puzzle page with the answers upside down ═══════
// https://postext.dev/en/cookbook/puzzle-page-upside-down-answers
// Code: MIT · Text: original (CC BY 4.0) · Pictures: generated with diffusion models
// Fonts: Baloo 2, Nunito, Fredoka (SIL OFL 1.1) · Needs postext ≥ 1.59.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'puzzle-page-upside-down-answers';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: reef colours: deep blue ink, coral, sea green, a sandy paper
const palette = {
  ink: '#16324a', // text: a deep sea blue
  coral: '#e8573f', // the accent: puzzle numbers, the title kicker
  sea: '#0f8b8d', // the second: crossword and word-search rules, the riddle's rings
  sun: '#ffc93c', // the turtle card's badge
  card: '#fff4e0', // the puzzle cards
  muted: '#5d7180', // answers, colophon, folio
  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: 'accent (defaults)', value: { hex: palette.coral, model: 'hex' } },
];
// #endregion
const [DISPLAY, TEXT, LABEL] = ['Baloo 2', 'Nunito', 'Fredoka'];

// #region answer: every puzzle on a card, its answers turned upside down under it
// placement 'inverted' sets each puzzle's key after it in a box turned 180°, inside the
// puzzle's card, so a page break never parts a puzzle from its answers. The key is made
// from the puzzle: the crossword's words by number, the ringed option, the right order.
const puzzle = {
  id: 'puzzle',
  box: 'card', // the card each puzzle sits on (a calloutStyles id)
  number: { shape: 'disc', fontFamily: DISPLAY, background: col('coral') },
  instruction: { fontFamily: TEXT, bold: false },
  options: { marker: 'circle', labels: 'none' }, // a ring to colour in, no letters
  grid: { fontFamily: LABEL, rule: col('sea'), cell: em(1.45) },
  match: { color: col('sea') },
  area: { kind: 'lines', color: col('sea') },
  answers: { color: col('coral'), fontFamily: LABEL },
  solutions: { placement: 'inverted', box: 'turned' },
  marginTop: mm(0), marginBottom: mm(0),
};

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

تنويعات

#أخفِ قائمة الكلمات

البحث عن الكلمات الأصعب يطبع الشبكة وحدها: أضف hidden إلى الكتلة.

-:::exercise{type=wordsearch size=9 directions="across down diagonal backwards"}
+:::exercise{type=wordsearch size=9 directions="across down diagonal backwards" hidden}

#اطبع الإجابات في آخر المجلة

يجمع chapterEnd كل الإجابات في الآخر بدل قلب كل واحدة منها.

-  solutions: { placement: 'inverted', box: 'turned' },
+  solutions: { placement: 'chapterEnd' },

أخطاء شائعة

  • الكلمة في الكلمات المتقاطعة التي لا تتقاطع مع أي كلمة أخرى تُترك خارج الشبكة ويُبلَّغ عنها بـexerciseWordUnplaced. اختر كلمات تشترك في حروف، أو أضف كلمة تصل بين مجموعتين.
  • بطاقة اللعبة تبقى متماسكة، فإذا لم تتسع كلمات متقاطعة طويلة انتقلت إلى العمود التالي: راجع الطبعة الإسبانية، فكلماتها أطول.

الحقوق

الوصفة
Ignacio Ferro
النص
نص أصلي, CC BY 4.0
الصور
  • A coral reef with a smiling sea turtle, an octopus, a clownfish, a pufferfish and a seahorse under sunbeams. · Generated With Diffusion Models · أصلي
  • A baby sea turtle hatching from its egg on the sand. · Generated With Diffusion Models · أصلي
الخطوط
Baloo 2 (SIL OFL 1.1) · Nunito (SIL OFL 1.1) · Fredoka (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
Sandbox