github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/boards/z_11_d_filetest.gno (about) 1 // PKGPATH: gno.land/r/boards_test 2 package boards_test 3 4 // SEND: 2000000000ugnot 5 6 import ( 7 "strconv" 8 9 "gno.land/r/demo/boards" 10 "gno.land/r/demo/users" 11 ) 12 13 var ( 14 bid boards.BoardID 15 pid boards.PostID 16 rid boards.PostID 17 ) 18 19 func init() { 20 users.Register("", "gnouser", "my profile") 21 22 bid = boards.CreateBoard("test_board") 23 pid = boards.CreateThread(bid, "First Post in (title)", "Body of the first post. (body)") 24 rid = boards.CreateReply(bid, pid, pid, "First reply of the First post\n") 25 } 26 27 func main() { 28 println(boards.Render("test_board/" + strconv.Itoa(int(pid)))) 29 boards.EditPost(bid, pid, rid, "", "Edited: First reply of the First post\n") 30 println("----------------------------------------------------") 31 println(boards.Render("test_board/" + strconv.Itoa(int(pid)))) 32 } 33 34 // Output: 35 // # First Post in (title) 36 // 37 // Body of the first post. (body) 38 // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards?help&__func=CreateReply&bid=1&threadid=1&postid=1&body.type=textarea)] \[[repost](/r/demo/boards?help&__func=CreateRepost&bid=1&postid=1&title.type=textarea&body.type=textarea&dstBoardID.type=textarea)] \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=1)] 39 // 40 // > First reply of the First post 41 // > 42 // > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1/2) \[[reply](/r/demo/boards?help&__func=CreateReply&bid=1&threadid=1&postid=2&body.type=textarea)] \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=2)] 43 // 44 // ---------------------------------------------------- 45 // # First Post in (title) 46 // 47 // Body of the first post. (body) 48 // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards?help&__func=CreateReply&bid=1&threadid=1&postid=1&body.type=textarea)] \[[repost](/r/demo/boards?help&__func=CreateRepost&bid=1&postid=1&title.type=textarea&body.type=textarea&dstBoardID.type=textarea)] \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=1)] 49 // 50 // > Edited: First reply of the First post 51 // > 52 // > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1/2) \[[reply](/r/demo/boards?help&__func=CreateReply&bid=1&threadid=1&postid=2&body.type=textarea)] \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=2)]