Beispiel #1
0
 private Maybe<String> lookInParentPages(String name) {
   for (SourcePage sourcePage : page.getAncestors()) {
     if (!inCache(sourcePage)) {
       // The cache is passed along... page is rendered as a normal page.
       Parser.make(copyForPage(sourcePage), sourcePage.getContent()).parse();
       putVariable(sourcePage, "", Maybe.noString);
     }
     Maybe<String> result = findVariableInCache(sourcePage, name);
     if (!result.isNothing()) return result;
   }
   return Maybe.noString;
 }
 private void runNewParser(String input) throws Exception {
   long start = System.currentTimeMillis();
   WikiPage page = new TestRoot().makePage("NewTest");
   // String result = ParserTest.translateTo(new TestRoot().makePage("NewTest"), pageContent);
   Symbol list = Parser.make(new ParsingPage(new WikiSourcePage(page)), input).parse();
   System.out.println(System.currentTimeMillis() - start);
   start = System.currentTimeMillis();
   /*String result =*/ new HtmlTranslator(
           new WikiSourcePage(page), new ParsingPage(new WikiSourcePage(page)))
       .translateTree(list);
   System.out.println(System.currentTimeMillis() - start);
   // System.out.println(result);
   assertEquals("done", "done");
 }