mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-23 06:20:01 +00:00
Merge branch 'tiddlywiki-com'
This commit is contained in:
commit
f343198353
@ -1,5 +1,5 @@
|
|||||||
created: 20150117190213631
|
created: 20150117190213631
|
||||||
modified: 20201201154211507
|
modified: 20230226144641763
|
||||||
tags: Concepts
|
tags: Concepts
|
||||||
title: Date Fields
|
title: Date Fields
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -21,6 +21,8 @@ Values of date fields are 17 or 18-character strings:
|
|||||||
|
|
||||||
To avoid problems arising from differences of time zone, TiddlyWiki always uses [[UTC|https://en.wikipedia.org/wiki/Coordinated_Universal_Time]].
|
To avoid problems arising from differences of time zone, TiddlyWiki always uses [[UTC|https://en.wikipedia.org/wiki/Coordinated_Universal_Time]].
|
||||||
|
|
||||||
|
The [[DateFormat]] template for storage of dates in these fields is `[UTC]YYYY0MM0DD0hh0mm0ss0XXX`.
|
||||||
|
|
||||||
As an example, the <<.field created>> field of this tiddler has the value <<.value """<$view field="created"/>""">>.
|
As an example, the <<.field created>> field of this tiddler has the value <<.value """<$view field="created"/>""">>.
|
||||||
|
|
||||||
Dates can be [[converted to other formats|DateFormat]] for display:
|
Dates can be [[converted to other formats|DateFormat]] for display:
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
created: 20131205155227468
|
created: 20131205155227468
|
||||||
modified: 20140919191220377
|
modified: 20230303214711802
|
||||||
tags: Concepts Reference
|
tags: Concepts Reference
|
||||||
title: WikiText
|
title: WikiText
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
~WikiText is a concise, expressive way of typing a wide range of text formatting, hypertext and interactive features. It allows you to focus on writing without a complex user interface getting in the way. It is designed to be familiar for users of [[MarkDown|http://daringfireball.net/projects/markdown/]], but with more of a focus on linking and the interactive features.
|
~WikiText is a concise, expressive way of typing a wide range of text formatting, hypertext and interactive features. It allows you to focus on writing without a complex user interface getting in the way. It is designed to be familiar for users of [[Markdown]] but with more of a focus on linking and the interactive features.
|
||||||
|
|
||||||
~WikiText can also be inserted to the text field using the [[Editor toolbar]].
|
~WikiText can also be inserted to the text field using the [[Editor toolbar]] buttons.
|
||||||
|
|
||||||
See [[Formatting text in TiddlyWiki]] for an introduction to WikiText.
|
See [[Formatting in WikiText]] and [[Formatting text in TiddlyWiki]] for an introduction to ~WikiText.
|
||||||
|
|
||||||
The following elements of WikiText syntax are built into the core:
|
The following elements of ~WikiText syntax are built into the core:
|
||||||
|
|
||||||
<<list-links "[tag[WikiText]]">>
|
<<list-links filter:"[tag[WikiText]]" class:"multi-columns">>
|
||||||
|
10
editions/tw5.com/tiddlers/definitions/Markdown.tid
Normal file
10
editions/tw5.com/tiddlers/definitions/Markdown.tid
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
created: 20220727090611178
|
||||||
|
modified: 20220728191637376
|
||||||
|
tags: Definitions
|
||||||
|
title: Markdown
|
||||||
|
|
||||||
|
<<<
|
||||||
|
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).
|
||||||
|
<<<https://daringfireball.net/projects/markdown/
|
||||||
|
|
||||||
|
~TiddlyWiki and Markdown share some formatting rules eg: [[inline code|Formatting in WikiText]] and [[code blocks|Code Blocks in WikiText]] but WikiText also offers advanced functions like [[transclusions|Transclusion in WikiText]] and [[macros|Macro Calls in WikiText]]
|
@ -1,12 +1,12 @@
|
|||||||
created: 20140418142957325
|
created: 20140418142957325
|
||||||
modified: 20221121131150032
|
modified: 20230226144359284
|
||||||
tags: Features
|
tags: Features
|
||||||
title: DateFormat
|
title: DateFormat
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
The default representation of dates is a compact string such as `20211002153802059`. For example, the `created` and `modified` fields are stored like this.
|
The default representation of dates is a compact string such as <<.value 20211002153802059>>. The associated template is `[UTC]YYYY0MM0DD0hh0mm0ss0XXX`. For example, the <<.field created>> and <<.field modified>> fields are stored like this.
|
||||||
|
|
||||||
The display format for this string can be controlled with a template. For example, transcluding the `modified` field automatically applies a template to display the date as `Sat Oct 02 2021 17:40:50 GMT+0200 (Central European Summer Time)`. A few widgets and filter operators allow you to manually specify a template, for example the ViewWidget:
|
The display format for this string can be controlled with a template. For example, transcluding the <<.field modified>> field automatically applies a template to display the date as <<.value "Sat Oct 02 2021 17:40:50 GMT+0200 (Central European Summer Time)">>. A few widgets and filter operators allow you to manually specify a template, for example the ViewWidget:
|
||||||
|
|
||||||
`<$view field=modified format=date template="DDth mmm YYYY 0hh:0mm:0ss" />`
|
`<$view field=modified format=date template="DDth mmm YYYY 0hh:0mm:0ss" />`
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ The date string is processed with the following substitutions:
|
|||||||
|
|
||||||
Note that other text is passed through unchanged, allowing commas, colons or other separators to be used.
|
Note that other text is passed through unchanged, allowing commas, colons or other separators to be used.
|
||||||
|
|
||||||
The `{era:BCE||CE}` notation can specify different strings for years that are negative, zero or positive. For example `{era:BC|Z|AD}` would display `BC` for negative years, `AD` for positive years, and `Z` for year zero.
|
The `{era:BCE||CE}` notation can specify different strings for years that are negative, zero or positive. For example `{era:BC|Z|AD}` would display <<.value BC>> for negative years, <<.value AD>> for positive years, and <<.value Z>> for year zero.
|
||||||
|
|
||||||
! Examples
|
! Examples
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ The `{era:BCE||CE}` notation can specify different strings for years that are ne
|
|||||||
|`DDth MMM \M\M\M YYYY` |16th February MMM 2011 |
|
|`DDth MMM \M\M\M YYYY` |16th February MMM 2011 |
|
||||||
|`DDth mmm YYYY 0hh:0mm:0ss` |16th Feb 2011 11:38:42 |
|
|`DDth mmm YYYY 0hh:0mm:0ss` |16th Feb 2011 11:38:42 |
|
||||||
|
|
||||||
!! Using `TIMESTAMP` to calculate time difference
|
!! Using <<.value TIMESTAMP>> to calculate time difference
|
||||||
|
|
||||||
You can calculate the difference between two dates by doing the following:
|
You can calculate the difference between two dates by doing the following:
|
||||||
|
|
||||||
@ -71,8 +71,9 @@ You can calculate the difference between two dates by doing the following:
|
|||||||
|
|
||||||
Here is an example of calculating the number of days that passed between creation and last modification of current tiddler:
|
Here is an example of calculating the number of days that passed between creation and last modification of current tiddler:
|
||||||
|
|
||||||
* Fields `modified` and `created` contain their respective datetimes in the format `[UTC]YYYY0MM0DD0hh0mm0ssXXX` so convert them to timestamps
|
* Convert the <<.field created>> and <<.field modified>> fields to timestamps
|
||||||
* `86400000` is the number of milliseconds in a day (1000 * 60 * 60 * 24)
|
* Divide their difference by <<.value 86400000>> which is the number of milliseconds in a day
|
||||||
|
** 1000 milliseconds per second × 60 seconds per minute × 60 minutes per hour × 24 hours per day = 86,400,000 milliseconds per day
|
||||||
|
|
||||||
<$macrocall $name=".example" n="0" eg="""<$let
|
<$macrocall $name=".example" n="0" eg="""<$let
|
||||||
timestamp-modified={{{ [{!!modified}format:date[TIMESTAMP]] }}}
|
timestamp-modified={{{ [{!!modified}format:date[TIMESTAMP]] }}}
|
||||||
|
@ -33,29 +33,17 @@ Note the various places you need to indicate the number of columns
|
|||||||
|
|
||||||
```
|
```
|
||||||
@@.fourcolumns
|
@@.fourcolumns
|
||||||
<$list filter="[tag[Filter Operators]]" variable="foo"><br>
|
<$list filter="[tag[Filter Operators]]" variable="foo">
|
||||||
<<foo>>
|
<<foo>><br>
|
||||||
</$list>
|
</$list>
|
||||||
@@
|
@@
|
||||||
```
|
```
|
||||||
|
|
||||||
!! Example showing partial list of filter operators
|
!! Example showing partial list of filter operators
|
||||||
|
|
||||||
<style>
|
|
||||||
.fourcolumns {
|
|
||||||
display:block;
|
|
||||||
column-count:4;
|
|
||||||
column-gap:1em;
|
|
||||||
-moz-column-count:4;
|
|
||||||
-moz-column-gap:1em;
|
|
||||||
-webkit-column-count: 4;
|
|
||||||
-webkit-column-gap:1em;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
@@.fourcolumns
|
@@.fourcolumns
|
||||||
<$list filter="[tag[Filter Operators]limit[24]]" variable="foo"><br>
|
<$list filter="[tag[Filter Operators]limit[24]]" variable="foo">
|
||||||
<<foo>>
|
<<foo>><br>
|
||||||
</$list>
|
</$list>
|
||||||
@@
|
@@
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ type: text/vnd.tiddlywiki
|
|||||||
|
|
||||||
Making lists of items plays a central role in working with TiddlyWiki. The following is a brief run-through of some of the more common techniques.
|
Making lists of items plays a central role in working with TiddlyWiki. The following is a brief run-through of some of the more common techniques.
|
||||||
|
|
||||||
~TiddlyWiki [[uses|The Extended Listops Filters]] lists [[internally|ListField]] for many purposes so the word can have several meanings. Here we are concerned with displaying sequences of items, but not necessarily presented as a conventional bullet list.
|
~TiddlyWiki [[uses|Extended Listops Filters]] lists [[internally|ListField]] for many purposes so the word can have several meanings. Here we are concerned with displaying sequences of items, but not necessarily presented as a conventional bullet list.
|
||||||
|
|
||||||
! Manually Typed Lists
|
! Manually Typed Lists
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ Prompted by the [[General Data Protection Regulation (GDPR)|https://en.wikipedia
|
|||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3093]] problem with crash when dragging over TiddlyWiki on some browsers
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3093]] problem with crash when dragging over TiddlyWiki on some browsers
|
||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3079]] issue with new journal button
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3079]] issue with new journal button
|
||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3164]] problem with ''filter'' and ''value'' attributes of SetWidget
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3164]] problem with ''filter'' and ''value'' attributes of SetWidget
|
||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3190]] problem with numeric operands in the [[The Extended Listops Filters]]
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3190]] problem with numeric operands in the [[Extended Listops Filters]]
|
||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/df1f7e9798b5f6c3d2c3fd82e438cbc9713ade04]] problem with "put" saver and 412 return codes
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/commit/df1f7e9798b5f6c3d2c3fd82e438cbc9713ade04]] problem with "put" saver and 412 return codes
|
||||||
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3048]] problem with variable references in field values in the edit template
|
* [[Fixed|https://github.com/Jermolene/TiddlyWiki5/pull/3048]] problem with variable references in field values in the edit template
|
||||||
* [[Extended|https://github.com/Jermolene/TiddlyWiki5/pull/3219]] behaviour of list-after field so that the tiddler is placed at the end of the list if the list-after field is present but empty
|
* [[Extended|https://github.com/Jermolene/TiddlyWiki5/pull/3219]] behaviour of list-after field so that the tiddler is placed at the end of the list if the list-after field is present but empty
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
caption: tw5-server
|
||||||
|
color: #70c9a0
|
||||||
|
community-author: hffqyd
|
||||||
|
created: 20230302011710789
|
||||||
|
delivery: Server-side Script
|
||||||
|
description: Web server for saving and uploading
|
||||||
|
method: save
|
||||||
|
modified: 20230302055929311
|
||||||
|
tags: Android Chrome Firefox [[Internet Explorer]] Linux Mac Opera Safari Saving Windows iOS Edge
|
||||||
|
title: Saving via a Minimal Web Server
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
A local server for TiddlyWiki5 that saves and backups wikis, inspired by
|
||||||
|
[[tw5-server.rb | https://gist.github.com/jimfoltz/ee791c1bdd30ce137bc23cce826096da]].
|
||||||
|
|
||||||
|
tw5-server provides features of:
|
||||||
|
|
||||||
|
* Server for TiddlyWiki5, as well as other files (e.g. images used in TW5 `[img[images/*.png]]`);
|
||||||
|
* Easy to save wiki via browsers;
|
||||||
|
* Backup wiki in compress format (.gz), to save disk space;
|
||||||
|
* Auto clean backups: keep one newest per previous month, keep all backups in current month.
|
||||||
|
* Upload files/images to server, for use in tiddlywiki as external links.
|
||||||
|
* Offer binary executable for Linux, macos and windows.
|
||||||
|
|
||||||
|
Download executable script and binary at the github.com [[tw5-server|https://github.com/hffqyd/tw5-server]].
|
||||||
|
|
||||||
|
! Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# python script:
|
||||||
|
python tw5-server.py -p 8000 -d ./ -b backup_dir
|
||||||
|
|
||||||
|
# binary file:
|
||||||
|
tw5server -a:192.168.0.10 -p:8000 -d:./ -b:backup
|
||||||
|
|
||||||
|
-h usage help
|
||||||
|
-a address, defautl localhost
|
||||||
|
-p port, default 8000
|
||||||
|
-d directory to servering, default `current dir`
|
||||||
|
-b backup directory name, default `backup`
|
||||||
|
-l log saving messages to stdout
|
||||||
|
|
||||||
|
Backups auto-clean strategy:
|
||||||
|
Keep all backups in current month, keep only the newest one for previous months.
|
||||||
|
```
|
||||||
|
|
||||||
|
In Unix/Linux, just excute `./tw5-server.py` (with `chmod +x tw5-server.py`).
|
||||||
|
|
||||||
|
Then go to http://localhost:8000 (or other address:port specified in command) in your web browser, and click on your wiki html file.
|
@ -325,3 +325,22 @@ type: text/vnd.tiddlywiki
|
|||||||
.tc-btn-download:active {
|
.tc-btn-download:active {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* WikiText rules */
|
||||||
|
|
||||||
|
.multi-columns,
|
||||||
|
.fourcolumns {
|
||||||
|
display: block;
|
||||||
|
column-count: 4;
|
||||||
|
column-gap: 1em;
|
||||||
|
-moz-column-count: 4;
|
||||||
|
-moz-column-gap: 1em;
|
||||||
|
-webkit-column-count: 4;
|
||||||
|
-webkit-column-gap: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {
|
||||||
|
.multi-columns {
|
||||||
|
column-count: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,25 +1,11 @@
|
|||||||
caption: action-listops
|
caption: action-listops
|
||||||
created: 20141025120850184
|
created: 20141025120850184
|
||||||
list: efg hlm pqr
|
modified: 20230301183438774
|
||||||
modified: 20211115091121133
|
|
||||||
myfield:
|
myfield:
|
||||||
revision: 0
|
|
||||||
tags: ActionWidgets Widgets
|
tags: ActionWidgets Widgets
|
||||||
title: ActionListopsWidget
|
title: ActionListopsWidget
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
\define .operator-rows(filter)
|
|
||||||
<$list filter="$filter$"><tr>
|
|
||||||
<td><$link>{{!!caption}}</$link></td>
|
|
||||||
<td>{{!!op-purpose}} <$list filter="[all[current]tag[Common Operators]]">{{$:/core/images/done-button}}</$list></td>
|
|
||||||
<td align="center"><$list filter="[all[current]tag[Negatable Operators]]">`!`</$list></td>
|
|
||||||
</tr></$list>
|
|
||||||
\end
|
|
||||||
|
|
||||||
\define .group-heading(_)
|
|
||||||
<tr class="doc-table-subheading"><th colspan="3" align="center">$_$</th></tr>
|
|
||||||
\end
|
|
||||||
|
|
||||||
! Introduction
|
! Introduction
|
||||||
|
|
||||||
The ''action-listops'' widget is an [[action widget|ActionWidgets]] that manipulates user lists in any field or data index. ActionWidgets are used within triggering widgets such as the ButtonWidget.
|
The ''action-listops'' widget is an [[action widget|ActionWidgets]] that manipulates user lists in any field or data index. ActionWidgets are used within triggering widgets such as the ButtonWidget.
|
||||||
@ -34,9 +20,9 @@ The ''action-listops'' widget is invisible. Any content within it is ignored.
|
|||||||
|$index |Optional index of a property in a [[data tiddler|DataTiddlers]] index to be manipulated as a list |
|
|$index |Optional index of a property in a [[data tiddler|DataTiddlers]] index to be manipulated as a list |
|
||||||
|$filter |An optional filter expression, the output of which will be saved to the field/index being manipulated |
|
|$filter |An optional filter expression, the output of which will be saved to the field/index being manipulated |
|
||||||
|$subfilter |An optional subfilter expression, which takes the list being manipulated as input, and saves the modified list back to the field/index being manipulated |
|
|$subfilter |An optional subfilter expression, which takes the list being manipulated as input, and saves the modified list back to the field/index being manipulated |
|
||||||
|$tags |An optional subfilter expression, which takes the 'tags' field of the target tiddler as input, and saves the modified list of tags back to the 'tags' field |
|
|$tags |An optional subfilter expression, which takes the <<.field tags>> field of the target tiddler as input, and saves the modified list of tags back to the <<.field tags>> field |
|
||||||
|
|
||||||
! $filter vs. $subfilter
|
!! Using $filter or $subfilter
|
||||||
|
|
||||||
Standalone use of the `$subfilter` attribute can be replaced by using a (more complicated) `$filter` attribute value.
|
Standalone use of the `$subfilter` attribute can be replaced by using a (more complicated) `$filter` attribute value.
|
||||||
|
|
||||||
@ -49,12 +35,12 @@ For example, the items "abc" and "123" can be appended to the field `myfield` us
|
|||||||
The same can be achieved using the `$filter` attribute and prepending the [[Filter Run]] `[all[current]get[myfield]enlist-input[]]` to the [[Filter Expression]]:
|
The same can be achieved using the `$filter` attribute and prepending the [[Filter Run]] `[all[current]get[myfield]enlist-input[]]` to the [[Filter Expression]]:
|
||||||
|
|
||||||
```
|
```
|
||||||
<$action-listops $field="myfield" $filter="[all[current]get[myfield]enlist-input[]] abc 123"/>
|
<$action-listops $field="myfield" $filter="[enlist{!!myfield}] abc 123"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
The short form is more convenient, but the long form is useful for live-debugging complicated `$subfilter` values using the filter tab of [[$:/AdvancedSearch]]. By using [[$:/AdvancedSearch]], the [[Filter Expression]] can be tested before using ''action-listops'' to modify actual tiddler fields. For this use case, the `all[current]` portion of the expression needs to be changed to select the proper test tiddler.
|
The short form is more convenient, but the long form is useful for live-debugging complicated `$subfilter` values using the filter tab of [[$:/AdvancedSearch]]. By using [[$:/AdvancedSearch]], the [[Filter Expression]] can be tested before using ''action-listops'' to modify actual tiddler fields. For this use case, the `all[current]` portion of the expression needs to be changed to select the proper test tiddler.
|
||||||
|
|
||||||
! $tags vs. $field + $subfilter
|
!! Using $tags or $subfilter
|
||||||
|
|
||||||
[[Tagging]] is implemented using a tiddler's 'tags' field, so appending the tags "abc" and "123" using the `$tags` attribute like this:
|
[[Tagging]] is implemented using a tiddler's 'tags' field, so appending the tags "abc" and "123" using the `$tags` attribute like this:
|
||||||
|
|
||||||
@ -68,110 +54,53 @@ is mostly equivalent to using `$subfilter` along with "tags" for the value of `$
|
|||||||
<$action-listops $field="tags" $subfilter="abc 123"/>
|
<$action-listops $field="tags" $subfilter="abc 123"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
! $action-listops widget vs. $action-setfield widget
|
!! Comparison to [[ActionSetFieldWidget]]
|
||||||
|
|
||||||
The ActionSetFieldWidget replaces a field's value using `$field`/`$value` attributes. A single ActionSetFieldWidget can be used to set any number of fields by using attributes not starting with $.
|
In general, ActionSetFieldWidget is better for setting multiple fields at once and for replacing the value of a field, which can also be a list. The ActionListopsWidget is better for modifying a list field based on the existing list and for using a [[Filter Expression]] to derive the value of the field.
|
||||||
|
|
||||||
The ActionListopsWidget replaces or modifies a single field's value. The new value is generated using filters.
|
The ~ActionSetFieldWidget sets the value of a field using `$field` and `$value` attribute pairs or attributes that do not start with a `$`. A single ~ActionSetFieldWidget can be used to set any number of fields of a single tiddler.
|
||||||
|
|
||||||
The following two examples are functionally equivalent:
|
The ~ActionListopsWidget replaces or modifies a single field's value using filter expressions.
|
||||||
|
|
||||||
|
The following widgets are functionally equivalent:
|
||||||
|
|
||||||
```
|
```
|
||||||
<$action-setfield $field="myfield" $value="abc 123"/>
|
<$action-setfield $field="myfield" $value="abc 123"/>
|
||||||
```
|
<$action-setfield myfield="abc 123"/>
|
||||||
|
|
||||||
```
|
|
||||||
<$action-listops $field="myfield" $filter="abc 123"/>
|
<$action-listops $field="myfield" $filter="abc 123"/>
|
||||||
```
|
```
|
||||||
|
Note that <<.value "abc 123">> in the first two cases is a literal string that is assigned to the field <<.field myfield>>, but in the third case a filter expression which evaluates to the same string.
|
||||||
|
|
||||||
In general, ActionSetFieldWidget is better for setting multiple fields at once and for replacing a field's value. The ActionListopsWidget is better for modifying a field based on the field's existing value and for using a [[Filter Expression]] to derive the value.
|
!! Extended Filter Operators
|
||||||
|
|
||||||
! Extended Filter Operators
|
A number of [[Extended Listops Filters]] are necessary for the manipulation of lists. These operators have been designed primarily for use in subfilter expressions whereby the modified current list is returned in place of the current list.
|
||||||
|
|
||||||
A number of [[extended filter operators|The Extended Listops Filters]] are necessary for the manipulation of lists. These operators have been designed primarily for use in subfilter expressions whereby the modified current list is returned in place of the current list.
|
!! Notes on de-duplication
|
||||||
|
|
||||||
<table>
|
In some cases, there may occur unexpected de-duplication of lists.
|
||||||
<<.group-heading "Listops Operators">>
|
|
||||||
<tr>
|
|
||||||
<th align="left">Operator</th>
|
|
||||||
<th align="left">Purpose</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
<<.operator-rows "[tag[Filter Operators]tag[Listops Operators]tag[Order Operators]!tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
! Examples
|
!!! Assignments to the <<.field list>> field
|
||||||
|
|
||||||
In this example we shall populate and then clear a list in an ordinary field (myfield) of this tiddler (the default.)
|
When assigning filter results to the <<.field list>> field (default), the generated list is automatically de-duplicated, so
|
||||||
|
|
||||||
|
```
|
||||||
|
<$action-listops $filter="[[1]] :and[[1]]"/>
|
||||||
|
```
|
||||||
|
will result in the <<.field list>> field of the current tiddler containing the string <<.value 1>>, but not <<.value "1 1">>.
|
||||||
|
|
||||||
|
!!! Input to the subfilter expression
|
||||||
|
|
||||||
|
The input to the subfilter expression in the `$subfilter` attribute is also de-duplicated. If you rely on lists containing duplicates, consider using this alternative using the `$filter` attribute:
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
src="""<$button>
|
src="""<$button>
|
||||||
<$action-listops $field="myfield" $subfilter="efg hlm pqr"/>
|
<$action-listops $field="myfield" $filter="[enlist:raw{!!myfield}] :all[[abc]]" />
|
||||||
Populate 'myfield'
|
Add 'abc' to 'myfield'
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $field="myfield" $subfilter="abc xyz"/>
|
|
||||||
Append More Items
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $field="myfield" $subfilter="-abc -hlm"/>
|
|
||||||
Remove Items
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $field="myfield" $filter="[[]]"/>
|
|
||||||
Clear 'myfield'
|
|
||||||
</$button>
|
</$button>
|
||||||
|
|
||||||
<$list filter="[list[!!myfield]]">
|
<$list filter="[enlist:raw{!!myfield}]" template="$:/core/ui/ListItemTemplate" />
|
||||||
|
"""/>
|
||||||
|
The [[enlist Operator]] with `raw` suffix will enlist the list saved in <<.field myfield>> of the current tiddler without de-duplication, while e.g. the [[list Operator]] will always de-duplicate. The widget then adds the item <<.value abc>> -- whether or not it is already included in the list -- and replaces the original list in <<.field myfield>>.
|
||||||
|
|
||||||
</$list>"""/>
|
|
||||||
|
|
||||||
---
|
! [[Examples|ActionListopsWidget (Examples)]]
|
||||||
In this example we shall append and remove items from a list in an ordinary field (myfield) of this tiddler (the default) and sort the resultant list. We shall then remove some of the appended items and sort the resulting list in reverse order.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $field="myfield" $subfilter="-efg ijk xyz [[this is a title]] +[sort[]]"/>
|
|
||||||
Mangle List
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $field="myfield" $subfilter="-xyz -[[this is a title]] +[!sort[]]"/>
|
|
||||||
Unmangle List
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
<$list filter="[list[!!myfield]]">
|
|
||||||
|
|
||||||
</$list>"""/>
|
|
||||||
|
|
||||||
---
|
|
||||||
In this example we shall append a few tags to the 'tags' field of this tiddler (the default.) We shall then remove some of the appended tags.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $tags="+[append{Days of the Week!!short}] $:/tag1 $:/tag2 $:/tag3"/>
|
|
||||||
Populate 'tags'
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tags="+[!remove:2{!!tags}]"/>
|
|
||||||
Remove Last Two Tags
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tags="+[!prefix[$:/]]"/>
|
|
||||||
Remove System Tags
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tags="-Mon -Tue"/>
|
|
||||||
Remove Mon and Tue
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tags="+[prefix[$:/]] ActionWidgets Widgets"/>
|
|
||||||
Remove User Tags
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tags="+[[]] ActionWidgets Widgets"/>
|
|
||||||
Clear Tags
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
<$list filter="[list[!!tags]]">
|
|
||||||
|
|
||||||
</$list>"""/>
|
|
||||||
|
@ -11,7 +11,7 @@ The browse widget displays an HTML file browser button that allows the user to c
|
|||||||
|
|
||||||
! Content and Attributes
|
! Content and Attributes
|
||||||
|
|
||||||
The content of the `<$browse>` widget is ignored.
|
The content of the <<.wid BrowseWidget>> widget is ignored.
|
||||||
|
|
||||||
|!Attribute |!Description |
|
|!Attribute |!Description |
|
||||||
|multiple |Set to "multiple" to select multiple file upload |
|
|multiple |Set to "multiple" to select multiple file upload |
|
||||||
@ -26,10 +26,10 @@ On iPhone/iPad choosing the multiple option will remove the ability to take phot
|
|||||||
''e.g.''
|
''e.g.''
|
||||||
|
|
||||||
```
|
```
|
||||||
<$browse>
|
<$browse/>
|
||||||
```
|
```
|
||||||
|
|
||||||
renders as:
|
renders as:
|
||||||
|
|
||||||
<$browse>
|
<$browse/>
|
||||||
|
|
||||||
|
138
editions/tw5.com/tiddlers/widgets/Extended Listops Filters.tid
Normal file
138
editions/tw5.com/tiddlers/widgets/Extended Listops Filters.tid
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
created: 20151014170727812
|
||||||
|
days: Fri Wed Mon Tue
|
||||||
|
dofwks: Mon Tue Wed Thu Fri Sat Sun
|
||||||
|
item1: six
|
||||||
|
item2: seven
|
||||||
|
item3: eight
|
||||||
|
list: Yesterday Today Tomorrow
|
||||||
|
marker: Thursday
|
||||||
|
modified: 20230227175501965
|
||||||
|
myfield: Monday Tuesday [[Middle of the Week]] Thursday Friday Saturday Sunday
|
||||||
|
numbers: 1 2 3 4 five 6 7 8 9
|
||||||
|
tags: Filters
|
||||||
|
title: Extended Listops Filters
|
||||||
|
|
||||||
|
\define .operator-rows(filter)
|
||||||
|
<$list filter="$filter$"><tr>
|
||||||
|
<td><$link>{{!!caption}}</$link></td>
|
||||||
|
<td>{{!!op-purpose}}</td>
|
||||||
|
<td align="center"><$list filter="[all[current]tag[Common Operators]]">✓</$list></td>
|
||||||
|
<td align="center"><$list filter="[all[current]tag[Negatable Operators]]">`!`</$list></td>
|
||||||
|
</tr></$list>
|
||||||
|
\end
|
||||||
|
|
||||||
|
\define .group-heading(_)
|
||||||
|
<tr class="doc-table-subheading"><th colspan="4" align="center">$_$</th></tr>
|
||||||
|
\end
|
||||||
|
|
||||||
|
! Introduction
|
||||||
|
|
||||||
|
A number of filters are used to manipulate lists.
|
||||||
|
|
||||||
|
Some filters are designed to move items from the tail of the list and insert them at specified locations in the list, e.g. [[putafter|putafter Operator]] or [[putbefore|putbefore Operator]]. Items are often appended to the list before using these filters. In general, these filters accept a suffix specifying the number of items to move (default to 1.)
|
||||||
|
|
||||||
|
Some filters are designed to either add or remove from the list, a selected range of items from an array, e.g. [[append|append Operator]] or [[remove|remove Operator]]. These filters are best used with a reference to an array, stored in a field or data index elsewhere in the wiki (they may be used with a simple list of items, provided the items do not include white space.) In general, these filters accept a suffix specifying the number of items to move (default to All.)
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<<.group-heading "Listops Operators">>
|
||||||
|
<tr>
|
||||||
|
<th align="left">Operator</th>
|
||||||
|
<th align="left">Purpose</th>
|
||||||
|
<th>✓</th>
|
||||||
|
<th>`!`</th>
|
||||||
|
</tr>
|
||||||
|
<<.operator-rows "[tag[Filter Operators]tag[Listops Operators]tag[Order Operators]!tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
! Examples
|
||||||
|
|
||||||
|
In this example we shall populate the '~DataIndex' index of the tiddler '~MyData' with the names of the days of the week, then clear this list.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[list[Days of the Week]]"/>
|
||||||
|
Get days-of-the-week
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[[]]"/>
|
||||||
|
Clear
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
{{ListopsData}}"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to insert items before and after a marker item (Wednesday) that are first appended to the list.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="one two +[putbefore:2[Wednesday]]"/>
|
||||||
|
Put 2 Items Before Wednesday
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="four five +[putafter:2[Wednesday]] three +[putbefore[Wednesday]]"/>
|
||||||
|
Put One Item Before & Two Items After Wednesday
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
{{ListopsData}}"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to replace the marker item (Wednesday) with items which are first appended to the list. We shall then move 3 items to the head of the list which have first been appended to the list from referenced fields.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="[[---o]] [[o---]] +[replace:2{!!marker}]"/>
|
||||||
|
Replace '!!marker' with 2 Items
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="[{!!item1}] [{!!item2}] [{!!item3}] +[putfirst:3[]]"/>
|
||||||
|
Put 3 Items First
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
{{ListopsData}}"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to append to the truncated list, items from a referenced field. We shall then remove the first two of the items added.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""|list: |<$view field="list"/> |
|
||||||
|
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[allbefore:include[Wednesday]] +[prepend{!!list}]"/>
|
||||||
|
Prepend '!!list' to items before 'Wednesday'
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[remove:2{!!list}]"/>
|
||||||
|
Remove first two items in '!!list' from current list
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[!remove:1{!!list}]"/>
|
||||||
|
Remove last item in '!!list' from current list
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
{{ListopsData}}"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall populate the list with numbers, then move items one by one from the head to the tail and from the tail to the head (best seen by clicking the lower buttons several times.)
|
||||||
|
|
||||||
|
This example illustrates that the append[] and prepend[] operators do not enforce unique instances of an item and that, with the next run, any duplicates are removed.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[[]]" $subfilter="+[append:3{!!numbers}]"/>
|
||||||
|
Setup some numbers
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[!append:6{!!numbers}]"/>
|
||||||
|
Append more numbers
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[putfirst:2[]]"/>
|
||||||
|
Move last 2 items to the head
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[putlast[]]"/>
|
||||||
|
Move the head to the last item
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
{{ListopsData}}"""/>
|
@ -1,114 +1,5 @@
|
|||||||
created: 20151014170727812
|
created: 20230301172832597
|
||||||
days: Fri Wed Mon Tue
|
modified: 20230301172832597
|
||||||
dofwks: Mon Tue Wed Thu Fri Sat Sun
|
|
||||||
item1: six
|
|
||||||
item2: seven
|
|
||||||
item3: eight
|
|
||||||
list: Yesterday Today Tomorrow
|
|
||||||
marker: Thursday
|
|
||||||
modified: 20211114011103356
|
|
||||||
myfield: Monday Tuesday [[Middle of the Week]] Thursday Friday Saturday Sunday
|
|
||||||
numbers: 1 2 3 4 five 6 7 8 9
|
|
||||||
tags: Filters
|
|
||||||
title: The Extended Listops Filters
|
title: The Extended Listops Filters
|
||||||
|
|
||||||
! Introduction
|
See [[Extended Listops Filters]]
|
||||||
|
|
||||||
A number of extended filters are necessary to manipulate lists.
|
|
||||||
|
|
||||||
The first set of filters are designed to move items from the tail of the list and insert them at specified locations in the list. Items are often appended to the list before using these filters. In general, these filters accept a suffix specifying the number of items to move (default to 1.)
|
|
||||||
|
|
||||||
A second set of filters are designed to either add or remove from the list, a selected range of items from an array. These filters are best used with a reference to an array, stored in a field or data index elsewhere in the wiki (they may be used with a simple list of items, provided the items do not include white space.) In general, these filters accept a suffix specifying the number of items to move (default to All.)
|
|
||||||
|
|
||||||
! Examples
|
|
||||||
|
|
||||||
In this example we shall populate the '~DataIndex' index of the tiddler '~MyData' with the names of the days of the week, then clear this list.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[list[Days of the Week]]"/>
|
|
||||||
Get days-of-the-week
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[[]]"/>
|
|
||||||
Clear
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
{{ListopsData}}"""/>
|
|
||||||
|
|
||||||
---
|
|
||||||
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to insert items before and after a marker item (Wednesday) that are first appended to the list.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="one two +[putbefore:2[Wednesday]]"/>
|
|
||||||
Put 2 Items Before Wednesday
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="four five +[putafter:2[Wednesday]] three +[putbefore[Wednesday]]"/>
|
|
||||||
Put One Item Before & Two Items After Wednesday
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
{{ListopsData}}"""/>
|
|
||||||
|
|
||||||
---
|
|
||||||
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to replace the marker item (Wednesday) with items which are first appended to the list. We shall then move 3 items to the head of the list which have first been appended to the list from referenced fields.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="[[---o]] [[o---]] +[replace:2{!!marker}]"/>
|
|
||||||
Replace '!!marker' with 2 Items
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="[{!!item1}] [{!!item2}] [{!!item3}] +[putfirst:3[]]"/>
|
|
||||||
Put 3 Items First
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
{{ListopsData}}"""/>
|
|
||||||
|
|
||||||
---
|
|
||||||
In this example we shall slice the populated list from the 'DaysOfTheWeek' index of the tiddler '~MyData' in order to append to the truncated list, items from a referenced field. We shall then remove the first two of the items added.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""|list: |<$view field="list"/> |
|
|
||||||
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[allbefore:include[Wednesday]] +[prepend{!!list}]"/>
|
|
||||||
Prepend '!!list' to items before 'Wednesday'
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[remove:2{!!list}]"/>
|
|
||||||
Remove first two items in '!!list' from current list
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[!remove:1{!!list}]"/>
|
|
||||||
Remove last item in '!!list' from current list
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
{{ListopsData}}"""/>
|
|
||||||
|
|
||||||
---
|
|
||||||
In this example we shall populate the list with numbers, then move items one by one from the head to the tail and from the tail to the head (best seen by clicking the lower buttons several times.)
|
|
||||||
|
|
||||||
This example illustrates that the append[] and prepend[] operators do not enforce unique instances of an item and that, with the next run, any duplicates are removed.
|
|
||||||
|
|
||||||
<$macrocall $name='wikitext-example-without-html'
|
|
||||||
src="""<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $filter="[[]]" $subfilter="+[append:3{!!numbers}]"/>
|
|
||||||
Setup some numbers
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[!append:6{!!numbers}]"/>
|
|
||||||
Append more numbers
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[putfirst:2[]]"/>
|
|
||||||
Move last 2 items to the head
|
|
||||||
</$button>
|
|
||||||
<$button>
|
|
||||||
<$action-listops $tiddler="ListopsData" $index="DataIndex" $subfilter="+[putlast[]]"/>
|
|
||||||
Move the head to the last item
|
|
||||||
</$button>
|
|
||||||
|
|
||||||
{{ListopsData}}"""/>
|
|
@ -0,0 +1,81 @@
|
|||||||
|
created: 20230301174431218
|
||||||
|
list: efg hlm pqr
|
||||||
|
modified: 20230301174431218
|
||||||
|
myfield:
|
||||||
|
revision: 0
|
||||||
|
title: ActionListopsWidget (Examples)
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
In this example we shall populate and then clear a list in an ordinary field (myfield) of this tiddler (the default).
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $field="myfield" $filter="efg hlm pqr"/>
|
||||||
|
Populate 'myfield'
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $field="myfield" $subfilter="abc xyz"/>
|
||||||
|
Append More Items
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $field="myfield" $subfilter="-abc -hlm"/>
|
||||||
|
Remove Items
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $field="myfield" $filter="[[]]"/>
|
||||||
|
Clear 'myfield'
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$list filter="[list[!!myfield]]">
|
||||||
|
|
||||||
|
</$list>"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall append and remove items from a list in an ordinary field (myfield) of this tiddler (the default) and sort the resultant list. We shall then remove some of the appended items and sort the resulting list in reverse order.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $field="myfield" $subfilter="-efg ijk xyz [[this is a title]] +[sort[]]"/>
|
||||||
|
Mangle List
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $field="myfield" $subfilter="-xyz -[[this is a title]] +[!sort[]]"/>
|
||||||
|
Unmangle List
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$list filter="[list[!!myfield]]">
|
||||||
|
|
||||||
|
</$list>"""/>
|
||||||
|
|
||||||
|
---
|
||||||
|
In this example we shall append a few tags to the 'tags' field of this tiddler (the default). We shall then remove some of the appended tags.
|
||||||
|
|
||||||
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
|
src="""<$button>
|
||||||
|
<$action-listops $tags="+[append{Days of the Week!!short}] $:/tag1 $:/tag2 $:/tag3"/>
|
||||||
|
Populate 'tags'
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tags="+[!remove:2{!!tags}]"/>
|
||||||
|
Remove Last Two Tags
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tags="+[!prefix[$:/]]"/>
|
||||||
|
Remove System Tags
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tags="-Mon -Tue"/>
|
||||||
|
Remove Mon and Tue
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tags="+[prefix[$:/]] ActionWidgets Widgets"/>
|
||||||
|
Remove User Tags
|
||||||
|
</$button>
|
||||||
|
<$button>
|
||||||
|
<$action-listops $tags="+[[]] ActionWidgets Widgets"/>
|
||||||
|
Clear Tags
|
||||||
|
</$button>
|
||||||
|
|
||||||
|
<$list filter="[list[!!tags]]">
|
||||||
|
|
||||||
|
</$list>"""/>
|
@ -1,19 +1,60 @@
|
|||||||
caption: Formatting
|
caption: Formatting
|
||||||
created: 20131205155959399
|
created: 20131205155959399
|
||||||
modified: 20220513120211686
|
modified: 20230303215447403
|
||||||
tags: WikiText
|
tags: WikiText
|
||||||
title: Formatting in WikiText
|
title: Formatting in WikiText
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
Available character formatting includes:
|
!! Overview
|
||||||
|
|
||||||
* <code>`backticks`</code> for `code` (<<.icon $:/core/images/mono-line>>)
|
Available character formatting in WikiText includes:
|
||||||
** Alternatively, <code>``double backticks allows `embedded` backticks``</code><br><br>
|
|
||||||
* `''bold''` for ''bold text'' (<<.icon $:/core/images/bold>>)<br><br>
|
|
||||||
* `//italic//` for //italic text// (<<.icon $:/core/images/italic>>)<br><br>
|
|
||||||
* `__underscore__` for __underscored text__ (<<.icon $:/core/images/underline>>)<br><br>
|
|
||||||
* `^^superscript^^` for ^^superscripted^^ text (<<.icon $:/core/images/superscript>>)<br><br>
|
|
||||||
* `,,subscript,,` for ,,subscripted,, text (<<.icon $:/core/images/subscript>>)<br><br>
|
|
||||||
* `~~strikethrough~~` for ~~strikethrough~~ text (<<.icon $:/core/images/strikethrough>>)
|
|
||||||
|
|
||||||
See also: [[Code Blocks in WikiText]]
|
|Wikitext | Button | Shortcut |Rendered Output |h
|
||||||
|
|Double single quotes are used for `''bold text''`| <kbd><<.icon $:/core/images/bold>></kbd> | <kbd><<displayshortcuts "((bold))">></kbd> |Double single quotes are used for ''bold text'' |
|
||||||
|
|Double slashes are used for `//italic text//`| <kbd><<.icon $:/core/images/italic>></kbd> | <kbd><<displayshortcuts "((italic))">></kbd> |Double slashes are used for //italic text//|
|
||||||
|
|Double underscores are used for `__underlined text__`| <kbd><<.icon $:/core/images/underline>></kbd> | <kbd><<displayshortcuts "((underline))">></kbd> |Double underscores are used for __underlined text__ |
|
||||||
|
|Double circumflex accents are used for `^^superscripted^^` text | <kbd><<.icon $:/core/images/superscript>></kbd> | <kbd><<displayshortcuts "((superscript))">></kbd> |Double circumflex accents are used for ^^superscripted^^ text |
|
||||||
|
|Double commas are used for `,,subscripted,,` text | <kbd><<.icon $:/core/images/subscript>></kbd> | <kbd><<displayshortcuts "((subscript))">></kbd> |Double commas are used for ,,subscripted,, text |
|
||||||
|
|Double tilde signs are used for `~~strikethrough~~` text | <kbd><<.icon $:/core/images/strikethrough>></kbd> | <kbd><<displayshortcuts "((strikethrough))">></kbd> |Double tilde signs are used for ~~strikethrough~~ text |
|
||||||
|
|Single backticks are used for ```code` `` | <kbd><<.icon $:/core/images/mono-line>></kbd> | <kbd><<displayshortcuts "((mono-line))">></kbd> |Single backticks are used for `code` |
|
||||||
|
|Double @ characters are used to create a `@@highlight@@` | - | - |Double @ characters are used to create a @@highlight@@ |
|
||||||
|
|
||||||
|
See [[Styles and Classes in WikiText]] for more formatting options
|
||||||
|
|
||||||
|
!! Embedded Backticks
|
||||||
|
|
||||||
|
|Wikitext |Rendered Output|h
|
||||||
|
|<code>``double backticks allows `embedded` backticks``</code>|``double backticks allows `embedded` backticks``|
|
||||||
|
|
||||||
|
!! Keyboard Shortcuts
|
||||||
|
|
||||||
|
The full list of KeyboardShortcuts can be found in the $:/ControlPanel -> ''Keyboard Shortcuts'' tab.
|
||||||
|
|
||||||
|
!! Semantic Information
|
||||||
|
|
||||||
|
|Wikitext | Resulting HTML Code |h
|
||||||
|
|Double single quotes are used for `''bold text''`|Double single quotes are used for `<strong>bold text</strong>` |
|
||||||
|
|Double slashes are used for `//italic text//`|Double slashes are used for `<em>italic text</em>` |
|
||||||
|
|Double underscores are used for `__underlined text__`|Double underscores are used for `<u>underlined text<u>` |
|
||||||
|
|Double circumflex accents are used for `^^superscripted^^` text |Double circumflex accents are used for `<sup>superscripted</sup>` text |
|
||||||
|
|Double commas are used for `,,subscripted,,` text |Double commas are used for `<sub>subscripted</sub>` text |
|
||||||
|
|Double tilde signs are used for `~~strikethrough~~` text |Double tilde signs are used for `<strike>strikethrough</strike>` text |
|
||||||
|
|Single backticks are used for ```code` `` |Single backticks are used for `<code>code</code>` |
|
||||||
|
|Double @ characters are used to create a `@@highlight@@` |Double @ characters are used to create a `<span class="tc-inline-style">highlighted</span>` |
|
||||||
|
|
||||||
|
!! Bold vs Strong
|
||||||
|
|
||||||
|
In TW we use the term "bold" instead of "strong" because most users are used to it. ... The rendering process converts our "bold text" into the STRONG HTML element.
|
||||||
|
|
||||||
|
>The `<strong>` element is for content that is of greater importance, while the `<b>` element is used to draw attention to text without indicating that it's more important.
|
||||||
|
>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong#b_vs._strong
|
||||||
|
|
||||||
|
!! Underline vs. Underscore
|
||||||
|
|
||||||
|
>Use underline to describe text formatting that puts a line under the characters. Use underscore to refer to the underscore character ( _ ).
|
||||||
|
>https://learn.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/u/underline-vs-underscore
|
||||||
|
|
||||||
|
!! Emphasis vs Italics
|
||||||
|
|
||||||
|
>The `<em>` element represents stress emphasis of its contents, while the `<i>` element represents text that is set off from the normal prose, such as a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning. (The title of a work, such as the name of a book or movie, should use `<cite>`.)
|
||||||
|
>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em#i_vs._em
|
||||||
|
66
editions/tw5.com/tiddlers/wikitext/HTML Entities.tid
Normal file
66
editions/tw5.com/tiddlers/wikitext/HTML Entities.tid
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
created: 20130204165019000
|
||||||
|
modified: 20221025124615415
|
||||||
|
tags: WikiText
|
||||||
|
title: HTML Entities
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
!! Summary
|
||||||
|
|
||||||
|
Use HTML entities to enter characters that cannot easily be typed on an ordinary keyboard. They take the form of an ampersand (`&`), an identifying string, and a terminating semi-colon (`;`), e.g. `&` for the ''&'' character.
|
||||||
|
|
||||||
|
!! Markup
|
||||||
|
|
||||||
|
```
|
||||||
|
The value of Tiddlers™ cannot even be expressed in £, € or $.
|
||||||
|
```
|
||||||
|
|
||||||
|
''Displays as:''
|
||||||
|
|
||||||
|
The value of Tiddlers™ cannot even be expressed in £, € or $.
|
||||||
|
|
||||||
|
!! Entity References
|
||||||
|
|
||||||
|
Comprehensive lists of html entities can be found at...
|
||||||
|
|
||||||
|
* [[Mozilla Developer Network -- Entities|https://developer.mozilla.org/en-US/docs/Glossary/Entity]]
|
||||||
|
|
||||||
|
* [[HTML Spec official list -- Entities|https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references]]
|
||||||
|
|
||||||
|
|
||||||
|
!! Examples Of Common And Useful Entities
|
||||||
|
|
||||||
|
|>|>|>|>|>|>| ! HTML Entities |
|
||||||
|
| &nbsp; | | no-break space | | &apos; | ' | single quote, apostrophe |
|
||||||
|
| &ndash; | – | en dash |~| &quot; | " | quotation mark |
|
||||||
|
| &mdash; | — | em dash |~| &prime; | ′ | prime; minutes; feet |
|
||||||
|
| &hellip; | … | horizontal ellipsis |~| &Prime; | ″ | double prime; seconds; inches |
|
||||||
|
| &copy; | © | Copyright symbol |~| &lsquo; | ‘ | left single quote |
|
||||||
|
| &reg; | ® | Registered symbol |~| &rsquo; | ’ | right single quote |
|
||||||
|
| &trade; | ™ | Trademark symbol |~| &ldquo; | “ | left double quote |
|
||||||
|
| &dagger; | † | dagger |~| &rdquo; | ” | right double quote |
|
||||||
|
| &Dagger; | ‡ | double dagger |~| &laquo; | « | left angle quote |
|
||||||
|
| &para; | ¶ | paragraph sign |~| &raquo; | » | right angle quote |
|
||||||
|
| &sect; | § | section sign |~| &times; | × | multiplication symbol |
|
||||||
|
| &uarr; | ↑ | up arrow |~| &darr; | ↓ | down arrow |
|
||||||
|
| &larr; | ← | left arrow |~| &rarr; | → | right arrow |
|
||||||
|
| &lArr; | ⇐ | double left arrow |~| &rArr; | ⇒ | double right arrow |
|
||||||
|
| &harr; | ↔ | left right arrow |~| &hArr; | ⇔ | double left right arrow |
|
||||||
|
|
||||||
|
!! Accented Characters
|
||||||
|
|
||||||
|
The table below shows how accented characters can be built up by //substituting// the
|
||||||
|
underscore (_) in the second table into the corresponding character. eg:
|
||||||
|
|
||||||
|
|Code |Character |Example |Result |h
|
||||||
|
|`Ä` |Ä | `Äpfel` |Äpfel |
|
||||||
|
|
||||||
|
|
||||||
|
|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>| ! Accented Characters |
|
||||||
|
| grave accent | &_grave; | À | à | È | è | Ì | ì | Ò | ò | Ù | ù | | | | | | |
|
||||||
|
| acute accent | &_acute; | Á | á | É | é | Í | í | Ó | ó | Ú | ú | | | Ý | ý | | |
|
||||||
|
| circumflex accent | &_circ; | Â | â | Ê | ê | Î | î | Ô | ô | Û | û | | | | | | |
|
||||||
|
| umlaut mark | &_uml; | Ä | ä | Ë | ë | Ï | ï | Ö | ö | Ü | ü | | | Ÿ | ÿ | | |
|
||||||
|
| tilde | &_tilde; | Ã | ã | | | | | Õ | õ | | | Ñ | ñ | | | | |
|
||||||
|
| ring | &_ring; | Å | å | | | | | | | | | | | | | | |
|
||||||
|
| slash | &_slash; | | | | | | | Ø | ø | | | | | | | | |
|
||||||
|
| cedilla | &_cedil; | | | | | | | | | | | | | | | Ç | ç |
|
@ -5,26 +5,36 @@ title: Styles and Classes in WikiText
|
|||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
caption: Styles and Classes
|
caption: Styles and Classes
|
||||||
|
|
||||||
You can use this construction to cause the wrapped content to be assigned specified CSS classes or styles:
|
Content can be wrapped in `@@`double at signs`@@` to apply specified CSS styles or classes to it. There are multiple ways to use this syntax, as presented below.
|
||||||
|
|
||||||
<<wikitext-example src:"@@.myStyle
|
Inline content wrapped in `@@`double at signs`@@` without specifying style or class will be assigned the `.tc-inline-style` and displayed as highlighted text. The foreground and background colours of the highlighted text are defined as `highlight-background` and `highlight-foreground` in the current palette.
|
||||||
* List One
|
|
||||||
* List Two
|
<<wikitext-example src:"@@some highlighted text@@">>
|
||||||
|
|
||||||
|
Style attributes, e.g. `color`, each followed by `;` semicolon can be introduced immediately after the opening `@@`.
|
||||||
|
|
||||||
|
<<wikitext-example src:"@@color:steelblue;background-color:lightcyan;some styled text@@">>
|
||||||
|
|
||||||
|
Similarly a style can be applied to a multiline content:
|
||||||
|
|
||||||
|
<<wikitext-example src:"@@background-color:lightcyan;
|
||||||
|
* Item one
|
||||||
|
* Item two
|
||||||
@@
|
@@
|
||||||
">>
|
">>
|
||||||
|
|
||||||
Similar syntax is used to assign styles. For example:
|
A class may be applied to a multiline content only:
|
||||||
|
|
||||||
<<wikitext-example src:"@@background-color:red;
|
<<wikitext-example src:"@@.tc-double-spaced-list
|
||||||
* List One
|
* Item one
|
||||||
* List Two
|
* Item two
|
||||||
@@
|
@@">>
|
||||||
">>
|
|
||||||
|
Multiple classes and styles can be used together:
|
||||||
Multiple styles and classes can be mixed. For example:
|
|
||||||
|
<<wikitext-example src:"@@.tc-double-spaced-list
|
||||||
<<wikitext-example src:"@@.tc-tiddler-frame
|
@@width:400px;background-color:lightcyan;
|
||||||
@@width:400px;
|
* Item one
|
||||||
Some text
|
* Item two
|
||||||
@@
|
@@
|
||||||
">>
|
">>
|
||||||
|
@ -519,3 +519,9 @@ Scott Sauye, @CrossEye, 2023-01-04
|
|||||||
Marcus Winter, @yaisog, 2023-01-07
|
Marcus Winter, @yaisog, 2023-01-07
|
||||||
|
|
||||||
Ethan Weller, @gamedungeon, 2023-01-17
|
Ethan Weller, @gamedungeon, 2023-01-17
|
||||||
|
|
||||||
|
Mateusz Wilczek, @mateuszwilczek, 2023/02/16
|
||||||
|
|
||||||
|
Andrea Octo, @andrigamerita, 2023/02/24
|
||||||
|
|
||||||
|
HuanC Fu, @hffqyd, 2023/03/03
|
||||||
|
Loading…
x
Reference in New Issue
Block a user