private void render(final GitLabIns node, final NodeRendererContext context, final HtmlWriter html) { html.withAttr().tag("ins", false, false, new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
private void render(final GitLabDel node, final NodeRendererContext context, final HtmlWriter html) { html.withAttr().tag("del", false, false, new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
@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"); } });
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(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 render(Ins node, NodeRendererContext context, HtmlWriter html) { if (insStyleHtmlOpen == null || insStyleHtmlClose == null) { if (context.getHtmlOptions().sourcePositionParagraphLines) { html.withAttr().tag("ins"); } else { html.srcPos(node.getText()).withAttr().tag("ins"); } context.renderChildren(node); html.tag("/ins"); } else { html.raw(insStyleHtmlOpen); context.renderChildren(node); html.raw(insStyleHtmlClose); } }
private void render(Superscript node, NodeRendererContext context, HtmlWriter html) { if (superscriptStyleHtmlOpen == null || superscriptStyleHtmlClose == null) { if (context.getHtmlOptions().sourcePositionParagraphLines) { html.withAttr().tag("sup"); } else { html.srcPos(node.getText()).withAttr().tag("sup"); } context.renderChildren(node); html.tag("/sup"); } else { html.raw(superscriptStyleHtmlOpen); context.renderChildren(node); html.raw(superscriptStyleHtmlClose); } }
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); }
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(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"); } } }
@Override public void render(TextBase node, NodeRendererContext context, HtmlWriter html) { if (myOptions.assignTextAttributes) { final Attributes nodeAttributes = context.extendRenderingNodeAttributes(AttributablePart.NODE, null); if (!nodeAttributes.isEmpty()) { // has attributes then we wrap it in a span html.setAttributes(nodeAttributes).withAttr().tag("span"); context.delegateRender(); html.closeTag("span"); return; } } context.delegateRender(); } }));
private void outputNextLineBreakSpan(final Node node, final HtmlWriter html, final boolean outputBreakText) { final Range range = myLines.get(myNextLine); int eolLength = myEOLs.get(myNextLine); myNextLine++; // remove trailing spaces from text int countTrailing = node.getChars().baseSubSequence(nextLineStartOffset, range.getEnd() - eolLength).countTrailing(" \t"); if (!outputBreakText && countTrailing > 0) { countTrailing--; } eolLength += countTrailing; html.srcPos(nextLineStartOffset, range.getEnd() - eolLength).withAttr(PARAGRAPH_LINE).tag("span"); nextLineStartOffset = range.getEnd(); // remove leading spaces nextLineStartOffset += node.getChars().baseSubSequence(nextLineStartOffset, node.getChars().getBaseSequence().length()).countLeading(BasedSequence.WHITESPACE_NO_EOL_CHARS); }
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(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); }