@Test
  public void canParseAProperDirective() {
    when(parser.moveNext(1)).thenReturn(new Symbol(SymbolType.Whitespace));
    final Symbol expectedSymbol = new Symbol(SymbolType.Text, "thePomFile");
    when(parser.parseTo(SymbolType.EndCell)).thenReturn(expectedSymbol);

    final Maybe<Symbol> result = mavenClasspathSymbolType.parse(symbol, parser);
    assertNotNull(result);
    assertNotSame(Symbol.nothing, result);
  }
 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");
 }
Beispiel #3
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();
    }
  }