| 1 | # -*- coding: utf-8 -*- |
| 2 | """One-off: adapt KDGIO build-writing.csx for AI-Guiders.github.io.""" |
| 3 | from pathlib import Path |
| 4 | |
| 5 | SRC = Path(r"d:\Experiments\Personal Cursor Folder\KarataevDmitry.github.io\tools\build-writing.csx") |
| 6 | DST = Path(__file__).resolve().parent / "build-writing.csx" |
| 7 | |
| 8 | t = SRC.read_text(encoding="utf-8") |
| 9 | |
| 10 | replacements = [ |
| 11 | ("https://karataevdmitry.github.io", "https://ai-guiders.github.io"), |
| 12 | ("Dmitry Karataev", "AI-Guiders"), |
| 13 | ("Дмитрий Каратаев", "AI-Guiders"), |
| 14 | ("D<span>.</span>Karataev", "AI<span>-</span>Guiders"), |
| 15 | ("Д<span>.</span>Каратаев", "AI<span>-</span>Guiders"), |
| 16 | ("https://github.com/KarataevDmitry", "https://github.com/AI-Guiders"), |
| 17 | ("💻", "🤖"), |
| 18 | ( |
| 19 | 'new NavLabels("Skip to content", "Main navigation", "Language", "About", "Projects", "Writing", "Experience", "Docs", "All writing", "Email", "Telegram", "GitHub", "All tags")', |
| 20 | 'new NavLabels("Skip to content", "Main navigation", "Language", "About", "Open stack", "Writing", "Handbook", "GitHub", "All writing", "Email", "Telegram", "GitHub", "All tags")', |
| 21 | ), |
| 22 | ( |
| 23 | 'new NavLabels("К содержанию", "Основная навигация", "Язык", "О себе", "Проекты", "Тексты", "Опыт", "Документы", "Все тексты", "Email", "Telegram", "GitHub", "Все теги")', |
| 24 | 'new NavLabels("К содержанию", "Основная навигация", "Язык", "О нас", "Open stack", "Тексты", "Handbook", "GitHub", "Все тексты", "Email", "Telegram", "GitHub", "Все теги")', |
| 25 | ), |
| 26 | ] |
| 27 | |
| 28 | for a, b in replacements: |
| 29 | t = t.replace(a, b) |
| 30 | |
| 31 | nav_line_replacements = [ |
| 32 | ('{home}#projects', '{home}#stack'), |
| 33 | ('{home}#experience', 'https://github.com/AI-Guiders/handbook/wiki'), |
| 34 | ('{home}#documents', 'https://github.com/AI-Guiders'), |
| 35 | ] |
| 36 | for old, new in nav_line_replacements: |
| 37 | t = t.replace(old, new) |
| 38 | |
| 39 | # Footer: drop personal email/telegram lines (org site) |
| 40 | for line in [ |
| 41 | ' sb.AppendLine($" <a href=\\"mailto:dkarataev1990@gmail.com\\">{labels.Email}</a>");', |
| 42 | ' sb.AppendLine($" <a href=\\"https://t.me/karataev_dmitry\\">{labels.Telegram}</a>");', |
| 43 | ]: |
| 44 | t = t.replace(line + "\n", "") |
| 45 | |
| 46 | DST.write_text(t, encoding="utf-8", newline="\n") |
| 47 | print("wrote", DST) |
| 48 | |