mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Refactor RDF parser to use an adapter
Avoid tight coupling between `model.Feed` and the original XML RDF feed.
This commit is contained in:
parent
ee3486af66
commit
6bc4b35e38
5 changed files with 480 additions and 372 deletions
|
@ -3,29 +3,13 @@
|
|||
|
||||
package dublincore // import "miniflux.app/v2/internal/reader/dublincore"
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"miniflux.app/v2/internal/reader/sanitizer"
|
||||
)
|
||||
|
||||
// DublinCoreFeedElement represents Dublin Core feed XML elements.
|
||||
type DublinCoreFeedElement struct {
|
||||
DublinCoreCreator string `xml:"http://purl.org/dc/elements/1.1/ channel>creator"`
|
||||
type DublinCoreChannelElement struct {
|
||||
DublinCoreCreator string `xml:"http://purl.org/dc/elements/1.1/ creator"`
|
||||
}
|
||||
|
||||
func (feed *DublinCoreFeedElement) GetSanitizedCreator() string {
|
||||
return strings.TrimSpace(sanitizer.StripTags(feed.DublinCoreCreator))
|
||||
}
|
||||
|
||||
// DublinCoreItemElement represents Dublin Core entry XML elements.
|
||||
type DublinCoreItemElement struct {
|
||||
DublinCoreTitle string `xml:"http://purl.org/dc/elements/1.1/ title"`
|
||||
DublinCoreDate string `xml:"http://purl.org/dc/elements/1.1/ date"`
|
||||
DublinCoreCreator string `xml:"http://purl.org/dc/elements/1.1/ creator"`
|
||||
DublinCoreContent string `xml:"http://purl.org/rss/1.0/modules/content/ encoded"`
|
||||
}
|
||||
|
||||
func (item *DublinCoreItemElement) GetSanitizedCreator() string {
|
||||
return strings.TrimSpace(sanitizer.StripTags(item.DublinCoreCreator))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue