mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
fix(changelog): renderizar parágrafo de resumo por versão
Parser ignorava texto livre entre o cabeçalho ## [versão] e a primeira seção ###. Adicionado campo `summary` em ChangelogVersion e captura das linhas de texto antes da primeira seção. ChangelogTab renderiza o resumo logo abaixo do cabeçalho, antes das entradas técnicas. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,11 @@ export function ChangelogTab({ versions }: { versions: ChangelogVersion[] }) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-4 w-full mx-auto sm:w-3/4">
|
<div className="space-y-4 w-full mx-auto sm:w-3/4">
|
||||||
|
{version.summary && (
|
||||||
|
<p className="text-sm text-muted-foreground leading-relaxed">
|
||||||
|
{version.summary}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
{version.sections.map((section) => (
|
{version.sections.map((section) => (
|
||||||
<div key={section.type}>
|
<div key={section.type}>
|
||||||
<Badge
|
<Badge
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export type ChangelogSection = {
|
|||||||
export type ChangelogVersion = {
|
export type ChangelogVersion = {
|
||||||
version: string;
|
version: string;
|
||||||
date: string;
|
date: string;
|
||||||
|
summary?: string;
|
||||||
sections: ChangelogSection[];
|
sections: ChangelogSection[];
|
||||||
/** Linha de contribuições/autor (pode conter markdown, ex: [Nome](url)) */
|
/** Linha de contribuições/autor (pode conter markdown, ex: [Nome](url)) */
|
||||||
contributor?: string;
|
contributor?: string;
|
||||||
@@ -22,6 +23,7 @@ export function parseChangelog(): ChangelogVersion[] {
|
|||||||
const versions: ChangelogVersion[] = [];
|
const versions: ChangelogVersion[] = [];
|
||||||
let currentVersion: ChangelogVersion | null = null;
|
let currentVersion: ChangelogVersion | null = null;
|
||||||
let currentSection: ChangelogSection | null = null;
|
let currentSection: ChangelogSection | null = null;
|
||||||
|
let summaryLines: string[] = [];
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const versionMatch = line.match(/^## \[(.+?)\] - (.+)$/);
|
const versionMatch = line.match(/^## \[(.+?)\] - (.+)$/);
|
||||||
@@ -37,11 +39,16 @@ export function parseChangelog(): ChangelogVersion[] {
|
|||||||
};
|
};
|
||||||
versions.push(currentVersion);
|
versions.push(currentVersion);
|
||||||
currentSection = null;
|
currentSection = null;
|
||||||
|
summaryLines = [];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sectionMatch = line.match(/^### (.+)$/);
|
const sectionMatch = line.match(/^### (.+)$/);
|
||||||
if (sectionMatch && currentVersion) {
|
if (sectionMatch && currentVersion) {
|
||||||
|
if (summaryLines.length > 0) {
|
||||||
|
currentVersion.summary = summaryLines.join(" ").trim();
|
||||||
|
summaryLines = [];
|
||||||
|
}
|
||||||
if (currentSection) {
|
if (currentSection) {
|
||||||
currentVersion.sections.push(currentSection);
|
currentVersion.sections.push(currentSection);
|
||||||
}
|
}
|
||||||
@@ -55,6 +62,11 @@ export function parseChangelog(): ChangelogVersion[] {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentVersion && !currentSection && line.trim()) {
|
||||||
|
summaryLines.push(line.trim());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// **Contribuições:** ou **Autor:** com texto/link opcional
|
// **Contribuições:** ou **Autor:** com texto/link opcional
|
||||||
const contributorMatch = line.match(
|
const contributorMatch = line.match(
|
||||||
/^\*\*(?:Contribuições|Autor):\*\*\s*(.+)$/,
|
/^\*\*(?:Contribuições|Autor):\*\*\s*(.+)$/,
|
||||||
|
|||||||
Reference in New Issue
Block a user