Rules Editor Home | Documentation Home | Stilo
Guide to
Migrate 3.2.0 Rules Editor
Stilo
Context Test
Context Tests

The context tracking annotation may be used to track arbitrary contextual information about your document. The Migrate conversion does not use this annotation, but you can set context and then test it from other rules to help get annotations applied correctly. For more information on setting the context with annotations see Context Annotations.

Typically, context is used to track information that came earlier in the document and that you no longer have access to. For example, you may have decided that you are in a task topic based on the styling of a title. This information may be useful when attempting to apply annotations to the text of that topic. But the following paragraphs only have information about themselves, their styles and their properties. In order to remember that you are in a task topic, you can set some context and then test for it. The context you choose to set is entirely up to you. Migrate does not interpret it.

Don't forget to clear or reset your context at the right time. If your task topic is finished, you want to make sure to clear that from your topic type context. If you can't find a way to do this reliably, you probably should not make use of the context tracking mechanism.

You can also choose to track more than one type of context. For example, you can track both topic type and list nesting context. To keep these things separate, you organize your context into classes.

Each piece of context information has an associated label and depth. Topics in your source document may be structured hierarchically. You can use the label to capture the topic type, and the depth to capture the nesting level. These are the parameters for testing context.

class arbitrary class name used to distinguish different contexts tracked required
label a label describing the value of the context entry required
depth the depth of the context entry optional

If the depth parameter is not provided, the deepest context entry for the specified class will be tested.

context test
context test