mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-10-13 01:35:27 +02:00
- Add interfaces.HTMLCleaner interface for better testability - Add CleanAndTrim() method to simplify repeated pattern - Move item/lesson type constants to models/item_types.go - Update all exporters to use interface instead of concrete type - Replace strings.TrimSpace(CleanHTML(...)) with CleanAndTrim()
14 lines
549 B
Go
14 lines
549 B
Go
package interfaces
|
|
|
|
// HTMLCleaner defines the interface for cleaning HTML content.
|
|
// Implementations convert HTML to plain text, stripping tags and decoding entities.
|
|
type HTMLCleaner interface {
|
|
// CleanHTML removes HTML tags and decodes HTML entities from a string.
|
|
// Returns plain text suitable for non-HTML output formats.
|
|
CleanHTML(htmlStr string) string
|
|
|
|
// CleanAndTrim removes HTML tags, decodes entities, and trims whitespace.
|
|
// Convenience method combining CleanHTML with strings.TrimSpace.
|
|
CleanAndTrim(htmlStr string) string
|
|
}
|