refactor: PDF filenames with_skills → with-skills (cosmetic only)

Changed PDF filename format to use hyphens instead of underscores for
consistency with other filename components, while keeping API parameter
as `version=with_skills`.

## Changes

**Backend:**
- internal/handlers/cv.go: Add underscore-to-hyphen conversion in filename generation
  - New logic: `strings.ReplaceAll(version, "_", "-")` for filename only
  - API parameter unchanged: still accepts `version=with_skills`

**Tests:**
- internal/handlers/pdf_test.go: Update expected filenames to use hyphens
  - cv-*-with_skills-*.pdf → cv-*-with-skills-*.pdf

**Documentation:**
- Updated all PDF filename references to use hyphens
- PDF-EXPORT-FEATURE.md
- doc/LONG-PDF-GENERATION.md
- PDF-VALIDATION-REPORT.md (new validation report)

**PDFs:**
- Regenerated all 8 PDFs with new naming convention
- Old: cv-short-with_skills-jamr-2025-en.pdf
- New: cv-short-with-skills-jamr-2025-en.pdf

## Examples

API calls unchanged:
- GET /export/pdf?version=with_skills (still works)

Generated filenames:
- cv-short-with-skills-jamr-2025-en.pdf ✓
- cv-long-with-skills-jamr-2025-es.pdf ✓

**Tests:** All passing ✓
**API:** Backwards compatible ✓
This commit is contained in:
juanatsap
2025-11-20 11:48:34 +00:00
parent b44f9b9a99
commit 54cdb0cc19
14 changed files with 215 additions and 20 deletions
+3 -1
View File
@@ -332,11 +332,13 @@ func (h *CVHandler) ExportPDF(w http.ResponseWriter, r *http.Request) {
// Build filename: cv-{length}[-{version}]-{initials}-{year}-{lang}.pdf
// Omit version if it's "clean"
// Replace underscores with hyphens in version for filename (with_skills → with-skills)
var filename string
if version == "clean" {
filename = fmt.Sprintf("cv-%s-%s-%d-%s.pdf", length, initials, currentYear, lang)
} else {
filename = fmt.Sprintf("cv-%s-%s-%s-%d-%s.pdf", length, version, initials, currentYear, lang)
versionForFilename := strings.ReplaceAll(version, "_", "-")
filename = fmt.Sprintf("cv-%s-%s-%s-%d-%s.pdf", length, versionForFilename, initials, currentYear, lang)
}
// Set response headers
+2 -2
View File
@@ -178,12 +178,12 @@ func TestExportPDF_FilenameGeneration(t *testing.T) {
"length": "long",
"version": "with_skills",
},
expectedFilename: "CV-Juan-Andrés-Moreno-Rubio-es-long-with_skills.pdf",
expectedFilename: "CV-Juan-Andrés-Moreno-Rubio-es-long-with-skills.pdf",
},
{
name: "Defaults (en, short, with_skills)",
params: map[string]string{},
expectedFilename: "CV-Juan-Andrés-Moreno-Rubio-en-short-with_skills.pdf",
expectedFilename: "CV-Juan-Andrés-Moreno-Rubio-en-short-with-skills.pdf",
},
}