diff --git a/examples/gno.land/r/README.md b/examples/gno.land/r/README.md new file mode 100644 index 00000000000..b12a996d781 --- /dev/null +++ b/examples/gno.land/r/README.md @@ -0,0 +1,10 @@ +# `r/` + +This directory primarily contains realms. It further branches out into namespaces: +- `demo` - realms meant to demonstrate Gno functionality +- `docs` - realms meant to teach about specific packages and concepts +- `gnoland` - official gno.land realms +- `gov` - governance realms +- `sys` - system realms +- `x` - experimental realms +- `*` - can include personal namespaces, such as `manfred`, `leon`, etc. \ No newline at end of file diff --git a/examples/gno.land/r/docs/add/add.gno b/examples/gno.land/r/docs/adder/adder.gno similarity index 98% rename from examples/gno.land/r/docs/add/add.gno rename to examples/gno.land/r/docs/adder/adder.gno index ffc8f9c6877..cd96d241692 100644 --- a/examples/gno.land/r/docs/add/add.gno +++ b/examples/gno.land/r/docs/adder/adder.gno @@ -1,4 +1,4 @@ -package add +package adder import ( "strconv" diff --git a/examples/gno.land/r/docs/add/add_test.gno b/examples/gno.land/r/docs/adder/adder_test.gno similarity index 74% rename from examples/gno.land/r/docs/add/add_test.gno rename to examples/gno.land/r/docs/adder/adder_test.gno index 8994b895f7e..327908ab2d3 100644 --- a/examples/gno.land/r/docs/add/add_test.gno +++ b/examples/gno.land/r/docs/adder/adder_test.gno @@ -1,4 +1,4 @@ -package add +package adder import ( "testing" @@ -13,7 +13,7 @@ Current Number: 0 Last Updated: Never -[Increase Number](/r/docs/add$help&func=Add&n=42) +[Increase Number](/r/docs/adder$help&func=Add&n=42) ` if output != expected { t.Errorf("Initial Render failed, got:\n%s", output) @@ -36,9 +36,9 @@ Current Number: 5 Last Updated: 2009-02-13 23:31:30 -[Increase Number](/r/docs/add$help&func=Add&n=42) +[Increase Number](/r/docs/adder$help&func=Add&n=42) ` if output != expected { - t.Errorf("Final Render failed, got:\n%s", output) + t.Errorf("Final Render failed, got:\n%s\nexpected:\n%s", output, finalOutput) } } diff --git a/examples/gno.land/r/docs/add/gno.mod b/examples/gno.land/r/docs/adder/gno.mod similarity index 61% rename from examples/gno.land/r/docs/add/gno.mod rename to examples/gno.land/r/docs/adder/gno.mod index a66c63e0910..f8bbf9d6fe8 100644 --- a/examples/gno.land/r/docs/add/gno.mod +++ b/examples/gno.land/r/docs/adder/gno.mod @@ -1,3 +1,3 @@ -module gno.land/r/docs/add +module gno.land/r/docs/adder require gno.land/p/moul/txlink v0.0.0-latest diff --git a/examples/gno.land/r/docs/home/home.gno b/examples/gno.land/r/docs/home/home.gno index 2c581019380..6e61f08c11a 100644 --- a/examples/gno.land/r/docs/home/home.gno +++ b/examples/gno.land/r/docs/home/home.gno @@ -9,8 +9,9 @@ Explore various examples to learn more about Gno functionality and usage. ## Examples - [Hello World](/r/docs/hello) - A simple introductory example. -- [Add](/r/docs/add) - An interactive example to update a number with transactions. -- [AVL Pager](/r/docs/avl_pager) - Paginate through AVL tree items. +- [Adder](/r/docs/adder) - An interactive example to update a number with transactions. +- [Source](/r/docs/source) - View realm source code. +- [AVL Pager](/r/docs/avl_pager) - Paginate through AVL tree items. - ... ## Other resources diff --git a/examples/gno.land/r/docs/source/gno.mod b/examples/gno.land/r/docs/source/gno.mod new file mode 100644 index 00000000000..a2b5ad313c0 --- /dev/null +++ b/examples/gno.land/r/docs/source/gno.mod @@ -0,0 +1 @@ +module gno.land/r/docs/source diff --git a/examples/gno.land/r/docs/source/source.gno b/examples/gno.land/r/docs/source/source.gno new file mode 100644 index 00000000000..45db3c98f06 --- /dev/null +++ b/examples/gno.land/r/docs/source/source.gno @@ -0,0 +1,17 @@ +package source + +// Welcome to the source code of this realm! + +func Render(_ string) string { + return `# Viewing source code +gno.land makes it easy to view the source code of any pure +package or realm, by using ABCI queries. + +gno.land's web frontend, ` + "`gnoweb`, " + ` makes this easy by +providing a intuitive UI that fetches the source of the +realm, that you can inspect anywhere by simply clicking +on the [source] button. + +Check it out in the top right corner! +` +}