Samples
The directory Arbortext-path/samples/APP contains sample stylesheet modules that demonstrate how to achieve some common PTC ALD tasks and effects that cannot be configured via the Arbortext Styler UI.
For additional reading to accompany a sample, please refer to its equivalent topic:
• Blocks
• Color
• Counters and variables
• Testing
• Text properties
Each of the samples are delivered in a set that contains a sample XML file, a sample stylesheet, a feature-specific stylesheet module that contains the required property sets and source edits, and a PDF that demonstrates the output of the feature. The top level of the samples directory also contains baseStylesheet.style. The stylesheet applies common formatting properties for all the sample files.
To review the samples, carry out the steps listed below. This example uses the applyAttributes sample, located at Arbortext-path/samples/APP/Testing/Attributes.
1. Open the sample XML file. e.g. applyAttributes.xml
2. Open the sample stylesheet, e.g. applyAttributes.style.
Check that the sample stylesheet includes the base stylesheet, baseStylesheet.style, and the feature specific stylesheet, e.g. applyAttributesPropertySets.style, as its modules. If not, add these.
3. Review the relevant source edits in the stylesheet via the > > menu option. The source edits are commented in the feature stylesheet module so will be easily recognizable. The sample XML file contains a summary of what source edits have been applied to the stylesheet.
|
You can reuse a feature specific module in your own stylesheet. Associate it as a module of your own stylesheet to use the property set code that defines the feature.
|
Autogenerated PTC ALD Code
Each of the property sets in the feature-specific stylesheet modules include autogenerated PTC ALD code, which defines the variables that will hold default block, style, and paragraph details:
var block = arguments[0];
var paragraph = block.defaultParagraph;
var style = block.defaultStyle;
var contextProp = arguments[1];
The code to support the sample features then follows.
An explanation of the lines is provided below:
• var block = arguments[0]; and var contextProp = arguments[1];
These lines set the block and contextProp variables to expect the appropriate objects from the contexts function that is calling the property set.
The arguments object is an array of the parameters passed on the line that calls the propertySets function.
• var paragraph = block.defaultParagraph;
The variable named paragraph will hold the default paragraph styling for the block. The styling will be defined by the block’s defaultParagraph property, which specifies paragraph property fallbacks for block contents in the form of an fParagraph object with associated properties.
• var style = block.defaultStyle;
The variable named style will hold the default styling for the block itself. The styling will be defined by the block’s defaultStyle property, which specifies property fallbacks for the block in the form of an fStyle object with associated properties.