diff --git a/examples/gno.land/p/demo/json/decode_test.gno b/examples/gno.land/p/demo/json/decode_test.gno index dc92f1f84cd..570bfaffd40 100644 --- a/examples/gno.land/p/demo/json/decode_test.gno +++ b/examples/gno.land/p/demo/json/decode_test.gno @@ -325,7 +325,7 @@ func TestUnmarshal(t *testing.T) { "width": 500, "height": 500 }, - "image": { + "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, @@ -347,7 +347,7 @@ func TestUnmarshal(t *testing.T) { { name: "web-app", value: `{"web-app": { - "servlet": [ + "servlet": [ { "servlet-name": "cofaxCDS", "servlet-class": "org.cofax.cds.CDSServlet", @@ -403,7 +403,7 @@ func TestUnmarshal(t *testing.T) { { "servlet-name": "cofaxAdmin", "servlet-class": "org.cofax.cds.AdminServlet"}, - + { "servlet-name": "fileServlet", "servlet-class": "org.cofax.cds.FileServlet"}, @@ -430,7 +430,7 @@ func TestUnmarshal(t *testing.T) { "cofaxAdmin": "/admin/*", "fileServlet": "/static/*", "cofaxTools": "/tools/*"}, - + "taglib": { "taglib-uri": "cofax.tld", "taglib-location": "/WEB-INF/tlds/cofax.tld"}}}`, @@ -478,7 +478,7 @@ func TestUnmarshal(t *testing.T) { func TestUnmarshalSafe(t *testing.T) { json := []byte(`{ "store": { - "book": [ + "book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", diff --git a/examples/gno.land/p/demo/json/node_test.gno b/examples/gno.land/p/demo/json/node_test.gno index 7546bf2e4cc..3729f720efd 100644 --- a/examples/gno.land/p/demo/json/node_test.gno +++ b/examples/gno.land/p/demo/json/node_test.gno @@ -1105,7 +1105,7 @@ func TestNode_ExampleMust(t *testing.T) { // Calculate AVG price from different types of objects, JSON from: https://goessner.net/articles/JsonPath/index.html#e3 func TestExampleUnmarshal(t *testing.T) { data := []byte(`{ "store": { - "book": [ + "book": [ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", diff --git a/examples/gno.land/p/moul/debug/debug_test.gno b/examples/gno.land/p/moul/debug/debug_test.gno index 02ce5f7c9c5..24678771982 100644 --- a/examples/gno.land/p/moul/debug/debug_test.gno +++ b/examples/gno.land/p/moul/debug/debug_test.gno @@ -50,7 +50,7 @@ func TestPackage(t *testing.T) { d.Log("foobar") got = d.Render("?debug=1") expected = `
debug - + ### Logs - hello world! - foobar @@ -63,7 +63,7 @@ func TestPackage(t *testing.T) { | ±std.PreviousRealm().Address()± | g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm | | ±std.ChainHeight()± | 123 | | ±time.Now().Format(time.RFC3339)± | 2009-02-13T23:31:30Z | - +
` expected = strings.ReplaceAll(expected, "±", "`") diff --git a/examples/gno.land/r/demo/demo.gno b/examples/gno.land/r/demo/demo.gno index 254a5ca6c96..0e86f8c5c89 100644 --- a/examples/gno.land/r/demo/demo.gno +++ b/examples/gno.land/r/demo/demo.gno @@ -3,7 +3,7 @@ package demo func Render(_ string) string { return `# Gno Demo Packages -Welcome to the "demo" namespace. Here you will find realms that demonstrate +Welcome to the "demo" namespace. Here you will find realms that demonstrate how the Gno language can be used. Check out some examples below: - [Art](/r/demo/art) diff --git a/examples/gno.land/r/demo/games/shifumi/shifumi.gno b/examples/gno.land/r/demo/games/shifumi/shifumi.gno index 698075e5078..d26ed04b249 100644 --- a/examples/gno.land/r/demo/games/shifumi/shifumi.gno +++ b/examples/gno.land/r/demo/games/shifumi/shifumi.gno @@ -89,7 +89,7 @@ Actions: * [NewGame](shifumi$help&func=NewGame) opponentAddress * [Play](shifumi$help&func=Play) gameIndex move (1=rock, 2=paper, 3=scissors) - game | player1 | | player2 | | win + game | player1 | | player2 | | win --- | --- | --- | --- | --- | --- ` // Output the 100 most recent games. diff --git a/examples/gno.land/r/demo/math_eval/math_eval.gno b/examples/gno.land/r/demo/math_eval/math_eval.gno index 329c5f9b1c2..46c78ae89dc 100644 --- a/examples/gno.land/r/demo/math_eval/math_eval.gno +++ b/examples/gno.land/r/demo/math_eval/math_eval.gno @@ -12,7 +12,7 @@ func Render(p string) string { if len(p) == 0 { return ` evaluates 32-bit integer expressions. for example: - + [(4+12)/2-1+11*15](/r/demo/math_eval:(4+12)/2-1+11*15) ` diff --git a/examples/gno.land/r/docs/avl_pager_with_params/render.gno b/examples/gno.land/r/docs/avl_pager_with_params/render.gno index 00712c6d364..ba92ff5d0c5 100644 --- a/examples/gno.land/r/docs/avl_pager_with_params/render.gno +++ b/examples/gno.land/r/docs/avl_pager_with_params/render.gno @@ -50,8 +50,8 @@ func renderHome(fullPath string) string { // Start building the output (plain text or markdown). out := "# AVL Pager + Render paths\n\n" - out += `This realm showcases how to maintain a paginated list while properly parsing render paths. -You can see how a single page can include a paginated element (like the example below), and how clicking + out += `This realm showcases how to maintain a paginated list while properly parsing render paths. +You can see how a single page can include a paginated element (like the example below), and how clicking an item can take you to a dedicated page for that specific item. No matter how you browse through the paginated list, the introductory text (this section) remains the same. diff --git a/examples/gno.land/r/docs/complexargs/complexargs.gno b/examples/gno.land/r/docs/complexargs/complexargs.gno index 799aa964dec..078cbb234f2 100644 --- a/examples/gno.land/r/docs/complexargs/complexargs.gno +++ b/examples/gno.land/r/docs/complexargs/complexargs.gno @@ -37,7 +37,7 @@ cannot be called via a standard "MsgCall" transaction. To call these functions, Check out the source code to see example functions and objects. -In this case, the following "MsgRun" code would be used to call the function: +In this case, the following "MsgRun" code would be used to call the function: ` out += ufmt.Sprintf("```go\n%s\n```\n\n", msgrun) diff --git a/examples/gno.land/r/docs/minisocial/minisocial.gno b/examples/gno.land/r/docs/minisocial/minisocial.gno index ed1c874fea4..5f6a361f02a 100644 --- a/examples/gno.land/r/docs/minisocial/minisocial.gno +++ b/examples/gno.land/r/docs/minisocial/minisocial.gno @@ -2,12 +2,12 @@ package minisocial func Render(_ string) string { return `# MiniSocial -MiniSocial is a minimalistic social media platform made for example purposes. +MiniSocial is a minimalistic social media platform made for example purposes. There are two versions of this app: - [V1](/r/docs/minisocial/v1) - handles simple post creation and stores posts in a slice -- [V2](/r/docs/minisocial/v2) - handles post creation, updating, and deletion, -and manages storage more efficiently with an AVL tree. V2 also utilizes different p/ packages to handle pagination, +- [V2](/r/docs/minisocial/v2) - handles post creation, updating, and deletion, +and manages storage more efficiently with an AVL tree. V2 also utilizes different p/ packages to handle pagination, easier Markdown formatting, etc.` } diff --git a/examples/gno.land/r/docs/source/source.gno b/examples/gno.land/r/docs/source/source.gno index 45db3c98f06..7cc1fd93e6a 100644 --- a/examples/gno.land/r/docs/source/source.gno +++ b/examples/gno.land/r/docs/source/source.gno @@ -3,7 +3,7 @@ package source // Welcome to the source code of this realm! func Render(_ string) string { - return `# Viewing source code + return `# Viewing source code gno.land makes it easy to view the source code of any pure package or realm, by using ABCI queries. diff --git a/examples/gno.land/r/gnoland/blog/gnoblog_test.gno b/examples/gno.land/r/gnoland/blog/gnoblog_test.gno index 82b41a79541..e7b21bbf425 100644 --- a/examples/gno.land/r/gnoland/blog/gnoblog_test.gno +++ b/examples/gno.land/r/gnoland/blog/gnoblog_test.gno @@ -61,7 +61,7 @@ Published by g1manfred47kzduec920z88wfr64ylksmdcedlf5 to gno.land's blog - + ` assertMDEquals(t, got, expected) } diff --git a/examples/gno.land/r/gnoland/home/home.gno b/examples/gno.land/r/gnoland/home/home.gno index 6d8270832b9..19a07584d55 100644 --- a/examples/gno.land/r/gnoland/home/home.gno +++ b/examples/gno.land/r/gnoland/home/home.gno @@ -46,7 +46,7 @@ using fully transparent, auditable code that anyone can inspect and reuse. Intuitive and easy to use, gno.land lowers the barrier to web3 and makes censorship-resistant platforms accessible to everyone. If you want to help lay -the foundations of a fairer and freer world, join us today. +the foundations of a fairer and freer world, join us today. ## Learn about gno.land diff --git a/examples/gno.land/r/gnoland/pages/page_contribute.gno b/examples/gno.land/r/gnoland/pages/page_contribute.gno index 3448383226e..f2cc158f338 100644 --- a/examples/gno.land/r/gnoland/pages/page_contribute.gno +++ b/examples/gno.land/r/gnoland/pages/page_contribute.gno @@ -19,7 +19,7 @@ A good place where to start are the issues tagged ["good first issue"](https://g ## Gno Bounties -Additionally, you can look out to help on specific issues labeled as bounties. The Gno bounty program is a good way to find interesting challenges in Gno, and get rewarded for helping us advance the project. We will maintain open and rewardable bounties in the gnolang/gno repository, and you can search all available bounties by using the ["bounty" label](https://github.com/gnolang/gno/labels/bounty). For more detals on the categories and types of bounties, we have a [bounties README](https://github.com/gnolang/bounties). +Additionally, you can look out to help on specific issues labeled as bounties. The Gno bounty program is a good way to find interesting challenges in Gno, and get rewarded for helping us advance the project. We will maintain open and rewardable bounties in the gnolang/gno repository, and you can search all available bounties by using the ["bounty" label](https://github.com/gnolang/gno/labels/bounty). For more detals on the categories and types of bounties, we have a [bounties README](https://github.com/gnolang/bounties). Recommendations on participating in the gno.land Bounty Program: @@ -78,7 +78,7 @@ _[3XL]_ \* | $ 32000 The gno.land grants program is to encourage and support the growth of the gno.land contributor community, and build out the usability of the platform and smart contract library. The program provides financial resources to contributors to explore the Gno tech stack, and build dApps, tooling, infrastructure, products, and smart contract libraries in gno.land. -For more details on gno.land grants, suggested topics, and how to apply, visit our grants [repository](https://github.com/gnolang/grants). +For more details on gno.land grants, suggested topics, and how to apply, visit our grants [repository](https://github.com/gnolang/grants). ## Join Game of Realms diff --git a/examples/gno.land/r/gnoland/pages/page_partners.gno b/examples/gno.land/r/gnoland/pages/page_partners.gno index e60802fef63..1f11d3b08c5 100644 --- a/examples/gno.land/r/gnoland/pages/page_partners.gno +++ b/examples/gno.land/r/gnoland/pages/page_partners.gno @@ -5,8 +5,8 @@ func init() { title := "Partnerships" body := `### Fund and Grants Program -Are you a builder, tinkerer, or researcher? If you’re looking to create awesome dApps, tooling, infrastructure, -or smart contract libraries on gno.land, you can apply for a grant. The gno.land Ecosystem Fund and Grants program +Are you a builder, tinkerer, or researcher? If you’re looking to create awesome dApps, tooling, infrastructure, +or smart contract libraries on gno.land, you can apply for a grant. The gno.land Ecosystem Fund and Grants program provides financial contributions for individuals and teams to innovate on the platform. Read more about our Funds and Grants program [here](https://github.com/gnolang/ecosystem-fund-grants). diff --git a/examples/gno.land/r/gnoland/users/v1/render.gno b/examples/gno.land/r/gnoland/users/v1/render.gno index a3d3565e80d..b4a8285a134 100644 --- a/examples/gno.land/r/gnoland/users/v1/render.gno +++ b/examples/gno.land/r/gnoland/users/v1/render.gno @@ -54,7 +54,7 @@ func renderHomePage() string { func renderIntroParagraph() string { out := md.Paragraph("Welcome to the gno.land user registry (v1). Please register a username.") out += md.Paragraph(`Registering a username grants the registering address the right to deploy packages and realms -under that username’s namespace. For example, if an address registers the username ` + md.InlineCode("gnome123") + `, it +under that username’s namespace. For example, if an address registers the username ` + md.InlineCode("gnome123") + `, it will gain permission to deploy packages and realms to package paths with the pattern ` + md.InlineCode("gno.land/{p,r}/gnome123/*") + `.`) out += md.Paragraph("In V1, usernames must follow these rules, in order to prevent username squatting:") diff --git a/examples/gno.land/r/gov/dao/v3/impl/types.gno b/examples/gno.land/r/gov/dao/v3/impl/types.gno index 1d1408efc18..0b88b355759 100644 --- a/examples/gno.land/r/gov/dao/v3/impl/types.gno +++ b/examples/gno.land/r/gov/dao/v3/impl/types.gno @@ -210,7 +210,7 @@ func StringifyProposal(p *dao.Proposal) string { out += ufmt.Sprintf(` This proposal contains the following metadata: -%s +%s `, p.ExecutorString()) } diff --git a/examples/gno.land/r/grepsuzette/home/contribs.gno b/examples/gno.land/r/grepsuzette/home/contribs.gno index ad1c7e492d7..b3a905067f4 100644 --- a/examples/gno.land/r/grepsuzette/home/contribs.gno +++ b/examples/gno.land/r/grepsuzette/home/contribs.gno @@ -7,7 +7,7 @@ My main contributions until the gno.land beta launch are listed below; most aren ### Port Joeson from coffeescript to golang -Worked on this from june 2022 until january 2023. Bounty [applied for](https://github.com/gnolang/bounties-old/issues/33) on Feb 2, 2023. +Worked on this from june 2022 until january 2023. Bounty [applied for](https://github.com/gnolang/bounties-old/issues/33) on Feb 2, 2023. Here is the port I did in Go: [grepsuzette/joeson](https://github.com/grepsuzette/joeson/). @@ -18,7 +18,7 @@ Here is the port I did in Go: [grepsuzette/joeson](https://github.com/grepsuzett 1000 ATOMs from @jaekwon More GNOTs than from #3. -There have been many examples posted, including a minimal [LISP REPL](https://github.com/grepsuzette/joeson/tree/master/examples/lisp-repl) and a theorical [study on precedence](https://github.com/grepsuzette/joeson/blob/master/examples/precedence/precedence_test.go) (precedence is often problematic with PEG parsers, this allowed to find a solution, used in the next part). +There have been many examples posted, including a minimal [LISP REPL](https://github.com/grepsuzette/joeson/tree/master/examples/lisp-repl) and a theorical [study on precedence](https://github.com/grepsuzette/joeson/blob/master/examples/precedence/precedence_test.go) (precedence is often problematic with PEG parsers, this allowed to find a solution, used in the next part). ### GNO grammar - partial @@ -32,7 +32,7 @@ In summer 2023, started to port the GNO grammar using Joeson (since there was no ![asteroid](https://raw.githubusercontent.com/grepsuzette/gfx/master/asteroid160.png) -**gnAsteroid** is an asteroid creation-kit, it was started around the time the joeson port was published, but didn't have a name back then. +**gnAsteroid** is an asteroid creation-kit, it was started around the time the joeson port was published, but didn't have a name back then. Asteroids orbit gno.land, it's the same blockchain, but different frontend, themable, working with wiki-like markdown files (enabling realms from gno.land @@ -63,7 +63,7 @@ Check the [other experiments here](/conjects/gnoweb.md). ### Tendermint vuln retrospective (2023) -Also worked on an anthology of publicly knowned vulnerabilities that affected Tendermint. +Also worked on an anthology of publicly knowned vulnerabilities that affected Tendermint. * [Cosmos-sdk vulnerability retrospective](https://github.com/gnolang/gno/issues/587) * found most vulns were not affecting our Tendermint version, however: diff --git a/examples/gno.land/r/grepsuzette/home/render.gno b/examples/gno.land/r/grepsuzette/home/render.gno index 13a6ed7aced..6938b0eb884 100644 --- a/examples/gno.land/r/grepsuzette/home/render.gno +++ b/examples/gno.land/r/grepsuzette/home/render.gno @@ -21,21 +21,21 @@ const art = ` ________[_]________ /\/ \/ \ /\ /\ ______ \ / /\/\ /\/\ / \ //_\ \ /\ \ /\/\/ \/ \ - /\ / /\/\ //___\ \__/ \ \/ + ' + /\ / /\/\ //___\ \__/ \ \/ + ' / \ /\/ \//_____\ \ |[]| \ . t . - /\/\/\/ //_______\ \|__| \ p e -/ \ /XXXXXXXXXX\ \ o l + /\/\/\/ //_______\ \|__| \ p e +/ \ /XXXXXXXXXX\ \ o l \ /_I_II I__I_\__________________\ + r e - I_I| I__I_____[]_|_[]_____I . t + I_I| I__I_____[]_|_[]_____I . t I_II I__I_____[]_|_[]_____I + ' - I II__I I XXXXXXX I + I II__I I XXXXXXX I ~~~~~" "~~~~~~~~~~~~~~~~~~~~~~~~ :*:*:*:*:* ` func r1() string { return "# greps' (gn)home" + ` -You've reached the terrestrial realms of Grepsuzette on gno.land. +You've reached the terrestrial realms of Grepsuzette on gno.land. ` + tripleBackquote + art + tripleBackquote + ` diff --git a/examples/gno.land/r/leon/home/home.gno b/examples/gno.land/r/leon/home/home.gno index 1efc1d6424b..56482de9c40 100644 --- a/examples/gno.land/r/leon/home/home.gno +++ b/examples/gno.land/r/leon/home/home.gno @@ -38,10 +38,10 @@ func init() { pfpCaption = "[My favourite painting & pfp](https://en.wikipedia.org/wiki/Wanderer_above_the_Sea_of_Fog)" abtMe = [2]string{ `### About me -Hi, I'm Leon, a DevRel Engineer at gno.land. I am a tech enthusiast, +Hi, I'm Leon, a DevRel Engineer at gno.land. I am a tech enthusiast, life-long learner, and sharer of knowledge.`, `### Contributions -My contributions to gno.land can mainly be found +My contributions to gno.land can mainly be found [here](https://github.com/gnolang/gno/issues?q=sort:updated-desc+author:leohhhn). TODO import r/gh`, diff --git a/examples/gno.land/r/leon/hor/render.gno b/examples/gno.land/r/leon/hor/render.gno index b457615ace6..a42ad18b94b 100644 --- a/examples/gno.land/r/leon/hor/render.gno +++ b/examples/gno.land/r/leon/hor/render.gno @@ -154,12 +154,12 @@ func renderAbout() string { out := ` Welcome, gnomes! -The Hall of Realms is a simple & permissionless dashboard for gnomes to share +The Hall of Realms is a simple & permissionless dashboard for gnomes to share their work with the community. Here, anyone is welcome to submit their own code. This realm utilizes a common -Gno pattern - the registry pattern - to allow anyone to programmatically submit -their work. +Gno pattern - the registry pattern - to allow anyone to programmatically submit +their work. Simply import the Hall of Realms in your code, and call the "Register()" function inside your realm init, as shown below: diff --git a/examples/gno.land/r/mason/home/home.gno b/examples/gno.land/r/mason/home/home.gno index 557227cf5d4..b08d511d5aa 100644 --- a/examples/gno.land/r/mason/home/home.gno +++ b/examples/gno.land/r/mason/home/home.gno @@ -12,50 +12,50 @@ const ( (\_/) -"-"-` dgnonut = ` - #$$$$$$$$* - #$$@@@@@@@@@@$$$# - #$$@@@@@@@@@@@@@$$$$# - #$$$@@@@$$$$$$$$$$$$$$$$* - #$$$$$$$$$$$$$$$$$$$$$$$$$#! - #$$$$$$$$$############$$$$$##* - !##$$$$$$####**********#####$###* - =##$$$$$###****!!!!!!!!!***######*! - *##$$$###***!!!!!!==!!!!!!**######*= - !*#######***!!!=;;;;;====!!!!**####** - !*#######**!!!==;;::::::;;==!!!**###**! - !*######***!==;::~~~~~~:::;;=!!!***#***= - =**#####**!!==;::~-,,,,,--~:;;=!!!******! - !**####***!==;:~-,.. ..,,-~:;==!!******!; - ;!**###***!!=;:~-,. ..-~:;==!!*****!= - =!*******!!==::-. .,-::==!!*****!= - =!*******!!=;:~, .-~:;=!!!****!=: - ~=!*******!==;:-. .,-:;=!!!****!=; - :=!*******!==;~,. ,-:;==!!!***!=; - :=!******!!==:~, ,-:;=!!!***!!=; - :=!!*****!!=;:~, ,~:;=!!****!!=;- - :=!!!****!!==;~, -~;==!!****!!=;- - :;=!!*****!!=;:- -:;=!!*****!!=:- - ~;=!!!****!!==;~ :;=!!*****!!!;:- - ~;==!!****!!!==: ;=!!******!!=;:, - ~:==!!!****!!!=;~ :=!********!!=;:. - -:;==!!*****!!!!; =!*********!==;: - ,~;==!!*******!!== =**#####****!==:~ - ,~:;=!!!!*********! **#######***!!=;~- - -~;;=!!!!**********! *##$$$$$###***!!=:~. - ,~:;==!!!****##########$$$$$$$$###****!=;:~ - -~:;==!!!***####$$$$$$@@@@@$$$###**!!=;:~, - ,-~:;=!!!***####$$$$@@@@@@$$$$##**!!!=;:-. - -~:;;=!!!***###$$$$$@@@@$$$$##***!!=;:-. - .-~:;;=!!!***###$$$$$$$$$$$##***!==;:~- - .-~:;==!!!!**####$$$$$$$###**!!==;:~- - ,-~::;==!!!!***########****!!==;:~-. - ,-~:;;==!!!!!***********!!!==;:~,. - ,,~~::;====!!!!!!!!!!!!!==;::~,. - .,-~::;;;===!!!!!!!!===;::~-,. - ,--~~:;;;;========;;::~--. - .,,-~~:::::::::::~~~-,,. - ..,---~~~~~~~~~--,.. - ..,,,,,,,,,... + #$$$$$$$$* + #$$@@@@@@@@@@$$$# + #$$@@@@@@@@@@@@@$$$$# + #$$$@@@@$$$$$$$$$$$$$$$$* + #$$$$$$$$$$$$$$$$$$$$$$$$$#! + #$$$$$$$$$############$$$$$##* + !##$$$$$$####**********#####$###* + =##$$$$$###****!!!!!!!!!***######*! + *##$$$###***!!!!!!==!!!!!!**######*= + !*#######***!!!=;;;;;====!!!!**####** + !*#######**!!!==;;::::::;;==!!!**###**! + !*######***!==;::~~~~~~:::;;=!!!***#***= + =**#####**!!==;::~-,,,,,--~:;;=!!!******! + !**####***!==;:~-,.. ..,,-~:;==!!******!; + ;!**###***!!=;:~-,. ..-~:;==!!*****!= + =!*******!!==::-. .,-::==!!*****!= + =!*******!!=;:~, .-~:;=!!!****!=: + ~=!*******!==;:-. .,-:;=!!!****!=; + :=!*******!==;~,. ,-:;==!!!***!=; + :=!******!!==:~, ,-:;=!!!***!!=; + :=!!*****!!=;:~, ,~:;=!!****!!=;- + :=!!!****!!==;~, -~;==!!****!!=;- + :;=!!*****!!=;:- -:;=!!*****!!=:- + ~;=!!!****!!==;~ :;=!!*****!!!;:- + ~;==!!****!!!==: ;=!!******!!=;:, + ~:==!!!****!!!=;~ :=!********!!=;:. + -:;==!!*****!!!!; =!*********!==;: + ,~;==!!*******!!== =**#####****!==:~ + ,~:;=!!!!*********! **#######***!!=;~- + -~;;=!!!!**********! *##$$$$$###***!!=:~. + ,~:;==!!!****##########$$$$$$$$###****!=;:~ + -~:;==!!!***####$$$$$$@@@@@$$$###**!!=;:~, + ,-~:;=!!!***####$$$$@@@@@@$$$$##**!!!=;:-. + -~:;;=!!!***###$$$$$@@@@$$$$##***!!=;:-. + .-~:;;=!!!***###$$$$$$$$$$$##***!==;:~- + .-~:;==!!!!**####$$$$$$$###**!!==;:~- + ,-~::;==!!!!***########****!!==;:~-. + ,-~:;;==!!!!!***********!!!==;:~,. + ,,~~::;====!!!!!!!!!!!!!==;::~,. + .,-~::;;;===!!!!!!!!===;::~-,. + ,--~~:;;;;========;;::~--. + .,,-~~:::::::::::~~~-,,. + ..,---~~~~~~~~~--,.. + ..,,,,,,,,,... ...` ) diff --git a/examples/gno.land/r/mouss/home/home.gno b/examples/gno.land/r/mouss/home/home.gno index ba463228553..7aaaf4e0aff 100644 --- a/examples/gno.land/r/mouss/home/home.gno +++ b/examples/gno.land/r/mouss/home/home.gno @@ -38,7 +38,7 @@ const ( realmURL = "/r/mouss/home" rec = realmURL + ":recipe/" gnoArt = ` - -==++. + -==++. *@@@@= @- -@ #@@@@@: -==-.-- :-::===: .-++-. @- .===:.- .-.-==- .===:=@ #@@@@@@@: -@@%**%@@ #@@#*#@@- *@@**@@* @- +%=::-*@ +@=-:-@* +%=::-*@ @@ -46,8 +46,8 @@ const ( -: - *@%:..+@@ *@+ #@=-@@: :@@= @- .@= =@ +@ *%.@= =@ --:==+=-:=. =%@%#*@@ *@+ #@+ =%@%%@%= #* %#=.:%*===*@ +% +% -%*===*@ -++++=++++. =-:::*@# . . .::. .. :: .:: . . .:: . - .-=+++=: .*###%#= - :: + .-=+++=: .*###%#= + :: ` ) diff --git a/examples/gno.land/r/n2p5/loci/loci.gno b/examples/gno.land/r/n2p5/loci/loci.gno index 232de1e6459..423a2266d6a 100644 --- a/examples/gno.land/r/n2p5/loci/loci.gno +++ b/examples/gno.land/r/n2p5/loci/loci.gno @@ -55,11 +55,11 @@ func renderGet(addr std.Address) string { const about = ` # Welcome to Loci -Loci is a simple key-value store keyed by the caller's gno.land address. -Only the caller can set the value for their address, but anyone can +Loci is a simple key-value store keyed by the caller's gno.land address. +Only the caller can set the value for their address, but anyone can retrieve the value for any address. There are only two functions: Set and Get. If you'd like to set a value, simply base64 encode any message you'd like and -it will be stored in in Loci. If you'd like to retrieve a value, simply provide +it will be stored in in Loci. If you'd like to retrieve a value, simply provide the address of the value you'd like to retrieve. For convenience, you can also use gnoweb to view the value for a given address, diff --git a/gnovm/pkg/gnofmt/processor.go b/gnovm/pkg/gnofmt/processor.go index 3487e3d1598..12c5fc0c2a6 100644 --- a/gnovm/pkg/gnofmt/processor.go +++ b/gnovm/pkg/gnofmt/processor.go @@ -161,9 +161,21 @@ func (p *Processor) processAndFormat(file *ast.File, filename string, topDecls d return nil, fmt.Errorf("unable to format import: %w", err) } + // Trim trailing whitespace + ret = trimTrailingWhitespace(ret) + return ret, nil } +// trimTrailingWhitespace removes trailing spaces and tabs from each line of the input byte slice. +func trimTrailingWhitespace(data []byte) []byte { + lines := bytes.Split(data, []byte("\n")) + for i, line := range lines { + lines[i] = bytes.TrimRight(line, " \t") + } + return bytes.Join(lines, []byte("\n")) +} + // processPackageFiles processes Gno package files and collects top-level declarations. func (p *Processor) processPackageFiles(path string, pkg Package) *parsedPackage { pkgc, ok := p.parsedPackage[path] diff --git a/gnovm/pkg/gnofmt/processes_test.go b/gnovm/pkg/gnofmt/processor_test.go similarity index 53% rename from gnovm/pkg/gnofmt/processes_test.go rename to gnovm/pkg/gnofmt/processor_test.go index 6c56012c3ad..35f20063a2e 100644 --- a/gnovm/pkg/gnofmt/processes_test.go +++ b/gnovm/pkg/gnofmt/processor_test.go @@ -7,6 +7,7 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -94,3 +95,58 @@ func main() { require.Equal(t, expectedOutput, string(formatted)) } +func TestTrimTrailingWhitespace(t *testing.T) { + tests := []struct { + name string + input []byte + want []byte + }{ + { + name: "no trailing whitespace", + input: []byte("package main\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + want: []byte("package main\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + }, + { + name: "simple trailing spaces", + input: []byte("package main \n\nfunc main() { \n\tprintln(\"hello\")\t\n} "), + want: []byte("package main\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + }, + { + name: "trailing tabs", + input: []byte("package main\t\n\nfunc main() {\t\n\tprintln(\"hello\")\t\n}\t"), + want: []byte("package main\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + }, + { + name: "mixed spaces and tabs", + input: []byte("package main \t \n\nfunc main() { \t\n\tprintln(\"hello\")\t \n} \t "), + want: []byte("package main\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + }, + { + name: "empty lines with whitespace", + input: []byte("package main\n \n\t\nfunc main() {\n\tprintln(\"hello\")\n}"), + want: []byte("package main\n\n\nfunc main() {\n\tprintln(\"hello\")\n}"), + }, + { + name: "no final newline", + input: []byte("package main "), + want: []byte("package main"), + }, + { + name: "multiple trailing newlines", + input: []byte("package main\n\n\n"), + want: []byte("package main\n\n\n"), + }, + { + name: "single line with trailing whitespace", + input: []byte("single line "), + want: []byte("single line"), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := trimTrailingWhitespace(tt.input) + assert.Equal(t, string(tt.want), string(got)) + }) + } +}