formatting+howto

Forms are settings, meaning configurations that can apply to any set of cards.

 

*content and *default

 

There are two setting cards that are used to format cards:

  • The *default setting controls the initial content for cards in a set.  If you change a *default setting, it won't impact existing cards in the set.
  • The *content setting controls the content of cards in a set on an ongoing basis.  If you change a *content setting, it will impact every card in the set.

 

Navigating to Form Cards

 

The first part of adding/editing a form is creating/finding the form card.  There are several ways to do this.

  1. If you already know the name of the form card, you can navigate straight to it by typing in the url or using the navbar.  Form cards are always named with this pattern: set+form_setting.  For example, User+*type+*content is a form card that combines the User+*type set with the *content form setting.  This card controls content for all the User cards (cards whose type is "User").
  2. If you go straight to the set card, from there you can click to add or edit the form setting. Notice how the User+*type card includes the *content setting card on it.
  3. To edit existing form cards, you can navigate to the setting card, where you will see the sets for that card.  For example, on *content, one of the cards you see under the +*type heading is User+*type+*content
  4. For sets related to a specific type, you can also start from type card.  For example, if you go to User and then click Options -> Settings, then you will see this same *content setting value beneath "Settings for All User cards".  
  5. You can also start from any card that is a member of the set of cards that your form will affect.  Try going to your personal card (or any User card), and clicking on Options->Settings.  Then click on *content to open the setting.
  6. Similarly, whenever you edit a card that is controlled by a *content setting, you will see a link at the top of the card that reads "Formatted by a form card".  Clicking on "form card" will take you to the *content setting card.

 

Setting Defaults

 

The simplest form setting is *default.  When you create a new card that has a *default setting, the new card will start with the same content, type, and permissions as the *default card.   After the card is created, it is no longer influenced by the *default setting in any way.

 

For example, look at logo+*right+*default.  Notice that it is a blank Image card.  The set logo+*right refers to all the cards that end in "+logo".  Therefore, any time you create a card that ends in "+logo", you will start with a blank Image card.

 

Similarly, country+*right+*default is a Phrase card that has the content "USA".  So any time you create a card ending in +country, your default content will be "USA".

 

 

Setting Content

 

Unlike *default, the *content setting continues to control a card's content even after it is created.  As a silly example, if I create a card called Recipe+*type+*content and I enter the content "Just cook it", then every recipe will have the content "just cook it".

 

Obviously, that's not particularly useful, because you don't want the exact same information on each recipe, you want templates of information that allow for lots of relative info about each recipe.

 

Consider again our example of the recipe form card:

Preparation time: {{+preparation time}}
Serves: {{+serves}}
{{+ingredients|closed}}
 

Preparation

 
{{+preparation|closed}}
 

This dish is:
{{+diet|item:link}}
Tags: {{+tags}}
 

Comments

 
{{+discussion|open}}
...

Looking at that card, you'll notice lots of inclusions, like {{+ingredients|open}}.  We won't go into great detail about inclusions here, but here's a brief overview of how this works:

  • The double curly brackets represent an inclusion, meaning that one card is inside another.  In this case, the ingredients card is inside the recipe card.
  • Because of this inclusion, every recipe will include an ingredients list.
  • The "+" before ingredients indicates that this is a contextual name, meaning that the included card receives a name relative to the including card.  For example, if I make a recipe called "Lobster Bisque", then its ingredient list will be named "Lobster Bisque+ingredients".
  • The "open" refers to the views of the included card.  When you see the ingredients card inside the recipe, it will be open.

 

Combining Content and Default

 

To continue with our Recipe example, you may have noticed that the "+serves" cards on the Recipe are Number cards.  This is because serves+*right+*default is a Number card.  So, you see, by combining default and content settings, you can start to build sophisticated templates.

 

See also

 

try it

 

wagneers

intro

videos

features

syntax

weekly calls

ideas

 

twitter

mailing list

 

developers

roadmap

next release

tickets

pack API

REST API

one-pager

 

github

mailing list

 

wagn.org

recent

todo