Package com.github.mustachejava

Examples of com.github.mustachejava.Mustache.execute()


        }
   
        // Body
        {
          StringWriter sw = new StringWriter();
          bodyTemplate.execute(sw, parameters);
          String formatted = sw.toString();
          message.setHtmlContent(formatted);
        }
      } catch(Exception e) {
        logger.error("Unable load CouchDb e-mail template",e);
View Full Code Here


    MustacheFactory mf = new DefaultMustacheFactory();

    Mustache mustache = mf.compile("template.mustache");

    Writer stdout = new OutputStreamWriter(System.out);
    mustache.execute( stdout, new HelloMustache() );
    stdout.flush();
  }

  /**. */
  public static void hard_coded_template_with_Map() throws IOException {
View Full Code Here

    scopes.put("feature", new Feature("Perfect!"));

    Mustache mustache = mf.compile(new StringReader("{{name}}, {{feature.description}}!"), "example");

    Writer stdout = new OutputStreamWriter(System.out);
    mustache.execute(stdout, scopes);
    stdout.flush();
  }

  /** external template evaluated with HelloMustache object. */
  public static void main(String[] args) throws IOException {
View Full Code Here

     *             if an error occurred during write
     */
    public void generate(Writer writer) throws IOException {
        MustacheFactory mf = new DefaultMustacheFactory();
        Mustache mustache = mf.compile("data/t2flow/workflow.mustache");
        mustache.execute(writer, workflow).flush();
    }

    /**
     * Creates a valid port name from the provided measure URI.
     *
 
View Full Code Here

            try {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    mustache.execute(writer, type).flush();
                }
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
        } finally {
View Full Code Here

      Mustache mustache = mustaches.compile(templateClass);

      StringWriter writer = new StringWriter();
      Map<?, ?> scope = toMustacheScope(context);

      Writer execute = mustache.execute(writer, scope);
      execute.flush();

      return writer.toString();

    } catch (IOException e) {
View Full Code Here

            try {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    mustache.execute(writer, type).flush();
                }
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
        } finally {
View Full Code Here

      InputStreamReader reader = new InputStreamReader(url.openStream(),
          Charset.forName("UTF-8"));
      Mustache mustache = getMustacheFactory().compile(reader,
          templatePath);

      mustache.execute(writer, outputTemplate).flush();
      writer.close();
      LOG.info("Done!");
    } catch (MalformedURLException e) {
      throw new GenerateException(e);
    } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.