From 6ee5af0a16a5f1a32eb933e30d8b86ff4e691beb Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 21 Apr 2025 14:45:39 -0400 Subject: Add short descriptions for API methods to improve manpages --- api/api.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'api/api.md') diff --git a/api/api.md b/api/api.md index f355163b..15526d43 100644 --- a/api/api.md +++ b/api/api.md @@ -189,7 +189,7 @@ sleep(1.5) Bool.parse : func(text: Text -> Bool?) ``` -Converts a string representation of a boolean value into a boolean. Acceptable boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`, `true`/`false`, `on`/`off`. +Converts a text representation of a boolean value into a boolean. Acceptable boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`, `true`/`false`, `on`/`off`. Argument | Type | Description | Default ---------|------|-------------|--------- @@ -4664,13 +4664,14 @@ last | `Int` | The index of the last grapheme cluster to include (1-indexed). | ## Text.translate ```tomo -Text.translate : func(translations: {Text=Text} -> Text) +Text.translate : func(text: Text, translations: {Text=Text} -> Text) ``` Takes a table mapping target texts to their replacements and performs all the replacements in the table on the whole text. At each position, the first matching replacement is applied and the matching moves on to *after* the replacement text, so replacement text is not recursively modified. See Text.replace() for more information about replacement behavior. Argument | Type | Description | Default ---------|------|-------------|--------- +text | `Text` | The text to be translated. | - translations | `{Text=Text}` | A table mapping from target text to its replacement. | - **Return:** The text with all occurrences of the targets replaced with their corresponding replacement text. @@ -4679,12 +4680,12 @@ translations | `{Text=Text}` | A table mapping from target text to its replaceme **Example:** ```tomo >> "A & an amperand".translate({ -"&" = "&", -"<" = "<", -">" = ">", -'"" = """, -"'" = "'", -} + "&" = "&", + "<" = "<", + ">" = ">", + '"" = """, + "'" = "'", +}) = "A <tag> & an ampersand" ``` -- cgit v1.2.3