diff --git a/README.md b/README.md index 25297658..287a9602 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,8 @@ array("foo") # {"name":"value"} => ["name", "value"] ``` +[Example in Playground](https://metafacture.org/playground/?example=array) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+array+{") ##### `call_macro` @@ -359,6 +361,8 @@ hash("foo") # ["name", "value"] => {"name":"value"} ``` +[Example in Playground](https://metafacture.org/playground/?example=hash) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+hash+{") ##### `move_field` @@ -383,6 +387,8 @@ Parses a text into an array or hash of values. parse_text("", "") ``` +[Example in Playground](https://metafacture.org/playground/?example=parse_text) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+parse_text+{") ##### `paste` @@ -453,6 +459,8 @@ Creates (or replaces) a field with a random number (less than the specified maxi random("", "") ``` +[Example in Playground](https://metafacture.org/playground/?example=random) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+random+{") ##### `remove_field` @@ -523,6 +531,8 @@ set_hash("") set_hash("", "subfieldName": ""[, ...]) ``` +[Example in Playground](https://metafacture.org/playground/?example=set_hash) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+set_hash+{") ##### `timestamp` @@ -539,6 +549,8 @@ Options: timestamp(""[, format: ""][, timezone: ""][, language: ""]) ``` +[Example in Playground](https://metafacture.org/playground/?example=timestamp) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+timestamp+{") ##### `vacuum` @@ -587,6 +599,8 @@ Counts the number of elements in an array or a hash and replaces the field value count("") ``` +[Example in Playground](https://metafacture.org/playground/?example=count) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+count+{") ##### `downcase` @@ -609,6 +623,8 @@ Only keeps field values that match the regular expression pattern. Works only wi filter("", "") ``` +[Example in Playground](https://metafacture.org/playground/?example=filter) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+filter+{") ##### `flatten` @@ -645,6 +661,8 @@ Returns the index position of a substring in a field and replaces the field valu index("", "") ``` +[Example in Playground](https://metafacture.org/playground/?example=index) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+index+{") ##### `isbn` @@ -770,6 +788,8 @@ Reverses the character order of a string or the element order of an array. reverse("") ``` +[Example in Playground](https://metafacture.org/playground/?example=reverse) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+reverse+{") ##### `sort_field` @@ -806,6 +826,8 @@ Replaces a string with its substring as defined by the start position (offset) a substring("", "", "") ``` +[Example in Playground](https://metafacture.org/playground/?example=substring) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+substring+{") ##### `sum` @@ -816,6 +838,8 @@ Sums numbers in an array and replaces the field value with this number. sum("") ``` +[Example in Playground](https://metafacture.org/playground/?example=sum) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+sum+{") ##### `to_json` @@ -831,6 +855,8 @@ Options: to_json(""[, pretty: ""][, error_string: ""]) ``` +[Example in Playground](https://metafacture.org/playground/?example=to_json) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+to_json+{") ##### `to_base64` @@ -841,6 +867,8 @@ Replaces the value with its Base64 encoding. to_base64("") ``` +[Example in Playground](https://metafacture.org/playground/?example=to_base64) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+to_base64+{") ##### `trim` @@ -898,6 +926,8 @@ E.g.: uri_encode("path.to.field", plus_for_space:"false", safe_chars:"") ``` +[Example in Playground](https://metafacture.org/playground/?example=uri_encode) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+uri_encode+{") ### Selectors @@ -948,6 +978,8 @@ end Iterates over each _named_ element of an array (like [`do list`](#do-list) with a variable name). If multiple arrays are given, iterates over the _corresponding_ elements from each array (i.e., all elements with the same array index, skipping elements whose arrays have already been exhausted). +[Example in Playground](https://metafacture.org/playground/?example=do+list_as) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixBind.java+"+list_as+{") ```perl @@ -1059,24 +1091,32 @@ end Executes the functions if/unless the field contains the value. If it is an array or a hash all field values must contain the string. +[Example in Playground](https://metafacture.org/playground/?example=all_contain) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_contain+{") ##### `any_contain` Executes the functions if/unless the field contains the value. If it is an array or a hash one or more field values must contain the string. +[Example in Playground](https://metafacture.org/playground/?example=any_contain) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_contain+{") ##### `none_contain` Executes the functions if/unless the field does not contain the value. If it is an array or a hash none of the field values may contain the string. +[Example in Playground](https://metafacture.org/playground/?example=none_contain) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_contain+{") ##### `str_contain` Executes the functions if/unless the first string contains the second string. +[Example in Playground](https://metafacture.org/playground/?example=str_contain) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_contain+{") #### `equal` @@ -1085,24 +1125,32 @@ Executes the functions if/unless the first string contains the second string. Executes the functions if/unless the field value equals the string. If it is an array or a hash all field values must equal the string. +[Example in Playground](https://metafacture.org/playground/?example=all_equal) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_equal+{") ##### `any_equal` Executes the functions if/unless the field value equals the string. If it is an array or a hash one or more field values must equal the string. +[Example in Playground](https://metafacture.org/playground/?example=any_equal) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_equal+{") ##### `none_equal` Executes the functions if/unless the field value does not equal the string. If it is an array or a hash none of the field values may equal the string. +[Example in Playground](https://metafacture.org/playground/?example=none_equal) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_equal+{") ##### `str_equal` Executes the functions if/unless the first string equals the second string. +[Example in Playground](https://metafacture.org/playground/?example=str_equal) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_equal+{") #### `exists` @@ -1112,6 +1160,9 @@ Executes the functions if/unless the field exists. ```perl if exists("") ``` + +[Example in Playground](https://metafacture.org/playground/?example=exists) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+exists+{") #### `in` @@ -1120,6 +1171,8 @@ Executes the functions if/unless the field value [is contained in](https://perld _Also aliased as [`is_contained_in`](#is_contained_in)._ +[Example in Playground](https://metafacture.org/playground/?example=in) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+in+{") #### `is_contained_in` @@ -1130,30 +1183,40 @@ _Alias for [`in`](#in)._ Executes the functions if/unless the field value is an array. +[Example in Playground](https://metafacture.org/playground/?example=is_array) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_array+{") #### `is_empty` Executes the functions if/unless the field value is empty. +[Example in Playground](https://metafacture.org/playground/?example=is_empty) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_empty+{") #### `is_false` Executes the functions if/unless the field value equals `false` or `0`. +[Example in Playground](https://metafacture.org/playground/?example=is_false) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_false+{") #### `is_hash` _Alias for [`is_object`](#is_object)._ +[Example in Playground](https://metafacture.org/playground/?example=is_hash) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_hash+{") #### `is_number` Executes the functions if/unless the field value is a number. +[Example in Playground](https://metafacture.org/playground/?example=is_number) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_number+{") #### `is_object` @@ -1166,12 +1229,16 @@ _Also aliased as [`is_hash`](#is_hash)._ Executes the functions if/unless the field value is a string (and not a number). +[Example in Playground](https://metafacture.org/playground/?example=is_string) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_string+{") #### `is_true` Executes the functions if/unless the field value equals `true` or `1`. +[Example in Playground](https://metafacture.org/playground/?example=is_true) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_true+{") @@ -1181,24 +1248,32 @@ Executes the functions if/unless the field value equals `true` or `1`. Executes the functions if/unless the field value matches the regular expression pattern. If it is an array or a hash all field values must match the regular expression pattern. +[Example in Playground](https://metafacture.org/playground/?example=all_match) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_match+{") ##### `any_match` Executes the functions if/unless the field value matches the regular expression pattern. If it is an array or a hash one or more field values must match the regular expression pattern. +[Example in Playground](https://metafacture.org/playground/?example=any_match) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_match+{") ##### `none_match` Executes the functions if/unless the field value does not match the regular expression pattern. If it is an array or a hash none of the field values may match the regular expression pattern. +[Example in Playground](https://metafacture.org/playground/?example=none_match) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_match+{") ##### `str_match` Executes the functions if/unless the string matches the regular expression pattern. +[Example in Playground](https://metafacture.org/playground/?example=str_match) + [Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_match+{") ## Xtext