§ 2.3.4 - Built-in Parameter and Content Handling for Both Styles and Built-insGenerally, aa_macro syntax inside the braces is: the keyword or stylename, followed by a space, followed by the parameter(s) and/or content. Of which, if there is more than one, may be separated by spaces or commas, and sometimes your own custom separators, depending on the particular built-in and what the parameter is likely to consist of. If, however, you invoke anything that expects parameters and/or content without a trailing space after the keyword or stylename, it will use the most recently encountered parameter(s.) So in order to ensure you pass no parameters, you must follow the built-in or stylename with a space. Here's a demonstration using the wordcount built-in: [wc this is a test] [wc] [wc ] 4 4 0 The content (this is a test) was evaluated once. By this I mean that the content was determined when evaluated during the first [wc] invocation, then that content was provided to the second [wc] without re-evaluation. The third [wc] returned zero because it had a trailing space and no further content. Another example: [b fancy [color F84 me] up] [i] [u] fancy me up fancy me up fancy me up What is happening there is that because macro() evaluates from the inside out and then left to right, the actual content that reaches the [b] (bold) built-in is the result of the [color] built-in, not the [color] built-in itself. One way to handle this when you intend to provide no content to a style or a built-in that normally expects content or keywords, always put a space after a stylename or built-in. In the case of something that does not expect content, such as [co] (the comma escape), the space is not necessary. Most of the time this won't cause you any trouble; and from time to time, you may be able to take advantage of the fact that the content of the previous parameter evaluation remains available. Another approach you can use within a style is to pre-clear content intentionally before the style does any further processing. For instance, using the [comment] tag with no content (just a single space after the tag name) first in a style can accomplish this... [style flexlink [comment ][a paramhandle.html[b],parameters]] [u underline] [i] {parameters} {parameters #clearbexample} underline underline parameters ( points to paramhandle.html ) parameters ( points to paramhandle.html#clearbexample ) ...what is happening there is the [u] underline built-in receives the content "underline", then because content has not been changed since then and the [i] built-in wasn't given a parameter, [i] inherits the previous content, still "underline". Then the parameters style is invoked, which uses the [comment] tag to clear the content, and that way, if no content is passed to the content of the style, none will be present. However, when content is provided to the parameters style, it is passed along normally. § 2.3.4.1 - More About Style ParametersThere will be times when you want to pass more than one bit of content to a style, and that is also available as part of the class functionality. You can learn about it below where [split] and [parm] are described. Within the built-in reference there are multiple examples of using styles. If you have questions or suggestions, please contact me using the information at the top of the aa_macro.py file.
Keyboard Navigation
, Previous Page . Next Page t TOC i Index |