refactor: Standardize method names and introduce context propagation

Removes the `Get` prefix from exporter methods (e.g., GetSupportedFormat -> SupportedFormat) to better align with Go conventions for simple accessors.

Introduces `context.Context` propagation through the application, starting from `ProcessCourseFromURI` down to the HTTP request in the parser. This makes network operations cancellable and allows for setting deadlines, improving application robustness.

Additionally, optimizes the HTML cleaner by pre-compiling regular expressions for a minor performance gain.
This commit is contained in:
2025-11-06 04:25:54 +01:00
parent 65469ea52e
commit 2790064ad5
16 changed files with 90 additions and 69 deletions

View File

@ -92,12 +92,12 @@ func (e *MarkdownExporter) Export(course *models.Course, outputPath string) erro
return os.WriteFile(outputPath, buf.Bytes(), 0644)
}
// GetSupportedFormat returns the format name this exporter supports
// SupportedFormat returns the format name this exporter supports
// It indicates the file format that the MarkdownExporter can generate.
//
// Returns:
// - A string representing the supported format ("markdown")
func (e *MarkdownExporter) GetSupportedFormat() string {
func (e *MarkdownExporter) SupportedFormat() string {
return "markdown"
}