Prepare V2 corpus, editorial journal and reproducible publication boundary
This commit is contained in:
1 parent
7b3f49788d
commit
69607c52fd
498 files changed
+97671
-468
No files matched your search
+2
-2
@@ -1,4 +1,4 @@
|
||||
"use client";
|
||||
import {useState} from 'react';
|
||||
import {useState,useEffect} from 'react';
|
||||
import Link from 'next/link';
|
||||
export default function Catalog({articles}){const [q,setQ]=useState(''),[topic,setTopic]=useState('Все');const topics=['Все',...new Set(articles.flatMap(a=>a.categories))];const shown=articles.filter(a=>(topic==='Все'||a.categories.includes(topic))&&(a.title+' '+a.excerpt+' '+a.categories.join(' ')).toLocaleLowerCase('ru').includes(q.toLocaleLowerCase('ru')));return <section id="catalog" className="articles-shell"><div className="articles-header"><div><p className="eyebrow">Восстановленные публикации</p><h2>Архив заметок</h2></div><span>{shown.length} из {articles.length}</span></div><div className="filters"><label htmlFor="search">Поиск по заголовкам и описаниям</label><input id="search" type="search" value={q} onChange={e=>setQ(e.target.value)} placeholder="Например: Bitrix, D, сертификат"/><div className="topics">{topics.map(t=><button aria-pressed={topic===t} key={t} onClick={()=>setTopic(t)}>{t}</button>)}</div></div><p aria-live="polite" className="result-count">{shown.length ? `Найдено: ${shown.length}`:'Ничего не найдено. Попробуйте другой запрос или тему.'}</p><div className="article-grid">{shown.map(a=><Link className="article-card" key={a.slug} href={'/articles/'+encodeURIComponent(a.slug)+'/'}><div className="card-topic">{a.categories[0]} <span>↗</span></div><div className="article-card__body"><div className="meta-line"><time dateTime={a.date}>{new Intl.DateTimeFormat('ru-RU',{year:'numeric',month:'long',day:'numeric',timeZone:'UTC'}).format(new Date(a.date))}</time><span>{a.readingMinutes} мин</span></div><h3>{a.title}</h3><p>{a.excerpt.slice(0,170)}…</p></div></Link>)}</div></section>}
|
||||
export default function Catalog({articles}){const [q,setQ]=useState(''),[topic,setTopic]=useState('Все');const topics=['Все',...new Set(articles.flatMap(a=>a.categories))];const shown=articles.filter(a=>(topic==='Все'||a.categories.includes(topic))&&(a.title+' '+a.excerpt+' '+a.categories.join(' ')).toLocaleLowerCase('ru').includes(q.toLocaleLowerCase('ru')));return <section id="journal" className="journal"><div className="journal-heading"><div><p className="kicker">ПОЛНЫЙ ИНДЕКС</p><h2>Статьи и заметки</h2></div><span>{articles.length} материалов</span></div><div className="catalog-controls"><label htmlFor="search"><span>Найти в журнале</span><input id="search" type="search" value={q} onChange={e=>setQ(e.target.value)} placeholder="Тема, язык или задача"/></label><div className="topic-tabs" aria-label="Темы">{topics.map(t=><button aria-pressed={topic===t} key={t} onClick={()=>setTopic(t)}>{t}</button>)}</div></div><p role="status" className="search-status">{shown.length?`Найдено материалов: ${shown.length}`:'По этому запросу ничего нет. Попробуйте другое слово или сбросьте тему.'}</p><div className="journal-list">{shown.map(a=><article key={a.slug} className="index-entry"><div className="index-date"><time dateTime={a.date}>{new Intl.DateTimeFormat('ru-RU',{year:'numeric',month:'short',day:'numeric',timeZone:'UTC'}).format(new Date(a.date))}</time><span>{a.categories.join(' · ')}</span></div><Link href={'/articles/'+encodeURIComponent(a.slug)+'/'}><h3>{a.title}</h3><p>{a.excerpt}</p></Link><span className="index-duration">{a.readingMinutes} мин <b aria-hidden="true">↗</b></span></article>)}</div>{!shown.length&&<button onClick={()=>{setQ('');setTopic('Все');}}>Сбросить поиск</button>}</section>}
|
||||
@@ -0,0 +1,4 @@
|
||||
"use client";
|
||||
import {useEffect} from 'react';
|
||||
import links from '../data/shortlinks.json';
|
||||
export default function Shortlinks(){useEffect(()=>{const id=new URLSearchParams(location.search).get('p');if(id&&links[id])location.replace(links[id]);},[]);return null;}
|
||||
@@ -1,8 +1,12 @@
|
||||
import ArticlePage,{generateMetadata as metadata} from '../articles/[slug]/page';
|
||||
import {getArticles} from '../../lib/articles';
|
||||
import Link from 'next/link';
|
||||
import {notFound} from 'next/navigation';
|
||||
import ArticlePage,{generateMetadata as articleMetadata} from '../articles/[slug]/page';
|
||||
import About from '../about/page';
|
||||
import Resources from '../resources/page';
|
||||
import routes from '../../data/archive-routes.json';
|
||||
import {getArticles,formatDate} from '../../lib/articles';
|
||||
export const dynamicParams=false;
|
||||
export function generateStaticParams(){return getArticles().map(a=>({path:a.legacyPath.split('/').filter(Boolean)}));}
|
||||
async function lookup(params){const {path}=await params;const a=getArticles().find(a=>a.legacyPath==='/'+path.map(decodeURIComponent).join('/')+'/');if(!a)notFound();return {slug:a.slug};}
|
||||
export async function generateMetadata({params}){return metadata({params:Promise.resolve(await lookup(params))});}
|
||||
export default async function Legacy({params}){return ArticlePage({params:Promise.resolve(await lookup(params))});}
|
||||
export function generateStaticParams(){return Object.keys(routes).map(p=>({path:p.split('/').filter(Boolean)}));}
|
||||
async function lookup(params){const {path}=await params;const route=routes['/'+path.map(decodeURIComponent).join('/')];if(!route)notFound();return route;}
|
||||
export async function generateMetadata({params}){const r=await lookup(params);if(r.type==='article')return articleMetadata({params:Promise.resolve({slug:r.slug})});return {title:(r.type==='index'?r.title:r.type==='about'?'О блоге':'Справочники')+' — ProgCode'};}
|
||||
export default async function Legacy({params}){const r=await lookup(params);if(r.type==='article')return ArticlePage({params:Promise.resolve({slug:r.slug})});if(r.type==='about')return About();if(r.type==='resources')return Resources();const articles=getArticles().filter(a=>r.slugs.includes(a.slug));return <main id="main" className="archive-page"><p className="kicker">ТЕМАТИЧЕСКИЙ ИНДЕКС</p><h1>{r.title}</h1><p className="large-text">Материалы по этой теме: {articles.length}. <Link href="/#journal">Перейти к поиску по всему журналу</Link>.</p><div className="journal-list">{articles.map(a=><article className="index-entry" key={a.slug}><div className="index-date"><time dateTime={a.date}>{formatDate(a.date)}</time><span>{a.categories.join(' · ')}</span></div><Link href={'/articles/'+encodeURIComponent(a.slug)+'/'}><h3>{a.title}</h3><p>{a.excerpt}</p></Link><span className="index-duration">{a.readingMinutes} мин ↗</span></article>)}</div></main>}
|
||||
@@ -1,3 +1,2 @@
|
||||
import {getArticles} from '../../lib/articles';
|
||||
export const metadata={title:'Источники и восстановление | ProgCode.Ru'};
|
||||
export default function About(){return <main className="article-page article-content"><p className="eyebrow">Прозрачный архив</p><h1>Что сохранено и откуда</h1><p>ProgCode.Ru — личный блог DarkRiDDeR о программировании. Восстановленная часть содержит 14 публикаций 2017–2019 годов: язык D, PHP, Bitrix, JavaScript и рабочие заметки Windows.</p><h2>Источники</h2><p>Использованы ранее сохранённые HTML-снимки Web Archive с метками 2017–2019 годов. Из оформления снимков 2022 года восстановлены 5 уникальных изображения (5 размещений). Встроенных иллюстраций отсутствует: 13. 26 октября 2026 года CDX повторно загружен и контрольный HTML-снимок получен; охват ограничен доступными локальными копиями, полного восстановления всего сайта мы не заявляем.</p><p>Текст извлечён из основного содержимого страницы. Комментарии, формы, старые скрипты, счётчики, встроенные плееры и исполняемые загрузки исключены. Сохранившиеся изображения размещены локально; отсутствующие не подменены выдуманными.</p><h2>Исторический контекст</h2><p>Это архив, а не актуальная документация. Примеры зависят от версий библиотек и ОС. Особенно осторожно следует относиться к старым выводам о безопасности. Новое редакционное дополнение к статье о TLS помечено отдельно и ссылается на справочник PHP.</p><h2>Новые возможности</h2><p>Поиск и фильтр тем, совместимость со старыми адресами, навигация и JSON-инструмент добавлены при восстановлении 26.10.2026. Сгенерированные редакционные публикации, включая будущие даты, не входят в этот архив.</p><h2>Реестр публикаций</h2><ul>{getArticles().map(a=><li key={a.slug}><a href={a.source}>{a.title}</a> — снимок {a.timestamp}</li>)}</ul><p>Машиночитаемый реестр, контрольные суммы и сохранённые исходники находятся в каталоге provenance репозитория.</p></main>}
|
||||
export const metadata={title:'О блоге — ProgCode'};
|
||||
export default function About(){return <main id="main" className="simple-page"><p className="kicker">PROGCODE.RU</p><h1>Блог одного<br/>программиста.</h1><p className="large-text">Здесь разбирают устройство инструментов, пишут небольшие функции и задают вопросы разработчикам.</p><div className="article-content"><h2>Что читать</h2><p>Основная коллекция — заметки DarkRiDDeR 2017–2019 годов о D, PHP, Bitrix, JavaScript и рабочем окружении. Среди них есть короткие рецепты, большой разбор сборщика мусора и интервью с создателем Tilix.</p><p>Технические примеры привязаны к контексту своих версий. Там, где старый совет мог привести к ошибке, текст уточнён. Интервью и переводы сохраняют авторство и ссылки на первичные публикации.</p><h2>Как ориентироваться</h2><p>Начните с <a href="/#journal">индекса статей</a>, выберите тему или задайте поиск. Для длинных разборов предусмотрено оглавление. В <a href="/resources/">справочниках</a> собраны первичные источники по темам блога, а <a href="/tools/">JSON-инструмент</a> помогает проверить ответ API.</p><h2>Автор и связь</h2><p>Автор исторических заметок подписывался DarkRiDDeR. Подтверждённый актуальный канал связи не указан; старые формы отправки сообщений больше не используются.</p></div></main>}
|
||||
@@ -1,62 +1,6 @@
|
||||
import Link from 'next/link';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { formatDate, getArticleBySlug, getArticles } from '../../../lib/articles';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getArticles().map((article) => ({ slug: article.slug }));
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }) {
|
||||
const { slug } = await params;
|
||||
const article = getArticleBySlug(decodeURIComponent(slug));
|
||||
|
||||
if (!article) {
|
||||
return { title: 'Статья не найдена' };
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${article.title} | ProgCode.Ru`,
|
||||
description: article.excerpt,
|
||||
alternates: { canonical: `/articles/${encodeURIComponent(article.slug)}/` },
|
||||
};
|
||||
}
|
||||
|
||||
export default async function ArticlePage({ params }) {
|
||||
const { slug } = await params;
|
||||
const article = getArticleBySlug(decodeURIComponent(slug));
|
||||
|
||||
if (!article) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<article className="article-page">
|
||||
<nav className="top-nav" aria-label="Навигация">
|
||||
<Link href="/">Все статьи</Link>
|
||||
</nav>
|
||||
|
||||
<header className="article-hero">
|
||||
<div className="article-hero__text">
|
||||
<div className="meta-line">
|
||||
<time dateTime={article.date}>{formatDate(article.date)}</time>
|
||||
<span>{article.author}</span>
|
||||
<span>{article.readingMinutes} мин</span>
|
||||
</div>
|
||||
<h1>{article.title}</h1>
|
||||
<div className="tag-list">
|
||||
{article.categories.map((category) => (
|
||||
<span key={category}>{category}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<aside className="archive-note"><strong>Архивная публикация {article.date.slice(0,4)} года.</strong> Код и версии могли устареть. Утверждения об отсутствии угроз в старых заметках не являются современной оценкой безопасности. <a href={article.source}>Снимок Web Archive ({article.timestamp.slice(0,4)}-{article.timestamp.slice(4,6)}-{article.timestamp.slice(6,8)})</a>. <Link href="/about/">Как восстановлен текст</Link>.</aside>
|
||||
{article.slug.startsWith('ошибка-php') && <aside className="archive-note">Исправление редакции, 26.10.2026: эта ошибка означает, что клиент не смог проверить цепочку доверия сертификата, а не обязательно отсутствие сертификата на сервере. Среди причин — отсутствующий CA bundle клиента или неполная цепочка сервера. Проверка TLS должна оставаться включённой. Настройка <code>curl.cainfo</code> задаёт абсолютный путь к доверенному CA bundle. <a href="https://www.php.net/manual/en/curl.configuration.php">Справочник PHP</a>; <a href="https://curl.se/libcurl/c/libcurl-errors.html">libcurl: ошибка 60</a>.</aside>}
|
||||
{article.slug.startsWith('вирус-') && <aside className="archive-note"><strong>Исправление редакции, 26.10.2026.</strong> Запуск браузера из планировщика — лишь один возможный механизм. Удаление задания не доказывает очистку системы, а оценка «никакой угрозы» из старого текста не обоснована. Перед изменениями экспортируйте подозрительное задание для анализа и выполните полную проверку актуальным защитным ПО. <a href="https://support.microsoft.com/en-us/windows/security/windows-security/stay-protected-with-the-windows-security-app">Microsoft: проверка с Windows Security</a>.</aside>}
|
||||
<div className="article-content" dangerouslySetInnerHTML={{ __html: article.contentHtml }} />
|
||||
</article>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
import {notFound} from 'next/navigation';
|
||||
import {getArticles,getArticleBySlug,formatDate} from '../../../lib/articles';
|
||||
export function generateStaticParams(){return getArticles().map(a=>({slug:a.slug}));}
|
||||
export async function generateMetadata({params}){const {slug}=await params;const a=getArticleBySlug(decodeURIComponent(slug));return a?{title:a.title+' — ProgCode',description:a.excerpt,alternates:{canonical:'/articles/'+encodeURIComponent(a.slug)+'/'}}:{title:'Статья не найдена'};}
|
||||
export default async function Article({params}){const {slug}=await params;const a=getArticleBySlug(decodeURIComponent(slug));if(!a)notFound();const related=getArticles().filter(x=>x.slug!==a.slug&&x.categories.some(c=>a.categories.includes(c))).slice(0,3);return <main id="main" className="article-shell"><nav className="breadcrumbs" aria-label="Путь"><Link href="/#journal">Журнал</Link><span>/</span><span>{a.categories.join(' · ')}</span></nav><header className="article-header"><p className="kicker">{a.categories.join(' / ')}</p><h1>{a.title}</h1><p className="article-deck">{a.excerpt}</p><div className="article-meta"><time dateTime={a.date}>{formatDate(a.date)}</time><span>{a.readingMinutes} мин чтения</span><span>{a.author}</span></div></header><div className="reading-layout">{a.toc?.length>1&&<aside className="contents-rail"><details open><summary>В этой статье</summary><nav aria-label="Оглавление статьи">{a.toc.map((s,i)=><a key={s.id} href={'#'+s.id}><span>{String(i+1).padStart(2,'0')}</span>{s.title}</a>)}</nav></details></aside>}<div className="reading-column"><div className="article-content" dangerouslySetInnerHTML={{__html:a.contentHtml}}/><div className="article-end"><span>КОНЕЦ ЗАМЕТКИ</span><a href="#main">↑ В начало</a></div>{related.length>0&&<section className="related"><p className="kicker">ПРОДОЛЖИТЬ ЧТЕНИЕ</p>{related.map(x=><Link key={x.slug} href={'/articles/'+encodeURIComponent(x.slug)+'/'}>{x.title}<span>↗</span></Link>)}</section>}</div></div></main>}
|
||||
+5
-329
@@ -1,330 +1,6 @@
|
||||
:root {
|
||||
--bg: #f3f0e8;
|
||||
--paper: #fffdfa;
|
||||
--ink: #1e252d;
|
||||
--muted: #64707d;
|
||||
--line: #d8d0c2;
|
||||
--accent: #216869;
|
||||
--accent-2: #b4432a;
|
||||
--code: #111827;
|
||||
}
|
||||
:root{--paper:#f6f4ef;--white:#fffefa;--ink:#242521;--muted:#6e7168;--line:#d8d8cd;--accent:#b84927;--soft:#eae7de;--code:#202621}*{box-sizing:border-box}html{scroll-behavior:smooth;scroll-padding-top:92px}body{margin:0;color:var(--ink);background:var(--paper);font-family:Arial,Helvetica,sans-serif;line-height:1.6}a{color:inherit;text-underline-offset:4px}button,input,textarea{font:inherit}button,a,input,textarea,summary{touch-action:manipulation}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,pre:focus-visible{outline:3px solid var(--accent);outline-offset:4px}img{max-width:100%;height:auto;display:block}h1,h2,h3,p{margin-top:0}h1,h2,h3{line-height:1.12}button{border:1px solid var(--line);padding:9px 14px;background:transparent;color:var(--ink);border-radius:3px}.button{display:inline-flex;align-items:center;justify-content:center;background:var(--ink);color:var(--white);padding:12px 20px;border:1px solid var(--ink);text-decoration:none;font-weight:700;border-radius:3px}.button:hover{background:var(--accent);border-color:var(--accent)}.skip-link{position:absolute;left:16px;top:-80px;z-index:30;background:var(--ink);color:#fff;padding:12px}.skip-link:focus{top:10px}.masthead{max-width:1264px;margin:auto;min-height:88px;padding:16px 32px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--ink);gap:24px}.wordmark{text-decoration:none;font-size:32px;font-weight:900;letter-spacing:-1.8px;line-height:1}.wordmark span{font-weight:400}.wordmark i{font-style:normal;color:var(--accent)}.masthead nav{display:flex;gap:28px;align-items:center;font-size:14px}.masthead nav a{text-decoration:none}.masthead nav a:hover{color:var(--accent)}.edition{font:11px monospace;letter-spacing:1px;color:var(--muted)}main{max-width:1200px;margin:auto}.kicker{font:700 11px/1.5 Arial,sans-serif;letter-spacing:1.5px;color:var(--accent);margin-bottom:16px}.intro{padding:58px 0 42px;display:flex;align-items:flex-end;justify-content:space-between;gap:40px}.intro h1{font-size:clamp(36px,4.2vw,62px);letter-spacing:-2.5px;margin-bottom:0}.intro h1 em{font-style:normal;color:var(--accent)}.intro-deck{font-size:16px;line-height:1.7;color:var(--muted);max-width:350px;margin-bottom:5px}.front-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:40px;border-top:1px solid var(--line);padding-top:28px}.lead-story{text-decoration:none;background:#e9e5d9;border:1px solid #d9d4c7;border-radius:4px;padding:30px 32px;display:flex;flex-direction:column}.story-meta{display:flex;justify-content:space-between;gap:10px;font:10px monospace;letter-spacing:1px;color:#706e63;margin-bottom:26px}.lead-story h2{font-size:clamp(28px,3vw,42px);letter-spacing:-1.4px;margin-bottom:17px}.lead-story>p{font-size:16px;color:#565b51;max-width:480px;line-height:1.6}.lead-visual{margin:20px -8px 26px}.lead-visual img{width:100%;max-height:280px;object-fit:contain}.text-link{display:flex;justify-content:space-between;font-size:14px;font-weight:700;margin-top:auto;border-top:1px solid #cbc8bb;padding-top:16px}.text-link b{color:var(--accent);font-size:22px}.section-title{border-bottom:2px solid var(--ink);padding-bottom:16px}.section-title .kicker{margin-bottom:8px}.section-title h2{font-size:25px;letter-spacing:-.6px;margin:0}.recipe{display:flex;gap:15px;border-bottom:1px solid var(--line);padding:22px 0;text-decoration:none;align-items:flex-start}.recipe-number{font:12px monospace;color:var(--muted);padding-top:3px}.tiny-topic{font:10px monospace;letter-spacing:.8px;color:var(--accent)}.recipe h3{font-size:19px;line-height:1.3;margin:6px 0 0;font-weight:600}.recipe>b{margin-left:auto;font-size:22px;color:var(--accent)}.recipe:hover h3,.index-entry a:hover h3{color:var(--accent)}.reading-routes{margin-top:58px;border-top:1px solid var(--ink);padding:24px 0 36px}.reading-routes>div{display:grid;grid-template-columns:repeat(3,1fr);gap:30px}.reading-routes a{text-decoration:none;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:9px;padding-right:24px}.reading-routes a:last-child{border:0}.reading-routes a>span{font:11px monospace;color:var(--muted)}.reading-routes strong{font-size:20px;line-height:1.25}.reading-routes small{font-size:13px;color:var(--muted)}.journal{padding:40px 0 56px;border-top:1px solid var(--ink)}.journal-heading{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:25px}.journal-heading h2{font-size:38px;letter-spacing:-1px;margin:0}.journal-heading>span{font:12px monospace;color:var(--muted)}.catalog-controls{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;background:var(--soft);padding:24px}.catalog-controls label{flex:1;max-width:390px}.catalog-controls label>span{display:block;font-size:12px;margin-bottom:8px}input{width:100%;background:var(--white);border:1px solid #a7aa9c;padding:12px;color:var(--ink);border-radius:2px}.topic-tabs{display:flex;flex-wrap:wrap;gap:7px}Line truncated
|
||||
@media(min-width:1600px){main{max-width:1200px}}@media(max-width:1280px){main{margin:0 32px}.article-header{margin-left:220px}.reading-layout{grid-template-columns:185px minmax(0,1fr);gap:35px}.reading-layout:has(>.reading-column:first-child){margin-left:220px}.simple-page{margin-left:auto;margin-right:auto;padding-left:25px;padding-right:25px}}@media(max-width:950px){.edition{display:none}.front-grid{grid-template-columns:1.2fr 1fr;gap:25px}.lead-story{padding:25px}.recipe h3{font-size:17px}.intro-deck{max-width:280px;font-size:14px}.catalog-controls{flex-direction:column;align-items:stretch;gap:18px}.catalog-controls label{max-width:none}.article-header{margin-left:0;max-width:820px}.reading-layout{display:block}.reading-layout:has(>.reading-column:first-child){margin-left:0}.contents-rail{position:static;max-height:none;max-width:810px;padding:15px 20px;background:var(--soft);margin-bottom:30px}.contents-rail nav{display:grid;grid-template-columns:1fr 1fr;gap:0 25px}.contents-rail details summary{padding-bottom:10px}.footer{grid-template-columns:1fr 1.5fr 1fr}.footer>span{display:none}.workbench{gap:20px}.index-entry{grid-template-columns:140px 1fr 70px;gap:20px}.article-content{font-size:17px}}
|
||||
@media(max-width:650px){html{scroll-padding-top:20px}.masthead{margin:0 20px;padding:20px 0;gap:20px;flex-wrap:wrap;min-height:108px}.wordmark{font-size:30px}.masthead nav{gap:22px;width:100%;font-size:12px;justify-content:space-between}.masthead nav a{white-space:nowrap}main{margin:0 20px}.intro{padding:35px 0 28px;display:block}.intro h1{font-size:41px;letter-spacing:-1.8px}.intro-deck{max-width:none;font-size:14px;margin:23px 0 0}.intro-deck br{display:none}.kicker{font-size:10px;letter-spacing:1.2px}.front-grid{display:block;padding-top:20px}.lead-story{padding:22px}.story-meta{font-size:8px;margin-bottom:22px;letter-spacing:.8px}.lead-story h2{font-size:29px;letter-spacing:-1px}.lead-story>p{font-size:14px}.lead-visual{margin:15px -12px 20px}.lead-visual img{max-height:none}.text-link{font-size:12px}.recipe-column{margin-top:30px}.section-title h2{font-size:25px}.recipe{padding:18px 0}.recipe h3{font-size:19px}.reading-routes{margin-top:35px;padding-top:20px}.reading-routes>div{display:block}.reading-routes a{border-right:0;border-bottom:1px solid var(--line);padding:17px 0;gap:7px}.reading-routes strong{font-size:20px}.journal{padding-top:28px;padding-bottom:35px}.journal-heading{display:block}.journal-heading h2{font-size:30px;margin-bottom:14px}.journal-heading>span{font-size:11px}.catalog-controls{padding:18px;margin:0 -4px}.topic-tabs{gap:6px}.topic-tabs button{font-size:12px;padding:8px 11px}.index-entry{grid-template-columns:1fr 55px;gap:10px;padding:22px 0}.index-date{grid-column:1/-1;display:flex;justify-content:space-between;gap:15px;font-size:10px;padding:0}.index-date span{display:inline;margin:0;font-size:10px}.index-entry h3{font-size:20px;line-height:1.3;margin:0 0 10px}.index-entry p{font-size:13px;line-height:1.6}.index-duration{font-size:10px;display:block;text-align:right;padding-top:6px}.index-duration b{display:block;font-size:23px;padding-top:15px}.utility-promo{display:block;padding:25px;margin-bottom:35px}.utility-promo h2{font-size:29px}.utility-promo p{font-size:14px}.utility-promo .button{font-size:12px;margin-top:25px}.footer{margin:0 20px;padding:28px 0;grid-template-columns:1fr 1fr;gap:22px}.footer>p{grid-column:1}.footer>div{grid-column:2;grid-row:1/3;font-size:12px}.footer .wordmark{font-size:24px}.breadcrumbs{font-size:10px;padding:22px 0;gap:10px}.article-header{margin:12px 0 26px}.article-header h1{font-size:34px;letter-spacing:-1px;line-height:1.13;margin-bottom:20px}.article-deck{font-size:18px;line-height:1.5;margin-bottom:20px}.article-meta{font-size:10px;gap:8px 15px;padding-top:13px}.contents-rail{padding:13px 16px;margin:0 0 25px}.contents-rail nav{display:flex;gap:0}.contents-rail nav a{padding:7px 0;font-size:12px}.article-content{font-size:17px;line-height:1.75}.article-content h2{font-size:25px;margin:36px 0 18px;line-height:1.25;letter-spacing:-.4px}.article-content h3{font-size:20px;margin-top:28px}.article-content pre{font-size:12px;padding:20px 18px;margin:24px -4px;max-width:calc(100% + 8px)}.article-content figure{margin:25px -4px;padding:10px}.article-content figcaption{font-size:11px;line-height:1.6;padding-top:10px;margin-top:10px}.article-content blockquote{padding-left:18px;margin:20px 0}.article-end{font-size:10px}.related{padding:20px}.related a{font-size:17px}.reading-layout{padding-bottom:35px}.simple-page{margin:0;padding:35px 20px 50px;max-width:none}.simple-page h1,.tool-page h1{font-size:43px;letter-spacing:-1.6px}.large-text{font-size:20px;line-height:1.6;margin-bottom:35px}.tool-page{padding:35px 0 50px}.tool-heading p:not(.kicker){font-size:15px}.workbench{grid-template-columns:1fr;gap:28px}.workbench textarea{min-height:260px;font-size:13px;padding:16px}.result-panel{min-height:280px;padding:0 18px 18px}.result-panel pre{font-size:13px;min-height:150px}.tool-actions{gap:7px}.tool-actions button{font-size:12px;padding:10px 13px}.field-note{font-size:10px;line-height:1.5}.tool-notes{margin-top:30px;font-size:14px}.missing{padding:45px 0 65px}.missing h1{font-size:34px}.missing>p:not(.kicker){font-size:14px}.missing-code{font-size:70px}.archive-page{padding:35px 0}.archive-page h1{font-size:37px}.archive-page>.large-text{font-size:18px}.resource-groups section>h2{font-size:25px}.resource-groups h3{font-size:18px}}
|
||||
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.site-hero {
|
||||
min-height: 360px;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(20, 24, 28, 0.86), rgba(20, 24, 28, 0.35)),
|
||||
linear-gradient(120deg,#152c31,#216869);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.site-hero__inner {
|
||||
width: min(1120px, calc(100% - 40px));
|
||||
margin: 0 auto;
|
||||
padding: 72px 0 46px;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 10px;
|
||||
color: var(--accent-2);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.site-hero .eyebrow {
|
||||
color: #f5b08c;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
line-height: 1.15;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.site-hero h1 {
|
||||
font-size: clamp(44px, 8vw, 82px);
|
||||
}
|
||||
|
||||
.site-description {
|
||||
max-width: 680px;
|
||||
margin: 18px 0 0;
|
||||
color: #e5e7eb;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.articles-shell {
|
||||
width: min(1120px, calc(100% - 32px));
|
||||
margin: 34px auto 64px;
|
||||
}
|
||||
|
||||
.articles-header,
|
||||
.top-nav,
|
||||
.meta-line,
|
||||
.tag-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.articles-header {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.articles-header h2 {
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
.articles-header > span,
|
||||
.meta-line {
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.article-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.article-card {
|
||||
min-height: 100%;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--paper);
|
||||
text-decoration: none;
|
||||
transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.article-card:hover {
|
||||
border-color: #9f8f7a;
|
||||
box-shadow: 0 12px 30px rgba(39, 33, 25, 0.12);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.article-card > img {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.article-card__body {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.article-card h3 {
|
||||
margin-top: 10px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.article-card p {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.tag-list span {
|
||||
border: 1px solid #c5bba9;
|
||||
border-radius: 999px;
|
||||
padding: 4px 10px;
|
||||
background: #f8f5ee;
|
||||
color: #5c4a37;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.article-page {
|
||||
width: min(1040px, calc(100% - 32px));
|
||||
margin: 0 auto 72px;
|
||||
}
|
||||
|
||||
.top-nav {
|
||||
padding: 22px 0;
|
||||
}
|
||||
|
||||
.top-nav a {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.article-hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
|
||||
gap: 28px;
|
||||
align-items: center;
|
||||
padding: 28px 0 34px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.article-hero h1 {
|
||||
margin: 14px 0 18px;
|
||||
font-size: clamp(34px, 6vw, 58px);
|
||||
}
|
||||
|
||||
.article-hero > img {
|
||||
width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
max-width: 820px;
|
||||
margin: 34px auto 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.article-content h2 {
|
||||
margin: 42px 0 14px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.article-content h3 {
|
||||
margin: 34px 0 12px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.article-content p,
|
||||
.article-content ul,
|
||||
.article-content ol {
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
.article-content a {
|
||||
color: var(--accent);
|
||||
text-decoration-thickness: 1px;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.article-content figure {
|
||||
margin: 28px 0;
|
||||
}
|
||||
|
||||
.article-content figure img {
|
||||
width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.article-content figcaption {
|
||||
margin-top: 8px;
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.article-content .table-scroll {
|
||||
overflow-x: auto;
|
||||
margin: 28px 0;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--paper);
|
||||
}
|
||||
|
||||
.article-content table {
|
||||
width: 100%;
|
||||
min-width: 620px;
|
||||
border-collapse: collapse;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.article-content th,
|
||||
.article-content td {
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.article-content th {
|
||||
background: #f0ece2;
|
||||
color: #443a2d;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.article-content tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.article-content pre {
|
||||
overflow-x: auto;
|
||||
border-radius: 8px;
|
||||
margin: 26px 0;
|
||||
padding: 18px 20px;
|
||||
background: var(--code);
|
||||
color: #e5e7eb;
|
||||
font-size: 15px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.article-content code {
|
||||
font-family: SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
|
||||
.article-content :not(pre) > code {
|
||||
border-radius: 4px;
|
||||
padding: 2px 5px;
|
||||
background: #ede6da;
|
||||
color: #663c1f;
|
||||
font-size: 0.92em;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.site-hero {
|
||||
min-height: 320px;
|
||||
}
|
||||
|
||||
.site-description {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.article-hero {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Документация Bitrix и имена API часто содержат длинные неразрывные токены. */
|
||||
.article-hero h1,
|
||||
.article-content h2,
|
||||
.article-content h3,
|
||||
.article-content :not(pre) > code,
|
||||
.article-content a {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restoration navigation and accessible tools */
|
||||
html{scroll-behavior:smooth} .masthead{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:22px max(20px,calc((100vw - 1120px)/2));background:#fffdfa;border-bottom:1px solid var(--line)} .brand{font-size:23px;font-weight:800;text-decoration:none;white-space:nowrap}.brand span{color:var(--accent)}.masthead nav{display:flex;gap:22px;flex-wrap:wrap;font-size:14px}.masthead nav a{text-decoration:none}.site-hero{background:#152c31;position:relative;min-height:420px;align-items:center;overflow:hidden}.site-hero__inner{position:relative;z-index:1}.site-hero h1{font-size:clamp(40px,6vw,70px);max-width:650px}.site-description{max-width:640px;font-size:18px}.hero-link{display:inline-block;margin-top:26px;color:#a7ddd5}.hero-code{position:absolute;right:max(36px,calc((100vw - 1120px)/2));font:22px/1.9 monospace;color:#9ac5bc;opacity:.5;transform:rotate(-5deg)}.hero-code span{color:#e7c995}.site-hero__inner{padding:55px 0}.filters{background:var(--paper);padding:22px;border:1px solid var(--line);border-radius:8px}.filters label{display:block;font-size:14px;margin-bottom:8px}input,textarea{font:inherit;width:100%;background:white;border:1px solid #8c9998;border-radius:4px;padding:13px;color:var(--ink)}.topics{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}button{font:inherit;cursor:pointer;border:1px solid #9bafaa;background:#fffdfa;color:#1e4440;padding:8px 16px;border-radius:5px}button[aria-pressed=true],button:hover{background:var(--accent);color:white}a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #c2732c;outline-offset:4px}.result-count{font-size:14px;color:var(--muted)}.article-card{text-decoration:none;box-shadow:none;transition:transform .15s}.article-card:hover{transform:translateY(-3px);border-color:var(--accent)}.card-topic{background:#e2ebe6;color:#24514b;padding:18px 22px;font:700 18px monospace;display:flex;justify-content:space-between;border-bottom:1px solid var(--line)}.card-topic span{color:#768c82}.article-card h3{font-size:22px}.article-card__body p{font-size:15px}.archive-note{padding:20px;background:#edf2ed;border-left:4px solid var(--accent);margin:24px 0;font-size:15px}.article-hero>img{display:none}.article-hero{display:block}.article-content{overflow-wrap:anywhere}.article-content h1{font-size:clamp(30px,5vw,52px);margin-bottom:24px}.article-content pre{max-width:100%;overflow:auto}.article-content img{height:auto}.article-content table{display:block;overflow:auto}.footer{padding:30px max(20px,calc((100vw - 1120px)/2));border-top:1px solid var(--line);font-size:14px;color:var(--muted)}.footer p{font-size:12px}textarea{display:block;min-height:240px;font:15px/1.6 monospace;margin:10px 0}pre.error{background:#5e2020} .article-page{min-width:0}
|
||||
@media(max-width:850px){.hero-code{display:none}.masthead{align-items:flex-start;flex-direction:column;gap:12px}.masthead nav{gap:16px}.article-grid{grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr))}.site-hero{min-height:360px}.article-page{width:calc(100% - 32px)}}
|
||||
|
||||
.article-content table{min-width:0;max-width:100%;width:100%}.article-content td,.article-content th{min-width:120px}.article-content pre{min-width:0}.article-content figure{margin:28px 0}.article-content figcaption{font-size:13px;color:var(--muted);margin-top:8px}
|
||||
.article-content .table-scroll{max-width:100%;overflow:auto;margin:25px 0;border:1px solid var(--line);border-radius:3px}.article-content .table-scroll:focus-visible{outline:3px solid var(--accent);outline-offset:4px}.article-content .table-scroll table{display:table;min-width:620px;max-width:none;width:100%;margin:0;overflow-wrap:normal}.article-content figure img[src$=".jpg"]{width:auto;max-width:100%;margin-inline:auto}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import './globals.css';
|
||||
import Link from 'next/link';
|
||||
export const metadata={metadataBase:new URL('https://progcode.ru'),icons:{icon:'/icon.svg'},title:'ProgCode.Ru — архив программиста',description:'Восстановленные заметки о D, PHP, Bitrix и JavaScript. Поиск по архиву и инструменты разработчика.'};
|
||||
export default function RootLayout({children}) {return <html lang="ru"><body><header className="masthead"><Link href="/" className="brand"></> ProgCode<span>.Ru</span></Link><nav aria-label="Основная навигация"><Link href="/">Архив</Link><Link href="/tools/">JSON-инструмент</Link><Link href="/about/">Об источниках</Link></nav></header>{children}<footer className="footer">ProgCode.Ru · Записки программиста с 2017 года · <Link href="/about/">Источники и восстановление</Link><p>Исторические публикации сохраняют контекст своего времени. Проверяйте версии перед использованием кода.</p></footer></body></html>}
|
||||
export const metadata={metadataBase:new URL('https://progcode.ru'),icons:{icon:'/icon.svg'},title:'ProgCode — записки о программировании',description:'D, PHP, Bitrix и JavaScript: разборы механизмов, рабочие рецепты и разговоры с разработчиками.'};
|
||||
export default function RootLayout({children}){return <html lang="ru"><body><a className="skip-link" href="#main">К содержанию</a><header className="masthead"><Link className="wordmark" href="/" aria-label="ProgCode — главная">prog<span>code</span><i>_</i></Link><nav aria-label="Главная навигация"><Link href="/#journal">Статьи</Link><Link href="/resources/">Справочники</Link><Link href="/tools/">JSON</Link><Link href="/about/">О блоге</Link></nav><span className="edition">D / PHP / WEB</span></header>{children}<footer className="footer"><Link className="wordmark" href="/">prog<span>code</span><i>_</i></Link><p>Заметки о том, как устроен код.<br/>D, PHP, Bitrix и веб-разработка.</p><div><Link href="/#journal">Все статьи</Link><Link href="/resources/">Полезные ссылки</Link><Link href="/tools/">JSON-инструмент</Link></div><span>Материалы 2017–2019</span></footer></body></html>}
|
||||
@@ -0,0 +1,2 @@
|
||||
import Link from 'next/link';
|
||||
export default function Missing(){return <main id="main" className="missing"><p className="kicker">ОШИБКА 404</p><div className="missing-code" aria-hidden="true">{ ? }</div><h1>Такой страницы нет.</h1><p>Возможно, в адресе опечатка или ссылка больше не существует.<br/>Попробуйте найти нужную тему в журнале.</p><Link className="button" href="/#journal">Перейти к поиску →</Link><Link href="/resources/">Открыть справочники</Link></main>}
|
||||
+4
-2
@@ -1,3 +1,5 @@
|
||||
import Link from 'next/link';
|
||||
import Catalog from './Catalog';
|
||||
import {getArticles} from '../lib/articles';
|
||||
export default function Home(){return <main><section className="site-hero"><div className="site-hero__inner"><p className="eyebrow">Код. Опыт. История.</p><h1>Записки<br/>программиста</h1><p className="site-description">D, PHP, Bitrix и JavaScript — практические задачи, небольшие открытия и архив разработки 2017–2019.</p><a className="hero-link" href="#catalog">Читать архив ↓</a></div><div className="hero-code" aria-hidden="true"><span>// знания остаются</span><br/>while (curious) {<br/> read();<br/> try();<br/> understand();<br/>}</div></section><Catalog articles={getArticles()}/></main>}
|
||||
import Shortlinks from './Shortlinks';
|
||||
import {getArticles,getArticleSummaries,formatDate} from '../lib/articles';
|
||||
export default function Home(){const all=getArticles(),lead=all.find(a=>a.slug==='новый-движок-ctfe'),recipes=all.filter(a=>a.categories.includes('Bitrix')||a.categories.includes('PHP')).slice(0,4);return <main id="main"><Shortlinks/><section className="intro"><div><p className="kicker">ЗАПИСКИ ПРОГРАММИСТА · 2017–2019</p><h1>Разобраться.<br/><em>Написать.</em> Проверить.</h1></div><p className="intro-deck">Что происходит во время компиляции? <br/>Как связаны товар и предложение? <br/>Здесь — механизмы, примеры и опыт разработки.</p></section><section className="front-grid" aria-label="С чего начать"><Link className="lead-story" href={'/articles/'+encodeURIComponent(lead.slug)+'/'}><div className="story-meta"><span>ВНУТРИ ЯЗЫКА D</span><span>01 / РАЗБОР</span></div><h2>Код, который работает<br/>до запуска программы</h2><p>Как CTFE выполняет функции на этапе компиляции и зачем D понадобился новый движок.</p><div className="lead-visual"><img src="/visuals/v2/ctfe-overview.svg" alt="Компилятор вычисляет square(3) для enum и получает n = 9 ещё до запуска программы"/></div><span className="text-link">Разобрать CTFE <b>↗</b></span></Link><div className="recipe-column"><div className="section-title"><p className="kicker">ПРАКТИКА</p><h2>Рецепты без лишнего</h2></div>{recipes.map((article,i)=><Link className="recipe" key={article.slug} href={'/articles/'+encodeURIComponent(article.slug)+'/'}><span className="recipe-number">0{i+1}</span><div><span className="tiny-topic">{article.categories.join(' / ')}</span><h3>{article.title}</h3></div><b aria-hidden="true">↗</b></Link>)}</div></section><section className="reading-routes" aria-label="Маршруты чтения"><p className="kicker">ВЫБЕРИТЕ ЗАДАЧУ</p><div><Link href="/category/dlang/"><span>01</span><strong>Понять язык D</strong><small>CTFE, память, диапазоны и интерфейсы →</small></Link><Link href="/category/bitix/"><span>02</span><strong>Собрать интеграцию Bitrix</strong><small>Товар, предложение, символьный код →</small></Link><Link href="/articles/ошибка-php-ssl-certificate-error-unable-to-get-local-issuer-certificate/"><span>03</span><strong>Разобраться с TLS</strong><small>Проверка сертификата без обхода защиты →</small></Link></div></section><Catalog articles={getArticleSummaries()}/><section className="utility-promo"><div><p className="kicker">НА РАБОЧЕМ СТОЛЕ</p><h2>Сначала проверьте JSON.</h2><p>Форматирование, поиск синтаксических ошибок и компактная запись — прямо в браузере.</p></div><Link className="button" href="/tools/">Открыть инструмент ↗</Link></section></main>}
|
||||
@@ -0,0 +1,3 @@
|
||||
export const metadata={title:'Справочники разработчика — ProgCode'};
|
||||
const sources=[['D','Язык, стандартная библиотека и инструменты',[['Спецификация D','https://dlang.org/spec/spec.html','Синтаксис, семантика и правила языка.'],['Стандартная библиотека Phobos','https://dlang.org/phobos/index.html','Контракты функций, модули и примеры.'],['DUB','https://dub.pm/','Сборка проектов и управление зависимостями.']]],['PHP','Функции и интеграции',[['Справочник PHP','https://www.php.net/manual/ru/','Функции, расширения и примеры использования.'],['API Bitrix','https://dev.1c-bitrix.ru/api_help/','Описание API и ограничений конкретных методов.']]],['Web','Сборка и безопасность',[['webpack: ProvidePlugin','https://webpack.js.org/plugins/provide-plugin/','Как автоматически подключать модуль для свободного идентификатора.'],['MDN: JSON.parse','https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse','Синтаксис JSON, ошибки разбора и точность чисел.'],['curl: проверка TLS','https://curl.se/docs/sslcerts.html','Цепочка доверия и безопасная диагностика сертификатов.']]]];
|
||||
export default function Resources(){return <main id="main" className="simple-page"><p className="kicker">ДЕРЖАТЬ ПОД РУКОЙ</p><h1>Сначала —<br/>первоисточник.</h1><p className="large-text">Справочники по темам журнала: для проверки версии API, поведения функции и границ примера.</p><div className="resource-groups">{sources.map(([topic,title,links])=><section key={topic}><p className="kicker">{topic}</p><h2>{title}</h2>{links.map(([name,href,text])=><a key={href} href={href}><h3>{name}<span>↗</span></h3><p>{text}</p></a>)}</section>)}</div></main>}
|
||||
@@ -1,3 +1,3 @@
|
||||
"use client";
|
||||
import {useState} from 'react';
|
||||
export default function Tools(){const [text,setText]=useState('{"hello":"ProgCode"}'),[result,setResult]=useState(''),[error,setError]=useState(false);function run(compact){try{setResult(JSON.stringify(JSON.parse(text),null,compact?0:2));setError(false);}catch(e){setResult('Ошибка JSON: '+e.message);setError(true);}}return <main className="article-page article-content"><p className="eyebrow">Инструменты разработчика</p><h1>Проверка и форматирование JSON</h1><p>Для отладки API в PHP, Bitrix и JavaScript. Введите JSON, чтобы проверить синтаксис, расставить отступы или получить компактную строку. Данные обрабатываются в браузере.</p><label htmlFor="json">Исходный JSON (до 1 МБ текста)</label><textarea id="json" maxLength={1000000} spellCheck={false} value={text} onChange={e=>setText(e.target.value)}/><div className="topics"><button onClick={()=>run(false)}>Проверить и форматировать</button><button onClick={()=>run(true)}>Сжать</button><button onClick={()=>{setText('');setResult('');}}>Очистить</button></div><pre role="status" className={error?'error':''}>{result||'Результат появится здесь'}</pre><h2>На что обратить внимание</h2><p>В JSON нужны двойные кавычки вокруг ключей и строк. Комментарии и запятая после последнего свойства не допускаются. Форматирование не проверяет бизнес-схему API. Числа за пределами безопасного диапазона JavaScript могут потерять точность; храните такие идентификаторы строками.</p><p>Новый инструмент, добавлен 26.10.2026. Основа: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse">MDN: JSON.parse</a>.</p></main>}
|
||||
export default function Tools(){const [text,setText]=useState('{"project":"ProgCode","ready":true}'),[result,setResult]=useState(''),[state,setState]=useState('empty'),[copy,setCopy]=useState('');function run(compact){setCopy('');try{setResult(JSON.stringify(JSON.parse(text),null,compact?0:2));setState('success');}catch(e){setResult(e.message);setState('error');}}async function copyResult(){try{await navigator.clipboard.writeText(result);setCopy('Скопировано');}catch{setCopy('Не удалось скопировать. Выделите текст результата вручную.');}}return <main id="main" className="tool-page"><div className="tool-heading"><p className="kicker">ИНСТРУМЕНТ РАЗРАБОТЧИКА</p><h1>Привести JSON <br/>в порядок.</h1><p>Проверьте синтаксис, расставьте отступы или уберите пробелы.<br/>Текст обрабатывается локально в вашем браузере.</p></div><div className="workbench"><section><label htmlFor="json">01 / Исходный JSON</label><textarea id="json" value={text} maxLength={1000000} spellCheck={false} onChange={e=>setText(e.target.value)} aria-describedby="json-limit"/><p id="json-limit" className="field-note">До 1 МБ текста. Исходный текст не отправляется на сервер.</p><div className="tool-actions"><button className="button" onClick={()=>run(false)}>Форматировать</button><button onClick={()=>run(true)}>Сжать</button><button onClick={()=>{setText('');setResult('');setState('empty');setCopy('');}}>Очистить</button></div></section><section className={'result-panel '+state}><div className="result-heading"><span>02 / Результат</span>{state==='success'&&<button onClick={copyResult}>Копировать</button>}</div><div role="status" aria-live="polite"><p className="result-label">{state==='error'?'Ошибка синтаксиса':state==='success'?'JSON корректен':'Ожидает проверки'}</p><pre tabIndex={0}>{result||'Результат появится после проверки.'}</pre></div><p role="status" className="copy-feedback">{copy}</p></section></div><div className="tool-notes"><h2>Синтаксис — только первый шаг.</h2><p>Ключи и строки требуют двойных кавычек. Комментарии и завершающие запятые не поддерживаются. Проверка не подтверждает соответствие схеме API. Большие целые числа могут терять точность в JavaScript: такие идентификаторы лучше хранить строками.</p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse">Правила JSON.parse в MDN ↗</a></div></main>}
|
||||
Reference in new issue
Block a user