1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 18:53:28 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/filters/examples/format Operator (Examples).tid
Jeremy Ruston 35b9faaa89
JSON Filter Operators (Revised Attempt) (#6936)
* First commit

Cherry-picked from #6666

* Adjust release version number

Just in case we decide to make a release before we merge #6666
2022-09-02 18:15:45 +01:00

35 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

created: 20201020102735123
modified: 20220611104737314
tags: [[Operator Examples]] [[format Operator]]
title: format Operator (Examples)
type: text/vnd.tiddlywiki
These examples use the tiddler HelloThere.
Created date with no format string specified:
<<.operator-example 1 "[[HelloThere]get[created]format:date[]]">>
Created date with a format string supplied as operator parameter:
<<.operator-example 2 "[[HelloThere]get[created]format:date[DDth MMM YYYY]]">>
Modified date shown as a relative date:
<<.operator-example 3 "[[HelloThere]get[modified]format:relativedate[]]">>
A tiddler title with spaces formatted as a title list:
<<.operator-example 4 """[[Hello There]format:titlelist[]]""">>
All tiddler titles tagged with <<tag TableOfContents>> formatted as a title list:
<<.operator-example 5 """[tag[TableOfContents]format:titlelist[]]""">>
A JSON string formatted as JSON note how the JSON string is normalised to remove the duplicated properties:
<<.operator-example 6 """[[{"one":"first","one":"another","two":"second"}]format:json[]]""">>
<<.tip "To create a string to save a [[title list|Title List]] into a list field, use `format:titlelist[]` with the [[join operator|join Operator]]">>
<<.operator-example 6 """[tag[TableOfContents]format:titlelist[]join[ ]]""">>
For example, to save titles tagged `TableOfContents` to the titles field of the tiddler [[format titlelist test]]:
<$macrocall $name='wikitext-example-without-html'
src='<$button> test
<$action-setfield $tiddler="format titlelist test" titles={{{ [tag[TableOfContents]format:titlelist[]join[ ]] }}}/>
</$button>'/>