Make NewCommonAttributes public
This commit is contained in:
parent
8fc6a10b0d
commit
d8d0526a05
@ -16,7 +16,7 @@ type Category struct {
|
|||||||
// NewCategory creates a new Category. It returns a *Category.
|
// NewCategory creates a new Category. It returns a *Category.
|
||||||
func NewCategory(term string) *Category {
|
func NewCategory(term string) *Category {
|
||||||
return &Category{
|
return &Category{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Term: term,
|
Term: term,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ type CommonAttributes struct {
|
|||||||
|
|
||||||
// NewCommonAttributes creates a new set of CommonAttributes. It returns a
|
// NewCommonAttributes creates a new set of CommonAttributes. It returns a
|
||||||
// *CommonAttributes.
|
// *CommonAttributes.
|
||||||
func newCommonAttributes() *CommonAttributes {
|
func NewCommonAttributes() *CommonAttributes {
|
||||||
return new(CommonAttributes)
|
return new(CommonAttributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
date.go
2
date.go
@ -19,7 +19,7 @@ func DateTime(t time.Time) string {
|
|||||||
// NewDate creates a new Date. It returns a *Date.
|
// NewDate creates a new Date. It returns a *Date.
|
||||||
func NewDate(t time.Time) *Date {
|
func NewDate(t time.Time) *Date {
|
||||||
return &Date{
|
return &Date{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
DateTime: DateTime(t),
|
DateTime: DateTime(t),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
entry.go
2
entry.go
@ -59,7 +59,7 @@ func (e *Entry) checkAuthors(authorInFeed bool) error {
|
|||||||
// NewEntry creates a new Entry. It returns a *Entry.
|
// NewEntry creates a new Entry. It returns a *Entry.
|
||||||
func NewEntry(title string) *Entry {
|
func NewEntry(title string) *Entry {
|
||||||
return &Entry{
|
return &Entry{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
ID: NewID(NewURN()),
|
ID: NewID(NewURN()),
|
||||||
Title: NewText("text", title),
|
Title: NewText("text", title),
|
||||||
Updated: NewDate(time.Now()),
|
Updated: NewDate(time.Now()),
|
||||||
|
2
feed.go
2
feed.go
@ -28,7 +28,7 @@ type Feed struct {
|
|||||||
// NewFeed creates a new Feed. It returns a *Feed.
|
// NewFeed creates a new Feed. It returns a *Feed.
|
||||||
func NewFeed(title string) *Feed {
|
func NewFeed(title string) *Feed {
|
||||||
return &Feed{
|
return &Feed{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
ID: NewID(NewURN()),
|
ID: NewID(NewURN()),
|
||||||
Title: NewText("text", title),
|
Title: NewText("text", title),
|
||||||
Updated: NewDate(time.Now()),
|
Updated: NewDate(time.Now()),
|
||||||
|
@ -17,7 +17,7 @@ type Generator struct {
|
|||||||
// NewGenerator creates a new Generator. It returns a *Generator.
|
// NewGenerator creates a new Generator. It returns a *Generator.
|
||||||
func NewGenerator(text string) *Generator {
|
func NewGenerator(text string) *Generator {
|
||||||
return &Generator{
|
return &Generator{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Text: html.UnescapeString(text),
|
Text: html.UnescapeString(text),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
icon.go
2
icon.go
@ -15,7 +15,7 @@ type Icon struct {
|
|||||||
// NewIcon creates a new Icon. It returns a *Icon.
|
// NewIcon creates a new Icon. It returns a *Icon.
|
||||||
func NewIcon(uri string) *Icon {
|
func NewIcon(uri string) *Icon {
|
||||||
return &Icon{
|
return &Icon{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
URI: uri,
|
URI: uri,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
id.go
2
id.go
@ -15,7 +15,7 @@ type ID struct {
|
|||||||
// NewID creates a new ID. It returns a *ID.
|
// NewID creates a new ID. It returns a *ID.
|
||||||
func NewID(uri string) *ID {
|
func NewID(uri string) *ID {
|
||||||
return &ID{
|
return &ID{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
URI: uri,
|
URI: uri,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ func newInlineOtherContent(mediaType string, content any) *InlineOtherContent {
|
|||||||
mediaType, _, _ = mime.ParseMediaType(mediaType)
|
mediaType, _, _ = mime.ParseMediaType(mediaType)
|
||||||
|
|
||||||
return &InlineOtherContent{
|
return &InlineOtherContent{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: mediaType,
|
Type: mediaType,
|
||||||
AnyElement: content,
|
AnyElement: content,
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ type InlineTextContent struct {
|
|||||||
// *InlineTextContent.
|
// *InlineTextContent.
|
||||||
func newInlineTextContent(mediaType, text string) *InlineTextContent {
|
func newInlineTextContent(mediaType, text string) *InlineTextContent {
|
||||||
return &InlineTextContent{
|
return &InlineTextContent{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: mediaType,
|
Type: mediaType,
|
||||||
Text: text,
|
Text: text,
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ type InlineXHTMLContent struct {
|
|||||||
// *InlineXHTMLContent.
|
// *InlineXHTMLContent.
|
||||||
func newInlineXHTMLContent(mediaType string, div *XHTMLDiv) *InlineXHTMLContent {
|
func newInlineXHTMLContent(mediaType string, div *XHTMLDiv) *InlineXHTMLContent {
|
||||||
return &InlineXHTMLContent{
|
return &InlineXHTMLContent{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: mediaType,
|
Type: mediaType,
|
||||||
XHTMLDiv: div,
|
XHTMLDiv: div,
|
||||||
}
|
}
|
||||||
|
2
link.go
2
link.go
@ -20,7 +20,7 @@ type Link struct {
|
|||||||
// NewLink creates a new Link. It returns a *Link.
|
// NewLink creates a new Link. It returns a *Link.
|
||||||
func NewLink(href string) *Link {
|
func NewLink(href string) *Link {
|
||||||
return &Link{
|
return &Link{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Href: href,
|
Href: href,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
logo.go
2
logo.go
@ -14,7 +14,7 @@ type Logo struct {
|
|||||||
// NewLogo creates a new Logo. It returns a *Logo.
|
// NewLogo creates a new Logo. It returns a *Logo.
|
||||||
func NewLogo(uri string) *Logo {
|
func NewLogo(uri string) *Logo {
|
||||||
return &Logo{
|
return &Logo{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
URI: uri,
|
URI: uri,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ func newOutOfLineContent(mediaType, src string) *OutOfLineContent {
|
|||||||
mediaType, _, _ = mime.ParseMediaType(mediaType)
|
mediaType, _, _ = mime.ParseMediaType(mediaType)
|
||||||
|
|
||||||
return &OutOfLineContent{
|
return &OutOfLineContent{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: mediaType,
|
Type: mediaType,
|
||||||
SRC: src,
|
SRC: src,
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ type Person struct {
|
|||||||
// NewPerson creates a new Person. It returns a *Person.
|
// NewPerson creates a new Person. It returns a *Person.
|
||||||
func NewPerson(name string) *Person {
|
func NewPerson(name string) *Person {
|
||||||
return &Person{
|
return &Person{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Name: name,
|
Name: name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ func (p *PlainText) isText() bool { return true }
|
|||||||
// newPlainText creates a new PlainText. It returns a *PlainText.
|
// newPlainText creates a new PlainText. It returns a *PlainText.
|
||||||
func newPlainText(textType, content string) *PlainText {
|
func newPlainText(textType, content string) *PlainText {
|
||||||
return &PlainText{
|
return &PlainText{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: textType,
|
Type: textType,
|
||||||
Text: content,
|
Text: content,
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ type Source struct {
|
|||||||
|
|
||||||
// NewSource creates a new Source. It returns a *Source.
|
// NewSource creates a new Source. It returns a *Source.
|
||||||
func NewSource() *Source {
|
func NewSource() *Source {
|
||||||
return &Source{CommonAttributes: newCommonAttributes()}
|
return &Source{CommonAttributes: NewCommonAttributes()}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddAuthor adds the Person as an author to the Source. It returns its index as
|
// AddAuthor adds the Person as an author to the Source. It returns its index as
|
||||||
|
@ -16,7 +16,7 @@ func (x *XHTMLText) isText() bool { return true }
|
|||||||
// newPlainText creates a new PlainText. It returns a *PlainText.
|
// newPlainText creates a new PlainText. It returns a *PlainText.
|
||||||
func newXHTMLText(textType, content string) *XHTMLText {
|
func newXHTMLText(textType, content string) *XHTMLText {
|
||||||
return &XHTMLText{
|
return &XHTMLText{
|
||||||
CommonAttributes: newCommonAttributes(),
|
CommonAttributes: NewCommonAttributes(),
|
||||||
Type: textType,
|
Type: textType,
|
||||||
XHTMLDiv: NewXHTMLDiv(content),
|
XHTMLDiv: NewXHTMLDiv(content),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user