1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Merge pull request #1545 from aelocson/variable-docs

Document the tv-* variables
This commit is contained in:
Jeremy Ruston 2015-03-11 21:44:32 +00:00
commit e4cc5dca77
32 changed files with 380 additions and 97 deletions

View File

@ -1,5 +1,5 @@
created: 20140211171341271 created: 20140211171341271
modified: 20150221220245000 modified: 20150228114909000
tags: Concepts Reference tags: Concepts Reference
title: Macros title: Macros
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -22,7 +22,7 @@ The <<.mlink dumpvariables>> macro lists all variables (including macros) that a
An <<.wlink ImportVariablesWidget>> widget can be used to copy macro definitions to another branch of the [[widget tree|Widgets]]. ~TiddlyWiki uses this technique internally to implement global macros -- namely any macros defined in tiddlers with the <<.tag $:/tags/Macro>> tag. An <<.wlink ImportVariablesWidget>> widget can be used to copy macro definitions to another branch of the [[widget tree|Widgets]]. ~TiddlyWiki uses this technique internally to implement global macros -- namely any macros defined in tiddlers with the <<.tag $:/tags/Macro>> tag.
For maximum flexibility, macros can also be [[written as JavaScript modules|http://tiddlywiki.com/dev/index.html#JavaScript%20Macros]]. For maximum flexibility, macros can also be <<.js-macro-link "written as JavaScript modules">>.
A similar effect to a parameterised macro call can be produced by setting [[variables|Variables]] around a [[transclusion|Transclusion]]. A similar effect to a parameterised macro call can be produced by setting [[variables|Variables]] around a [[transclusion|Transclusion]].

View File

@ -0,0 +1,11 @@
created: 20150228133106000
modified: 20150228134018000
tags: Definitions
title: Document Object Model
type: text/vnd.tiddlywiki
The <<.dlink-ex DOM "http://en.wikipedia.org/wiki/Document_Object_Model">> of a web page is a tree-shaped model of its content, maintained internally by the web browser as the user interacts with that content. Each point in the tree is called a <<.def node>>.
When ~TiddlyWiki is running in a web browser, its [[widgets|Widgets]] are rendered into DOM nodes for display.
When ~TiddlyWiki is running on [[Node.js|TiddlyWiki on Node.js]], it uses a fake DOM to simulate the behaviour of a browser.

View File

@ -0,0 +1,11 @@
created: 20150228132723000
modified: 20150228133925000
tags: Definitions
title: HyperText Markup Language
type: text/vnd.tiddlywiki
<<.dlink-ex HTML "http://en.wikipedia.org/wiki/HTML">> is a standard plain-text format used for defining the content of a web page.
It consists of a tree of elements expressed using a system of special <<.def tags>> enclosed in angle brackets.
Almost the whole of HTML can be used unchanged in the WikiText of a tiddler.

View File

@ -0,0 +1,11 @@
created: 20150228131248000
modified: 20150228131522000
tags: Definitions
title: Percent Encoding
type: text/vnd.tiddlywiki
<<.dlink-ex "Percent encoding" "http://en.wikipedia.org/wiki/Percent-encoding">> is a notation that allows otherwise invalid characters to be included in a [[URI]].
Such characters are represented as a percent sign `%` followed by two additional characters.
For example, a space is represented as `%20` and an actual percent sign is represented as `%25`.

View File

@ -0,0 +1,7 @@
created: 20150228113450000
modified: 20150228113654000
tags: Definitions
title: URI
type: text/vnd.tiddlywiki
A <<.dlink-ex "URI" "http://en.wikipedia.org/wiki/Uniform_resource_identifier">> (also often known as a <<.def URL>>) is a string of characters used to specify the location of a resource such as a web page.

View File

@ -1,5 +1,5 @@
created: 20140410101941871 created: 20140410101941871
modified: 20150226162742000 modified: 20150228104558000
tags: Learning Filters tags: Learning Filters
title: Introduction to filter notation title: Introduction to filter notation
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -10,62 +10,43 @@ type: text/vnd.tiddlywiki
The simplest case is where you already know exactly which tiddlers you want. Type each title in double square brackets, with a space between each one and the next: The simplest case is where you already know exactly which tiddlers you want. Type each title in double square brackets, with a space between each one and the next:
``` > `[[Recipe book]] [[ScrambledEggs]] [[Mom's apple pie]]`
[[Recipe book]] [[ScrambledEggs]] [[Mom's apple pie]]
```
You can omit the square brackets when a title doesn't contain any spaces: You can omit the square brackets when a title doesn't contain any spaces:
``` > `[[Recipe book]] ScrambledEggs [[Mom's apple pie]]`
[[Recipe book]] ScrambledEggs [[Mom's apple pie]]
```
The double square brackets are actually a shorthand for this: The double square brackets are actually a shorthand for this:
``` > `[title[ScrambledEggs]]`
[title[ScrambledEggs]]
```
... which gives us the <<.def "general model">> for any filter: ... which gives us the <<.def "general model">> for any filter:
``` > `[operator[parameter]]`
[operator[parameter]]
```
For instance, here's how to select all the tiddlers that have been tagged <<.tag Recipe>>: For instance, here's how to select all the tiddlers that have been tagged <<.tag Recipe>>:
``` > `[tag[Recipe]]`
[tag[Recipe]]
```
We can reverse the meaning by adding an exclamation mark `!` just before the operator. For example, we can select any tiddlers that do <<.em not>> have the <<.tag Recipe>> tag: We can reverse the meaning by adding an exclamation mark `!` just before the operator. For example, we can select any tiddlers that do <<.em not>> have the <<.tag Recipe>> tag:
``` > `[!tag[Recipe]]`
[!tag[Recipe]]
```
Tiddlers can be filtered by other fields than just title and tags: Tiddlers can be filtered by other fields than just title and tags:
``` > `[field:serving[4]]`
[field:serving[4]]
```
That example will select any tiddlers that have <<.value 4>> in their <<.field serving>> field. That example will select any tiddlers that have <<.value 4>> in their <<.field serving>> field.
As the word "serving" isn't a standard filter operator (and isn't likely to become one), you can safely omit the `field:` prefix: As the word "serving" isn't a standard filter operator (and isn't likely to become one), you can safely omit the `field:` prefix:
``` > `[serving[4]]`
[serving[4]]
```
!Combinations !Combinations
The filters we've looked at so far have involved just one step each. But you can <<.def run>> several steps together like this: The filters we've looked at so far have involved just one step each. But you can <<.def run>> several steps together like this:
``` > `[tag[Vegetarian]!tag[soup]serving[4]]`
[tag[Vegetarian]!tag[soup]serving[4]]
```
Notice how the entire run is contained in a single pair of square brackets. Notice how the entire run is contained in a single pair of square brackets.
@ -73,29 +54,21 @@ A tiddler has to match <<.em all>> of the steps in a run. So the example above r
A sequence of separate runs will select the tiddlers that match <<.em any>> of the runs. We can use this to find recipes that serve either 3, 4 or 5 people: A sequence of separate runs will select the tiddlers that match <<.em any>> of the runs. We can use this to find recipes that serve either 3, 4 or 5 people:
``` > `[serving[3]] [serving[4]] [serving[5]]`
[serving[3]] [serving[4]] [serving[5]]
```
If we want to ignore vegetarian recipes that serve 4, we can say this: If we want to ignore vegetarian recipes that serve 4, we can say this:
``` > `[serving[3]] [serving[4]!tag[Vegetarian]] [serving[5]]`
[serving[3]] [serving[4]!tag[Vegetarian]] [serving[5]]
```
By default, each run considers every tiddler in the wiki. But we can use a `+` sign to force a run to consider only the tiddlers that were selected by the preceding runs: By default, each run considers every tiddler in the wiki. But we can use a `+` sign to force a run to consider only the tiddlers that were selected by the preceding runs:
``` > `[serving[3]] [serving[4]] [serving[5]] +[tag[Vegetarian]] +[sort[title]]`
[serving[3]] [serving[4]] [serving[5]] +[tag[Vegetarian]] +[sort[title]]
```
This selects recipes for 3, 4 or 5 people, then filters <<.em those>> to remove the vegetarian ones, and finally sorts any that are left into alphabetical order of title. This selects recipes for 3, 4 or 5 people, then filters <<.em those>> to remove the vegetarian ones, and finally sorts any that are left into alphabetical order of title.
In a similar way, we can use a `-` sign to <<.em remove>> a run's tiddlers from the result so far. Here we select all vegetarian recipes apart from two: In a similar way, we can use a `-` sign to <<.em remove>> a run's tiddlers from the result so far. Here we select all vegetarian recipes apart from two:
``` > `[tag[Vegetarian]] -[title[ScrambledEggs]] -BeansOnToast`
[tag[Vegetarian]] -[title[ScrambledEggs]] -BeansOnToast
```
!Special parameters !Special parameters
@ -103,14 +76,10 @@ The parameter of each step we've seen so far has been in square brackets, meanin
<<.def "Curly brackets">> `{}` mean that the parameter is a TextReference, and that its value is to be looked up in a specified tiddler. For example, if we have a tiddler called <<.tid Preference>> whose text happens to be the word <<.value Vegetarian>>, we can say <<.def "Curly brackets">> `{}` mean that the parameter is a TextReference, and that its value is to be looked up in a specified tiddler. For example, if we have a tiddler called <<.tid Preference>> whose text happens to be the word <<.value Vegetarian>>, we can say
``` > `[tag{Preference}]`
[tag{Preference}]
```
as an alternative to `[tag[Vegetarian]]`. This allows the preference to change over time. as an alternative to `[tag[Vegetarian]]`. This allows the preference to change over time.
<<.def "Angle brackets">> `<>` mean that the parameter is the name of a [[variable|Variables]] whose value is to be used instead. Here we use the built-in <<.vlink currentTiddler>> variable in a filter that selects any tiddlers whose text contains the title of the current one: <<.def "Angle brackets">> `<>` mean that the parameter is the name of a [[variable|Variables]] whose value is to be used instead. Here we use the built-in <<.vlink currentTiddler>> variable in a filter that selects any tiddlers whose text contains the title of the current one:
``` > `[search<currentTiddler>]`
[search<currentTiddler>]
```

View File

@ -0,0 +1,6 @@
created: 20150228123855000
modified: 20150228123921000
title: $:/editions/tw5.com/macro-examples/tv-get-export-image-link
type: text/vnd.tiddlywiki
\define tv-get-export-image-link(src) http://www.tiddlywiki.com/$src$

View File

@ -0,0 +1,8 @@
created: 20150228120252000
modified: 20150228120554000
title: $:/editions/tw5.com/macro-examples/tv-wikilink-tooltip
type: text/vnd.tiddlywiki
\define tv-wikilink-tooltip()
<$transclude field="tooltip">(<$transclude field="caption"/>)</$transclude>
\end

View File

@ -1,5 +1,5 @@
created: 20140716084658099 created: 20140716084658099
modified: 20140716195055502 modified: 20150228143618000
tags: Messages navigator-message tags: Messages navigator-message
title: WidgetMessage: tm-import-tiddlers title: WidgetMessage: tm-import-tiddlers
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -14,7 +14,4 @@ The import tiddlers message is usually generated with the DropzoneWidget or the
! Configuration Variables ! Configuration Variables
The variable `tv-auto-open-on-import` controls whether the `tm-import-tiddlers` message automatically triggers the display of the pending import tiddler [[$:/Import]]: * <<.vlink tv-auto-open-on-import>>
* ''no'': The pending import tiddler is not opened in the story
* ''yes'': The pending import tiddler is opened in th story. This is the default

View File

@ -1,5 +1,5 @@
created: 20150110182600000 created: 20150110182600000
modified: 20150226161700000 modified: 20150228082845000
title: Documentation Macros title: Documentation Macros
tags: [[Improving TiddlyWiki Documentation]] tags: [[Improving TiddlyWiki Documentation]]
@ -18,7 +18,7 @@ The following macros are used throughout ~TiddlyWiki's documentation. Their name
|!Macro |!Used for |!Example | |!Macro |!Used for |!Example |
|^.tip |^hints and tips |<<.tip "Turn your screen on, otherwise<br>you won't be able to see much.">> | |^.tip |^hints and tips |<<.tip "Turn your screen on, otherwise<br>you won't be able to see much.">> |
|^.warning |^warning advice |<<.warning "Make a backup of your file<br>before your upgrade.">> | |^.warning |^warning advice |<<.warning "Make a backup of your file<br>before you upgrade.">> |
!Blocks !Blocks
|!Macro |!Used for | |!Macro |!Used for |

View File

@ -1,11 +1,9 @@
created: 20150117152607000 created: 20150117152607000
modified: 20150221151136000 modified: 20150228114306000
title: $:/editions/tw5.com/operator-macros title: $:/editions/tw5.com/operator-macros
tags: $:/tags/Macro tags: $:/tags/Macro
\define .operator-examples(op,text:"Examples") <$link to="$op$ Operator (Examples)">$text$</$link> \define .operator-examples(op,text:"Examples") <$link to="$op$ Operator (Examples)">$text$</$link>
\define .variable-examples(v,text:"Examples") <$link to="$v$ Variable (Examples)">$text$</$link>
\define .macro-examples(m,text:"Examples") <$link to="$m$ Macro (Examples)">$text$</$link>
\define .operator-example(n,eg,ie) \define .operator-example(n,eg,ie)
<div class="doc-example"> <div class="doc-example">

View File

@ -0,0 +1,18 @@
created: 20150228114241000
modified: 20150228141312000
title: $:/editions/tw5.com/variable-macros
tags: $:/tags/Macro
\define .variable-examples(v,text:"Examples") <$link to="$v$ Variable (Examples)">$text$</$link>
\define .macro-examples(m,text:"Examples") <$link to="$m$ Macro (Examples)">$text$</$link>
\define .js-macro-link(_) [[$_$|http://tiddlywiki.com/dev/index.html#JavaScript%20Macros]]
\define .this-is-static-link-variable() <<.tip "This variable has no useful effect when ~TiddlyWiki is running in a browser, as the `href` attribute is ignored there -- links between tiddlers are performed by JavaScript instead. The variable comes into play when one is using the [[Node.js configuration|TiddlyWiki on Node.js]] to [[generate a static version|RenderTiddlersCommand]] of a wiki.">>
\define .this-is-toolbar-config-variable(configTiddler)
It can be set to <<.value yes>> or <<.value no>> prior to transcluding such a button.
The standard page template sets it to the value found in [[$configTiddler$]], with the result that this becomes the default for the whole page. The user can adjust this default by using a tickbox on the <<.controlpanel-tab Settings>> tab of the [[Control Panel|$:/ControlPanel]].
\end

View File

@ -1,8 +1,12 @@
created: 20150220161908000 created: 20150220161908000
modified: 20150221222104000 modified: 20150228134138000
title: Core Variables title: Core Variables
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
The following [[variables|Variables]] are built into ~TiddlyWiki's core: The following [[variables|Variables]] are built into ~TiddlyWiki's core:
<<list-links "[tag[Core Variables]]">> <<list-links "[tag[Core Variables]] -[tag[Configuration Variables]]">>
The core will also use various configuration variables and macros if you define them:
<<list-links "[tag[Configuration Variables]]">>

View File

@ -1,12 +1,12 @@
created: 20150221141507000 created: 20150221141507000
modified: 20150221144853000 modified: 20150228103440000
tags: [[transclusion Variable]] [[Variable Examples]] tags: [[transclusion Variable]] [[Variable Examples]]
title: transclusion Variable (Examples) title: transclusion Variable (Examples)
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
This example shows how to distinguish between the sidebar and other environments: This example shows how to distinguish between the sidebar and other environments:
<$macrocall $name=".example" n="3" <$macrocall $name=".example" n="1"
eg="""We are eg="""We are
<$list <$list
filter="[<transclusion>prefix[{|$:/core/ui/PageTemplate/sidebar|||}]]" filter="[<transclusion>prefix[{|$:/core/ui/PageTemplate/sidebar|||}]]"

View File

@ -0,0 +1,26 @@
created: 20150228135051000
modified: 20150228135737000
tags: [[tv-config-toolbar-class Variable]] [[Variable Examples]]
title: tv-config-toolbar-class Variable (Examples)
type: text/vnd.tiddlywiki
<style>
.green-background {
background-color: green;
fill: white;
}
</style>
<$macrocall $name=".example" n="1"
eg="""<$set name="tv-config-toolbar-class" value="tc-btn-invisible">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
"""/>
<$macrocall $name=".example" n="2"
eg="""<$set name="tv-config-toolbar-class" value="green-background">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
"""/>
The `green-background` [[CSS|Cascading Style Sheets]] class is declared in a stylesheet within this tiddler.

View File

@ -0,0 +1,19 @@
created: 20150228140420000
modified: 20150228141418000
tags: [[tv-config-toolbar-icons Variable]] [[Variable Examples]]
title: tv-config-toolbar-icons Variable (Examples)
type: text/vnd.tiddlywiki
<$macrocall $name=".example" n="1"
eg="""<$set name="tv-config-toolbar-icons" value="no">
<$set name="tv-config-toolbar-text" value="yes">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
</$set>
"""/>
<$macrocall $name=".example" n="2"
eg="""<$set name="tv-config-toolbar-icons" value="yes">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
"""/>

View File

@ -0,0 +1,17 @@
created: 20150228140420000
modified: 20150228140516000
tags: [[tv-config-toolbar-text Variable]] [[Variable Examples]]
title: tv-config-toolbar-text Variable (Examples)
type: text/vnd.tiddlywiki
<$macrocall $name=".example" n="1"
eg="""<$set name="tv-config-toolbar-text" value="no">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
"""/>
<$macrocall $name=".example" n="2"
eg="""<$set name="tv-config-toolbar-text" value="yes">
{{$:/core/ui/Buttons/new-tiddler}}
</$set>
"""/>

View File

@ -0,0 +1,11 @@
created: 20150228124038000
tags: [[tv-get-export-image-link Variable]] [[Variable Examples]]
title: tv-get-export-image-link Variable (Examples)
type: text/vnd.tiddlywiki
This example fetches [[the TiddlyWiki icon|http://www.tiddlywiki.com/favicon.ico]]:
<$importvariables filter="$:/editions/tw5.com/macro-examples/tv-get-export-image-link">
<$codeblock code={{$:/editions/tw5.com/macro-examples/tv-get-export-image-link}}/>
<$macrocall $name=".example" n="1" eg="""[img[favicon.ico]]"""/>
</$importvariables>

View File

@ -0,0 +1,14 @@
created: 20150228115959000
modified: 20150228120621000
tags: [[tv-wikilink-tooltip Variable]] [[Variable Examples]]
title: tv-wikilink-tooltip Variable (Examples)
type: text/vnd.tiddlywiki
This example shows a way of giving links a tooltip derived from the target tiddler's <<.field caption>> field:
<$importvariables filter="$:/editions/tw5.com/macro-examples/tv-wikilink-tooltip">
<$codeblock code={{$:/editions/tw5.com/macro-examples/tv-wikilink-tooltip}}/>
<$macrocall $name=".example" n="1" eg="""Here is a link to [[backlinks Operator]] with a custom tooltip."""/>
</$importvariables>
Here is [[a standard link|HelloThere]] for comparison.

View File

@ -0,0 +1,17 @@
created: 20150228103411000
modified: 20150228104438000
tags: [[tv-wikilinks Variable]] [[Variable Examples]]
title: tv-wikilinks Variable (Examples)
type: text/vnd.tiddlywiki
<$macrocall $name=".example" n="1"
eg="""HelloThere,
[[HelloThere]],
<$link to="HelloThere">is //this// a link?</$link>"""/>
<$macrocall $name=".example" n="2"
eg="""<$set name="tv-wikilinks" value="no">
HelloThere,
[[HelloThere]],
<$link to="HelloThere">is //this// a link?</$link>
</$set>"""/>

View File

@ -0,0 +1,10 @@
created: 20150228132024000
modified: 20150228133745000
title: namespace Variable
tags: Variables [[Core Variables]]
type: text/vnd.tiddlywiki
caption: namespace
The <<.def namespace>> [[variable|Variables]] is used internally by [[HTML|HyperText Markup Language]] widgets to keep track of the correct namespace for the [[DOM|Document Object Model]] elements they generate.
An `svg` or `math` element supplies a distinct namespace for itself and any child elements it contains.

View File

@ -0,0 +1,12 @@
created: 20150228120919000
modified: 20150228130407000
title: tv-auto-open-on-import Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-auto-open-on-import
The <<.def tv-auto-open-on-import>> [[variable|Variables]] controls whether the `tm-import-tiddlers` message causes the tiddler [[$:/Import]] (which lists the pending imports) to open in the story river.
By default, the tiddler is opened. But if this variable has the value <<.value no>>, it isn't.
An example of setting this variable to <<.value no>> can be found in the upgrade plugin within the [[TiddlyWiki Upgrade Wizard|http://www.tiddlywiki.com/upgrade.html]]. People can drag their wiki files onto the wizard without triggering the normal import display.

View File

@ -0,0 +1,14 @@
created: 20150228134732000
modified: 20150228135803000
title: tv-config-toolbar-class Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-config-toolbar-class
The <<.def tv-config-toolbar-class>> [[variable|Variables]] controls the value of the [[CSS|Cascading Style Sheets]] `class` attribute on the HTML element for a toolbar button.
It can be set prior to transcluding such a button.
In most environments, it defaults to <<.value tc-btn-invisible>>, which removes the button's background colour and border.
<<.variable-examples "tv-config-toolbar-class">>

View File

@ -0,0 +1,14 @@
created: 20150228135910000
modified: 20150228141357000
title: tv-config-toolbar-icons Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-config-toolbar-icons
The <<.def tv-config-toolbar-icons>> [[variable|Variables]] controls whether toolbar buttons display icons.
<<.this-is-toolbar-config-variable $:/config/Toolbar/Icons>>
<<.variable-examples "tv-config-toolbar-icons">>
See also <<.vlink tv-config-toolbar-text>>.

View File

@ -0,0 +1,14 @@
created: 20150228135910000
modified: 20150228141403000
title: tv-config-toolbar-text Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-config-toolbar-text
The <<.def tv-config-toolbar-text>> [[variable|Variables]] controls whether toolbar buttons display text.
<<.this-is-toolbar-config-variable $:/config/Toolbar/Text>>
<<.variable-examples "tv-config-toolbar-text">>
See also <<.vlink tv-config-toolbar-icons>>.

View File

@ -0,0 +1,17 @@
created: 20150228122257000
modified: 20150228130940000
title: tv-get-export-image-link Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-get-export-image-link
The <<.def tv-get-export-image-link>> [[variable|Variables]] controls the value of the `src` attribute on the HTML `img` element generated by the <<.wlink ImageWidget>> widget when the value of its `source` attribute is not the title of a tiddler.
The variable should be a [[macro|Macros]] with the following parameter:
;src
: The value of the `source` attribute -- equivalent to the image name specified in <$link to="Images in WikiText">the shorthand syntax</$link> `[img[source]]`
The ability to override image URIs in this way can be useful when one is using the [[Node.js configuration|TiddlyWiki on Node.js]] to export a static version of a wiki.
<<.variable-examples "tv-get-export-image-link">>

View File

@ -0,0 +1,17 @@
created: 20150228114004000
modified: 20150228130943000
title: tv-get-export-link Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-get-export-link
The <<.def tv-get-export-link>> [[variable|Variables]] controls the value of the `href` attribute on the HTML `a` element generated by the <<.wlink LinkWidget>> widget.
<<.this-is-static-link-variable>>
The variable should be a [[macro|Macros]] with the following parameter:
;to
: The title of the target tiddler of the link, with no escaping
See also <<.vlink tv-wikilink-template>>. If both that variable and this one exist, this one dominates.

View File

@ -0,0 +1,15 @@
created: 20150228130131000
modified: 20150228131730000
title: tv-get-export-path Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-get-export-path
The <<.def tv-get-export-path>> [[variable|Variables]] specifies the full pathname to which the <<.clink rendertiddlers RenderTiddlersCommand>> [[Node.js|TiddlyWiki on Node.js]] command writes each tiddler.
The variable should be implemented as a <<.js-macro-link "JavaScript macro">> with the following parameter:
;title
: The title of the tiddler
If no such macro exists, the tiddlers are written to files whose names are [[percent-encoded|Percent Encoding]], in the command's output folder.

View File

@ -0,0 +1,23 @@
created: 20150228105954000
modified: 20150228131300000
title: tv-wikilink-template Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-wikilink-template
The <<.def tv-wikilink-template>> [[variable|Variables]] controls the value of the `href` attribute on the HTML `a` element generated by the <<.wlink LinkWidget>> widget.
<<.this-is-static-link-variable>>
The variable is treated as if it was a [[macro|Macros]] with the following parameters:
;uri_encoded
: The title of the target tiddler of the link, but [[percent-encoded|Percent Encoding]]
;uri_doubleencoded
: The value of the <<.param uri_encoded>> parameter but percent-encoded again, i.e. with its `%` characters further converted to `%25`
> `\define tv-wikilink-template() ../tiddlers/$uri_encoded$.html`
The variable defaults to `#$uri_encoded$`.
See also the <<.vlink tv-get-export-link>> variable, which dominates over this one.

View File

@ -0,0 +1,12 @@
created: 20150228115540000
modified: 20150228130451000
title: tv-wikilink-tooltip Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-wikilink-tooltip
The <<.def tv-wikilink-tooltip>> [[variable|Variables]] specifies the default value for the <<.attr tooltip>> attribute of the <<.wlink LinkWidget>> widget.
It is often defined as a [[macro|Macros]], and its value parsed as inline WikiText.
<<.variable-examples "tv-wikilink-tooltip">>

View File

@ -0,0 +1,18 @@
created: 20150228102737000
modified: 20150228130415000
title: tv-wikilinks Variable
tags: Variables [[Core Variables]] [[Configuration Variables]]
type: text/vnd.tiddlywiki
caption: tv-wikilinks
The <<.def tv-wikilinks>> [[variable|Variables]] controls the behaviour of the <<.wlink LinkWidget>> widget.
The widget normally produces a link to a tiddler. But if this variable has the value <<.value no>>, the widget suppresses the link and simply displays the text that would otherwise have served as the link.
You can suppress links for a whole tiddler by placing the following line at the start of the tiddler's text:
> `\define tv-wikilinks() no`
This variable has no effect on external links, as those do not involve the <<.wid link>> widget.
<<.variable-examples "tv-wikilinks">>

View File

@ -1,6 +1,6 @@
title: LinkWidget title: LinkWidget
created: 201310241419 created: 201310241419
modified: 201502231037 modified: 20150228144334000
tags: Widgets tags: Widgets
caption: link caption: link
@ -18,7 +18,7 @@ The `link` widget generates links to tiddlers. (Use the HTML `<a>` element to ge
The content of the link widget is rendered within the `<a>` tag. The content of the link widget is rendered within the `<a>` tag.
The default value of the tooltip attribute is `<<tv-wikilink-tooltip>>`. The default value of the tooltip attribute is supplied by the <<.vlink tv-wikilink-tooltip>> variable.
This means that you can control the text of a link tooltip in several ways: This means that you can control the text of a link tooltip in several ways:
@ -51,7 +51,6 @@ A useful convention is to set the tooltip like this:
This causes the tooltip to be the ''tooltip'' field of the target tiddler. If the field isn't present, then the title is used instead. This causes the tooltip to be the ''tooltip'' field of the target tiddler. If the field isn't present, then the title is used instead.
! CSS Classes ! CSS Classes
* `tc-tiddlylink` - applied to all links * `tc-tiddlylink` - applied to all links
@ -60,35 +59,9 @@ This causes the tooltip to be the ''tooltip'' field of the target tiddler. If th
* `tc-tiddlylink-missing` - applied to tiddler links where the target tiddler doesn't exist * `tc-tiddlylink-missing` - applied to tiddler links where the target tiddler doesn't exist
* `tc-tiddlylink-resolves` - applied to tiddler links when the target tiddler does exist * `tc-tiddlylink-resolves` - applied to tiddler links when the target tiddler does exist
! Configuration macros ! Configuration variables
Configuration macros can be used to modify the behaviour of the link widget. * <<.vlink tv-wikilinks>>
* <<.vlink tv-wikilink-template>>
!! tv-wikilinks * <<.vlink tv-wikilink-tooltip>>
* <<.vlink tv-get-export-link>>
Links are suppressed if the macro `tv-wikilinks` evaluates to the string `no`. For example:
```
\define tv-wikilinks() no
```
!! tv-wikilink-template
The target of the link widget defaults to the URL encoded title of the tiddler. The `href` can be templated by defining the configuration macro `tv-wikilink-template`, and including within it the token `$uri_encoded$`. For example:
```
\define tv-wikilink-template() http://tiddlywiki.com/#$uri_encoded$
```
The token `$uri_doubleencoded$` is replaced by the double encoded title of the tiddler.
Note that in the browser the `<a>` element generated by the link widget has a JavaScript event handler that navigates directly to the target tiddler, ignoring the `href` attribute.
!! tv-wikilink-tooltip
Provides default text for the link tooltip:
```
\define tv-wikilink-tooltip() This is a link to {{!!title}}
<$link to="HelloThere"/>
```