Browse Source

Reused example from spec file

Martijn van Groningen 2 years ago
parent
commit
b259248568

+ 6 - 3
docs/reference/esql/functions/trim.asciidoc

@@ -2,8 +2,11 @@
 === `TRIM`
 Removes leading and trailing whitespaces from strings.
 
-[source,esql]
+[source.merge.styled,esql]
 ----
-ROW message = "   some text  "
-| EVAL message = TRIM(message)
+include::{esql-specs}/string.csv-spec[tag=trim]
 ----
+[%header.monospaced.styled,format=dsv,separator=|]
+|===
+include::{esql-specs}/string.csv-spec[tag=trim-result]
+|===

+ 6 - 1
x-pack/plugin/esql/qa/testFixtures/src/main/resources/string.csv-spec

@@ -182,10 +182,15 @@ emp_no:integer | name:keyword
 ;
 
 trimRow
-ROW message = "   some text  ",  color = " red "| EVAL message = TRIM(message)| EVAL color = TRIM(color);
+// tag::trim[]
+ROW message = "   some text  ",  color = " red "| EVAL message = TRIM(message)| EVAL color = TRIM(color)
+// end::trim[]
+;
 
+// tag::trim-result[]
 message:s | color:s
 some text | red
+// end::trim-result[]
 ;
 
 concat