@Override public void run() { if (!options.footnoteLinkRefClass.isEmpty()) html.attr("class", options.footnoteLinkRefClass); html.attr("href", "#fn-" + footnoteOrdinal); html.withAttr().tag("a"); html.raw(options.footnoteRefPrefix + String.valueOf(footnoteOrdinal) + options.footnoteRefSuffix); html.tag("/a"); } });
public HtmlWriter withAttr(LinkStatus status) { attr(Attribute.LINK_STATUS_ATTR, status.getName()); return withAttr(AttributablePart.LINK); }
void render(final OrderedList node, final NodeRendererContext context, HtmlWriter html) { int start = node.getStartNumber(); if (listOptions.isOrderedListManualStart() && start != 1) html.attr("start", String.valueOf(start)); html.withAttr().tagIndent("ol", new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
private void render(final TableBlock node, final NodeRendererContext context, HtmlWriter html) { if (!options.className.isEmpty()) { html.attr("class", options.className); } html.srcPosWithEOL(node.getChars()).withAttr().tagLineIndent("table", new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
@Override public void run() { if (!paragraphClass.isEmpty()) html.attr("class", paragraphClass); html.srcPos(sourceText.getStartOffset(), sourceText.getEndOffset()).withAttr(TASK_ITEM_PARAGRAPH).tagLine("p", new Runnable() { @Override public void run() { html.raw(node.isItemDoneMarker() ? doneMarker : notDoneMarker); context.renderChildren(node); } }); } });
private void render(GfmUser node, NodeRendererContext context, HtmlWriter html) { if (context.isDoNotRenderLinks()) { html.text(node.getChars()); } else { StringBuilder sb = new StringBuilder(); sb.append(options.gitHubIssuesUrlRoot).append(options.gitHubIssueUrlPrefix).append(node.getText()).append(options.gitHubIssueUrlSuffix); html.srcPos(node.getChars()).attr("href", sb.toString()).withAttr().tag("a"); html.raw(options.gitHubUserTextPrefix); html.text(node.getChars()); html.raw(options.gitHubUserTextSuffix); html.tag("/a"); } }
private void render(GfmIssue node, NodeRendererContext context, HtmlWriter html) { if (context.isDoNotRenderLinks()) { html.text(node.getChars()); } else { StringBuilder sb = new StringBuilder(); sb.append(options.gitHubIssuesUrlRoot).append(options.gitHubIssueUrlPrefix).append(node.getText()).append(options.gitHubIssueUrlSuffix); html.srcPos(node.getChars()).attr("href", sb.toString()).withAttr().tag("a"); html.raw(options.gitHubIssueTextPrefix); html.text(node.getChars()); html.raw(options.gitHubIssueTextSuffix); html.tag("/a"); } }
private void renderEmbedLink(final EmbedLink node, final NodeRendererContext context, final HtmlWriter html) { if (context.isDoNotRenderLinks()) { context.renderChildren(node); } else { ResolvedLink resolvedLink = context.resolveLink(LinkType.LINK, node.getUrl().unescape(), null); html.attr("title", node.getText()) .attr("src", resolvedLink.getUrl()) .withAttr() .tag("embed", true); } }
private void render(TableCell node, NodeRendererContext context, HtmlWriter html) { String tag = node.isHeader() ? "th" : "td"; if (node.getAlignment() != null) { html.attr("align", getAlignValue(node.getAlignment())); } if (options.columnSpans && node.getSpan() > 1) { html.attr("colspan", String.valueOf(node.getSpan())); } html.srcPos(node.getText()).withAttr().tag(tag); context.renderChildren(node); html.tag("/" + tag); }
private void render(Abbreviation node, NodeRendererContext context, HtmlWriter html) { String text = node.getChars().unescape(); BasedSequence abbreviation = node.getAbbreviation(); String tag; if (options.useLinks) { html.attr("href", "#"); tag = "a"; } else { tag = "abbr"; } html.attr("title", abbreviation); html.srcPos(node.getChars()).withAttr().tag(tag); html.text(text); html.closeTag(tag); }
private void render(final GitLabInlineMath node, final NodeRendererContext context, final HtmlWriter html) { html.withAttr().attr(Attribute.CLASS_ATTR, options.inlineMathClass).withAttr().tag("span"); html.text(node.getText()); html.tag("/span"); }
private void render(Zzzzzz node, NodeRendererContext context, HtmlWriter html) { if (options.zzzzzzOption1) html.attr("href", context.encodeUrl(options.zzzzzzOption2)); html.withAttr().tag("a"); html.text(node.getText().unescape()); html.tag("/a"); }
private void render(ZzzzzzBlock node, NodeRendererContext context, HtmlWriter html) { if (options.zzzzzzOption1) html.attr("href", context.encodeUrl(options.zzzzzzOption2)); html.withAttr().tag("a"); html.text(node.getText().unescape()); html.tag("/a"); }
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"); } } }
private void render(BasedSequence contentChars, String language, NodeRendererContext context, HtmlWriter html) { String text = contentChars.normalizeEOL(); if (!text.isEmpty()) { if (!language.isEmpty()) { html.attr("class", context.getHtmlOptions().languageClassPrefix + language); } html.line(); html.tag("pre").openPre(); html.srcPos(contentChars).withAttr().tag("code"); html.text(text); html.tag("/code"); html.tag("/pre").closePre(); html.line(); } }
private void render(TableCell tableCell, NodeRendererContext context, HtmlWriter html) { String tag = tableCell.isHeader() ? "th" : "td"; if (tableCell.getAlignment() != null) { html.attr("align", getAlignValue(tableCell.getAlignment())); } html.withAttr().tag(tag); context.renderChildren(tableCell); html.tag("/" + tag); }
@SuppressWarnings("MethodMayBeStatic") void render(AutoLink node, NodeRendererContext context, final HtmlWriter html) { final String text = node.getText().toString(); if (context.isDoNotRenderLinks() || isSuppressedLinkPrefix(node.getUrl(), context)) { html.text(text); } else { ResolvedLink resolvedLink = context.resolveLink(LinkType.LINK, text, null); html.srcPos(node.getText()).attr("href", resolvedLink.getUrl().startsWith("www.") ? context.getHtmlOptions().autolinkWwwPrefix + resolvedLink.getUrl() : resolvedLink.getUrl()) .withAttr(resolvedLink) .tag("a", false, false, new Runnable() { @Override public void run() { html.text(text); } }); } }
void render(IndentedCodeBlock node, NodeRendererContext context, HtmlWriter html) { html.line(); html.srcPosWithEOL(node.getChars()).withAttr().tag("pre").openPre(); String noLanguageClass = context.getHtmlOptions().noLanguageClass.trim(); if (!noLanguageClass.isEmpty()) { html.attr("class", noLanguageClass); } html.srcPosWithEOL(node.getContentChars()).withAttr(CODE_CONTENT).tag("code"); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().trimTailBlankLines().normalizeEndWithEOL()); } html.tag("/code"); html.tag("/pre").closePre(); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); }
private void render(WikiLink node, NodeRendererContext context, HtmlWriter html) { if (!context.isDoNotRenderLinks()) { if (options.disableRendering) { html.text(node.getChars().unescape()); } else { ResolvedLink resolvedLink = context.resolveLink(WikiLinkExtension.WIKI_LINK, node.getLink().unescape(), null); html.attr("href", resolvedLink.getUrl()); html.srcPos(node.getChars()).withAttr(resolvedLink).tag("a"); context.renderChildren(node);//html.text(node.getText().isNotNull() ? node.getText().toString() : node.getPageRef().toString()); html.tag("/a"); } } }
void render(Link node, NodeRendererContext context, HtmlWriter html) { if (context.isDoNotRenderLinks() || isSuppressedLinkPrefix(node.getUrl(), context)) { context.renderChildren(node); } else { ResolvedLink resolvedLink = context.resolveLink(LinkType.LINK, node.getUrl().unescape(), null, null); html.attr("href", resolvedLink.getUrl()); // 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).tag("a"); renderChildrenSourceLineWrapped(node, node.getText(), context, html); html.tag("/a"); } }