import re
import pathlib


def _emitter(target, source, env):
    """Define a generic emitter for the LaTeX exporting"""
    if re.search("--export-latex", env.get("INKSCAPEFLAGS", "")):
        target.extend(
            [str(_) + "_tex" for _ in target
             if pathlib.Path(str(_)).suffix in (".pdf", ".ps", ".eps")
             ]
        )

    return target, source