Please enable JavaScript to view this site.

 

Navigation: Tokens

The Structure of Tokens

Scroll Prev Up Next More

Each token represents a specific way of looking at, and displaying, a date and information that relates to it.

 

The date of a token is determined by its DayValue and the structure of the scanned Template. This means that every token of the same DayValue corresponds to the exact same date.

It is the difference in TokenRoot (and possibly LanguageTag) that leads to the displaying of different information.

 

Q++Studio expects tokens to have the following structure (the spaces are there only for clarity):

 

[LanguageTag DayValue Prefix TokenRoot Suffix]

 

Some examples of tokens, where the various parts of each token have been color-coded as follows; LanguageTag, DayValue, TokenRoot, Prefix, Suffix:

LanguageTag

(optional)

A letter from 'a' to 'z' denoting the language to use for a particular token. This letter must appear immediately after the opening brace [ of the token.

 

Most of the time, for single-language diaries, tokens will not need a LanguageTag.

DayValue

A number from 1 to 1008 (24 times 42) which denotes, with respect to the current grid, which day a token refers to.

 

For example in a weekly grid, DayValues will range from 1 to 7, 1 referring to the first day of the grid (usually, but not necessarily, Monday).

 

If the token contains a LanguageTag, then the DayValue occurs immediately after, if not then the DayValue occurs immediately after the opening brace [.

 

Zero DayValues

 

A monthly grid with a weekly insert set to "month fit". The week that straddles the month change, is repeated, with a DayValue of 0 corresponding to January in the left-most pages, and a DayValue of 0 corresponding to February in the right-most pages.

A monthly grid with a weekly insert set to "month fit". The week that straddles the month change, is repeated, with a DayValue of 0 corresponding to January in the left-most pages, and a DayValue of 0 corresponding to February in the right-most pages.

You can use 0 (zero) as the DayValue of a token in a grid which is part of a month fit insert, to display a token based on the current month (ie. January for the 2 pages on the left of the example above, and February for the 2 pages on the right of the example to the right).

 

DayValues of 0 can also be used as part of a zap or conditional token to check if the date of a particular token is in in the current month (to avoid some “general” tokens such as [yyyy] and [mmmm] being deleted due to being outside the month, you can add the ignore outside days suffix to any token).

TokenRoot

The TokenRoot is the fundamental part of a token. Most of the time the terms token and TokenRoot will be used interchangeably. Click here to go to the list of all TokenRoots.

Prefix

(optional)

It is an optional part that, if present, is placed before the TokenRoot. See Token Prefixes.

Suffix

(optional)

It is an optional part that, if present, is placed between the TokenRoot and the closing brace. See Token Suffixes.

 

Some remarks about tokens :

 

If a token contains no LanguageTag, then Q++Studio will assume it is equal to 'a'.

If a token contains no LanguageTag, then the DayValue can also be omitted.

If a token contains no DayValue, then Q++Studio will assume it is equal to 1.

Tokens are case-sensitive. The tokens [d] and [D] are totally different.

Tokens start with an opening brace [ and end with a closing brace ].

If you wish to use plain text containing braces, make sure you add an underscore to each brace, [_ and _], to specify that the text contained is not a token.

Tokens should generally not contain any spaces (spaces can be included in tokens in a few rare cases, notably in filler suffixes and in holidays response tokens).

 

Finally, note that the evaluation of tokens is recursive; that means that the result of converting a token can be another token or even a series of tokens.

 


Topic 000137, last updated on 10-Jan-2023