transclusion
From Wikipedia:
In computer science, transclusion is the inclusion of part of a document into another document by reference.
For example, an article about a country might include a chart or a paragraph describing that country's agricultural exports from a different article about agriculture. Rather than copying the included data and storing it in two places, a transclusion embodies modular design, by allowing it to be stored only once (and perhaps corrected and updated if the link type supported that) and viewed in different contexts. The reference also serves to link both articles.
The term was coined by hypertext pioneer Ted Nelson in 1982.
See:
Cards can include other cards inside them. nesting helps you:
- edit chunks of content in place - faster and easier than editing whole pages.
- keep data current - a card's updates (e.g., an address or event info) appear everywhere it's included.
- display the same information in different ways using views. Eg, closed view let you use space more efficiently.
- specify content patterns with inclusion-based formats.
Example
The following (relevant) video is in a card named +howto video and is included here with the following syntax:
{{_l+howto video}}
How To
Including cards is achieved through a simple syntax, which consists of the name of the card inside double braces, with a couple of optional modifiers.
{{ cardname | key1:value; key2:value }}
The complete Nest Syntax is documented here:
{{ cardname | view }}
{{ cardname | key: value }}
{{ cardname | key1: value1 ; key2 value2 }}
{{ cardname | key1: value1 ; key2 value2 | itemkey1:itemvalue1; itemkey2:itemvalue2}}
Keys and Values
Key Values Notes view
"view" key is optional; if no key is given, value will be treated as view
title
text
replaces card name in view
show
applicable view names
e.g. title_link on any view that shows a title. use commas for multiple views
hide
applicable view names
e.g. paging on searches or menu wherever it's shown by default. use commas for multiple views
structure
any card name
overrides content and structure rule.
item
any valid view name
may be deprecated?; set via multiple-pipe syntax above Eg: size
Image cards only
type
any valid Cardtype name
may be deprecated?; set type via rules with *default setting
other
any valid CSS value
may be deprecated?; will be treated as CSS
Notes
- whitespace is optional
- inclusions can use contextual names
- see nesting and view cards for examples.
To demonstrate, here's a simple sample card:
Well, hello. I'm the content of simple sample card.
We included the card above using this syntax: {{simple sample | view:open }}. The "view:open" part means we want to see the whole card, with its green header and everything. There are many other views: closed, content, titled, link, name, change, core, etc.
The default view is "content", which means you only see the content of the card -- no header or footer. So if you don't specify a view, and just type {{simple sample}}, you'll just get the card's content:
Well, hello. I'm the content of simple sample card.
You would get the very same thing with {{simple sample | view:content}}, which is just a bit more explicit. Actually, because "view" is such a common key, you can just leave it out, like so: {{simple sample | closed}}, which gives us this:
Well, hello. I'm the content of simple sample card.
set item views
When you include Search and Pointer cards, you can also specify the view of each card in the returned list by adding another pipe. For example, {{sample user search | open | link}} will yield:
That syntax basically means "show me the search card in open view and each of its items in link view".
escape inclusions
If you want to use double curly brackets without creating an inclusion (for example in documentation), put a backslash just before the brackets. For example, \{{nymph}} appears as:
{{nymph}}
Tips
- Nest Syntax describes more, such as showing & hiding individual elements such as a card's menu, or customizing its title.
- You can edit included cards by double-clicking anywhere in them, or by clicking "edit" in the menu in the card's header.
-
Inclusions are not inline, but you can make them inline by using "display:inline" (and if the enclosing card is Basic, editing it's HTML so that instead of having a p tag around the inclusion it has a div tag), so for example "Ethan McCutchen's favorite fruit is {{Ethan McCutchen+favorite fruit|display:inline}}." will render as:
Ethan McCutchen's favorite fruit is . -
When you're including a card that doesn't exist yet, you can specify what type it should be with something like {{Phoebe Owens+favorite fruit|type:Phrase}}. Try clicking on this and you'll see it in action:
-
You can put comments in Wagn cards by making an inclusion and beginning with a hash symbol (#). Use two to make a comment that's completely invisible to web browsers:
{{## completely invisible comment}}
And one to have it show up as an HTML comment (i.e. <!-- # only visible in HTML -->):
{{# only visible in HTML}}