From 86c18cde7ca2667cb5133827080dc0539ccf3d3c Mon Sep 17 00:00:00 2001
From: "i.nueske" <i.nueske@indiscale.com>
Date: Wed, 15 Jan 2025 18:38:13 +0100
Subject: [PATCH] DOC: Make the Custom Transformers example executable without
 changes, fix indentation

---
 src/doc/converters/transform_functions.rst | 84 +++++++++++-----------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/doc/converters/transform_functions.rst b/src/doc/converters/transform_functions.rst
index 3021b47d..35c11093 100644
--- a/src/doc/converters/transform_functions.rst
+++ b/src/doc/converters/transform_functions.rst
@@ -86,32 +86,32 @@ following code:
 
 .. code-block:: python
 
-	def replace_letters(in_value: Any, in_parameters: dict) -> Any:
-      """
-      Replace letters in variables
-      """
+    def replace_letters(in_value: Any, in_parameters: dict) -> Any:
+        """
+        Replace letters in variables
+        """
 
-      # The arguments to the transformer (as given by the definition in the cfood)
-		  # are contained in `in_parameters`. We need to make sure they are set or
-		  # set their defaults otherwise:
+        # The arguments to the transformer (as given by the definition in the cfood)
+        # are contained in `in_parameters`. We need to make sure they are set or
+        # set their defaults otherwise:
 
-      if "in_letter" not in in_parameters:
-          raise RuntimeError("Parameter `in_letters` missing.")
+        if "in_letters" not in in_parameters:
+            raise RuntimeError("Parameter `in_letters` missing.")
 
-      if "out_letter" not in in_parameters:
-          raise RuntimeError("Parameter `out_letters` missing.")
+        if "out_letters" not in in_parameters:
+            raise RuntimeError("Parameter `out_letters` missing.")
 
-      l_in = in_parameters["in_letters"]
-      l_out = in_parameters["out_letters"]
+        l_in = in_parameters["in_letters"]
+        l_out = in_parameters["out_letters"]
 
 
-      if len(l_in) != len(l_out):
-          raise RuntimeError("`in_letters` and `out_letters` must have the same length.")
+        if len(l_in) != len(l_out):
+            raise RuntimeError("`in_letters` and `out_letters` must have the same length.")
 
-      for l1, l2 in zip(l_in, l_out):
-          in_value = in_value.replace(l1, l2)
+        for l1, l2 in zip(l_in, l_out):
+            in_value = in_value.replace(l1, l2)
 
-      return in_value
+        return in_value
 
 
 This code needs to be put into a module that can be found during runtime of the crawler.
@@ -122,16 +122,16 @@ In the cfood the transfomer needs to be registered:
 
 .. code-block:: yaml
 
-  ---
-  metadata:
-    crawler-version: 0.10.2
-    macros:
-  ---
-  Converters:  # put custom converters here
-  Transformers:
-    replace_letters:  # This name will be made available in the cfood
-      function: replace_letters
-      package: utilities.replace_letters
+    ---
+    metadata:
+        crawler-version: 0.10.2
+        macros:
+    ---
+    #Converters:  # put custom converters here
+    Transformers:
+        replace_letters:  # This name will be made available in the cfood
+        function: replace_letters
+        package: utilities.replace_letters
 
 This would assume that the code for the function `replace_letters` is residing in a file
 called `replace_letters.py` that is stored in a package called `utilities`.
@@ -141,17 +141,17 @@ The transformer can then be used in a converter, e.g.:
 
 .. code-block:: yaml
 
-  Experiment:
-		type: Dict
-		match: ".*"
-		transform:
-			replace_letters:
-				in: $a
-				out: $b
-				functions:
-				- replace_letters:  # This is the name of our custom transformer
-			      in_letters: "abc"
-			      out_letters: "xyz"
-		records:
-			Report:
-				tags: $b
+    Experiment:
+        type: Dict
+        match: ".*"
+        transform:
+            replace_letters:
+                in: $a
+                out: $b
+                functions:
+                - replace_letters:  # This is the name of our custom transformer
+                    in_letters: "abc"
+                    out_letters: "xyz"
+        records:
+            Report:
+                tags: $b
-- 
GitLab