Skip to main content

Tools

This section of the menu contains auxiliary and service tools for A-Parser.

Template testing

For quick template verification, A-Parser includes a built-in Template testing tool. It contains pre-installed results for all parsers based on test queries, which allows you to execute a formatting template without actual parsing. Here you can test templates for subsequent use in presets.

Templates testing

In the Project drop-down menu, you can select a ready-made result structure for one of the built-in parsers, or you can paste your own json into the JSON field. On the right, in the Template field, the template being tested is written, and at the bottom, in the Result field, after clicking the Run button, you can see the result of the template execution.

In template testing, all rules of the template engine work in full, so you can also test complex templates using built-in template engine tools.

Templates testing - elements

Elements of the Template testing tab:

Adding a new project


Deleting a project


Saving a project


Formatting a JSON document


Template execution speed diagnostics

Pre-installed projects cannot be saved; to save changes, you must add a new project.

Template testing is available for each parser separately; to do this, you must select a pre-installed project.

Results are presented in JSON format, which allows you to make changes to the source data if necessary.

After changing the template, it must be applied - the Run button in the upper right corner.

If the template is composed incorrectly, a detailed error will appear in the Result field:

Example of error output in a template

JavaScript Editor

JavaScript Editor

This tab is used to manage (create/edit/delete) functions used in tools.js.

Let's look at the following function as an example, which is available in the JavaScript Editor by default:

Tools.prototype.sum = function(a, b) {
// Function body (Additional calculations can be here)
return a + b;
}

sum - the name of the function by which it will be available via $tools.js.sum

a, b - function arguments (optional)

a + b - the returned result of the function

Function creation example

An example of creating a function to remove HTML tags and testing its operation in the Template testing tab.

Example of creating an html tag cleaning function

Function code:

Tools.prototype.removeHtmlTags = function(string) {
return string.replace(/<[^>]*>/g, '');
}

Result format:

[% FOREACH i IN serp;
tools.js.removeHtmlTags(i.snippet) _ "\n";
END %]
The result of the function removeHtmlTags

Updating A-Parser

Update A-Parser

On this tab, you can update A-Parser to the current version using the interface.

Service

This is a service tab where the following are available:

  • Debugging and diagnostics of A-Parser operation
  • Restarting and shutting down A-Parser
  • Translation editor

In most cases, these tools are used only for A-Parser development or problem diagnostics and are not needed by users for work.

Regex Builder

Regex Builder

The Regex Builder is used for quick composition of simple regular expressions. Its full description is available here.