public HtmlWriter srcPos() { return srcPos(context.getCurrentNode().getChars()); }
private void render(final TableRow node, final NodeRendererContext context, HtmlWriter html) { html.srcPos(node.getChars()).withAttr().tagLine("tr", new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
private void render(final TableCaption node, final NodeRendererContext context, HtmlWriter html) { html.srcPos(node.getChars()).withAttr().tagLine("caption", new Runnable() { @Override public void run() { context.renderChildren(node); } }); }
@SuppressWarnings("WeakerAccess") public HtmlWriter srcPosWithEOL(BasedSequence sourceText) { if (sourceText.isNotNull()) { return srcPos(sourceText.getStartOffset(), sourceText.getEndOffset()); } return this; }
@SuppressWarnings("MethodMayBeStatic") void render(ThematicBreak node, NodeRendererContext context, HtmlWriter html) { html.srcPos(node.getChars()).withAttr().tagVoidLine("hr"); }
@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); } }); } });
public HtmlWriter srcPos(BasedSequence sourceText) { if (sourceText.isNotNull()) { BasedSequence trimmed = sourceText.trimEOL(); return srcPos(trimmed.getStartOffset(), trimmed.getEndOffset()); } return this; }
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"); } }
@Override public void run() { html.srcPos(node.getText()).withAttr().tag("span"); context.renderChildren(node); html.tag("/span"); } });
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 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 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(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(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(Strikethrough node, NodeRendererContext context, HtmlWriter html) { if (strikethroughStyleHtmlOpen == null || strikethroughStyleHtmlClose == null) { if (context.getHtmlOptions().sourcePositionParagraphLines) { html.withAttr().tag("del"); } else { html.srcPos(node.getText()).withAttr().tag("del"); } context.renderChildren(node); html.tag("/del"); } else { html.raw(strikethroughStyleHtmlOpen); context.renderChildren(node); html.raw(strikethroughStyleHtmlClose); } }
private void render(Subscript node, NodeRendererContext context, HtmlWriter html) { if (subscriptStyleHtmlOpen == null || subscriptStyleHtmlClose == null) { if (context.getHtmlOptions().sourcePositionParagraphLines) { html.withAttr().tag("sub"); } else { html.srcPos(node.getText()).withAttr().tag("sub"); } context.renderChildren(node); html.tag("/sub"); } else { html.raw(subscriptStyleHtmlOpen); context.renderChildren(node); html.raw(subscriptStyleHtmlClose); } }
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(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"); } } }