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

دليل الوصفات · الفصل 1 · الصفحة والشبكة

نشرة جمعية: القصة الرئيسية والأخبار القصيرة

نشرة من صفحتين لجمعية حدائق صغيرة على عمود ونصف: القصة الرئيسية تملأ العمود العريض وتكمل في الصفحة 2، وفواصل الأعمدة ترسل الأخبار الموسومة إلى العمود الضيق.

في هذه الصفحة
المُخرَج
Canvas
المستوى
متوسط
Postext
اختُبرت مع Postext 1.65.0
تتطلب ≥ 1.25.0
الترخيص
حُدّثت في 11 أكتوبر 2026
الشيفرة MIT · النص CC BY 4.0
  • نموذج باللغة الإنجليزية: لا توجد طبعة عربية بعد
  • مقاس القص 210 × 297 مم
  • عمود ونصف, فاصل 8 مم بين الأعمدة
  • Work Sans 9.4/13.4
  • Courier Prime
  • Titan One
  • صفحتان
  • المستوى
  • Postext 1.57.1
  • أُخرجت في 55 ms
  • أسطر الشيفرة: 168

باختصار

نشرة من صفحتين لنادٍ للبستنة. القصة الرئيسية تملأ عمودًا عريضًا وتكمل في الصفحة 2، والأخبار القصيرة تملأ عمودًا ضيقًا بجانبها.

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

عدد الربيع من The Allotment Gazette، نشرة جمعية متخيَّلة لحدائق صغيرة مؤجَّرة، مطبوعة على وجهَي ورقة A4 واحدة. على شريط بلون القش الاسمُ بخط Titan One على سطرين، وعلى حافته السفلى صف من الشتلات، ولسان بلون الطماطم فيه رقم العدد والموسم. تحته تنقسم الصفحة إلى عمود عرضه 113 mm وآخر عرضه 57 mm. القصة الرئيسية، عن ثلاث حجيرات سماد جديدة، تملأ العمود العريض تحت مخطط للموقع مرسوم بالشيفرة، وتتوقف عند وسم «Continued on page 2». ويضم العمود الضيق خمسة أخبار قصيرة، يبدأ كل منها بوسوم على شكل كبسولة. في الصفحة 2 تكمل القصة تحت عنوان تتمة، ويتوسط العمودَ رسمٌ بياني للحرارة. وفي الأسفل تُنضَّد الفقرة التي تتحدث عن حوض الزراعة بجانب رسمه، الموضوع على يمين العمود. وتملأ ثمانيةُ إعلانات العمود الضيق.

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

  • كيف أصمم تخطيط عمود ونصف، فيه عمود نص عريض وعمود جانبي ضيق؟
  • هل يستطيع Postext تنضيد ثلاثة أعمدة نصية أو أكثر، أو التفاف النص حول صورة؟
  • كيف أضع عمودين داخل إطار (عمود نص بجانب عمود شكل)؟
  • كيف أصنع شارات مضمّنة: مفاتيح لوحة المفاتيح، ووسوم، وبنوك كلمات للتمارين؟

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

script.js · الأسطر 33–49في الشيفرة الكاملة
const layout = {
  layoutType: 'oneAndHalf', // the narrow column sits on the right and takes text (the
  // defaults of sideColumnSide and sideColumnRole; 'floats' would keep text out of it)
  sideColumnPercent: 32, // 57 mm of the 178 mm measure
  gutterWidth: mm(8), // the wide column keeps the other 113 mm
  columnRule: { enabled: true, color: col('rule') }, // a 0.5 pt hairline in the gutter
};
// The text runs down the wide column, then the narrow one, then the next page's wide
// column. A :::columnbreak sends the next block on to the following column, so the
// Markdown decides what each column holds:
//   ## Shared compost bays open by the top gate      ← the lead, in the wide column
//   … :chip[Continued on page 2]{style="jump"}
//   :::columnbreak                                    ← the briefs open the narrow column
//   ## In brief {style="rail"}
//   …
//   :::columnbreak                                    ← from the last column: next page
//   :chip[Continued from page 1]{style="jump"}        ← the lead goes on in the wide column

المكونات

الخطوط
Work Sans, Titan One, Courier Prime (SIL OFL 1.1)
الأصول
  • The site plan, the temperature chart, the square-metre bed and the row of seedlings under the nameplate, drawn in code in the page's palette (Ignacio Ferro, CC BY 4.0)

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

#1 · دع Markdown يملأ كل عمود

إعدادات الإخراج في الجواب المختصر أعلاه. في التخطيط oneAndHalf يأخذ العمود الضيق نصًّا افتراضيًا، فيجري النص في العمود العريض، ثم الضيق، ثم العمود العريض في الصفحة التالية (أنواع الإخراج). ينهي :::columnbreak العمود حيث يقف (التوجيهات): بعد وسم «Continued on page 2» في القصة الرئيسية يفتح العمود الضيق للأخبار القصيرة، وبعد آخر خبر، في آخر عمود من الصفحة، يفتح الصفحة 2. في هذا العدد ضُبط عمودا الصفحة 1 لينتهيا على خط الشبكة نفسه، على بعد 275 mm من الحافة العليا، فإذا حذفت أيًّا من الفاصلين بقيت الصفحات كما هي. تظهر قيمة الفاصلين حين يتغير النص. احذف الفقرة الثانية من القصة الرئيسية، ومن دون الفاصل الأول يبدأ «In brief» على بعد 247 mm في العمود العريض، تحت الوسم، ويمتد الخبر الأول إلى العمود الضيق، حيث يُعاد تقسيم نصفه الثاني إلى أسطر على عرض العمود البالغ 57 mm.

#2 · ابنِ ترويسة النشرة من البيانات التمهيدية

script.js · الأسطر 53–75في الشيفرة الكاملة
const BEARING = 0.6; // mm: Titan One's left side bearing at 60 pt (T 0.42, G 0.63, L/H 0.85)
const DRILL = { id: 'drill', typeId: 'drawing', kind: 'svg', createdAt: 0, updatedAt: 0,
  svg: { fileId: 'drill.svg', width: 2100, height: 80 } }; // drawn by the design, not the text
const masthead = { enabled: true,
  minHeight: pt(10 * LEAD), // ten grid lines: the text starts one line clear of the band
  slot: { elements: [
    // The band is 62 mm deep. The column rule starts under the masthead, where the text does.
    { kind: 'box', id: 'band', style: { backgroundColor: col('straw') },
      placement: { ...at('page', 'top-left'), size: { width: mm(210), height: mm(62) } } },
    { kind: 'image', id: 'drill', resourceId: 'drill', // seedlings along the band's foot
      placement: { ...at('page', 'top-left', 0, 54), size: { width: mm(210), height: mm(8) } } },
    { kind: 'text', id: 'society', content: '{subtitle}', ...caps(8, 'leaf'), align: 'left',
      placement: { ...at('page', 'top-left', SIDE, 12), size: { width: mm(150) } } },
    { kind: 'text', id: 'title', content: '{titleText}', fontFamily: DISPLAY, fontSize: pt(60),
      lineHeight: 0.9, // 54 pt from line to line
      color: col('leaf'), align: 'left', overflow: 'wrap', // two lines in 178 mm
      placement: { ...at('page', 'top-left', SIDE - BEARING, 17), size: { width: mm(178) } } },
    // {attr.issue} comes from the H1 line, {publishDate} from the frontmatter.
    { kind: 'text', id: 'tab', content: '{attr.issue} · {publishDate}', ...caps(9, 'paper'),
      align: 'right', box: { backgroundColor: col('tomato'),
        padding: { top: mm(1.8), right: mm(3.2), bottom: mm(1.6), left: mm(3.2) } },
      placement: at('page', 'top-right', -SIDE, 44) },
  ] } };

يأخذ H1 نمط عنوان يرسم تصميمُه ترويسةَ النشرة، وspan: 'page' يضع هذا التصميم فوق العمودين. ينكسر {titleText} بحجم 60 pt إلى سطرين في مستطيله البالغ 178 mm. ويجمع اللسان بين {attr.issue}، المكتوب على سطر H1، و{publishDate} من البيانات التمهيدية (frontmatter) (عناصر النص). من دون minHeight تحجز الترويسة مساحة حتى أسفل الشريط، على بعد 62 mm من الحافة العليا، ويبدأ النص على خط الشبكة التالي، عند 62.5 mm، ملامسًا الشريط. وminHeight بقيمة عشرة أسطر من الشبكة يبدأ النص عند 67 mm.

#3 · وسّم الأخبار القصيرة بالشارات

script.js · الأسطر 79–89في الشيفرة الكاملة
const chip = (id, look) => ({ id, fontFamily: LABEL, bold: true,
  fontSize: pt(7.7), // in points: em(0.82) is 7.7 pt in the text, 6.6 pt on the 8 pt jump lines
  borderWidth: pt(0), borderRadius: em(1), // a radius past half the height draws a pill
  paddingX: em(0.5), paddingY: em(0.14), ...look }); // em: of the chip's own size
const chipStyles = [
  chip('tag', { background: col('tomato'), color: col('paper') }), // the first is the default
  chip('free', { background: col('marigold'), color: col('ink') }),
  chip('when', { backgroundEnabled: false, borderWidth: pt(0.8), borderColor: col('leaf'),
    color: col('leaf') }),
  chip('jump', { background: col('straw'), color: col('ink') }),
];

التصريح بـchipStyles يحل محل الشارة المدمجة الزرقاء الشاحبة، والشارة التي ليس لها style تأخذ النمط الأول (أنماط الشارات). نصف قطر أكبر من نصف ارتفاع المستطيل يرسم كبسولة. الشارة لا تنكسر من داخلها أبدًا، فلا ينكسر السطر إلا عند المسافة التي قبلها أو بعدها، ويبقى تاريخ مثل «Sat 11 April» على سطر واحد. كُتبت الوسوم بالحروف الكبيرة في Markdown لأن أنماط الشارات ليس فيها إعداد لحالة الحروف. والحشوة العمودية تُرسم خارج السطر، فتبقى الشبكة البالغة 13.4 pt سليمة.

#4 · صُفّ النص بجانب الرسم

script.js · الأسطر 93–98في الشيفرة الكاملة
// wrap sets the drawing at that side of its column, width of it, and the text after the
// ::resource line runs beside it at the measure left over, then under it at full width:
//   #### Sixteen squares by the gate {style="kicker"}
//   ::resource{id="bed"}                     ← 51 mm at the right of the 113 mm column
//   The demonstration bed by the gate is 1.2 metres square …   ← beside it, then under it
const WRAP = { wrap: 'right', width: 0.45 }; // a body line of white between it and the text

يضع wrap: 'right' رسم الحوض على الحافة اليمنى للعمود البالغ 113 mm، بعرض 45 % منه (51 mm)، وتُنضَّد الفقرة التي تلي سطر ::resource بجانبه في المليمترات السبعة والخمسين المتبقية، على بعد سطر من المتن عن الرسم وتعليقه (التفاف النص). أعلى الرسم بمحاذاة السطر الأول من الفقرة، وتبقى كل الأسطر على الشبكة البالغة 13.4 pt. ولو طالت الفقرة لأكملت تحت الرسم بعرض 113 mm كاملًا، فقرةً واحدة؛ وأي عنوان أو شكل آخر يأتي والرسم ما زال بجانب النص ينزل تحته. والعنوان من المستوى الرابع فوقه يأخذ نمط عنوان لا يغيّر إلا لونه إلى الأخضر الورقي.

#5 · ضع رسمًا بيانيًا ضيقًا في وسط شريطه

script.js · الأسطر 102–114في الشيفرة الكاملة
const drawing = (id, w, h, placement = {}) => ({ id, typeId: 'drawing', kind: 'svg',
  svg: { fileId: `${id}.svg`, width: w * 10, height: h * 10 }, // mm × 10: fitted to the column
  placement: { position: 'here', ...placement }, // drawn where ::resource{id} stands
  caption: CAPTIONS[id][0], note: CAPTIONS[id][1], altText: CAPTIONS[id][2],
  createdAt: 0, updatedAt: 0 });
// width is a fraction of the column and align where the figure sits in it: the text above
// and below never moves into the white either side.
const HEAT = { width: 0.62, align: 'center' };
const resources = () => [drawing('plan', 114, 56.5), drawing('heat', 68, 40, HEAT),
  drawing('bed', 50, 50, WRAP), DRILL];
// Newsletter drawings carry no "Figure 1": an empty prefix prints no label.
const resourceTypes = [{ id: 'drawing', name: 'Drawing', shortLabel: 'Drawing',
  captionPrefix: '', numberingTemplate: '', resetOn: 'never', counterFormat: 'decimal' }];

يجعل width: 0.62 عرض الرسم البياني 70.1 mm في العمود البالغ 113 mm، ويترك align: 'center' 21.5 mm من الورق على كل جانب (التموضع). النص فوقه وتحته يحتفظ بعرض السطر كاملًا ولا يجري أبدًا في ذلك البياض. الرسوم تنتمي إلى نوع مورد قيمة captionPrefix فيه فارغة، فيبدأ كل تعليق بكلماته الخاصة بالأسود العريض، من غير «Figure 1» قبلها.

الوصفة كاملة

Sandbox
// ═══ Postext Cookbook · Nº 042 · Community newsletter: lead story and briefs ═════
// https://postext.dev/en/cookbook/community-newsletter
// Code: MIT · Text: original (CC BY 4.0) · Drawings: generated in code (CC BY 4.0)
// Fonts: Work Sans, Titan One, Courier Prime (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
  buildDocumentWithFonts, renderPageToCanvas, registerResourceImage, inlineSvgFonts,
} from 'https://esm.sh/postext';

const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'community-newsletter';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: garden colours, every one linked by id
// ink: text · leaf: nameplate and headlines · tomato, the accent: tags, tab, column heads ·
// straw: the band · marigold: second tag · tint: pale greens · rule: hairlines · muted: notes
const palette = { ink: '#1d211c', leaf: '#2f6b3a', tomato: '#c43f2a', straw: '#f2d492',
  marigold: '#e2b33c', tint: '#eef4e8', rule: '#cfd3c6', muted: '#5f6659', paper: '#fbfaf5' };
// Each colour carries its hex and the palette entry it follows.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // defaults link to 'main-color': point it at the leaf, never blue
  ...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
  { id: 'main-color', name: 'leaf (defaults)', value: { hex: palette.leaf, model: 'hex' } },
];
// #endregion
const [TEXT, DISPLAY, LABEL] = ['Work Sans', 'Titan One', 'Courier Prime'];
const SIDE = 16; // mm: the side margins of one A4 sheet, printed on both sides
const LEAD = 13.4; // body leading in pt: the baseline grid
const caps = (size, colour) => ({ fontFamily: LABEL, fontSize: pt(size), fontWeight: 700,
  textTransform: 'uppercase', letterSpacing: pt(size * 0.12), color: col(colour) });
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });

// #region answer: a wide column for the lead, a narrow one for the briefs, one flow
const layout = {
  layoutType: 'oneAndHalf', // the narrow column sits on the right and takes text (the
  // defaults of sideColumnSide and sideColumnRole; 'floats' would keep text out of it)
  sideColumnPercent: 32, // 57 mm of the 178 mm measure
  gutterWidth: mm(8), // the wide column keeps the other 113 mm
  columnRule: { enabled: true, color: col('rule') }, // a 0.5 pt hairline in the gutter
};
// The text runs down the wide column, then the narrow one, then the next page's wide
// column. A :::columnbreak sends the next block on to the following column, so the
// Markdown decides what each column holds:
//   ## Shared compost bays open by the top gate      ← the lead, in the wide column
//   … :chip[Continued on page 2]{style="jump"}
//   :::columnbreak                                    ← the briefs open the narrow column
//   ## In brief {style="rail"}
//   …
//   :::columnbreak                                    ← from the last column: next page

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

تنويعات

#ضع الأخبار القصيرة على اليسار

العمود العريض يُقرأ أولًا دائمًا، فيضع Markdown نفسه القصة الرئيسية على اليمين والأخبار القصيرة على اليسار.

   layoutType: 'oneAndHalf',
+  sideColumnSide: 'left',

#نضّد الأخبار القصيرة على عرض الصفحة

لا يجري نص المتن في أكثر من عمودين. وفي وصفة الصفحة الأولى من جريدة تمتد أربعة أخبار قصيرة على عرض أسفل الصفحة في إطار فيه :::columns{count=4}.

الحقوق

الوصفة
Ignacio Ferro
النص
نص أصلي, CC BY 4.0
الصور
  • The site plan, the temperature chart, the square-metre bed and the row of seedlings under the nameplate, drawn in code in the page's palette · Ignacio Ferro · CC BY 4.0
الخطوط
Work Sans (SIL OFL 1.1) · Titan One (SIL OFL 1.1) · Courier Prime (SIL OFL 1.1)
الشيفرة
MIT، مثل Postext
Sandbox