diff options
-rw-r--r-- | cmd/ponzu/options.go | 39 | ||||
-rw-r--r-- | content/post.go | 38 |
2 files changed, 39 insertions, 38 deletions
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index 6f42f0c..468a447 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -80,25 +80,6 @@ type {{ .name }} struct { Theme string ` + "`json:" + `"theme"` + "`" + ` } -func init() { - Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) } -} - -// SetContentID partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id } - -// ContentID partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID } - -// ContentName partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title } - -// SetSlug partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug } - -// Editor partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor } - // MarshalEditor writes a buffer of html to edit a {{ .name }} and partially implements editor.Editable func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) { view, err := editor.Form({{ .initial }}, @@ -152,6 +133,26 @@ func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) { return view, nil } + +func init() { + Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) } +} + +// SetContentID partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id } + +// ContentID partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID } + +// ContentName partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title } + +// SetSlug partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug } + +// Editor partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor } + ` func newProjectInDir(path string) error { diff --git a/content/post.go b/content/post.go index d121ed7..dcdfeff 100644 --- a/content/post.go +++ b/content/post.go @@ -19,25 +19,6 @@ type Post struct { Theme string `json:"theme"` } -func init() { - Types["Post"] = func() interface{} { return new(Post) } -} - -// SetContentID partially implements editor.Editable -func (p *Post) SetContentID(id int) { p.ID = id } - -// ContentID partially implements editor.Editable -func (p *Post) ContentID() int { return p.ID } - -// ContentName partially implements editor.Editable -func (p *Post) ContentName() string { return p.Title } - -// SetSlug partially implements editor.Editable -func (p *Post) SetSlug(slug string) { p.Slug = slug } - -// Editor partially implements editor.Editable -func (p *Post) Editor() *editor.Editor { return &p.editor } - // MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable func (p *Post) MarshalEditor() ([]byte, error) { view, err := editor.Form(p, @@ -88,3 +69,22 @@ func (p *Post) MarshalEditor() ([]byte, error) { return view, nil } + +func init() { + Types["Post"] = func() interface{} { return new(Post) } +} + +// SetContentID partially implements editor.Editable +func (p *Post) SetContentID(id int) { p.ID = id } + +// ContentID partially implements editor.Editable +func (p *Post) ContentID() int { return p.ID } + +// ContentName partially implements editor.Editable +func (p *Post) ContentName() string { return p.Title } + +// SetSlug partially implements editor.Editable +func (p *Post) SetSlug(slug string) { p.Slug = slug } + +// Editor partially implements editor.Editable +func (p *Post) Editor() *editor.Editor { return &p.editor } |