aboutsummaryrefslogtreecommitdiff
path: root/docs/text.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-01-12 16:49:58 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-01-12 16:49:58 -0500
commit645d66e0de0f201404d9ad4b210f90c139a247ff (patch)
tree08367c3631b928752cde94083bdfe2ae49db0b79 /docs/text.md
parentb025cf269d2e07e179be4a0e34d936862dc640c2 (diff)
Change table syntax to `{key=value}` and `{:K,V}`/`{K,V}`
Diffstat (limited to 'docs/text.md')
-rw-r--r--docs/text.md16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/text.md b/docs/text.md
index fd37d4df..0384aa41 100644
--- a/docs/text.md
+++ b/docs/text.md
@@ -279,7 +279,7 @@ Text.find_all(pattern:Pattern -> [Match])
Text.matches(pattern:Pattern -> [Text]?)
Text.map(pattern:Pattern, fn:func(m:Match -> Text) -> Text)
Text.replace(pattern:Pattern, replacement:Text, placeholder:Pattern=$// -> [Text])
-Text.replace_all(replacements:{Pattern:Text}, placeholder:Pattern=$// -> [Text])
+Text.replace_all(replacements:{Pattern,Text}, placeholder:Pattern=$// -> [Text])
Text.split(pattern:Pattern -> [Text])
Text.trim(pattern=$/{whitespace}/, trim_left=yes, trim_right=yes -> [Text])
```
@@ -1183,7 +1183,7 @@ See [`replace()`](#replace) for more information about replacement behavior.
**Signature:**
```tomo
-func replace_all(replacements:{Pattern:Text}, backref: Pattern = $/\/ -> Text)
+func replace_all(replacements:{Pattern,Text}, backref: Pattern = $/\/ -> Text)
```
**Parameters:**
@@ -1206,15 +1206,15 @@ replacement text.
**Example:**
```tomo
>> "A <tag> & an amperand":replace_all({
- $/&/: "&amp;",
- $/</: "&lt;",
- $/>/: "&gt;",
- $/"/: "&quot",
- $/'/: "&#39;",
+ $/&/ = "&amp;",
+ $/</ = "&lt;",
+ $/>/ = "&gt;",
+ $/"/ = "&quot",
+ $/'/ = "&#39;",
}
= "A &lt;tag&gt; &amp; an ampersand"
->> "Hello":replace_all({$/{lower}/:"[\0]", $/{upper}/:"{\0}"})
+>> "Hello":replace_all({$/{lower}/="[\0]", $/{upper}/="{\0}"})
= "{H}[ello]"
```