diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec26478..01787a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -467,7 +467,7 @@ jobs: # Process a local file (mount current directory) docker run --rm -v $(pwd):/workspace ghcr.io/${{ github.repository }}:latest /workspace/input.json markdown /workspace/output.md ``` - + EOF # Security and quality analysis workflows diff --git a/internal/config/config_test.go b/internal/config/config_test.go index ef94164..5074a81 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -1,4 +1,3 @@ -// Package config_test provides tests for the config package. package config import ( diff --git a/internal/exporters/bench_test.go b/internal/exporters/bench_test.go index 5f91aab..3a485b6 100644 --- a/internal/exporters/bench_test.go +++ b/internal/exporters/bench_test.go @@ -1,4 +1,3 @@ -// Package exporters_test provides benchmarks for all exporters. package exporters import ( diff --git a/internal/exporters/docx.go b/internal/exporters/docx.go index 56db39c..56b9f34 100644 --- a/internal/exporters/docx.go +++ b/internal/exporters/docx.go @@ -69,7 +69,7 @@ func (e *DocxExporter) Export(course *models.Course, outputPath string) error { // Ensure output directory exists and add .docx extension if !strings.HasSuffix(strings.ToLower(outputPath), ".docx") { - outputPath = outputPath + ".docx" + outputPath += ".docx" } // Create the file @@ -198,5 +198,5 @@ func (e *DocxExporter) exportSubItem(doc *docx.Docx, subItem *models.SubItem) { // Returns: // - A string representing the supported format ("docx") func (e *DocxExporter) SupportedFormat() string { - return "docx" + return FormatDocx } diff --git a/internal/exporters/docx_test.go b/internal/exporters/docx_test.go index 374fcbb..9488d6b 100644 --- a/internal/exporters/docx_test.go +++ b/internal/exporters/docx_test.go @@ -1,4 +1,3 @@ -// Package exporters_test provides tests for the docx exporter. package exporters import ( @@ -331,7 +330,7 @@ func TestDocxExporter_ComplexCourse(t *testing.T) { Caption: "
Watch this introductory video
", Media: &models.Media{ Video: &models.VideoMedia{ - OriginalUrl: "https://example.com/intro.mp4", + OriginalURL: "https://example.com/intro.mp4", Duration: 300, }, }, @@ -359,7 +358,7 @@ func TestDocxExporter_ComplexCourse(t *testing.T) { Caption: "Course overview diagram
", Media: &models.Media{ Image: &models.ImageMedia{ - OriginalUrl: "https://example.com/overview.png", + OriginalURL: "https://example.com/overview.png", }, }, }, diff --git a/internal/exporters/factory.go b/internal/exporters/factory.go index 82f4560..bda72b0 100644 --- a/internal/exporters/factory.go +++ b/internal/exporters/factory.go @@ -1,5 +1,3 @@ -// Package exporters provides implementations of the Exporter interface -// for converting Articulate Rise courses into various file formats. package exporters import ( @@ -10,6 +8,13 @@ import ( "github.com/kjanat/articulate-parser/internal/services" ) +// Format constants for supported export formats. +const ( + FormatMarkdown = "markdown" + FormatDocx = "docx" + FormatHTML = "html" +) + // Factory implements the ExporterFactory interface. // It creates appropriate exporter instances based on the requested format. type Factory struct { @@ -36,11 +41,11 @@ func NewFactory(htmlCleaner *services.HTMLCleaner) interfaces.ExporterFactory { // Format strings are case-insensitive (e.g., "markdown", "DOCX"). func (f *Factory) CreateExporter(format string) (interfaces.Exporter, error) { switch strings.ToLower(format) { - case "markdown", "md": + case FormatMarkdown, "md": return NewMarkdownExporter(f.htmlCleaner), nil - case "docx", "word": + case FormatDocx, "word": return NewDocxExporter(f.htmlCleaner), nil - case "html", "htm": + case FormatHTML, "htm": return NewHTMLExporter(f.htmlCleaner), nil default: return nil, fmt.Errorf("unsupported export format: %s", format) @@ -50,5 +55,5 @@ func (f *Factory) CreateExporter(format string) (interfaces.Exporter, error) { // SupportedFormats returns a list of all supported export formats, // including both primary format names and their aliases. func (f *Factory) SupportedFormats() []string { - return []string{"markdown", "md", "docx", "word", "html", "htm"} + return []string{FormatMarkdown, "md", FormatDocx, "word", FormatHTML, "htm"} } diff --git a/internal/exporters/factory_test.go b/internal/exporters/factory_test.go index cf3eb2e..8379e14 100644 --- a/internal/exporters/factory_test.go +++ b/internal/exporters/factory_test.go @@ -1,4 +1,3 @@ -// Package exporters_test provides tests for the exporter factory. package exporters import ( diff --git a/internal/exporters/html.go b/internal/exporters/html.go index 3eaf792..d170320 100644 --- a/internal/exporters/html.go +++ b/internal/exporters/html.go @@ -1,5 +1,3 @@ -// Package exporters provides implementations of the Exporter interface -// for converting Articulate Rise courses into various file formats. package exporters import ( @@ -112,7 +110,10 @@ func (e *HTMLExporter) Export(course *models.Course, outputPath string) error { buf.WriteString("