mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-01 08:16:55 +00:00
Docs updates
This commit is contained in:
parent
1c73460ecc
commit
c25129584c
25
editions/tw5.com/tiddlers/Pragma_ _function.tid
Normal file
25
editions/tw5.com/tiddlers/Pragma_ _function.tid
Normal file
@ -0,0 +1,25 @@
|
||||
created: 20221009162634214
|
||||
modified: 20221009163238956
|
||||
tags: Pragmas
|
||||
title: Pragma: \function
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.0">> The ''\function'' [[pragma|Pragmas]] is used to [[define custom functions|Functions]]. It is a shortcut syntax for the SetVariableWidget.
|
||||
|
||||
The usual form allows custom functions to span multiple lines:
|
||||
|
||||
```
|
||||
\function <function-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...)
|
||||
<multiple-line-definition-text>
|
||||
\end
|
||||
```
|
||||
|
||||
There is also a single line form for shorter functions:
|
||||
|
||||
```
|
||||
\function <function-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...) <single-line-definition-text>
|
||||
```
|
||||
|
||||
The first line of the definition specifies the function name and any parameters. Each parameter has a name and, optionally, a default value that is used if no value is supplied on a particular call to the function. The lines that follow contain the text of the function (i.e. the snippet represented by the function name), until `\end` appears on a line by itself:
|
||||
|
||||
See [[Functions]] for more details.
|
@ -1,5 +1,5 @@
|
||||
created: 20140211171341271
|
||||
modified: 20221007144757675
|
||||
modified: 20221009163114481
|
||||
tags: Concepts Reference
|
||||
title: Macros
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -1,12 +1,12 @@
|
||||
created: 20221009124003601
|
||||
modified: 20221009125246821
|
||||
modified: 20221009163124867
|
||||
tags: Concepts Reference
|
||||
title: Functions
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! Introduction
|
||||
|
||||
A <<.def function>> is a named snippet of text containing a [[Filter Expression]]. Functions can have named parameters which are available within the function as variables.
|
||||
<<.from-version "5.3.0">> A <<.def function>> is a named snippet of text containing a [[Filter Expression]]. Functions can have named parameters which are available within the function as variables.
|
||||
|
||||
Functions are usually defined with the [[Pragma: \function]]:
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
created: 20220917113154900
|
||||
modified: 20221003121441054
|
||||
modified: 20221009163301629
|
||||
tags: Pragmas
|
||||
title: Pragma: \parameters
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\parameters'' [[pragma|Pragmas]] is used within [[procedure|Procedure Definitions]] and [[widget|Widget Definitions]] definitions to declare the parameters that are expected, and their default values. It is a shortcut syntax for the ParametersWidget.
|
||||
<<.from-version "5.3.0">> The ''\parameters'' [[pragma|Pragmas]] is used within [[procedure|Procedure Definitions]] and [[widget|Widget Definitions]] definitions to declare the parameters that are expected, and their default values. It is a shortcut syntax for the ParametersWidget.
|
||||
|
||||
```
|
||||
\parameters (<name>[:<default-value>],<name>[:<default-value>]...)
|
||||
|
@ -1,10 +1,10 @@
|
||||
created: 20221007132845007
|
||||
modified: 20221009122437394
|
||||
modified: 20221009163250309
|
||||
tags: Pragmas
|
||||
title: Pragma: \procedure
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\procedure'' [[pragma|Pragmas]] is used to [[define procedures|Procedure Definitions]]. It is a shortcut syntax for the SetVariableWidget with an implicit ParametersWidget.
|
||||
<<.from-version "5.3.0">> The ''\procedure'' [[pragma|Pragmas]] is used to [[define procedures|Procedure Definitions]]. It is a shortcut syntax for the SetVariableWidget with an implicit ParametersWidget.
|
||||
|
||||
The usual form allows procedures to span multiple lines:
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
created: 20221009121950630
|
||||
modified: 20221009122447180
|
||||
modified: 20221009163229920
|
||||
tags: Pragmas
|
||||
title: Pragma: \widget
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\widget'' [[pragma|Pragmas]] is used to [[define custom widgets|Custom Widgets]]. It is a shortcut syntax for the SetVariableWidget with an implicit ParametersWidget.
|
||||
<<.from-version "5.3.0">> The ''\widget'' [[pragma|Pragmas]] is used to [[define custom widgets|Custom Widgets]]. It is a shortcut syntax for the SetVariableWidget with an implicit ParametersWidget.
|
||||
|
||||
The usual form allows custom widgets to span multiple lines:
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
created: 20221007124007426
|
||||
modified: 20221007144806995
|
||||
modified: 20221009163145607
|
||||
tags: Concepts Reference
|
||||
title: Procedures
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! Introduction
|
||||
|
||||
A <<.def procedure>> is a named snippet of text. They are typically defined with the [[Pragma: \procedure]]:
|
||||
<<.from-version "5.3.0">> A <<.def procedure>> is a named snippet of text. They are typically defined with the [[Pragma: \procedure]]:
|
||||
|
||||
```
|
||||
\procedure my-procedure(parameter:"Default value")
|
||||
|
@ -1,12 +1,12 @@
|
||||
created: 20221007144237585
|
||||
modified: 20221009121901496
|
||||
modified: 20221009163155576
|
||||
tags: Concepts Reference
|
||||
title: Custom Widgets
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! Introduction
|
||||
|
||||
A <<.def "custom widget">> is a special kind of [[procedure|Procedures]] that can be called using the same syntax as widgets.
|
||||
<<.from-version "5.3.0">> A <<.def "custom widget">> is a special kind of [[procedure|Procedures]] that can be called using the same syntax as widgets.
|
||||
|
||||
Custom widgets can also be used to override built-in JavaScript widgets to customise their behaviour.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user