Пример #1
0
 /**
  * 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();
     }
   }
 }
Пример #2
0
 /**
  * Gets the XHTML Output based on the hamlFile given
  *
  * @param hamlFile the haml file object
  * @return JSP String
  * @throws IOException if unable to read the file.
  */
 public String getHamlOutput(File hamlFile) throws IOException {
   JHaml jhaml = new JHaml();
   return jhaml.parse(FileUtils.readFileToString(hamlFile));
 }