private void renderLooseParagraph(final Paragraph node, final NodeRendererContext context, final HtmlWriter html) { if (context.getHtmlOptions().noPTagsUseBr) { renderTextBlockParagraphLines(node, context, html, false); html.tagVoid("br").tagVoid("br").line(); } else { html.srcPosWithEOL(node.getChars()).withAttr().tagLine("p", new Runnable() { @Override public void run() { renderTextBlockParagraphLines(node, context, html, false); } }); } }
private void render(Emoji node, NodeRendererContext context, HtmlWriter html) { final EmojiResolvedShortcut shortcut = EmojiResolvedShortcut.getEmojiText(node, myOptions.useShortcutType, myOptions.useImageType, myOptions.rootImagePath); if (shortcut.emoji == null || shortcut.emojiText == null) { // output as text html.text(":"); context.renderChildren(node); html.text(":"); } else { if (shortcut.isUnicode) { html.text(shortcut.emojiText); } else { ResolvedLink resolvedLink = context.resolveLink(LinkType.IMAGE, shortcut.emojiText, null); html.attr("src", resolvedLink.getUrl()); html.attr("alt", shortcut.alt); if (!myOptions.attrImageSize.isEmpty()) html.attr("height", myOptions.attrImageSize).attr("width", myOptions.attrImageSize); if (!myOptions.attrAlign.isEmpty()) html.attr("align", myOptions.attrAlign); if (!myOptions.attrImageClass.isEmpty()) html.attr("class", myOptions.attrImageClass); html.withAttr(resolvedLink); html.tagVoid("img"); } } }
private void render(WikiImage node, NodeRendererContext context, HtmlWriter html) { if (!context.isDoNotRenderLinks()) { if (options.disableRendering) { html.text(node.getChars().unescape()); } else { String altText = node.getText().isNotNull() ? node.getText().toString() : node.getLink().unescape(); ResolvedLink resolvedLink = context.resolveLink(WikiLinkExtension.WIKI_LINK, node.getLink().unescape(), null); String url = resolvedLink.getUrl(); html.attr("src", url); html.attr("alt", altText); html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img"); } } }
@SuppressWarnings("MethodMayBeStatic") void render(Image node, NodeRendererContext context, HtmlWriter html) { if (!(context.isDoNotRenderLinks() || isSuppressedLinkPrefix(node.getUrl(), context))) { String altText = new TextCollectingVisitor().collectAndGetText(node); ResolvedLink resolvedLink = context.resolveLink(LinkType.IMAGE, node.getUrl().unescape(), null, null); String url = resolvedLink.getUrl(); if (!node.getUrlContent().isEmpty()) { // reverse URL encoding of =, & String content = Escaping.percentEncodeUrl(node.getUrlContent()).replace("+", "%2B").replace("%3D", "=").replace("%26", "&"); url += content; } html.attr("src", url); html.attr("alt", altText); // we have a title part, use that if (node.getTitle().isNotNull()) { resolvedLink.getNonNullAttributes().replaceValue(Attribute.TITLE_ATTR, node.getTitle().unescape()); } else { resolvedLink.getNonNullAttributes().remove(Attribute.TITLE_ATTR); } html.attr(resolvedLink.getAttributes()); html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img"); } }
private void renderLooseParagraph(final Paragraph node, final NodeRendererContext context, final HtmlWriter html) { if (context.getHtmlOptions().noPTagsUseBr) { renderTextBlockParagraphLines(node, context, html, false); html.tagVoid("br").tagVoid("br").line(); } else { html.srcPosWithEOL(node.getChars()).withAttr().tagLine("p", new Runnable() { @Override public void run() { renderTextBlockParagraphLines(node, context, html, false); } }); } }
html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img");
private void render(EmojiNode node, NodeRendererContext context, HtmlWriter html) { String emojiName = node.getText().toString(); String emojiUrl = null; if (RequestCycle.get() != null) { String emojiCode = EmojiOnes.getInstance().all().get(emojiName); if (emojiCode != null) { emojiUrl = RequestCycle.get().urlFor(new PackageResourceReference( EmojiOnes.class, "icon/" + emojiCode + ".png"), new PageParameters()).toString(); } } if (emojiUrl != null) { ResolvedLink resolvedLink = context.resolveLink(LinkType.IMAGE, emojiUrl, null); html.attr("src", emojiUrl); html.attr("alt", "emoji " + emojiName); if (!attrImageSize.isEmpty()) html.attr("height", attrImageSize).attr("width", attrImageSize); if (!attrAlign.isEmpty()) html.attr("align", attrAlign); html.withAttr(resolvedLink); html.tagVoid("img"); } else { // output as text html.text(":"); context.renderChildren(node); html.text(":"); } }
@SuppressWarnings("MethodMayBeStatic") void render(Image node, NodeRendererContext context, HtmlWriter html) { if (!(context.isDoNotRenderLinks() || isSuppressedLinkPrefix(node.getUrl(), context))) { String altText = new TextCollectingVisitor().collectAndGetText(node); ResolvedLink resolvedLink = context.resolveLink(LinkType.IMAGE, node.getUrl().unescape(), null, null); String url = resolvedLink.getUrl(); if (!node.getUrlContent().isEmpty()) { // reverse URL encoding of =, & String content = Escaping.percentEncodeUrl(node.getUrlContent()).replace("+", "%2B").replace("%3D", "=").replace("%26", "&"); url += content; } html.attr("src", url); html.attr("alt", altText); // we have a title part, use that if (node.getTitle().isNotNull()) { resolvedLink.getNonNullAttributes().replaceValue(Attribute.TITLE_ATTR, node.getTitle().unescape()); } else { resolvedLink.getNonNullAttributes().remove(Attribute.TITLE_ATTR); } html.attr(resolvedLink.getAttributes()); html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img"); } }
html.srcPos(node.getChars()).withAttr(resolvedLink).tagVoid("img");