باختصار
ورقة عمل في العلوم لأطفال في الثامنة، عن أجزاء النبتة. تحت كل سؤال صندوق للإجابة، وفي بعض الجمل فراغات تُملأ من قائمة كلمات.
ما الذي ستنضده
ورقة العمل 3A من Seedlings Science، وهي سلسلة متخيَّلة لأطفال في الثامنة، على أربع صفحات مقاسها 200 × 260 mm مطبوعة على وجه واحد. شريط بلون أخضر الأوراق عليه كبسولة صفراء للوحدة، والعنوان، وخانات بيضاء للاسم والتاريخ؛ وبجانبه نبتة بازلاء بالألوان المائية في قرص أبيض، أجزاؤها الستة مرقّمة بالأصفر. الرسم المائي مولَّد بنماذج الانتشار (diffusion models)، ويأتي جاهزًا داخل قرصه، في ملفي JPEG يلتقيان عند حافة الشريط: العلوي في زواياه أخضر الشريط، والسفلي في زواياه أبيض؛ أما الأرقام وخطوط الدلالة فتبقى في الشيفرة، فوق الصورة. كل نشاط عنوان مرقّم فوق بطاقة خضراء فاتحة. في البطاقات صناديق إجابة بيضاء فيها عبارة رمادية صغيرة ومساحة لعدة أسطر، وبنوك كلمات من شارات صفراء، وفراغات بحدود داخل الجمل، وجدولًا لتوصيل الأطعمة بأجزاء النبتة، وقائمة تحقق من دوائر للتلوين. كل صندوق إجابة يقع على بعد 2 mm تحت سؤاله و5 mm فوق ما يليه، وكل بطاقة تنتهي على بعد 9 mm فوق ما يأتي بعدها في صفحتها. النص منضّد بخط Andika، الذي صممته SIL للأطفال الذين يتعلمون القراءة.
تجيب هذه الوصفة عن
- كيف أضع إطارات بعضها داخل بعض، كبطاقة ورقة عمل تضم إطارات إجابات، بتباعد دقيق؟
- كيف أبني صفحة ورقة عمل: أسطر للتعبئة، وإطارات إجابات، وبنوك كلمات، وقوائم تحقق؟
- كيف أصنع شارات مضمّنة: مفاتيح لوحة المفاتيح، ووسوم، وبنوك كلمات للتمارين؟
- كيف أضع صورًا أو أيقونات داخل خلايا الجدول؟
الجواب المختصر
// In the Markdown a box inside a box is a fence inside a fence (each ::: closes one):
// :::callout{type="card"}
// What is inside the pea pods?
// :::callout{type="answer"}
// Write here ← the prompt first: a :::space that opens a box is dropped
// :::space{lines=3} (gotcha: space-dropped-box-top)
// :::
// :::
const [ASK, AFTER, HEAD, NEXT] = [2, 5, 3, 9]; // mm: question→box, box→next, heading→card
const card = {
id: 'card', background: col('tint'), borderRadius: mm(4),
padding: { top: mm(4), right: mm(5), bottom: mm(5), left: mm(5) },
marginTop: mm(HEAD), marginBottom: mm(NEXT), // NEXT: under a card, to whatever follows
// Off the grid, or what follows a card drops to the next grid line. Only the outer card can
// set it: a nested box ignores snapToGrid, span and placement (gotcha: nested-callout-limits).
snapToGrid: false,
body: { paragraphSpacing: false }, // the boxes' margins do all the spacing
lists: { bulletChar: '', // no bullet: in the checklist a circle chip opens each item
gap: mm(2), itemSpacing: pt(7) }, columnGap: mm(6),
};
// A nested box's margins collapse with its neighbours', the larger winning (ASK, AFTER); the
// last box's marginBottom falls inside the card's padding instead of adding to it.
const nested = (id, look) => ({ id, background: col('paper'), borderRadius: mm(2.5),
marginTop: mm(ASK), marginBottom: mm(AFTER), ...look });
const answer = nested('answer', { border: { enabled: true, color: col('rule'), width: pt(0.75) },
padding: { top: mm(1.6), right: mm(3), bottom: mm(2), left: mm(3) },
// A small grey prompt on a full 17 pt line; :::space counts in these body lines.
body: { fontFamily: LABEL, fontSize: pt(8), color: col('muted') } });
const bank = nested('bank', { title: t({ en: 'Word bank', es: 'Banco de palabras' }),
padding: { top: mm(2.2), right: mm(3), bottom: mm(2.4), left: mm(3) },
titleStyle: { fontFamily: LABEL, fontSize: pt(7.5), fontWeight: 600, color: col('leaf'),
textTransform: 'uppercase', letterSpacing: pt(1.3), gap: mm(1.6) } });
// config() plugs in all three: calloutStyles: [card, answer, bank].
المكونات
- الميزات
- إطارات متداخلةالخروج عن الشبكة عمدًاالشارات داخل السطرإطارات التنبيهأعمدة داخل الإطار أو النصمسافة عمودية صريحةأنماط العناوينالعناوين المرقّمةفصول بلا أرقامصفحات افتتاح مصمَّمةالنصوص والخطوط والمربعات في تصاميم الصفحةالصور في تصاميم الصفحةسمات العنوانفواصل الأسطر في العناوينأنماط الجداول المسمّاةصور في خلايا الجداولأنواع موارد مخصّصةأشكال في هذا الموضع بالضبطالقوائم النقطية وقوائم التحققالقوائم المرقّمة
- الخطوط
- Andika, Baloo 2, Fredoka (SIL OFL 1.1)
- الأصول
plant-1092.jpgplant-foot-1092.jpg- The pea plant on the opener, a watercolour (top of the disc) (Generated With Diffusion Models, أصلي)
- The pea plant’s roots, the foot of the same watercolour below the band (Generated With Diffusion Models, أصلي)
- The plant's leader lines, the six food icons and the star, drawn in code in the page’s palette (Ignacio Ferro, MIT)
طريقة التحضير
#1 · أخرج العناوين من الشبكة أيضًا
headings: { fontFamily: DISPLAY, snapToGrid: false, // or what follows snaps back to the grid
balancing: { enabled: false }, // no extra space above headings to fill out a page
levels: [
// parity 'any': a sheet opens the next page, on either side.
{ level: 1, span: 'page', breakBefore: { enabled: true, parity: 'any' },
marginTop: pt(0), marginBottom: pt(0), advancedDesign: opener() },
{ level: 2, numberingTemplate: '{2}', marginTop: mm(0), marginBottom: mm(0),
advancedDesign: activity },
] },
في الجواب المختصر، تنطوي هوامش كل إطار مع هوامش جيرانه ويغلب الأكبر. فمسافة 5 mm الخاصة ببنك الكلمات تغلب مسافة 2 mm فوق القائمة التي تحته، ومسافة 5 mm الخاصة بآخر صندوق إجابة تقع داخل الحشوة السفلية للبطاقة البالغة 5 mm بدل أن تُضاف إليها. إذا بقي عنوان المستوى الثاني على الشبكة حجز بين 10.8 و14.1 mm بدل 8.6 mm التي لقرصه، لأن ما يليه يعود ليلتصق بالسطر التالي ذي 17 pt؛ ويُبقيه headings.snapToGrid: false عند 8.6 mm. ضبط snapToGrid على الأنماط المتداخلة لا يغيّر شيئًا، لأن البطاقة الخارجية وحدها تستطيع مغادرة الشبكة (الصناديق المتداخلة). موازنة الأعمدة معطّلة لأنها تضيف مساحة فوق العناوين لتملأ الصفحة؛ ففي الصفحة 2 كانت ستضع 33 mm فوق النشاط 3 بدل 9.
#2 · اجعل كل فراغ شارة
const chip = (id, fill, look) => ({ id, fontFamily: LABEL, background: col(fill),
borderWidth: pt(0), borderColor: col('leaf'), borderRadius: em(1), ...look });
// An empty chip, :chip[ ], is a box of padding and outline alone. It is a band 1.25 em tall,
// so paddingX ROUND makes it a circle.
const [ROUND, OUTLINE] = [em(0.625), pt(0.9)];
// A blank is all padding, 2 × paddingX wide and 19.6 pt tall: taller than the 17 pt line, so
// the card's itemSpacing sets its items 24 pt apart (gotcha: chip-overlap).
const blank = (id, width) => chip(id, 'paper', { borderWidth: OUTLINE, borderRadius: mm(1.4),
paddingX: mm(width / 2), paddingY: em(0.12), fontSize: em(1.15) });
const chipStyles = [
chip('word', 'sun', { bold: true, paddingX: em(0.6), paddingY: em(0.08), gap: em(0.45) }),
blank('blank', 34), blank('wide', 38), // mm: in a sentence; alone in a column
chip('dot', 'leaf', { paddingX: ROUND, fontSize: em(0.6) }),
chip('tick', 'paper', { borderWidth: OUTLINE, paddingX: ROUND, fontSize: em(1.1), gap: em(0.5) }),
];
الشارة مستطيل غير قابل للكسر في السطر، وحشوتها تُرسم خارج السطر من غير أن تزيد ارتفاعه. بنك الكلمات صف من الشارات في إطار bank متداخل. والفراغات والنقاط التي تُوصَل والدوائر التي تُلوَّن شارات أيضًا، يُكتب كلٌّ منها :chip[ ]: الشارة التي فيها مسافة واحدة مستطيل فارغ من الحشوة والحدّ وحدهما (الشارات داخل السطر). يحدد paddingX العرض: الفراغ عرضه 34 mm داخل جملة و38 mm وحده في عمود، والدائرة تأخذ نصف ارتفاعها البالغ 1.25 em على كل جانب. في قائمة التحقق تقف الدائرة حيث كانت ستقف النقطة (bulletChar: ''). بارتفاع 19.6 pt يكون الفراغ أطول من السطر البالغ 17 pt، ولهذا لكل فراغ بند قائمة خاص به، على بعد 24 pt من التالي.
#3 · رقّم الأنشطة بتصميم عنوان
const DISC_H2 = 8.6; // mm: the disc and the title are this tall, so the heading reserves this
const numberDisc = { kind: 'text', id: 'num', content: '{number}', // numberingTemplate '{2}'
fontFamily: DISPLAY, fontSize: pt(15), fontWeight: 800, color: col('paper'),
box: { backgroundColor: col('leaf'), borderRadius: mm(DISC_H2 / 2) }, // centred both ways
placement: { anchor: { to: 'container', edge: 'top-left' },
size: { width: mm(DISC_H2), height: mm(DISC_H2) } } };
const activityTitle = { kind: 'text', id: 'title', content: '{titleText}',
fontFamily: DISPLAY, fontSize: pt(17), fontWeight: 700, color: col('ink'), align: 'left',
overflow: 'wrap', placement: { anchor: { to: '#num', edge: 'right-of' },
offset: { x: mm(3) }, size: { width: mm(140), height: mm(DISC_H2) } } };
const activity = { enabled: true, slot: { elements: [numberDisc, activityTitle] } };
// ## How did I do? {style="review"} is not an activity: it has no number and a star for a disc.
const review = { id: 'review', numbered: false, advancedDesign: { ...activity, slot: {
elements: [{ kind: 'image', id: 'num', resourceId: 'star', placement: numberDisc.placement },
activityTitle] } } };
عنوان المستوى الثاني ذو advancedDesign يحتفظ بمكانه في العمود، ويُرسم التصميم بدل نصه: قرص فيه {number}، الذي يطبع numberingTemplate الخاص بالمستوى، و{titleText} على يمينه (الامتداد والتصميم المتقدم). القرص والعنوان ارتفاع كل منهما 8.6 mm، وخارج الشبكة يحجز العنوان هذا المقدار بالضبط، فلا يحتاج التصميم إلى minHeight. ولأن الأرقام تأتي من عدّاد المستوى الثاني، فإن نشاطًا يُدرج في ملف Markdown يعيد ترقيم ما بعده. عنوان التقييم الذاتي يستعمل نمطًا فيه numbered: false، فيُستبعد من العدّ، وتقف نجمة SVG حيث كان القرص سيقف.
#4 · ضع الصور في خلايا الجدول
const tableStyles = [{ id: 'match', borderRadius: mm(3), // no header row, so no header fill
headerBackgroundEnabled: false, bodyBackgroundEnabled: true, bodyBackground: col('paper'),
bodyFontFamily: LABEL, bodyFontSize: pt(13), bodyColor: col('ink'), cellPadding: mm(1.4),
rules: 'none' }]; // the white panel is the body fill alone
const cell = (content, extra) => ({ content, verticalAlign: 'middle', ...extra });
const dotCell = () => cell(':chip[ ]{style="dot"}', { align: 'center' });
const matchRow = (icon, food, part) => [cell('', { image: { resourceId: icon, width: 0.76 },
align: 'center' }), cell(food), dotCell(), cell(''), dotCell(),
cell(`:chip[${part}]{style="word"}`)];
const sheetType = { id: 'sheet', name: 'Worksheet item', shortLabel: '', captionPrefix: '',
numberingTemplate: '{n}', resetOn: 'never', counterFormat: 'decimal' }; // no caption, no number
// Set 'here' in its card, built once FOODS exist. A box keeps a line of its text, 6 mm, over
// an embedded table; with that off (see layout), a :::space{lines=0.33} sets ASK instead.
const foods = () => ({ id: 'foods', typeId: 'sheet', kind: 'table', createdAt: 0, updatedAt: 0,
placement: { position: 'here' }, table: { styleId: 'match', model: {
columnWidths: [0.14, 0.25, 0.06, 0.31, 0.06, 0.18], // the widest gap: room to draw a line
rows: FOODS.map((name, r) => matchRow(ICONS[r], name, PARTS[r])) } } });
يرسم TableCell.image موردًا داخل خليته، هنا بنسبة 76 % من عرض الخلية، ويكبر الصف ليتسع له. ويضع verticalAlign: 'middle' اسم الطعام والنقاط والشارة في وسط الصورة. العمود الأعرض، 31 % من الجدول، يبقى فارغًا لخط التلميذ. النمط المسمّى يدوّر الحدّ الخارجي للجدول ويقصّ تعبئة المتن البيضاء عليه. ولا يرسم خطوطًا، فاللوح هو التعبئة البيضاء وحدها (أنماط الجداول المسمّاة). نوع موردها له captionPrefix فارغ، وليس للجدول نص تعليق، فلا يُطبع تحته تعليق. ويضع placement: { position: 'here' } الجدول حيث يقف سطر ::resource الخاص به، داخل البطاقة. يترك الإطار فوق جدول كهذا سطرًا من نصه، أي 6 mm هنا؛ ويوقف layout.inlineResourceGapInBoxes: false ذلك، ويضع :::space{lines=0.33} قبل سطر ::resource مسافة 2 mm التي تحفظها صناديق الإجابة تحت أسئلتها.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 022 · Worksheet with answer boxes and a word bank ══════
// https://postext.dev/en/cookbook/worksheet-answer-boxes
// Code: MIT · Text: original (CC BY 4.0) · Plant: diffusion models · Icons: drawn in code
// Fonts: Andika, Baloo 2, Fredoka (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
buildDocumentWithFonts, prepareFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'worksheet-answer-boxes';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = { ink: '#243040', muted: '#5d6975', paper: '#ffffff', // type; prompts; boxes
leaf: '#2f7d4a', sun: '#f4b43a', soil: '#8a5a36', // the accent; words to pick; drawings
tint: '#e5f1e7', rule: '#a9c9b1' }; // the activity cards; answer-box outlines
// Each colour names its palette entry and carries its hex.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
// The engine's defaults link to 'main-color': point it at the leaf, so nothing prints blue.
const colorPalette = Object.entries({ ...palette, 'main-color': palette.leaf })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const [TEXT, DISPLAY, LABEL] = ['Andika', 'Baloo 2', 'Fredoka']; // Andika: for early readers
const [TOP, SIDE] = [18, 16]; // mm; a sheet printed one-sided, so the margins do not mirror
// #region answer: cards that hold white answer boxes, stacked exactly, off the grid
// In the Markdown a box inside a box is a fence inside a fence (each ::: closes one):
// :::callout{type="card"}
// What is inside the pea pods?
// :::callout{type="answer"}
// Write here ← the prompt first: a :::space that opens a box is dropped
// :::space{lines=3} (gotcha: space-dropped-box-top)
// :::
// :::
const [ASK, AFTER, HEAD, NEXT] = [2, 5, 3, 9]; // mm: question→box, box→next, heading→card
const card = {
id: 'card', background: col('tint'), borderRadius: mm(4),
padding: { top: mm(4), right: mm(5), bottom: mm(5), left: mm(5) },
marginTop: mm(HEAD), marginBottom: mm(NEXT), // NEXT: under a card, to whatever follows
// Off the grid, or what follows a card drops to the next grid line. Only the outer card can
// set it: a nested box ignores snapToGrid, span and placement (gotcha: nested-callout-limits).
snapToGrid: false,
body: { paragraphSpacing: false }, // the boxes' margins do all the spacing
lists: { bulletChar: '', // no bullet: in the checklist a circle chip opens each item
gap: mm(2), itemSpacing: pt(7) }, columnGap: mm(6),
};
// A nested box's margins collapse with its neighbours', the larger winning (ASK, AFTER); the
// last box's marginBottom falls inside the card's padding instead of adding to it.
const nested = (id, look) => ({ id, background: col('paper'), borderRadius: mm(2.5),
marginTop: mm(ASK), marginBottom: mm(AFTER), ...look });
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#أعد البطاقات إلى الشبكة
مع القيمة الافتراضية snapToGrid: true، ينزل ما يلي البطاقة إلى خط الشبكة التالي ذي 17 pt، فتصير مسافة 9 mm تحت كل بطاقة 14.5 mm تحت النشاط 2، و13.2 mm تحت النشاط 4، و11.2 mm تحت النشاط 6.
- snapToGrid: false,
+ snapToGrid: true,#أعطِ الإجابة مساحة أكبر
يعدّ :::space بأسطر صندوق الإجابة نفسه البالغة 17 pt، وكل سطر يُضاف يمنح التلميذ 6 mm إضافية للكتابة.
Write here
-:::space{lines=4}
+:::space{lines=6}أخطاء شائعة
خطأ شائع
يُحذف :::space في أعلى الإطار أو العمود
يُحذف :::space في أعلى العمود، وفي أعلى مجموعة :::columns، وفي أعلى إطار بلا عنوان له محتوى آخر، وفي أعلى تتمة إطار مقطوع. ومنذ postext 1.5 يكون الإطار المكوَّن من :::space فقط بالارتفاع الذي يطلبه الفراغ (إطار إجابة، مكان للكتابة)، والفراغ الواقع مباشرةً تحت عنوان الإطار يُنزل المتن بذلك القدر. لافتتاح إطار بلا عنوان بفراغ، أعطه عنوانًا أو سطرًا أول ثم أضف الفراغ بعده. مسافة عمودية صريحة →
خطأ شائع
الإطار المتداخل يتجاهل span وplacement وsnapToGrid
الإطار المتداخل في إطار آخر يتجاهل span وplacement وsnapToGrid وfloatBarrier الخاصة به: يجري دائمًا داخل الإطار الأم، بالعرض الداخلي للأم. إطارات متداخلة →
خطأ شائع
الشارات الأطول من خطوة السطر تلامس السطر التالي
الشارة التي يزيد ارتفاع إطارها على خطوة السطر تلامس شارات السطر التالي (التحذير chipOverlap). قلّل حشوها العمودي أو حدّها أو مقاسها، أو زِد تباعد الأسطر. الشارات داخل السطر →
فحص Sandbox · chipOverlap
الشارات تلامس السطر التالي
السبب. مستطيل الشارة في هذا النمط أطول من تباعد الأسطر، فتتلامس الشارات في الأسطر المتتالية.
الحل. قلّل الحشو العمودي للشارة أو حدّها أو حجمها، أو زد تباعد الأسطر. التوثيق →
- لا يستطيع الإطار أن يسطّر أسطر الكتابة الخاصة به، لأن أنماط الإطارات ليست لها خلفية مسطّرة. تبقى صناديق الإجابة فارغة وتأخذ ارتفاعها من
:::space، وأسطر الإكمال القصيرة شارات بحدود. - نمط العنوان الذي فيه
numbered: falseيظل يرسم تصميم مستواه، مع ترك{number}فارغًا. من دون تصميم خاص به كان التقييم الذاتي سيبدأ بقرص أخضر فارغ، لذلك ينسخreviewتصميم النشاط ويضع النجمة حيث كان القرص.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- نص أصلي, CC BY 4.0
- الصور
- The pea plant on the opener, a watercolour (top of the disc) · Generated With Diffusion Models · أصلي
- The pea plant’s roots, the foot of the same watercolour below the band · Generated With Diffusion Models · أصلي
- The plant's leader lines, the six food icons and the star, drawn in code in the page’s palette · Ignacio Ferro · MIT
- الخطوط
- Andika (SIL OFL 1.1) · Baloo 2 (SIL OFL 1.1) · Fredoka (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


