Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit 91e1e27

Browse files
authored
Merge pull request #363 from metafacture/newPlaygroundExamples
Add multiple missing playground examples for fix functions
2 parents 71e5a83 + 6c2eda8 commit 91e1e27

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ array("foo")
296296
# {"name":"value"} => ["name", "value"]
297297
```
298298

299+
[Example in Playground](https://metafacture.org/playground/?example=array)
300+
299301
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+array+{")
300302

301303
##### `call_macro`
@@ -359,6 +361,8 @@ hash("foo")
359361
# ["name", "value"] => {"name":"value"}
360362
```
361363

364+
[Example in Playground](https://metafacture.org/playground/?example=hash)
365+
362366
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+hash+{")
363367

364368
##### `move_field`
@@ -383,6 +387,8 @@ Parses a text into an array or hash of values.
383387
parse_text("<sourceField>", "<parsePattern>")
384388
```
385389

390+
[Example in Playground](https://metafacture.org/playground/?example=parse_text)
391+
386392
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+parse_text+{")
387393

388394
##### `paste`
@@ -453,6 +459,8 @@ Creates (or replaces) a field with a random number (less than the specified maxi
453459
random("<targetField>", "<maximum>")
454460
```
455461

462+
[Example in Playground](https://metafacture.org/playground/?example=random)
463+
456464
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+random+{")
457465

458466
##### `remove_field`
@@ -523,6 +531,8 @@ set_hash("<targetFieldName>")
523531
set_hash("<targetFieldName>", "subfieldName": "<subfieldValue>"[, ...])
524532
```
525533

534+
[Example in Playground](https://metafacture.org/playground/?example=set_hash)
535+
526536
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+set_hash+{")
527537

528538
##### `timestamp`
@@ -539,6 +549,8 @@ Options:
539549
timestamp("<targetField>"[, format: "<formatPattern>"][, timezone: "<timezoneCode>"][, language: "<languageCode>"])
540550
```
541551

552+
[Example in Playground](https://metafacture.org/playground/?example=timestamp)
553+
542554
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+timestamp+{")
543555

544556
##### `vacuum`
@@ -587,6 +599,8 @@ Counts the number of elements in an array or a hash and replaces the field value
587599
count("<sourceField>")
588600
```
589601

602+
[Example in Playground](https://metafacture.org/playground/?example=count)
603+
590604
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+count+{")
591605

592606
##### `downcase`
@@ -609,6 +623,8 @@ Only keeps field values that match the regular expression pattern. Works only wi
609623
filter("<sourceField>", "<regexp>")
610624
```
611625

626+
[Example in Playground](https://metafacture.org/playground/?example=filter)
627+
612628
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+filter+{")
613629

614630
##### `flatten`
@@ -645,6 +661,8 @@ Returns the index position of a substring in a field and replaces the field valu
645661
index("<sourceField>", "<substring>")
646662
```
647663

664+
[Example in Playground](https://metafacture.org/playground/?example=index)
665+
648666
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+index+{")
649667

650668
##### `isbn`
@@ -770,6 +788,8 @@ Reverses the character order of a string or the element order of an array.
770788
reverse("<sourceField>")
771789
```
772790

791+
[Example in Playground](https://metafacture.org/playground/?example=reverse)
792+
773793
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+reverse+{")
774794

775795
##### `sort_field`
@@ -806,6 +826,8 @@ Replaces a string with its substring as defined by the start position (offset) a
806826
substring("<sourceField>", "<startPosition>", "<length>")
807827
```
808828

829+
[Example in Playground](https://metafacture.org/playground/?example=substring)
830+
809831
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+substring+{")
810832

811833
##### `sum`
@@ -816,6 +838,8 @@ Sums numbers in an array and replaces the field value with this number.
816838
sum("<sourceField>")
817839
```
818840

841+
[Example in Playground](https://metafacture.org/playground/?example=sum)
842+
819843
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+sum+{")
820844

821845
##### `to_json`
@@ -831,6 +855,8 @@ Options:
831855
to_json("<sourceField>"[, pretty: "<boolean>"][, error_string: "<errorValue>"])
832856
```
833857

858+
[Example in Playground](https://metafacture.org/playground/?example=to_json)
859+
834860
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+to_json+{")
835861

836862
##### `to_base64`
@@ -841,6 +867,8 @@ Replaces the value with its Base64 encoding.
841867
to_base64("<sourceField>")
842868
```
843869

870+
[Example in Playground](https://metafacture.org/playground/?example=to_base64)
871+
844872
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+to_base64+{")
845873

846874
##### `trim`
@@ -898,6 +926,8 @@ E.g.:
898926
uri_encode("path.to.field", plus_for_space:"false", safe_chars:"")
899927
```
900928

929+
[Example in Playground](https://metafacture.org/playground/?example=uri_encode)
930+
901931
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixMethod.java+"+uri_encode+{")
902932

903933
### Selectors
@@ -948,6 +978,8 @@ end
948978

949979
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).
950980

981+
[Example in Playground](https://metafacture.org/playground/?example=do+list_as)
982+
951983
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixBind.java+"+list_as+{")
952984

953985
```perl
@@ -1059,24 +1091,32 @@ end
10591091

10601092
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.
10611093

1094+
[Example in Playground](https://metafacture.org/playground/?example=all_contain)
1095+
10621096
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_contain+{")
10631097

10641098
##### `any_contain`
10651099

10661100
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.
10671101

1102+
[Example in Playground](https://metafacture.org/playground/?example=any_contain)
1103+
10681104
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_contain+{")
10691105

10701106
##### `none_contain`
10711107

10721108
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.
10731109

1110+
[Example in Playground](https://metafacture.org/playground/?example=none_contain)
1111+
10741112
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_contain+{")
10751113

10761114
##### `str_contain`
10771115

10781116
Executes the functions if/unless the first string contains the second string.
10791117

1118+
[Example in Playground](https://metafacture.org/playground/?example=str_contain)
1119+
10801120
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_contain+{")
10811121

10821122
#### `equal`
@@ -1085,24 +1125,32 @@ Executes the functions if/unless the first string contains the second string.
10851125

10861126
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.
10871127

1128+
[Example in Playground](https://metafacture.org/playground/?example=all_equal)
1129+
10881130
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_equal+{")
10891131

10901132
##### `any_equal`
10911133

10921134
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.
10931135

1136+
[Example in Playground](https://metafacture.org/playground/?example=any_equal)
1137+
10941138
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_equal+{")
10951139

10961140
##### `none_equal`
10971141

10981142
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.
10991143

1144+
[Example in Playground](https://metafacture.org/playground/?example=none_equal)
1145+
11001146
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_equal+{")
11011147

11021148
##### `str_equal`
11031149

11041150
Executes the functions if/unless the first string equals the second string.
11051151

1152+
[Example in Playground](https://metafacture.org/playground/?example=str_equal)
1153+
11061154
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_equal+{")
11071155

11081156
#### `exists`
@@ -1112,6 +1160,9 @@ Executes the functions if/unless the field exists.
11121160
```perl
11131161
if exists("<sourceField>")
11141162
```
1163+
1164+
[Example in Playground](https://metafacture.org/playground/?example=exists)
1165+
11151166
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+exists+{")
11161167

11171168
#### `in`
@@ -1120,6 +1171,8 @@ Executes the functions if/unless the field value [is contained in](https://perld
11201171

11211172
_Also aliased as [`is_contained_in`](#is_contained_in)._
11221173

1174+
[Example in Playground](https://metafacture.org/playground/?example=in)
1175+
11231176
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+in+{")
11241177

11251178
#### `is_contained_in`
@@ -1130,30 +1183,40 @@ _Alias for [`in`](#in)._
11301183

11311184
Executes the functions if/unless the field value is an array.
11321185

1186+
[Example in Playground](https://metafacture.org/playground/?example=is_array)
1187+
11331188
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_array+{")
11341189

11351190
#### `is_empty`
11361191

11371192
Executes the functions if/unless the field value is empty.
11381193

1194+
[Example in Playground](https://metafacture.org/playground/?example=is_empty)
1195+
11391196
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_empty+{")
11401197

11411198
#### `is_false`
11421199

11431200
Executes the functions if/unless the field value equals `false` or `0`.
11441201

1202+
[Example in Playground](https://metafacture.org/playground/?example=is_false)
1203+
11451204
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_false+{")
11461205

11471206
#### `is_hash`
11481207

11491208
_Alias for [`is_object`](#is_object)._
11501209

1210+
[Example in Playground](https://metafacture.org/playground/?example=is_hash)
1211+
11511212
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_hash+{")
11521213

11531214
#### `is_number`
11541215

11551216
Executes the functions if/unless the field value is a number.
11561217

1218+
[Example in Playground](https://metafacture.org/playground/?example=is_number)
1219+
11571220
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_number+{")
11581221

11591222
#### `is_object`
@@ -1166,12 +1229,16 @@ _Also aliased as [`is_hash`](#is_hash)._
11661229

11671230
Executes the functions if/unless the field value is a string (and not a number).
11681231

1232+
[Example in Playground](https://metafacture.org/playground/?example=is_string)
1233+
11691234
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_string+{")
11701235

11711236
#### `is_true`
11721237

11731238
Executes the functions if/unless the field value equals `true` or `1`.
11741239

1240+
[Example in Playground](https://metafacture.org/playground/?example=is_true)
1241+
11751242
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+is_true+{")
11761243

11771244

@@ -1181,24 +1248,32 @@ Executes the functions if/unless the field value equals `true` or `1`.
11811248

11821249
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.
11831250

1251+
[Example in Playground](https://metafacture.org/playground/?example=all_match)
1252+
11841253
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+all_match+{")
11851254

11861255
##### `any_match`
11871256

11881257
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.
11891258

1259+
[Example in Playground](https://metafacture.org/playground/?example=any_match)
1260+
11901261
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+any_match+{")
11911262

11921263
##### `none_match`
11931264

11941265
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.
11951266

1267+
[Example in Playground](https://metafacture.org/playground/?example=none_match)
1268+
11961269
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+none_match+{")
11971270

11981271
##### `str_match`
11991272

12001273
Executes the functions if/unless the string matches the regular expression pattern.
12011274

1275+
[Example in Playground](https://metafacture.org/playground/?example=str_match)
1276+
12021277
[Java Code](https://github.com/search?type=code&q=repo:metafacture/metafacture-fix+path:FixConditional.java+"+str_match+{")
12031278

12041279
## Xtext

0 commit comments

Comments
 (0)