mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 18:00:26 +00:00
Docs updates
This commit is contained in:
parent
93100a1c8f
commit
9641345b92
@ -1,5 +1,6 @@
|
||||
code-body: yes
|
||||
created: 20150221145447000
|
||||
modified: 20150221145626000
|
||||
modified: 20221003132544224
|
||||
title: $:/editions/tw5.com/macro-examples/say-hi-using-variables
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
code-body: yes
|
||||
created: 20150221145803000
|
||||
modified: 20150221221536000
|
||||
modified: 20221003132533754
|
||||
title: $:/editions/tw5.com/macro-examples/say-hi
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define sayhi(name:"Bugs Bunny" address:"Rabbit Hole Hill")
|
||||
\define sayhi(name:"Bugs Bunny",address:"Rabbit Hole Hill")
|
||||
Hi, I'm $name$ and I live in $address$.
|
||||
\end
|
||||
|
@ -1,4 +1,6 @@
|
||||
code-body: yes
|
||||
created: 20150221145803000
|
||||
modified: 20221003132607664
|
||||
title: $:/editions/tw5.com/macro-examples/tags-of-current-tiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
code-body: yes
|
||||
created: 20150228120252000
|
||||
modified: 20150228120554000
|
||||
modified: 20221003132558078
|
||||
title: $:/editions/tw5.com/macro-examples/tv-wikilink-tooltip
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,13 +1,29 @@
|
||||
created: 20220917112233317
|
||||
modified: 20220917155832411
|
||||
modified: 20221003133242496
|
||||
tags: Pragmas
|
||||
title: Pragma: \define
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\define'' [[pragma|Pragmas]]
|
||||
The ''\define'' [[pragma|Pragmas]] is used to [[define macros|Macro Definitions]]. It is a shortcut syntax for the SetVariableWidget.
|
||||
|
||||
The usual form allows macros to span multiple lines:
|
||||
|
||||
```
|
||||
\define <macro-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 macros:
|
||||
|
||||
```
|
||||
\define <macro-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...) <single-line-definition-text>
|
||||
```
|
||||
|
||||
The first line of the definition specifies the macro 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 macro. The lines that follow contain the text of the macro text (i.e. the snippet represented by the macro name), until `\end` appears on a line by itself:
|
||||
|
||||
For example:
|
||||
|
||||
<$codeblock code={{$:/editions/tw5.com/macro-examples/say-hi}}/>
|
||||
|
||||
Alternatively, the entire definition can be presented on a single line without an `\end` marker:
|
||||
|
@ -1,8 +1,17 @@
|
||||
created: 20220917113054582
|
||||
modified: 20220917113329624
|
||||
modified: 20221003120802195
|
||||
tags: Pragmas
|
||||
title: Pragma: \import
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\import'' [[pragma|Pragmas]]
|
||||
The ''\import'' [[pragma|Pragmas]] is used to import definitions from other tiddlers that are identified with a filter. It is a shortcut syntax for the ImportVariablesWidget.
|
||||
|
||||
```
|
||||
\import <filter>
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro]]
|
||||
```
|
||||
|
@ -1,7 +1,18 @@
|
||||
created: 20220917113154900
|
||||
modified: 20220917113205051
|
||||
modified: 20221003121441054
|
||||
tags: Pragmas
|
||||
title: Pragma: \parameters
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\parameters'' [[pragma|Pragmas]]
|
||||
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>]...)
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
\parameters (firstname:"Joe",lastname:"Blogs")
|
||||
```
|
||||
|
||||
|
@ -1,7 +1,25 @@
|
||||
created: 20220917112931273
|
||||
modified: 20220917113254747
|
||||
modified: 20221003121749187
|
||||
tags: Pragmas
|
||||
title: Pragma: \rules
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\rules'' [[pragma|Pragmas]] adjusts the set of rules used to parse the remaining text.
|
||||
The ''\rules'' [[pragma|Pragmas]] adjusts the set of parser rules used to parse the remaining text.
|
||||
|
||||
```
|
||||
\rules only|expect <rule-list>
|
||||
```
|
||||
|
||||
The list of available parser rules can be consulted in $:/ControlPanel -> Info -> Advanced -> Parsing.
|
||||
|
||||
For example, in stylesheets it is typical to only use the rules associated with macros and transclusions:
|
||||
|
||||
```
|
||||
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline
|
||||
```
|
||||
|
||||
Some users prefer not to use CamelCase links:
|
||||
|
||||
```
|
||||
\rules except prettylink
|
||||
```
|
@ -1,10 +1,20 @@
|
||||
created: 20220917113002350
|
||||
modified: 20220917113304284
|
||||
modified: 20221003121147795
|
||||
tags: Pragmas
|
||||
title: Pragma: \whitespace
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''\whitespace'' [[pragma|Pragmas]]
|
||||
<<.from-version "5.1.15">> The ''\whitespace'' [[pragma|Pragmas]] determines how spaces and newlines are treated within wikitext. Note that this only applies to the printable text, and not to other text, such as the values of attributes.
|
||||
|
||||
;`\whitespace trim` or `\whitespace notrim`
|
||||
: <<.from-version "5.1.15">> Control whether whitespace is trimmed from the start and end of text runs (the default is ''notrim''). This setting can be useful when the whitespace generated by linebreaks disturbs formatting
|
||||
* ''notrim'' -- whitespace text is not subject to special processing (the default)
|
||||
* ''trim'' -- whitespace text is removed
|
||||
|
||||
```
|
||||
\whitespace trim|notrim
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
\whitespace trim
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20141002133113496
|
||||
modified: 20220909111836951
|
||||
modified: 20220930195819232
|
||||
tags: Concepts Reference
|
||||
title: Variables
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -21,3 +21,4 @@ By themselves, the snippets are <<.em not>> parsed as WikiText. However, a varia
|
||||
The <<.mlink dumpvariables>> macro lists all variables (including macros) that are available at that position in the widget tree.
|
||||
|
||||
~TiddlyWiki's core has [[several variables|Core Variables]] built in.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: Variables
|
||||
created: 20141002141231992
|
||||
modified: 20220917075007507
|
||||
modified: 20220930195709700
|
||||
tags: WikiText
|
||||
title: Variables in WikiText
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -34,3 +34,4 @@ The `\define` pragma below [[defines a macro|Macro Definitions]] called <<.var t
|
||||
This example uses the <<.olink backlinks>> [[operator|Filter Operators]] to list all tiddlers that link to this one.
|
||||
|
||||
<$macrocall $name=".example" n="3" eg="""<<list-links filter:"[<currentTiddler>backlinks[]]">>"""/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user