diff --git a/examples/gno.land/p/demo/blog/blog.gno b/examples/gno.land/p/demo/blog/blog.gno
index 1cf37b7ad3a..6be11336b0c 100644
--- a/examples/gno.land/p/demo/blog/blog.gno
+++ b/examples/gno.land/p/demo/blog/blog.gno
@@ -1,7 +1,6 @@
package blog
import (
- "errors"
"std"
"strconv"
"strings"
@@ -13,10 +12,12 @@ import (
)
type Blog struct {
- Title string
- Prefix string // i.e. r/gnoland/blog:
- Posts avl.Tree // slug -> Post
- NoBreadcrumb bool
+ Title string
+ Prefix string // i.e. r/gnoland/blog:
+ Posts avl.Tree // slug -> *Post
+ PostsPublished avl.Tree // published-date -> *Post
+ PostsAlphabetical avl.Tree // title -> *Post
+ NoBreadcrumb bool
}
func (b Blog) RenderLastPostsWidget(limit int) string {
@@ -42,7 +43,7 @@ func (b Blog) RenderHome(res *mux.ResponseWriter, req *mux.Request) {
}
res.Write("
")
- b.Posts.Iterate("", "", func(key string, value interface{}) bool {
+ b.PostsPublished.ReverseIterate("", "", func(key string, value interface{}) bool {
post := value.(*Post)
res.Write(post.RenderListItem())
return false
@@ -62,19 +63,16 @@ func (b Blog) RenderPost(res *mux.ResponseWriter, req *mux.Request) {
}
p := post.(*Post)
- if !b.NoBreadcrumb {
- breadStr := breadcrumb([]string{
- ufmt.Sprintf("[%s](%s)", b.Title, b.Prefix),
- "p",
- p.Title,
- })
- res.Write(breadStr)
- }
-
- // output += ufmt.Sprintf("## [%s](%s)\n", p.Title, p.URL())
+ res.Write("# " + p.Title + "\n\n")
res.Write(p.Body + "\n\n")
+ res.Write("---\n\n")
+
res.Write(p.RenderTagList() + "\n\n")
- res.Write(formatAuthorAndDate(p.Author, p.CreatedAt) + "\n\n")
+ res.Write(p.RenderAuthorList() + "\n\n")
+ res.Write(p.RenderPublishData() + "\n\n")
+
+ res.Write("---\n")
+ res.Write("
Comment section
\n\n")
// comments
p.Comments.ReverseIterate("", "", func(key string, value interface{}) bool {
@@ -82,6 +80,8 @@ func (b Blog) RenderPost(res *mux.ResponseWriter, req *mux.Request) {
res.Write(comment.RenderListItem())
return false
})
+
+ res.Write("\n")
}
func (b Blog) RenderTag(res *mux.ResponseWriter, req *mux.Request) {
@@ -124,21 +124,34 @@ func (b Blog) Render(path string) string {
return router.Render(path)
}
-func (b *Blog) NewPost(author std.Address, slug, title, body string, tags []string) error {
- _, found := b.Posts.Get(slug)
- if found {
- return errors.New("slug already exists.")
+func (b *Blog) NewPost(publisher std.Address, slug, title, body, pubDate string, authors, tags []string) error {
+ if _, found := b.Posts.Get(slug); found {
+ return ErrPostSlugExists
}
- post := Post{
- Author: author,
+ var parsedTime time.Time
+ var err error
+ if pubDate != "" {
+ parsedTime, err = time.Parse(time.RFC3339, pubDate)
+ if err != nil {
+ return err
+ }
+ } else {
+ // If no publication date was passed in by caller, take current block time
+ parsedTime = time.Now()
+ }
+
+ post := &Post{
+ Publisher: publisher,
+ Authors: authors,
Slug: slug,
Title: title,
Body: body,
Tags: tags,
- CreatedAt: time.Now(),
+ CreatedAt: parsedTime,
}
- return b.prepareAndSetPost(&post)
+
+ return b.prepareAndSetPost(post)
}
func (b *Blog) prepareAndSetPost(post *Post) error {
@@ -146,20 +159,35 @@ func (b *Blog) prepareAndSetPost(post *Post) error {
post.Body = strings.TrimSpace(post.Body)
if post.Title == "" {
- return errors.New("title is missing.")
+ return ErrPostTitleMissing
}
if post.Body == "" {
- return errors.New("body is missing.")
+ return ErrPostBodyMissing
}
if post.Slug == "" {
- return errors.New("slug is missing.")
+ return ErrPostSlugMissing
}
- // more input sanitization?
post.Blog = b
post.UpdatedAt = time.Now()
+ trimmedTitleKey := strings.Replace(post.Title, " ", "", -1)
+ pubDateKey := post.CreatedAt.Format(time.RFC3339)
+
+ // Cannot have two posts with same title key
+ if _, found := b.PostsAlphabetical.Get(trimmedTitleKey); found {
+ return ErrPostTitleExists
+ }
+ // Cannot have two posts with *exact* same timestamp
+ if _, found := b.PostsPublished.Get(pubDateKey); found {
+ return ErrPostPubDateExists
+ }
+
+ // Store post under keys
+ b.PostsAlphabetical.Set(trimmedTitleKey, post)
+ b.PostsPublished.Set(pubDateKey, post)
b.Posts.Set(post.Slug, post)
+
return nil
}
@@ -179,15 +207,24 @@ type Post struct {
CreatedAt time.Time
UpdatedAt time.Time
Comments avl.Tree
- Author std.Address
+ Authors []string
+ Publisher std.Address
Tags []string
CommentIndex int
}
-func (p *Post) Update(title, body string, tags []string) error {
+func (p *Post) Update(title, body, publicationDate string, authors, tags []string) error {
p.Title = title
p.Body = body
p.Tags = tags
+ p.Authors = authors
+
+ parsedTime, err := time.Parse(time.RFC3339, publicationDate)
+ if err != nil {
+ return err
+ }
+
+ p.CreatedAt = parsedTime
return p.Blog.prepareAndSetPost(p)
}
@@ -234,31 +271,66 @@ func (p *Post) RenderListItem() string {
return "error: no such post\n"
}
output := "
\n\n"
- output += ufmt.Sprintf("## [%s](%s)\n", p.Title, p.URL())
- output += ufmt.Sprintf("**[Learn More](%s)**\n", p.URL())
+ output += ufmt.Sprintf("### [%s](%s)\n", p.Title, p.URL())
+ // output += ufmt.Sprintf("**[Learn More](%s)**\n\n", p.URL())
+
+ output += " " + p.CreatedAt.Format("02 Jan 2006")
// output += p.Summary() + "\n\n"
// output += p.RenderTagList() + "\n\n"
- // output += formatAuthorAndDate(p.Author, p.CreatedAt) + "\n"
output += "\n"
output += "
"
return output
}
+// Render post tags
func (p *Post) RenderTagList() string {
if p == nil {
return "error: no such post\n"
}
- output := ""
+ if len(p.Tags) == 0 {
+ return ""
+ }
+
+ output := "Tags: "
for idx, tag := range p.Tags {
if idx > 0 {
output += " "
}
tagURL := p.Blog.Prefix + "t/" + tag
output += ufmt.Sprintf("[#%s](%s)", tag, tagURL)
+
}
return output
}
+// Render authors if there are any
+func (p *Post) RenderAuthorList() string {
+ out := "Written"
+ if len(p.Authors) != 0 {
+ out += " by "
+
+ for idx, author := range p.Authors {
+ out += author
+ if idx < len(p.Authors)-1 {
+ out += ", "
+ }
+ }
+ }
+ out += " on " + p.CreatedAt.Format("02 Jan 2006")
+
+ return out
+}
+
+func (p *Post) RenderPublishData() string {
+ out := "Published "
+ if p.Publisher != "" {
+ out += "by " + p.Publisher.String() + " "
+ }
+ out += "to " + p.Blog.Title
+
+ return out
+}
+
func (p *Post) URL() string {
if p == nil {
return p.Blog.Prefix + "404"
@@ -287,15 +359,15 @@ type Comment struct {
}
func (c Comment) RenderListItem() string {
- output := ""
- output += ufmt.Sprintf("#### %s\n", formatAuthorAndDate(c.Author, c.CreatedAt))
- output += c.Comment + "\n"
- output += "\n"
- return output
-}
+ output := "
"
+ output += c.Comment + "\n\n"
+ output += "
"
+
+ output += "
"
+ output += ufmt.Sprintf("by %s on %s", c.Author, c.CreatedAt.Format(time.RFC822))
+ output += "
\n\n"
-func formatAuthorAndDate(author std.Address, createdAt time.Time) string {
- authorString := author.String() // FIXME: username.
- createdAtString := createdAt.Format("2006-01-02 3:04pm MST")
- return ufmt.Sprintf("by %s on %s", authorString, createdAtString)
+ output += "---\n\n"
+
+ return output
}
diff --git a/examples/gno.land/p/demo/blog/errors.gno b/examples/gno.land/p/demo/blog/errors.gno
index db9f8f39fa1..9d885d7222f 100644
--- a/examples/gno.land/p/demo/blog/errors.gno
+++ b/examples/gno.land/p/demo/blog/errors.gno
@@ -2,4 +2,12 @@ package blog
import "errors"
-var ErrNoSuchPost = errors.New("no such post")
+var (
+ ErrPostTitleMissing = errors.New("post title is missing")
+ ErrPostSlugMissing = errors.New("post slug is missing")
+ ErrPostBodyMissing = errors.New("post body is missing")
+ ErrPostSlugExists = errors.New("post with specified slug already exists")
+ ErrPostPubDateExists = errors.New("post with specified publication date exists")
+ ErrPostTitleExists = errors.New("post with specified title already exists")
+ ErrNoSuchPost = errors.New("no such post")
+)
diff --git a/examples/gno.land/r/gnoland/blog/admin.gno b/examples/gno.land/r/gnoland/blog/admin.gno
index 646fe5f155e..f615e26e491 100644
--- a/examples/gno.land/r/gnoland/blog/admin.gno
+++ b/examples/gno.land/r/gnoland/blog/admin.gno
@@ -39,20 +39,32 @@ func AdminRemoveModerator(addr std.Address) {
moderatorList.Set(addr.String(), false) // FIXME: delete instead?
}
-func ModAddPost(slug, title, body, tags string) {
+func ModAddPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
caller := std.GetOrigCaller()
- tagList := strings.Split(tags, ",")
- err := b.NewPost(caller, slug, title, body, tagList)
+
+ var tagList []string
+ if tags != "" {
+ tagList = strings.Split(tags, ",")
+ }
+ var authorList []string
+ if authors != "" {
+ authorList = strings.Split(authors, ",")
+ }
+
+ err := b.NewPost(caller, slug, title, body, publicationDate, authorList, tagList)
+
checkErr(err)
}
-func ModEditPost(slug, title, body, tags string) {
+func ModEditPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
tagList := strings.Split(tags, ",")
- err := b.GetPost(slug).Update(title, body, tagList)
+ authorList := strings.Split(authors, ",")
+
+ err := b.GetPost(slug).Update(title, body, publicationDate, authorList, tagList)
checkErr(err)
}
diff --git a/examples/gno.land/r/gnoland/blog/gnoblog.gno b/examples/gno.land/r/gnoland/blog/gnoblog.gno
index cad84507614..1cdc95fe9a8 100644
--- a/examples/gno.land/r/gnoland/blog/gnoblog.gno
+++ b/examples/gno.land/r/gnoland/blog/gnoblog.gno
@@ -27,3 +27,10 @@ func Render(path string) string {
func RenderLastPostsWidget(limit int) string {
return b.RenderLastPostsWidget(limit)
}
+
+func PostExists(slug string) bool {
+ if b.GetPost(slug) == nil {
+ return false
+ }
+ return true
+}
diff --git a/examples/gno.land/r/gnoland/blog/gnoblog_test.gno b/examples/gno.land/r/gnoland/blog/gnoblog_test.gno
index e98b34fdc2b..1be61138b39 100644
--- a/examples/gno.land/r/gnoland/blog/gnoblog_test.gno
+++ b/examples/gno.land/r/gnoland/blog/gnoblog_test.gno
@@ -24,24 +24,22 @@ No posts.
// create two posts, list post.
{
- ModAddPost("slug1", "title1", "body1", "tag1,tag2")
- ModAddPost("slug2", "title2", "body2", "tag1,tag3")
+ ModAddPost("slug1", "title1", "body1", "2022-05-20T13:17:22Z", "moul", "tag1,tag2")
+ ModAddPost("slug2", "title2", "body2", "2022-05-20T13:17:23Z", "moul", "tag1,tag3")
got := Render("")
expected := `
-# Gnoland's Blog
+ # Gnoland's Blog
-## [title1](/r/gnoland/blog:p/slug1)
-**[Learn More](/r/gnoland/blog:p/slug1)**
-
+### [title2](/r/gnoland/blog:p/slug2)
+ 20 May 2022
-## [title2](/r/gnoland/blog:p/slug2)
-**[Learn More](/r/gnoland/blog:p/slug2)**
-
+### [title1](/r/gnoland/blog:p/slug1)
+ 20 May 2022
-`
+ `
assertMDEquals(t, got, expected)
}
@@ -49,14 +47,24 @@ No posts.
{
got := Render("p/slug2")
expected := `
-# [Gnoland's Blog](/r/gnoland/blog:) / p / title2
+# title2
body2
-[#tag1](/r/gnoland/blog:t/tag1) [#tag3](/r/gnoland/blog:t/tag3)
+---
-by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-`
+Tags: [#tag1](/r/gnoland/blog:t/tag1) [#tag3](/r/gnoland/blog:t/tag3)
+
+Written by moul on 20 May 2022
+
+Published by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq to Gnoland's Blog
+
+---
+
Comment section
+
+
+
+ `
assertMDEquals(t, got, expected)
}
@@ -72,11 +80,10 @@ by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-## [title1](/r/gnoland/blog:p/slug1)
-**[Learn More](/r/gnoland/blog:p/slug1)**
-
+### [title1](/r/gnoland/blog:p/slug1)
+ 20 May 2022
-`
+ `
assertMDEquals(t, got, expected)
}
@@ -89,42 +96,72 @@ by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
AddComment("slug1", "comment5")
got := Render("p/slug2")
expected := `
-# [Gnoland's Blog](/r/gnoland/blog:) / p / title2
+# title2
body2
-[#tag1](/r/gnoland/blog:t/tag1) [#tag3](/r/gnoland/blog:t/tag3)
+---
-by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
+Tags: [#tag1](/r/gnoland/blog:t/tag1) [#tag3](/r/gnoland/blog:t/tag3)
-#### by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-comment4
+Written by moul on 20 May 2022
-#### by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-comment2
-`
+Published by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq to Gnoland's Blog
+
+---
+
Comment section
+
+comment4
+
+
by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 13 Feb 09 23:31 UTC
+
+---
+
+comment2
+
+
by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 13 Feb 09 23:31 UTC
+
+---
+
+
+ `
assertMDEquals(t, got, expected)
}
// edit post.
{
- ModEditPost("slug2", "title2++", "body2++", "tag1,tag4")
+ ModEditPost("slug2", "title2++", "body2++", "2009-11-10T23:00:00Z", "manfred", "tag1,tag4")
got := Render("p/slug2")
expected := `
-# [Gnoland's Blog](/r/gnoland/blog:) / p / title2++
+# title2++
body2++
-[#tag1](/r/gnoland/blog:t/tag1) [#tag4](/r/gnoland/blog:t/tag4)
+---
-by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
+Tags: [#tag1](/r/gnoland/blog:t/tag1) [#tag4](/r/gnoland/blog:t/tag4)
-#### by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-comment4
+Written by manfred on 10 Nov 2009
-#### by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 2009-02-13 11:31pm UTC
-comment2
-`
+Published by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq to Gnoland's Blog
+
+---
+
Comment section
+
+comment4
+
+
by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 13 Feb 09 23:31 UTC
+
+---
+
+comment2
+
+
by g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq on 13 Feb 09 23:31 UTC
+
+---
+
+
+ `
assertMDEquals(t, got, expected)
}
diff --git a/examples/gno.land/r/gnoland/pages/admin.gno b/examples/gno.land/r/gnoland/pages/admin.gno
index 39fba6d3274..ab447e8f604 100644
--- a/examples/gno.land/r/gnoland/pages/admin.gno
+++ b/examples/gno.land/r/gnoland/pages/admin.gno
@@ -38,20 +38,24 @@ func AdminRemoveModerator(addr std.Address) {
moderatorList.Set(addr.String(), false) // XXX: delete instead?
}
-func ModAddPost(slug, title, body, tags string) {
+func ModAddPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
caller := std.GetOrigCaller()
tagList := strings.Split(tags, ",")
- err := b.NewPost(caller, slug, title, body, tagList)
+ authorList := strings.Split(authors, ",")
+
+ err := b.NewPost(caller, slug, title, body, publicationDate, authorList, tagList)
checkErr(err)
}
-func ModEditPost(slug, title, body, tags string) {
+func ModEditPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
tagList := strings.Split(tags, ",")
- err := b.GetPost(slug).Update(title, body, tagList)
+ authorList := strings.Split(authors, ",")
+
+ err := b.GetPost(slug).Update(title, body, publicationDate, authorList, tagList)
checkErr(err)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_about.gno b/examples/gno.land/r/gnoland/pages/page_about.gno
index 80c43c1741d..c296b9427b0 100644
--- a/examples/gno.land/r/gnoland/pages/page_about.gno
+++ b/examples/gno.land/r/gnoland/pages/page_about.gno
@@ -16,5 +16,5 @@ This consensus mechanism also achieves higher security with fewer validators, op
Any blockchain using Gno achieves succinctness, composability, expressivity, and completeness not found in any other smart contract platform.
By observing a minimal structure, the design can endure over time and challenge the regime of information censorship we’re living in today.`
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:22Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_ecosystem.gno b/examples/gno.land/r/gnoland/pages/page_ecosystem.gno
index 68969c44529..c5e0134565f 100644
--- a/examples/gno.land/r/gnoland/pages/page_ecosystem.gno
+++ b/examples/gno.land/r/gnoland/pages/page_ecosystem.gno
@@ -31,5 +31,5 @@ Gnoswap is currently under development and led by the Onbloc team. Gnoswap will
Through the Gno.land Developer Portal, new developers can explore the exciting world of Gnolang (Gno), a novel programming language that powers the Gno.land blockchain. If you want to interact with Gno.land, start writing a realm, build a dApp, or even port a Solidity contract to a Gnolang realm, you’ll find the resources to [get started here](https://docs.onbloc.xyz/).`
)
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:23Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_events.gno b/examples/gno.land/r/gnoland/pages/page_events.gno
index 18e7faeb3d3..eca3cda88ca 100644
--- a/examples/gno.land/r/gnoland/pages/page_events.gno
+++ b/examples/gno.land/r/gnoland/pages/page_events.gno
@@ -147,5 +147,5 @@ If you’re interested in building web3 with us, catch up with Gno.land in perso
`
)
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:24Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_gnolang.gno b/examples/gno.land/r/gnoland/pages/page_gnolang.gno
index ecbadab9f01..9e76263322d 100644
--- a/examples/gno.land/r/gnoland/pages/page_gnolang.gno
+++ b/examples/gno.land/r/gnoland/pages/page_gnolang.gno
@@ -39,5 +39,5 @@ Using Gno, developers can rapidly accelerate application development and adopt a
The Go language is so well designed that the Gno smart contract system will become the new gold standard for smart contract development and other blockchain applications. As a programming language that is universally adopted, secure, composable, and complete, Gno is essential for the broader adoption of web3 and its sustainable growth.`
)
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:25Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_gor.gno b/examples/gno.land/r/gnoland/pages/page_gor.gno
index 3a6bb022e09..98047b34848 100644
--- a/examples/gno.land/r/gnoland/pages/page_gor.gno
+++ b/examples/gno.land/r/gnoland/pages/page_gor.gno
@@ -217,5 +217,5 @@ Game of Realms participants and core contributors have made significant progress
`
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:26Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_partners.gno b/examples/gno.land/r/gnoland/pages/page_partners.gno
index 440302437fa..36674d84a78 100644
--- a/examples/gno.land/r/gnoland/pages/page_partners.gno
+++ b/examples/gno.land/r/gnoland/pages/page_partners.gno
@@ -17,5 +17,5 @@ Are you a builder, tinkerer, or researcher? If you’re looking to create awesom
`
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:27Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_start.gno b/examples/gno.land/r/gnoland/pages/page_start.gno
index a36ec6e52b1..e08244ae57b 100644
--- a/examples/gno.land/r/gnoland/pages/page_start.gno
+++ b/examples/gno.land/r/gnoland/pages/page_start.gno
@@ -17,5 +17,5 @@ func init() {
- [Install Gno Key](/r/demo/boards:testboard/5)
- TODO: add more links
`
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:28Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_testnets.gno b/examples/gno.land/r/gnoland/pages/page_testnets.gno
index b6c09ab71ee..031afa4b044 100644
--- a/examples/gno.land/r/gnoland/pages/page_testnets.gno
+++ b/examples/gno.land/r/gnoland/pages/page_testnets.gno
@@ -15,5 +15,5 @@ func init() {
See CONTRIBUTING.md on GitHub.
`
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:29Z", nil, nil)
}
diff --git a/examples/gno.land/r/gnoland/pages/page_tokenomics.gno b/examples/gno.land/r/gnoland/pages/page_tokenomics.gno
index de899ae0a70..f51364c36e6 100644
--- a/examples/gno.land/r/gnoland/pages/page_tokenomics.gno
+++ b/examples/gno.land/r/gnoland/pages/page_tokenomics.gno
@@ -7,5 +7,5 @@ func init() {
// XXX: description = """
body = `Lorem Ipsum`
)
- _ = b.NewPost("", path, title, body, nil)
+ _ = b.NewPost("", path, title, body, "2022-05-20T13:17:30Z", nil, nil)
}
diff --git a/examples/gno.land/r/manfred/present/admin.gno b/examples/gno.land/r/manfred/present/admin.gno
index ff0cb075656..60af578b54f 100644
--- a/examples/gno.land/r/manfred/present/admin.gno
+++ b/examples/gno.land/r/manfred/present/admin.gno
@@ -38,20 +38,24 @@ func AdminRemoveModerator(addr std.Address) {
moderatorList.Set(addr.String(), false) // XXX: delete instead?
}
-func ModAddPost(slug, title, body, tags string) {
+func ModAddPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
caller := std.GetOrigCaller()
tagList := strings.Split(tags, ",")
- err := b.NewPost(caller, slug, title, body, tagList)
+ authorList := strings.Split(authors, ",")
+
+ err := b.NewPost(caller, slug, title, body, publicationDate, authorList, tagList)
checkErr(err)
}
-func ModEditPost(slug, title, body, tags string) {
+func ModEditPost(slug, title, body, publicationDate, authors, tags string) {
assertIsModerator()
tagList := strings.Split(tags, ",")
- err := b.GetPost(slug).Update(title, body, tagList)
+ authorList := strings.Split(authors, ",")
+
+ err := b.GetPost(slug).Update(title, body, publicationDate, authorList, tagList)
checkErr(err)
}
diff --git a/examples/gno.land/r/manfred/present/present_miami23.gno b/examples/gno.land/r/manfred/present/present_miami23.gno
index 36b1980bb0b..ca2160de3a9 100644
--- a/examples/gno.land/r/manfred/present/present_miami23.gno
+++ b/examples/gno.land/r/manfred/present/present_miami23.gno
@@ -4,8 +4,6 @@ func init() {
path := "miami23"
title := "Portal Loop Demo (Miami 2023)"
body := `
-# Portal Loop Demo (Miami 2023)
-
Rendered by Gno.
[Source (WIP)](https://github.com/gnolang/gno/pull/1176)
@@ -40,5 +38,5 @@ Rendered by Gno.
- Engage in workshops.
- Connect and have fun with colleagues.
`
- _ = b.NewPost(adminAddr, path, title, body, []string{"demo", "portal-loop", "miami"})
+ _ = b.NewPost(adminAddr, path, title, body, "2023-10-15T13:17:24Z", []string{"moul"}, []string{"demo", "portal-loop", "miami"})
}
diff --git a/examples/gno.land/r/manfred/present/present_miami23_filetest.gno b/examples/gno.land/r/manfred/present/present_miami23_filetest.gno
index 05c41905060..ac19d83ade4 100644
--- a/examples/gno.land/r/manfred/present/present_miami23_filetest.gno
+++ b/examples/gno.land/r/manfred/present/present_miami23_filetest.gno
@@ -1,57 +1,11 @@
package main
-import "gno.land/r/manfred/present"
+import (
+ "gno.land/r/manfred/present"
+)
func main() {
println(present.Render(""))
println("------------------------------------")
println(present.Render("p/miami23"))
}
-
-// Output:
-//