@Override public String makeUrl(PageTitle target) { String page = UrlEncoding.WIKI.encode(target.getNormalizedFullTitle()); String f = target.getFragment(); String url = page; if (f != null && !f.isEmpty()) url = page + "#" + UrlEncoding.WIKI.encode(f); return LOCAL_URL + "/" + url; }
@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); }
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()); }