From 2c522c5470207cf394fad153dafc69b9e45edaf4 Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Tue, 15 Oct 2024 15:17:22 +0200 Subject: [PATCH] Fix documentation for rule files and replacements --- src/manipulator/map.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/manipulator/map.rs b/src/manipulator/map.rs index d5678b55..97da3330 100644 --- a/src/manipulator/map.rs +++ b/src/manipulator/map.rs @@ -66,18 +66,21 @@ use struct_field_names_as_array::FieldNamesAsSlice; /// ``` /// /// It is also possible to replace all occurences in the original value that -/// match a `search` regular expression with a `replacement` value. +/// match a regular expression with a replacement value. +/// The `replacements` parameter is a list of pairs where the left part is the +/// search string and the right part the replacement string. /// ```toml /// [[rules]] /// query = "tok=\"complicated\"" /// target = 1 /// ns = "" /// name = "newtok" -/// value = {target = 1, search = "cat", replacement = "dog"} +/// value = {target = 1, replacements = [["cat", "dog"]]} /// ``` /// This would add a new annotation value "complidoged" to any token with the value "complicated". +/// You can define more /// -/// The `replacement` value can contain back references to the regular +/// The `replacements` values can contain back references to the regular /// expression (e.g. "${0}" for the whole match or "${1}" for the first match /// group). /// ```toml @@ -86,7 +89,7 @@ use struct_field_names_as_array::FieldNamesAsSlice; /// target = 1 /// ns = "" /// name = "abbr" -/// value = {target = 1, search = "([A-Z])[a-z]+ ([A-Z])[a-z]+", replacement = "${1}${2}"} +/// value = {target = 1, replacements = [["([A-Z])[a-z]+ ([A-Z])[a-z]+", "${1}${2}"]]} /// ``` /// This example would add an annotation with the value "NY". ///