Add concept of serie

This commit is contained in:
Romain de Laage 2022-02-14 19:21:31 +01:00
parent bbe2ca6cf8
commit 3af6883c9e
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
7 changed files with 100 additions and 35 deletions

View File

@ -2,12 +2,17 @@ package page
import (
"strings"
"time"
)
type Page struct {
Title string `json:"title"`
Path string `json:"path"`
Content []string `json:"content"`
Title string `json:"title"`
Content []string `json:"content"`
Authors []string `json:"authors"`
Tags []string `json:"tags"`
DateEdit time.Time `json:"dateEdit"`
DateCreate time.Time `json:"dateCreate"`
DatePublish time.Time `json:"datePublish"`
}
func (p *Page) GetPage() string {

View File

@ -1,18 +0,0 @@
package post
import (
"time"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/page"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/tag"
)
type Post struct {
page.Page
Authors []string `json:"authors"`
Tags []tag.Tag `json:"tags"`
DateEdit time.Time `json:"dateEdit"`
DateCreate time.Time `json:"dateCreate"`
DatePublish time.Time `json:"datePublish"`
}

23
model/serie/serie.go Normal file
View File

@ -0,0 +1,23 @@
package serie
import (
"strings"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/page"
)
type Serie struct {
Name string `json:"name"`
Feedable bool `json:"feedable"`
Prefix string `json:"prefix"`
Abstract []string `json:"abstract"`
Pages []page.Page `json:"pages"`
}
func (s *Serie) GetAbstract() string {
return strings.Join(s.Abstract, "\n")
}
func (s *Serie) SetAbstract(newAbstract string) {
s.Abstract = strings.Split(newAbstract, "\n")
}

View File

@ -4,16 +4,14 @@ import (
"strings"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/author"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/post"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/page"
"git.rdelaage.ovh/rdelaage/cyanocorax/model/serie"
)
type Site struct {
Name string `json:"name"`
Icon string `json:"icon"`
Authors []author.Author `json:"authors"`
Posts []post.Post `json:"posts"`
Pages []page.Page `json:"pages"`
Series []serie.Serie `json:"series"`
Abstract []string `json:"abstract"`
}

View File

@ -1,5 +0,0 @@
package tag
type Tag struct {
Name string `json:"name"`
}

67
test.json Normal file
View File

@ -0,0 +1,67 @@
{
"name": "An example site",
"icon": "🐣",
"authors": [
{
"handle": "rdelaage",
"fullName": "Romain de Laage",
"bio": [
"Ceci est un test",
"de biographie",
"sur plusieurs lignes"
],
"banner": [
"/-\\",
"\\-/"
]
}
],
"series": [
{
"name": "Blog",
"feedable": true,
"prefix": "blog",
"abstract": [
"This is my blog",
"Content under free license"
],
"pages": [
{
"title": "Retour d'expérience sur Gemini",
"tags": [
"Opinion",
"Technologie",
"Gemini"
],
"authors": [
"rdelaage"
],
"datePublish": "2022-02-12T10:00:00Z",
"dateCreate": "2022-02-12T09:37:34Z",
"dateEdit": "2022-02-12T10:01:23Z",
"content": [
"Ceci est un test",
"",
"Un super test"
]
}
]
},
{
"name": "Now",
"feedable": false,
"prefix": "now",
"abstract": [
"I am programming, this software",
"",
"It is fun!"
]
}
],
"abstract" : [
"Welcome on this example site",
"It shows the features of cyanocorax",
"",
"Cynanocorax is the scientific name of a little bird!"
]
}

View File

@ -1,9 +1,4 @@
* Add renderer
* Add the concept of Serie
* Add feedable bool in serie
* Use of archive/zip, sort packages
* Global feed with all feedable series, add feed per feedable serie
* Support for enclosure/podcast ?
* Posts and pages are the same, merge them
* Each page must be in a serie
* Each serie have a prefix and an abstract (index), pages are optional and path is automatically calculated