1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

rename jsonvariables back to jsonvariable

This commit is contained in:
pmario 2024-05-23 07:46:18 +02:00
parent aa8ccfe8f9
commit 432c6af2a2
5 changed files with 23 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/*\ /*\
title: $:/core/modules/filters/jsonvariables.js title: $:/core/modules/filters/jsonvariable.js
type: application/javascript type: application/javascript
module-type: filteroperator module-type: filteroperator
@ -16,7 +16,7 @@ Display as JSON with basic formatting
/* /*
Export our filter function Export our filter function
*/ */
exports.jsonvariables = function(source,operator,options) { exports.jsonvariable = function(source,operator,options) {
var results = [], var results = [],
widget = options.widget; widget = options.widget;
// "replacer" must be defined, otherwise JSON.stringify will throw a circular reference error RSOD // "replacer" must be defined, otherwise JSON.stringify will throw a circular reference error RSOD

View File

@ -56,7 +56,7 @@ tags: $:/tags/Global
<li> <li>
<code title={{$:/language/Search/Variables/Signature}}><$text text=<<wlf.dv-formattedVar>>/></code><br/> <code title={{$:/language/Search/Variables/Signature}}><$text text=<<wlf.dv-formattedVar>>/></code><br/>
<% if [<wlf.dv-formattedVar>prefix[\function]] %> <% if [<wlf.dv-formattedVar>prefix[\function]] %>
<pre title={{$:/language/Search/Variables/Function/Definition}}><code><$text text={{{ [<varname>jsonvariables[]jsonextract[srcVariable],[value]] }}}/></code></pre> <pre title={{$:/language/Search/Variables/Function/Definition}}><code><$text text={{{ [<varname>jsonvariable[]jsonextract[srcVariable],[value]] }}}/></code></pre>
<% endif %> <% endif %>
<pre title={{$:/language/Search/Variables/Content}}><code><$text text={{{ [<varname>getvariable[]] }}}/></code></pre> <pre title={{$:/language/Search/Variables/Content}}><code><$text text={{{ [<varname>getvariable[]] }}}/></code></pre>
</li> </li>
@ -235,7 +235,7 @@ tags: $:/tags/Global
<<dv-info>> <<dv-info>>
<% endif %> <% endif %>
<% if [<varname>prefix[\function]] %> <% if [<varname>prefix[\function]] %>
<$codeblock code={{{ [<varname>jsonvariables[]jsonextract[srcVariable],[value]] }}}/> <$codeblock code={{{ [<varname>jsonvariable[]jsonextract[srcVariable],[value]] }}}/>
<% endif %> <% endif %>
<pre tabindex="0" title={{$:/language/Search/Variables/Content}}><code><$text text={{{ [<varname>getvariable[]] }}}/></code></pre> <pre tabindex="0" title={{$:/language/Search/Variables/Content}}><code><$text text={{{ [<varname>getvariable[]] }}}/></code></pre>
</blockquote> </blockquote>

View File

@ -1,15 +1,15 @@
created: 20240506132850677 created: 20240506132850677
modified: 20240523052607425 modified: 20240523052607425
tags: [[Operator Examples]] [[jsonvariables Operator]] tags: [[Operator Examples]] [[jsonvariable Operator]]
title: jsonvariables Operator (Examples) title: jsonvariable Operator (Examples)
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
The following example shows the "internal" structure of the `fn.test` function defined in <<.olink jsonvariables>> operator The following example shows the "internal" structure of the `fn.test` function defined in <<.olink jsonvariable>> operator
<<.example 1 """\procedure testProc() [[aa aa]] bb <<.example 1 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]] \function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
<pre><code><$text text={{{[[fn.test]jsonvariables[]]}}}/></code></pre> <pre><code><$text text={{{[[fn.test]jsonvariable[]]}}}/></code></pre>
""">> """>>
The following example shows the same structure ''pretty printed'' using the <<.olink format>> filter operator The following example shows the same structure ''pretty printed'' using the <<.olink format>> filter operator
@ -19,7 +19,7 @@ The following example shows the same structure ''pretty printed'' using the <<.o
\function tab() [charcode[9]] \function tab() [charcode[9]]
<pre><code><$text text={{{[[fn.test]jsonvariables[]format:json<tab>]}}}/></code></pre> <pre><code><$text text={{{[[fn.test]jsonvariable[]format:json<tab>]}}}/></code></pre>
""">> """>>
The following example extracts the ''function definition'' using the <<.olink jsonextract>> filter operator The following example extracts the ''function definition'' using the <<.olink jsonextract>> filter operator
@ -27,7 +27,7 @@ The following example extracts the ''function definition'' using the <<.olink js
<<.example 3 """\procedure testProc() [[aa aa]] bb <<.example 3 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]] \function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
<pre><code><$text text={{{[[fn.test]jsonvariables[]jsonextract[srcVariable],[value]]}}}/></code></pre> <pre><code><$text text={{{[[fn.test]jsonvariable[]jsonextract[srcVariable],[value]]}}}/></code></pre>
""">> """>>
The following example extracts the `srcVariables.params` with pretty printing using <<.olink jsonextract>> The following example extracts the `srcVariables.params` with pretty printing using <<.olink jsonextract>>
@ -37,5 +37,5 @@ The following example extracts the `srcVariables.params` with pretty printing us
\function tab() [charcode[9]] \function tab() [charcode[9]]
<pre><code><$text text={{{[[fn.test]jsonvariables[]jsonextract[srcVariable],[params]format:json<tab>]}}}/></code></pre>""">> <pre><code><$text text={{{[[fn.test]jsonvariable[]jsonextract[srcVariable],[params]format:json<tab>]}}}/></code></pre>""">>

View File

@ -1,4 +1,4 @@
caption: jsonvariables caption: jsonvariable
created: 20240506131935424 created: 20240506131935424
modified: 20240506151517068 modified: 20240506151517068
op-input: a selection variable names op-input: a selection variable names
@ -7,7 +7,7 @@ op-parameter: one or more indexes of the property to retrieve
op-parameter-name: R op-parameter-name: R
op-purpose: retrieve the JSON string from a ~TiddlyWiki variable op-purpose: retrieve the JSON string from a ~TiddlyWiki variable
tags: [[Filter Operators]] [[JSON Operators]] tags: [[Filter Operators]] [[JSON Operators]]
title: jsonvariables Operator title: jsonvariable Operator
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
\procedure testProc() [[aa aa]] bb \procedure testProc() [[aa aa]] bb
@ -16,9 +16,9 @@ type: text/vnd.tiddlywiki
<<.from-version "5.3.4">> <<.from-version "5.3.4">>
The <<.op jsonvariables>> operator is used to retrieve variables as JSON substrings. See also the following related operators: The <<.op jsonvariable>> operator is used to retrieve variables as JSON substrings. See also the following related operators:
Properties within a JSON object are identified by a sequence of indexes. In the following example, we use a procedure: `testProc` and a function: `fn.test` to show the possibilities of <<.op jsonvariables>>. The `tab`-function is needed for the <<.olink format>> ooperator, which is used to "pretty-print" the output. Properties within a JSON object are identified by a sequence of indexes. In the following example, we use a procedure: `testProc` and a function: `fn.test` to show the possibilities of <<.op jsonvariable>>. The `tab`-function is needed for the <<.olink format>> ooperator, which is used to "pretty-print" the output.
``` ```
\procedure testProc() [[aa aa]] bb \procedure testProc() [[aa aa]] bb
@ -26,12 +26,12 @@ Properties within a JSON object are identified by a sequence of indexes. In the
\function tab() [charcode[9]] \function tab() [charcode[9]]
<pre><code><$text text={{{[[fn.test]jsonvariables[]format:json<tab>]}}}/></code></pre> <pre><code><$text text={{{[[fn.test]jsonvariable[]format:json<tab>]}}}/></code></pre>
``` ```
Which results to: Which results to:
<pre><code><$text text={{{[[fn.test]jsonvariables[]format:json<tab>]}}}/></code></pre> <pre><code><$text text={{{[[fn.test]jsonvariable[]format:json<tab>]}}}/></code></pre>
Also see: Also see:
@ -42,4 +42,4 @@ Also see:
Every TW variable has this internal structure, which we can use to extract the info we need. Every TW variable has this internal structure, which we can use to extract the info we need.
!! <<.operator-examples "jsonvariables">> !! <<.operator-examples "jsonvariable">>

View File

@ -1,35 +1,35 @@
created: 20240506101435113 created: 20240506101435113
modified: 20240506140610448 modified: 20240506140610448
tags: tags:
title: test-jsonvariables-conat title: test-jsonvariable-conat
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
''Nice to have'' ''Nice to have''
<<.example 1 """\function tab() [charcode[9]] <<.example 1 """\function tab() [charcode[9]]
<pre><$text text={{{[[.concat]jsonvariables[]]}}}/></pre> <pre><$text text={{{[[.concat]jsonvariable[]]}}}/></pre>
""">> """>>
''Human readable version'' ''Human readable version''
<<.example 2 """\function tab() [charcode[9]] <<.example 2 """\function tab() [charcode[9]]
<pre><$text text={{{[[.concat]jsonvariables[]format:json<tab>]}}}/></pre> <pre><$text text={{{[[.concat]jsonvariable[]format:json<tab>]}}}/></pre>
""">> """>>
''Function definition'' ''Function definition''
<<.example 3 """\function tab() [charcode[9]] <<.example 3 """\function tab() [charcode[9]]
<pre><$text text={{{[[.concat]jsonvariables[]jsonextract[srcVariable],[value]format:json<tab>]}}}/></pre> <pre><$text text={{{[[.concat]jsonvariable[]jsonextract[srcVariable],[value]format:json<tab>]}}}/></pre>
""">> """>>
''Get parameters'' ''Get parameters''
<<.example 4 """\function tab() [charcode[9]] <<.example 4 """\function tab() [charcode[9]]
<pre><$text text={{{[[.concat]jsonvariables[]jsonextract[srcVariable],[params]format:json<tab>]}}}/></pre> <pre><$text text={{{[[.concat]jsonvariable[]jsonextract[srcVariable],[params]format:json<tab>]}}}/></pre>
""">> """>>
''Expected'' ''Expected''