protected String processTmplFile(File inFolder, File file) throws IOException {
        final String template = FileUtils.readFileToString(file);

        Map<String, String> parameters = new HashMap<>();

        Map<String, String> dependencies = listReferencedFiles(template);
        Map<String, String> imagesDependencies = listImages(template, inFolder);

        for (String key : globals.stringPropertyNames()) {
            parameters.put(key, globals.getProperty(key));
        }

        for (String dep : dependencies.keySet()) {
            if (!fileMap.containsKey(dep)) {
                File tmplFile = new File(inFolder.getAbsolutePath() + File.separator + dep);
                String result = processTmplFile(inFolder, tmplFile);
                FileInfo fileInfo = new FileInfo(result);
                fileMap.put(dep, fileInfo);
            }

            parameters.put(dependencies.get(dep), fileMap.get(dep).getText());
        }

        for (String iDep : imagesDependencies.keySet()) {
            parameters.put(iDep, imagesDependencies.get(iDep));
        }

        String result = null;

        Engine engine = Engine.getEngine();
        try {
            Template template1 = engine.parseTemplate(template);
            result = (String) template1.evaluate(parameters);
        } catch (ParseException ex) {
            java.util.logging.Logger.getLogger(FilesystemWalker.class.getName()).log(Level.SEVERE, null, ex);
        }

        return result;
    }