PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/moul/x/daily/piglatindemo/v0

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v0
Namespace
moul / x / daily / piglatindemo
Files
3 (README)(gnomod.toml)
Exported functions
1
Module
gno.land/r/moul/x/daily/piglatindemo/v0
gno
0.9

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • piglatindemo.gnogno
piglatindemo.gnogno
1// Package piglatindemo is a small gnoweb demo of the Pig Latin translator2// provided by the [p/moul/x/daily/piglatin](/p/moul/x/daily/piglatin/v0)3// library: it renders the rules, a gallery of worked examples, and an4// interactive sentence translator.5//6// It contains no translation logic of its own — everything comes from7// `piglatin.Translate` and `piglatin.TranslateToken`.8package piglatindemo910import (11	"strings"1213	"gno.land/p/moul/x/daily/piglatin/v0"14)1516// Render is the gnoweb entrypoint (Markdown). Root explains the rules; any17// other path is treated as a sentence to translate, e.g. Render("/Hello world").18func Render(path string) string {19	var b strings.Builder2021	sentence := strings.TrimPrefix(path, "/")22	sentence = strings.TrimSpace(sentence)2324	if sentence == "" {25		b.WriteString("# Pig Latin\n\n")26		b.WriteString("Demo of the [`p/moul/x/daily/piglatin`](/p/moul/x/daily/piglatin/v0) ")27		b.WriteString("library — a tiny port of the classic **Pig Latin** translator ")28		b.WriteString("(the go-to beginner exercise). Pure `strings`/`unicode`, fully deterministic.\n\n")29		b.WriteString("## Rules\n\n")30		b.WriteString("1. Word starts with a **vowel** → append `way`. `apple` → `appleway`\n")31		b.WriteString("2. Word starts with **consonant(s)** → move the leading consonant cluster to the end, then add `ay`. `string` → `ingstray`\n")32		b.WriteString("3. `y` is a consonant only as the first letter (`yellow` → `ellowyay`); otherwise a vowel (`myth` → `ythmay`).\n")33		b.WriteString("4. **Capitalization** is preserved: `Hello` → `Ellohay`, `NASA` → `ASANAY`.\n")34		b.WriteString("5. **Punctuation** glued to a word stays put: `Hello,` → `Ellohay,`.\n\n")35		b.WriteString("## Try it\n\n")36		b.WriteString("Append a sentence to the path — spaces are fine:\n\n")37		for _, ex := range []string{"hello world", "The quick brown fox", "I love Gno!"} {38			b.WriteString("- [`/")39			b.WriteString(ex)40			b.WriteString("`](/r/moul/x/daily/piglatindemo/v0:/")41			b.WriteString(ex)42			b.WriteString(") → `")43			b.WriteString(piglatin.Translate(ex))44			b.WriteString("`\n")45		}46		b.WriteString("\n## Examples\n\n")47		b.WriteString("| Input | Pig Latin |\n|---|---|\n")48		for _, w := range []string{"pig", "banana", "smile", "eat", "yellow", "myth", "Hello,", "GNO"} {49			b.WriteString("| `")50			b.WriteString(w)51			b.WriteString("` | `")52			b.WriteString(piglatin.TranslateToken(w))53			b.WriteString("` |\n")54		}55		return b.String()56	}5758	b.WriteString("# Pig Latin\n\n")59	b.WriteString("**Original:**\n\n> ")60	b.WriteString(sentence)61	b.WriteString("\n\n**Pig Latin:**\n\n> ")62	b.WriteString(piglatin.Translate(sentence))63	b.WriteString("\n\n---\n\n[← rules & examples](/r/moul/x/daily/piglatindemo/v0)\n")64	return b.String()65}66

Functions

  • Render(path string) string

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.