Modifiers are the specially formatted scripts. Text Accelerator uses these scripts to process the text. Physically the modifiers are the file located in the folder: %allusersprofile%\Tordex\Text Accelerator\scripts. Modifiers files have the extension ".tascript" and have the XML based formate. Below is the example htmlent modifier:
<?xml version="1.0" encoding="UTF-8"?> <tascript function="htmlent" language="JavaScript"> <description>Convert all applicable characters to HTML entities</description> <include file="libs\php.default.min.js"/> <params> <param id="input" input="true" /> </params> <script> <![CDATA[ function htmlent(input) { return htmlentities(input, "ENT_QUOTES"); } ]]> </script> </tascript>
tascript is the root node. Attributes:
This is just a description. Used for autocomplete help. Write something descriptive there.
With include node you can add the external script files. The included files must be in raw format (.js, .vbs). Please note the language of the included files must be the save as pointed in the language attribute of tascript element. tascript can contain some include directives.
Attributes:
This directive describes the parameters of the script. The node params must have one or more children nodes param. Every param node describes one parameter. The order of the param nodes is important. params node don't have any attribute.
Attributes of param node:
Every param element can have a children elements description and value. description element have a text to describe what this parameter do. The value element defines the possible values.
Attributes of value node:
Below is the example of the formatdate modifier with predefined parameters:
<?xml version="1.0" encoding="UTF-8"?> <tascript function="datefmt" language="VBScript"> <description>Formats the input date.</description> <params> <param id="input" input="true" /> <param id="format" def="0"> <description>Optional. Numeric value that indicates the date/time format used.</description> <value val="0">Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed.</value> <value val="1">Display a date using the long date format specified in your computer's regional settings.</value> <value val="2">Display a date using the short date format specified in your computer's regional settings.</value> <value val="3">Display a time using the time format specified in your computer's regional settings.</value> <value val="4">Display a time using the 24-hour format (hh:mm).</value> </param> </params> <script> <![CDATA[ function datefmt(input, format) datefmt = FormatDateTime(CDate(input), format) end function ]]> </script> </tascript>
This node contains the script for modifier. Use the CDATA section to write the script. Usually you have to write the function here that Text Accelerator calls to process the text. This section can be omitted if you include external script files and the processing function is in this file.