/** If you are not generating via ant run , you can call this function from your app. */
  public void generateOutput() {
    populateLayouts();

    List<File> fileList =
        FileUtil.listFiles(configuration.getHamlPath(), configuration.isRecursive());

    for (File hamlFile : fileList) {
      try {
        String subdir = FileUtil.getSubDirectory(hamlFile, configuration.getHamlPath());

        if (isLayoutFolder(configuration.getHamlPath() + subdir)) continue;

        createFolderIfNotExists(configuration.getOutputPath() + subdir);

        String hamlOutput = getHamlOutput(hamlFile);
        File outputFile =
            new File(
                configuration.getOutputPath()
                    + subdir
                    + StringUtils.replace(
                        hamlFile.getName(), ".haml", "." + configuration.getOutputExtension()));

        writeToFile(outputFile, hamlOutput);
      } catch (Exception e) {
        System.err.println("Unable to convert haml file : " + hamlFile.getName());
        e.printStackTrace();
      }
    }
  }
 /**
  * Iterates the layouts in the haml/layouts folder and stores the processed MarkUp into a HashMap.
  * The key is the filename.
  */
 public void populateLayouts() {
   JHaml jhaml = new JHaml();
   this.layouts.clear();
   File file = new File(configuration.getHamlLayoutPath());
   for (File layoutFile : file.listFiles(FileUtil.getHamlFilenameFilter())) {
     try {
       this.layouts.put(layoutFile.getName(), jhaml.parse(FileUtils.readFileToString(layoutFile)));
     } catch (Exception e) {
       System.err.println("Unable to convert layout : " + layoutFile.getName());
       e.printStackTrace();
     }
   }
 }