@Test
  @Ignore
  public void testRenderHtml() throws Exception {
    FileContent inputFileContent = new FileContent(inputFile);

    WikiConfig wikiConfig = getConfig();
    PageTitle pageTitle = PageTitle.make(wikiConfig, inputFile.getName());
    PageId pageId = new PageId(pageTitle, -1);
    String wikitext = inputFileContent.getContent();
    ExpansionCallback expCallback = null;

    EngProcessedPage ast = getEngine().postprocess(pageId, wikitext, expCallback);

    TestCallback rendererCallback = new TestCallback();

    String actual = HtmlRenderer.print(rendererCallback, wikiConfig, pageTitle, ast);

    File expectedFile =
        TestResourcesFixture.rebase(
            inputFile,
            INPUT_SUB_DIR,
            EXPECTED_AST_SUB_DIR,
            "html",
            true /* don't throw if file doesn't exist */);

    FileCompare cmp = new FileCompare(getResources());
    cmp.compareWithExpectedOrGenerateExpectedFromActual(expectedFile, actual);
  }
Ejemplo n.º 2
0
  public void visit(InternalLink link) {
    try {
      PageTitle page = PageTitle.make(config, link.getTarget());
      if (page.getNamespace().equals(config.getNamespace("Category"))) {
        return;
      }
    } catch (LinkTargetException e) {
    }

    write(link.getPrefix());
    if (link.getTitle().getContent() == null || link.getTitle().getContent().isEmpty()) {
      write(link.getTarget());
    } else {
      iterate(link.getTitle());
    }
    write(link.getPostfix());
  }