From 3e10b7255aed4654a395c6c13842392907d87439 Mon Sep 17 00:00:00 2001 From: masterpmi Date: Fri, 24 Jul 2026 07:51:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20build.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index e608a31..c7dc882 100644 --- a/build.py +++ b/build.py @@ -169,12 +169,13 @@ def main(): else: date_formatted = md_file.stem.replace('-', '.') + # ИСПРАВЛЕНО: добавлен / в начало ссылок card_html = f'''
-

{title}

+

{title}

{date_formatted}
{excerpt_html}
- Читать далее + Читать далее
''' news_cards.append(card_html) @@ -184,6 +185,27 @@ def main(): with open('public/news.html', 'w', encoding='utf-8') as f: f.write(TEMPLATE.format(title="Новости", content=news_content)) + + # добавлен код генерации отдельных страниц новостей + for md_file in news_files: + with open(md_file, 'r', encoding='utf-8') as f: + meta, body = parse_front_matter(f.read()) + + title = meta.get('title', md_file.stem.replace('-', ' ').title()) + breadcrumbs = build_breadcrumbs(f'/news/{md_file.stem}.html') + + back_link = f'← Назад к списку новостей' + full_content = breadcrumbs + back_link + '\n' + body + + html_content = markdown.markdown(full_content, extensions=['fenced_code', 'tables']) + + output_path = Path(f'public/news/{md_file.stem}.html') + output_path.parent.mkdir(parents=True, exist_ok=True) + + with open(output_path, 'w', encoding='utf-8') as f: + f.write(TEMPLATE.format(title=title, content=html_content)) + + print(f"✅ Создана страница новости: {output_path}") # 3. Страница сотрудников staff_by_lab = {}