github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/demo/boards/z_12_filetest.gno (about)

     1  // PKGPATH: gno.land/r/boards_test
     2  package boards_test
     3  
     4  // SEND: 200000000ugnot
     5  
     6  import (
     7  	"gno.land/r/demo/boards"
     8  	"gno.land/r/demo/users"
     9  )
    10  
    11  var (
    12  	bid1 boards.BoardID
    13  	bid2 boards.BoardID
    14  	pid  boards.PostID
    15  )
    16  
    17  func init() {
    18  	users.Register("", "gnouser", "my profile")
    19  
    20  	bid1 = boards.CreateBoard("test_board1")
    21  	pid = boards.CreateThread(bid1, "First Post (title)", "Body of the first post. (body)")
    22  	bid2 = boards.CreateBoard("test_board2")
    23  }
    24  
    25  func main() {
    26  	rid := boards.CreateRepost(bid1, pid, "", "Check this out", bid2)
    27  	println(rid)
    28  	println(boards.Render("test_board2"))
    29  }
    30  
    31  // Output:
    32  // 1
    33  // \[[post](/r/demo/boards?help&__func=CreateThread&bid=2&body.type=textarea)]
    34  //
    35  // ----------------------------------------
    36  // Repost: Check this out
    37  // ## [First Post (title)](/r/demo/boards:test_board1/1)
    38  //
    39  // Body of the first post. (body)
    40  // \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board1/1) \[[x](/r/demo/boards?help&__func=DeletePost&bid=1&threadid=1&postid=1)] (0 replies) (1 reposts)