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");
 }
Esempio n. 2
0
  @Override
  public String getHtml() {

    // -AJM- Okay, this is not as clean as I'd like it to be, but for now it does the trick
    if (containsWikitext()) {
      String content = getDecoratedContent();
      ParsingPage parsingPage = BaseWikitextPage.makeParsingPage((BaseWikitextPage) sourcePage);

      Symbol syntaxTree = Parser.make(parsingPage, content).parse();

      return new HtmlTranslator(new WikiSourcePage(sourcePage), parsingPage)
          .translateTree(syntaxTree);
    } else {
      return sourcePage.getHtml();
    }
  }