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

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