Merge branch 'tiddlywiki-com'

This commit is contained in:
Jeremy Ruston
2026-01-05 16:36:49 +00:00
4 changed files with 95 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
created: 20150117190213631
modified: 20230226144641763
modified: 20251225215015507
tags: Concepts
title: Date Fields
type: text/vnd.tiddlywiki
@@ -28,4 +28,5 @@ As an example, the <<.field created>> field of this tiddler has the value <<.val
Dates can be [[converted to other formats|DateFormat]] for display:
<$macrocall $name="wikitext-example-without-html"
src="""<$view field="created" format="date" template="DDD DDth MMM YYYY"/>""">
src="""<$view field="created" format="date" template="DDD DDth MMM YYYY"/>"""/>

View File

@@ -1,51 +1,77 @@
caption: action-log
created: 20201114113318785
modified: 20201120155202652
modified: 20260105121108063
tags: Widgets ActionWidgets [[Debugging Widgets]]
title: ActionLogWidget
type: text/vnd.tiddlywiki
! Introduction
<<.from-version "5.1.23">> The ''action-log'' widget is an [[action widget|ActionWidgets]] that can be used to output debugging information to the [[JavaScript console|Web Developer Tools]] supported by most browsers. This can be useful because otherwise it is difficult to observe what is going on within a sequence of actions.
<<.from-version "5.1.23">> The <<.wid action-log>> widget is an [[action widget|ActionWidgets]] that can be used to output debugging information to the [[JavaScript console|Web Developer Tools]] supported by most browsers. This can be useful to observe and debug the behavior within a sequence of actions.
When the action is invoked, the names and values of all [[attributes|Widget Attributes]] are logged to the JavaScript console.
```
<$action-log name=value />
```
ActionWidgets are used within triggering widgets such as the ButtonWidget.
<<.tip """ For debugging outside of actions see [[LogWidget]]""">>
<<.note """ For debugging outside of actions see [[LogWidget]]""">>
! Content and Attributes
The ''action-log'' widget is invisible. Any content within it is ignored.
When the actions are invoked, the names and values of all attributes are logged to the JavaScript console.
In addition there are optional attributes that can be used:
|!Optional Attribute |!Description |
|$$filter|All variables matching this filter will also be logged. |
|$$message |A message to display as the title of the information logged. Useful when several `action-log` widgets are used in sequence. |
|$$all |Set to "yes" to log all variables in a collapsed table. Note that if there is nothing specified to log, all variables are always logged instead.|
The <<.wid action-log>> widget is invisible. Any content within it is ignored.
<<.from-version "5.4.0">> Any [[multi-valued variables|Multi-Valued Variables]] or attributes are logged as a list of values.
<<.tip """A handy tip if an action widget is not behaving as expected is to temporarily change it to an `<$action-log>` widget so that the attributes can be observed.""">>
|!Attribute |!Description |
|<<.attr $$filter>>|(Optional) All variables whose name matches the [[Filter Expression]] will be logged |
|<<.attr $$message>> |(Optional) A message to display as the title of the information logged. Useful when several <<.wid action-log>> widgets are used in sequence |
|<<.attr $$all>> |(Optional) Set to <<.value yes>> to log all variables |
! Example
<<.note """ If `<$action-log />` is called without any attributes, all defined variables will be logged as if `$$all=yes` were set.""">>
Here is an example of logging two variables:
<<.note """When logging [[Variable Attribute Values]], the body text of macros and procedures will be output as their value. Functions are evaluated and their first result is logged.""">>
! Examples
!! Basic Example
Log the value of variable <<.var name>>, the first result of the filter expression `[tag[Learning]]` and the value of field <<.field created>> of the current tiddler:
```
<$action-log myVar=<<myVar>> otherVar=<<otherVar>>/>
<$action-log name=<<name>> filter={{{ [tag[Learning]] }}} created={{!!created}} />
```
To log all variables:
!! Example using <<.attr $$filter>> and <<.attr $$message>>
Log all core variables (which start with <<.var tv->>) with a table title:
```
<$action-log />
<$action-log $$message="Core Variables" $$filter="[prefix[tv-]]" />
```
!! Widget Debugging
To log two variables as well as all core variables (which start with `tv-`):
Change a misbehaving <<.wlink ActionSetFieldWidget>> widget to an <<.wid action-log>> widget to verify that <<.var currentTiddler>> and <<.var value>> match their expected values:
<<.tip """If an action widget is not behaving as expected it is often useful to temporarily change it to an <<.wid action-log>> widget so that the passed attributes can be verified.""">>
```
<$action-log myVar=<<myVar>> other={{!!status}} $$filter="[prefix[tv-]]"/>
<$action-log $tiddler=<<currentTiddler>> $field="text" $value=<<value>> />
```
This application is the primary reason that the attributes of the <<.wid action-log>> widget are prefixed with two dollar signs instead of one. Otherwise, the attributes of the original widget could be interpreted as attributes to <<.wid action-log>> and lead to unintended consequences.
!! Example with Function
Log the <<.var tiddlerList>> function definition and its first evaluation result:
```
\function tiddlerList() [tag[Learning]]
<$action-log $$filter="[title[tiddlerList]]" value=<<tiddlerList>> />
```
<<.note """The values output with the <<.attr $$filter>> or <<.attr $$all>> attributes will only contain the definition of functions instead of their values, as the evaluation of many functions can lead to significant performance penalties.""">>

View File

@@ -1,45 +1,71 @@
created: 20201120152706842
modified: 20201120154927696
modified: 20260105121111637
tags: Widgets [[Debugging Widgets]]
title: LogWidget
type: text/vnd.tiddlywiki
! Introduction
<<.from-version "5.1.23">> The ''log'' widget can be used to output debugging information to the [[JavaScript console|Web Developer Tools]] supported by most browsers.
<<.from-version "5.1.23">> The <<.wid log>> widget is a [[widget|Widgets]] that can be used to output debugging information to the [[JavaScript console|Web Developer Tools]] supported by most browsers.
<<.tip """ For use with ActionWidgets see [[ActionLogWidget]] which uses identical parameters""">>
When the widget is rendered or refreshed, the names and values of all [[attributes|Widget Attributes]] are logged to the JavaScript console.
```
<$log name=value />
```
<<.note """ For debugging inside of actions see [[ActionLogWidget]]""">>
! Content and Attributes
The ''log'' widget is invisible. Any content within it is ignored. Note that the widget will log to the console both when it is first rendered and also every time it refreshes.
When the widget is rendered, the names and values of all attributes are logged to the JavaScript console.
In addition there are optional attributes that can be used:
|!Optional Attribute |!Description |
|$$filter|All variables matching this filter will also be logged. |
|$$message |A message to display as the title of the information logged. Useful when several `log` widgets are used in sequence. |
|$$all |Set to "yes" to log all variables in a collapsed table. Note that if there is nothing specified to log, all variables are always logged instead.|
The <<.wid log>> widget is invisible. Any content within it is ignored.
! Example
|!Attribute |!Description |
|<<.attr $$filter>>|(Optional) All variables whose name matches the [[Filter Expression]] will be logged |
|<<.attr $$message>> |(Optional) A message to display as the title of the information logged. Useful when several <<.wid log>> widgets are used in sequence |
|<<.attr $$all>> |(Optional) Set to <<.value yes>> to log all variables |
Here is an example of logging two variables:
<<.note """ If `<$log />` is called without any attributes, all defined variables will be logged as if `$$all=yes` were set.""">>
<<.note """When logging [[Variable Attribute Values]], the body text of macros and procedures will be output as their value. Functions are evaluated and their first result is logged.""">>
! Examples
!! Basic Example
Log the value of variable <<.var name>>, the first result of the filter expression `[tag[Learning]]` and the value of field <<.field created>> of the current tiddler:
```
<$log myVar=<<myVar>> otherVar=<<otherVar>>/>
<$log name=<<name>> filter={{{ [tag[Learning]] }}} created={{!!created}} />
```
To log all variables:
!! Example using <<.attr $$filter>> and <<.attr $$message>>
Log all core variables (which start with <<.var tv->>) with a table title:
```
<$log />
<$log $$message="Core Variables" $$filter="[prefix[tv-]]" />
```
!! Widget Debugging
To log two variables as well as all core variables (which start with `tv-`):
Change a misbehaving <<.wlink TranscludeWidget>> widget to a <<.wid log>> widget to verify that <<.var name>> and <<.var mode>> match their expected values:
<<.tip """If a widget is not behaving as expected it is often useful to temporarily change it to a <<.wid log>> widget so that the passed attributes can be verified.""">>
```
<$log myVar=<<myVar>> other={{!!status}} $$filter="[prefix[tv-]]"/>
<$log $variable=<<name>> $mode=<<mode>> />
```
This application is the primary reason that the attributes of the <<.wid log>> widget are prefixed with two dollar signs instead of one. Otherwise, the attributes of the original widget could be interpreted as attributes to <<.wid log>> and lead to unintended consequences.
!! Example with Function
Log the <<.var tiddlerList>> function definition and its first evaluation result (see browser console after clicking "Try it"):
<<.example n:"2" eg:"""\function tiddlerList() [tag[Learning]]
<$log $$filter="[title[tiddlerList]]" value=<<tiddlerList>> />""" >>
<<.note """The values output with the <<.attr $$filter>> or <<.attr $$all>> attributes will only contain the definition of functions instead of their values, as the evaluation of many functions can lead to significant performance penalties.""">>

View File

@@ -28,4 +28,4 @@ See [[HTML in WikiText]] for more details.
The available widgets include:
<<list-links "[tag[Widgets]]">>
<<list-links "[tag[Widgets]]" class:"multi-columns">>