Recursive Macro Tokens are a special case of recursive tokens, where a token is converted to a string which contains one or more tokens. This in turn leads to the conversion of these tokens as part of the conversion of the original token.
The specificity of recursive macro tokens lies in the way in which the recursion is introduced in the macro token evaluation.
There are 2 ways in which recursion can come into the evaluation of a Macro Token, based on the value of the sRESULT variable at the end of the macro:
sResult contains |
required further steps |
only non-macro tokens |
If the result of a macro refers only to non-macro token (as is the case in this example), then the processing of the tokens in sResult is done just as if you had manually placed these sResult tokens in the QuarkXPress document of the template, and no further steps are necessary. |
some macro tokens |
If the result of a macro refers to at least one macro token (as is the case in this example), then the processing of these subsequent macro tokens in sResult requires that you specify that you will be using macros for macro indices cannot be gleaned from the list of tokens of the scanned from the GridTemplate.
•If you can tell, at the time of writing the macro, which other macro will be used, then you can use the INCLUDE_MACRO compiler directive in the body of the macro, or set this parameter as one of the initial conditions of the Macros property used for the corresponding DiaryGridLine. •If you cannot tell, at the time of writing the macro, which other macro will be used, then you must set the INCLUDE_MACRO compiler directive within the initial conditions of the Macros property. |
Reference date of recursively generated tokens
Note that whenever using tokens recursively within a macro, the base date of the token (the date of the token minus the DayValue) being converted as the result of a recursion, is the same base date as that of the original macro token.
This means that unless you want the recursively used token to be based on a different date than the original token, you should always use the same DayValue as that of the incoming macro token. The safest way to do this is to always use the n_TokenDayValue system variable when constructing a token in a macro.
Topic 135500, last updated on 22-Nov-2021