diff --git a/build.py b/build.py new file mode 100644 index 0000000..d7ebf03 --- /dev/null +++ b/build.py @@ -0,0 +1,88 @@ +import os +import markdown +from pathlib import Path + +# Базовый HTML-шаблон с подключенным KaTeX для формул +TEMPLATE = """ + + + + + {title} | ФМИ + + + + + + + +
+

Физико-математический институт

+ +
+
+ {content} +
+ + +""" + +def build_page(md_path, html_path, title): + with open(md_path, 'r', encoding='utf-8') as f: + md_text = f.read() + + # Конвертируем Markdown в HTML + поддерживаем формулы + html_content = markdown.markdown(md_text, extensions=['fenced_code', 'tables']) + + with open(html_path, 'w', encoding='utf-8') as f: + f.write(TEMPLATE.format(title=title, content=html_content)) + +def main(): + # Создаем папку для готового сайта + Path('public').mkdir(exist_ok=True) + + # 1. Главная страница (список новостей) + news_files = sorted(Path('content/news').glob('*.md'), reverse=True) + news_links = "".join([f'
  • {f.stem}
  • ' for f in news_files]) + build_page(Path('content/index.md'), 'public/index.html', 'Главная') # Создайте этот файл + + # 2. Страница всех новостей + news_list_html = "

    Последние новости

    " + with open('public/news.html', 'w', encoding='utf-8') as f: + f.write(TEMPLATE.format(title="Новости", content=news_list_html)) + + # 3. Отдельные страницы новостей + for md_file in news_files: + out_path = Path(f'public/news/{md_file.stem}.html') + out_path.parent.mkdir(exist_ok=True) + build_page(md_file, out_path, md_file.stem.replace('-', ' ').title()) + + # 4. Страница сотрудников (аналогично) + staff_files = sorted(Path('content/staff').glob('*.md')) + staff_links = "".join([f'
  • {f.stem}
  • ' for f in staff_files]) + staff_list_html = "

    Наши сотрудники

    " + with open('public/staff.html', 'w', encoding='utf-8') as f: + f.write(TEMPLATE.format(title="Сотрудники", content=staff_list_html)) + + for md_file in staff_files: + out_path = Path(f'public/staff/{md_file.stem}.html') + out_path.parent.mkdir(exist_ok=True) + build_page(md_file, out_path, md_file.stem.replace('-', ' ').title()) + + print("✅ Сайт успешно собран!") + +if __name__ == '__main__': + main() diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000..a8012a4 --- /dev/null +++ b/content/index.md @@ -0,0 +1 @@ +# Добро пожаловать на сайт ФМИ diff --git a/content/news/2026-07-22-seminar.md b/content/news/2026-07-22-seminar.md new file mode 100644 index 0000000..efb22ec --- /dev/null +++ b/content/news/2026-07-22-seminar.md @@ -0,0 +1,9 @@ +# Семинар по квантовой механике + +Дата: 25 июля 2026 г. + +На семинаре будет рассмотрено уравнение Шрёдингера: + +$$ i\hbar \frac{\partial}{\partial t} \Psi = \hat{H} \Psi $$ + +Приглашаются все сотрудники и аспиранты. diff --git a/content/staff/ivanov.md b/content/staff/ivanov.md new file mode 100644 index 0000000..d37137b --- /dev/null +++ b/content/staff/ivanov.md @@ -0,0 +1,6 @@ +# Иванов Иван Иванович + +**Должность:** Ведущий научный сотрудник +**Степень:** д.ф.-м.н. + +Специалист в области математической физики.