Creating a plugin

Creating a plugin should be quite easy, it requires 3 steps:

  • Extend the base plugin class, implementing these abstract methods:

    class doconv.plugin.base.PluginBase[source]
    check_dependencies()[source]

    Check that all neccessary dependencies for a particular plugin are available in the system, raise an exception otherwise.

    convert(input_file, output_file, input_format, output_format)[source]

    Convert a input_file from a specified format to another

    get_supported_conversions()[source]

    Return the conversions provided by the plugin implementing this method.

  • If the plugin requires some external files, for example XSLT files, store them in a directory with the plugin’s name and remember to add the directory to the MANIFEST.in.

  • Add an entry point for your new plugin to setup.py:

    entry_points={
        'console_scripts': [
            'doconv = doconv.doconv:main'
            ],
        'doconv.converter': [
            'asciidoc = doconv.plugin.asciidoc:AsciiDoc',
            'docbooktodita = doconv.plugin.docbooktodita:DocBookToDita',
            'yournewplugin = doconv.plugin.yournewplugin:YourNewPlugin',
            ],
        },
    

You are done! In case you would like to contribute your new plugin, see how to contribute.