worked
untyped stringworked is the example small enough to check by hand: 11 bytes, 5 symbols, frequencies 5/2/2/1/1.
Value
"abracadabra"
samples
[]stringsamples show what the skew is worth. The first is flat by construction, the last is almost all one symbol, and the ratio moves the whole way between.
- OID
- 017aeb…9cf1:4
samples details
Render
func(path string) stringRender renders the demo for gnoweb. Render("") / Render("/") -> the worked example, the ratios, the edge cases Render("/<text>") -> encode that text and show its table
- OID
- 017aeb…9cf1:5
Render details
renderInput
func(in string) stringrenderInput encodes a caller's text. Everything echoed back goes through md.InlineCode or ui.Inline: the string arrives from the URL and is attacker controlled markdown until it is escaped. A hand-built code span would not do, because an escaped backtick still closes the span.
- OID
- 017aeb…9cf1:7
renderInput details
ratioLine
func(e *v0.Encoded) stringratioLine states the budget in one sentence.
- OID
- 017aeb…9cf1:8
ratioLine details
percent
func(e *v0.Encoded) intpercent is the saving as a whole number. Integer arithmetic: a Render that prints a float is a Render that prints a different float on another node.
- OID
- 017aeb…9cf1:9
percent details
symbolLabel
func(b uint8) stringsymbolLabel renders one byte for a table cell. A symbol is a BYTE, not a rune: converting a byte above 127 with string(b) produces a two-byte UTF-8 sequence that is not the byte the code stands for, which would make the count beside it wrong for any non-ASCII input. Anything outside printable ASCII is shown as hex instead.
- OID
- 017aeb…9cf1:10
symbolLabel details
countByte
func(s string, b uint8) intcountByte counts one byte in s, for the same reason symbolLabel exists.
- OID
- 017aeb…9cf1:11
countByte details
parseArg
func(path string) string- OID
- 017aeb…9cf1:12