XMPL Syntax Converter - XMPieLab/XMPL-V5 GitHub Wiki
To convert XMPL V3 to XMPL V5 syntax in web pages, use the Syntax Converter.
As a prerequisite, install NodeJS version 12 or later. If you don't have NodeJS, visit https://nodejs.org/, download and install it.
Note: Files and folder paths mustn't contain spaces.
The Syntax Converter makes the following changes to the HTML page:
-
Changes the text ADORs by adding a new
xmp-text
directive.Before conversion:
<p>{{xmp.r['FirstName']}}</p>
After conversion:
<p><span xmp-text="{{xmp.r['FirstName']}}"></span></p>
-
Changes the XMPL library to the new version.
-
Adds comments as to which attributes are not yet supported.
-
Moves the link to xmpcfg.js up to the library link.
To convert XMPL V3 syntax to XMPL V5 syntax in existing websites:
- Create a folder and place in it the migrate.js file.
- Install dependencies from the package.json file.
To do so, use the
npm install
command. - Choose the file or folder that you want to convert, and copy its path. Note! The files and folder path mustn't contain spaces.
- On the command line, where the migrate.js file is located, type:
node convert.js --input [[Path to file/folder that you want to convert to the new version]] --output [[Path to the folder where the new files will be located]]
. - When the conversion is complete, the output folder will contain files with the new syntax.
- In this folder a log.txt file is created containing information about the files that were converted. Example of a log file:
D:\{{path to the file}}\page.html
<!-- ==========================================================
xmp-repeat
xmp-text-asset
not yet supported in version 5.0
* ========================================================== -->
The log file stores information about attributes that are not yet supported, which appear as comments.
<tbody>
<!--xmp-repeat not yet supported in version 5.0-->
<tr xmp-repeat="item in xmp.r['Table']">
<td>{{item['FirstName']}}</td>
<td>{{item['LastName']}}</td>
<td>{{item['Gender']}}</td>
</tr>
</tbody>
Notes:
- Check what script to include in the head. You can find more information here.
- The Syntax Converter does not delete unneeded code.
Here is a tutorial video that demonstrates the use of the Syntax Converter.