contextual names
Contextual (or "relative") names are card names that can be interpreted differently based on context.
Contextual names are translated into "absolute" names in links, inclusions, and searches. These patterns are central to formatting and contextual search.
Examples
A few examples of contextual names:
- _
- _self
- _user
- +address
- _left+address
Note: to understand the following examples, you will need a basic understanding of link syntax and inclusion syntax.Context: who is signed in
Let's consider the contextual name "_user". The meaning of this name varies depending upon who is using the site. For example, here is what we see if we link to _user with this link syntax "[[_user]]":
If you are not logged in, you will see this as a link to Anonymous. If you're logged in as "Bob Dylan", you'll see a link to Bob Dylan.
Context: card content
Here is the raw content of a card named Earth:
Our planet is named {{_self|link}}. {{_|name}} has seven continents. See [[+continents]]
And here is what Earth looks like when it is rendered:
Our planet is named Earth. Earth has seven continents. See +continents
Note how in the context of the "Earth" card, both "_self" and its short form "_" refer to "Earth".
Also note what happens to the "+continents" card. In the context of the Earth card, the absolute name is "Earth+continents". In order to be less visually noisy, the text of the link is still just "+continents", but the link itself points to "Earth+continents". You can confirm by clicking or mousing over the link.
Context: plus card content
Plus cards support still more contextual names, including _left and _right. Here is the raw content of a plus card named Earth+continents (the one we linked to in the previous example):
Australia, Asia, Africa, Europe, Antarctica, and North and South America are all [[_right]] on planet [[_left]].
And here is what that card looks like rendered:
Australia, Asia, Africa, Europe, Antarctica, and North and South America are all continents on planet Earth.
How To
Use these terms in links, inclusions, or searches:
_user
the card of the person currently signed in (see above)
_main
the main card of the page. Required in Layout cards, but can be used anywhere.
E.g., the main card of this page:
- [[_main]] gives us: contextual names
_self, _, +
the card's name. You can also use _ for short.
E.g., in the context of the Earth card, these refer to Earth:
- _self
- _
...and these refer to Earth+continents
- _self+continents
- _+continents
- +continents
Note that cards beginning or ending with "+" are contextual cards, and that "+address" refers to the same card as "_self+address".
_left, _right
the parts of a plus card's name. _right is the rightmost part; _left is everything else.
E.g., in the context of Earth+continents
- _self is "Earth+continents"
- _left is "Earth"
- _right is "continents"
...and in the context of Earth+continents+image
- _self is "Earth+continents+image"
- _left is "Earth+continents"
- _right is "image"
_L, _R, _LL, _LR, etc
_L and _R are short-hand for _left and _right. You can string L's and R's together to handle arbitrarily complex plus cards.
E.g., in the context of hay+bee+sea+dee
- _L is "hay+bee+sea"
- _R is "dee"
- _LL (left's left) is "hay+bee"
- _LR (left's right) is "sea"
- _LLL (left's left's left) is "hay"
- _LLR (left's left's right) is "bee"
_1, _2, _3, etc
Another way to refer to plus card parts.
E.g., in the context of hay+bee+sea
- _1 is "hay"
- _2 is "bee"
- _3 is "sea"
Tips
- These terms can be used as variables in regular web addresses - see contextual web addresses.
- In the context of Searches, _self refers to the left side of the card's name.
E.g., if John+friends is a Search card, then _self refers to John, not John+friends. (This is considered a legacy issue and will be addressed in an upcoming release).
