File type: Export template

File type: Export template

Overview

An export template describes a way for a set to be exported to a HTML or other text files.

Package format

An export template is described in a package with the .mse-export-template file extension. Its name should begin with game- where game is the name of the game the template is made for. It should contain a data file called export-template with the following properties.

Properties

Property Type Default Description
Common to all packages
mse version version required Version of MSE this export template is made for.
short name string file name A short name of this export template, for the 'new set' and style panel lists.
full name string file name A longer name of this export template.
icon filename none Filename of an icon / preview for this export template, for the 'export to HTML' dialog.
position hint number Where to place this item in the list? Lower numbers come first.
version version 0.0.0 Version number of this package.
depends on list of dependencies Packages this package depends on.
Specific to export template
game Name of a game required Game this export template is made for
file type string "HTML files (*.html)|*.html" File type to use, this is a list separated by | characters. Alternatingly, a human description and a file pattern to match are given.
create directory boolean false Should a directory for data files be created? This is required for some script function.
option fields list of fields Fields for additional options to show.
option style field map of styles Styling for the option fields.
script script Script that generates the text that will be written to the exported file.

During the evaluation of the script the following variables are available:

game The current game.
style The current stylesheet.
set The set being exported.
cards The cards selected by the user.
options The values of the option fields.
directory Name of the directory created (if create directory is set).

See also

The following functions are made specifically for exporting to html:

to_html Convert tagged text to html.
symbols_to_html Convert text to html using a symbol font.
to_text Remove all tags from tagged text.
copy_file Copy a file from the export template to the output directory.
write_text_file Write a text file to the output directory.
write_image_file Write an image file to the output directory.

Example

Look at the "magic-spoiler.mse-export-template" for an example.