fix: normalize numbered lists and FY labels in PDF export

- Convert "1) ... 2) ..." inline lists to line-separated items in PDF
- Use FY-3/FY-2/FY-1 labels in financial table (was FY3/FY2/FY1)
- Applies to both top-level and nested field values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
admin
2026-02-25 12:18:07 -05:00
parent 53dd849096
commit 8620ea87b7

View File

@@ -1244,12 +1244,13 @@ class PDFGenerationService {
html += `<tbody>`;
const periods = ['fy3', 'fy2', 'fy1', 'ltm'];
const periodLabels: Record<string, string> = { fy3: 'FY-3', fy2: 'FY-2', fy1: 'FY-1', ltm: 'LTM' };
periods.forEach(period => {
if (value && typeof value === 'object' && value[period as keyof typeof value]) {
const data = value[period as keyof typeof value] as any;
html += `
<tr>
<td><strong>${period.toUpperCase()}</strong></td>
<td><strong>${periodLabels[period] || period.toUpperCase()}</strong></td>
<td>${data?.revenue || '-'}</td>
<td>${data?.revenueGrowth || '-'}</td>
<td>${data?.ebitda || '-'}</td>
@@ -1264,20 +1265,22 @@ class PDFGenerationService {
html += `<h3>📋 ${this.formatFieldName(key)}</h3>`;
Object.entries(value).forEach(([subKey, subValue]) => {
if (subValue && typeof subValue !== 'object') {
const displaySubValue = String(subValue).replace(/\.\s+(\d+)\)\s/g, '.<br>$1) ');
html += `
<div class="field">
<span class="field-label">${this.formatFieldName(subKey)}</span>
<span class="field-value">${subValue}</span>
<span class="field-value">${displaySubValue}</span>
</div>
`;
}
});
} else if (value) {
// Handle simple fields
// Handle simple fields — normalize inline numbered lists to line-separated
const displayValue = String(value).replace(/\.\s+(\d+)\)\s/g, '.<br>$1) ');
html += `
<div class="field">
<span class="field-label">${this.formatFieldName(key)}</span>
<span class="field-value">${value}</span>
<span class="field-value">${displayValue}</span>
</div>
`;
}