Package com.github.mustachejava

Examples of com.github.mustachejava.DefaultMustacheFactory$FragmentCacheLoader


    System.out.println(out.toString());
  }

  @Test
  public void testToJson5() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli3.mustache");
    Path file = getPath("src/test/resources/fdbcli.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);

    MappingJsonFactory jf = new MappingJsonFactory();
View Full Code Here


    private final MustacheFactory factory;
    private Pattern acceptPattern;

    /** Uses the {@link DefaultMustacheFactory} */
    public MustacheRenderer(){
        this.factory = new DefaultMustacheFactory();
    }
View Full Code Here

        expect(request.getContext("session")).andReturn(Collections.<String,Object>emptyMap());
        expect(request.getContext(Request.APPLICATION_SCOPE)).andReturn(Collections.<String,Object>emptyMap());
        expect(request.getWriter()).andReturn(writer).anyTimes();

        replay(request, applicationContext, applicationResource);
        Renderer renderer = new MustacheRenderer(new DefaultMustacheFactory() {
                @Override
                public Reader getReader(String path) {
                    return new InputStreamReader(getClass().getResourceAsStream(path), Charset.forName("utf-8"));
                }
            });
View Full Code Here

        if (!new File(rootDir, filename).exists()) {
          System.out.println("template not found, skipping: " + filename);
          return;
        }

        MustacheFactory mc = new DefaultMustacheFactory(rootDir);
        Mustache mustache = mc.compile(filename);

        String base = filename.substring(0, filename.lastIndexOf("."));
        File file = new File(mocks, base + ".json");
        Map parameters = new HashMap<Object, Object>(req.getParameterMap()) {
          @Override
View Full Code Here

     */
    private Mustache createMustache(Reader resourceReader, String resourceUri) throws IOException {
        try {
            Mustache newMustache;
            if (startDelimiter != null && endDelimiter != null && mustacheFactory instanceof DefaultMustacheFactory) {
                DefaultMustacheFactory defaultMustacheFactory = (DefaultMustacheFactory) mustacheFactory;
                newMustache = defaultMustacheFactory.compile(resourceReader, resourceUri, startDelimiter, endDelimiter);
            } else {
                newMustache = mustacheFactory.compile(resourceReader, resourceUri);
            }
            return newMustache;
        } finally {
View Full Code Here

  private Object context;

  private ResourceSet(Class<?> contextClass, String dir) {
    this.contextClass = contextClass;
    this.dir = dir;
    this.mustaches = new DefaultMustacheFactory(dir);
  }
View Full Code Here

  private Object context;

  private ResourceSet(Class<?> contextClass, String dir) {
    this.contextClass = contextClass;
    this.dir = dir;
    this.mustaches = new DefaultMustacheFactory(dir);
  }
View Full Code Here

    } catch (IllegalArgumentException e) {
      Args.usage(Main.class);
      System.exit(1);
    }

    MustacheFactory mb = new DefaultMustacheFactory("templates/" + language) {
      @Override
      public void encode(String value, Writer writer) {
        try {
          writer.write(value);
        } catch (IOException e) {
          throw new MustacheException();
        }
      }
    };
    Mustache mustache = mb.compile(template + ".txt");

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    XPathFactory xpf = XPathFactory.newInstance();
    final DocumentBuilder db = dbf.newDocumentBuilder();
    final XPathExpression replyX = xpf.newXPath().compile("//a");
View Full Code Here

    return mustacheFactory.compile(name + ".mustache");
  }

  MustacheFactory newMustacheFactory(PagesBaseDir pagesBaseDir) {
    String resourceRoot = pagesBaseDir.getBaseDir();
    return new DefaultMustacheFactory(resourceRoot);
  }
View Full Code Here

  private Object context;

  private ResourceSet(Class<?> contextClass, String dir) {
    this.contextClass = contextClass;
    this.dir = dir;
    this.mustaches = new DefaultMustacheFactory(dir);
  }
View Full Code Here

TOP

Related Classes of com.github.mustachejava.DefaultMustacheFactory$FragmentCacheLoader

Copyright © 2018 www.massapicom. 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.