Build a new filter plugin¶
AMC has two built-in source file types : LaTeX and AMC-TXT. You can add some more...
Files to be written¶
To define a new file type named mytype
, you need to create two perl modules with the following files:
$HOME/.AMC.d/plugins/mytype/perl/AMC/Filter/register/mytype.pm $HOME/.AMC.d/plugins/mytype/perl/AMC/Filter/mytype.pm
Have a look at the corresponding files for type plain
(LaTeX files) and the parents modules (AMC/Filter/register.pm
and AMC/Filter.pm
) to see how they are built. The AMC::Filter::register::mytype
module is used to register this new file type in AMC, and the AMC::Filter::mytype
module is used to process an input file written with our new type to a LaTeX file. As an example, the processing part of AMC::Filter::mytype
only copies the file:
sub filter { my ($self,$input_file,$output_file)=@_; copy($input_file,$output_file); }
Pack the code¶
If you want to publish your module so that another user can use it, make a ZIP archive with the mytype
tree from your $HOME/.AMC.d/plugins/
directory. That's it!