From 7f69e814219268610c9d5c9b724f64a17a78b2cb Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 10 Feb 2019 23:50:39 +0000 Subject: JSON: add iterative conditions for arrays (cherry picked from commit c5c57c4eafde32a0632c2a00bdc634860fc5d06d) --- doc/doc-docbook/spec.xfpt | 25 ++++++++++++++++++++++--- doc/doc-txt/NewStuff | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index d3de8763f..22f06e3c1 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -9558,7 +9558,7 @@ if a returned value is a JSON string, it retains its leading and trailing quotes. .new For the &"jsons"& variant, which is intended for use with JSON strings, the -leading and trailing quotes are removed. +leading and trailing quotes are removed from the returned value. .wen . XXX should be a UTF-8 compare @@ -9596,7 +9596,7 @@ yields &"99"&. Two successive separators mean that the field between them is empty (for example, the fifth field above). -.vitem "&*${extract json{*&<&'number'&>&*}}&&& +.vitem "&*${extract json {*&<&'number'&>&*}}&&& {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" &&& "&*${extract jsons{*&<&'number'&>&*}}&&& {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" @@ -9612,7 +9612,7 @@ if a returned value is a JSON string, it retains its leading and trailing quotes. .new For the &"jsons"& variant, which is intended for use with JSON strings, the -leading and trailing quotes are removed. +leading and trailing quotes are removed from the returned value. .wen @@ -11341,6 +11341,25 @@ being processed, to enable these expansion items to be nested. To scan a named list, expand it with the &*listnamed*& operator. +.new +.vitem "&*forall_json{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&& + "&*forany_json{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&& + "&*forall_jsons{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" &&& + "&*forany_jsons{*&<&'a JSON array'&>&*}{*&<&'a condition'&>&*}*&" +.cindex JSON "iterative conditions" +.cindex JSON expansions +.cindex expansion "&*forall_json*& condition" +.cindex expansion "&*forany_json*& condition" +.cindex expansion "&*forall_jsons*& condition" +.cindex expansion "&*forany_jsons*& condition" +As for the above, except that the first argument must, after expansion, +be a JSON array. +The array separator is not changeable. +For the &"jsons"& variants the elements are expected to be JSON strings +and have their quotes removed before the evaluation of the condition. +.wen + + .vitem &*ge&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& &&& &*gei&~{*&<&'string1'&>&*}{*&<&'string2'&>&*}*& diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 8dc3648f5..3b5cda15c 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -11,7 +11,7 @@ Version 4.93 1. An "external" authenticator, per RFC 4422 Appendix A. - 2. A JSON lookup type. + 2. A JSON lookup type, and JSON variants of the forall/any expansion conditions. Version 4.92 -------------- -- cgit v1.2.3