public static void renderInlineHtml(HtmlInlineBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; if (escape) { html.text(node.getChars().normalizeEOL()); } else { html.rawPre(node.getChars().normalizeEOL()); } }
public void renderHtmlBlock(final HtmlBlockBase node, final DocxRendererContext docx, boolean suppress, boolean escape) { if (suppress) return; if (escape) { String normalizeEOL = node.getChars().normalizeEOL(); if (node instanceof HtmlBlock) { if (normalizeEOL.length() > 0 && normalizeEOL.charAt(normalizeEOL.length() - 1) == '\n') { // leave off the trailing EOL normalizeEOL = normalizeEOL.substring(0, normalizeEOL.length() - 1); } } // render as fenced code docx.renderFencedCodeLines(node.getContentLines()); //P p = docx.createP(); //docx.text(normalizeEOL); } else { try { docx.getDocxDocument().addAltChunk(AltChunkType.Html, node.getChars().toString().getBytes(Charset.forName("UTF-8"))); } catch (Docx4JException e) { e.printStackTrace(); } } }
public static void renderHtmlBlock(HtmlBlockBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape, final boolean trimSpaces) { if (suppress) return; if (node instanceof HtmlBlock) html.line(); String normalizeEOL = node instanceof HtmlBlock ? node.getContentChars().normalizeEOL() : node.getChars().normalizeEOL(); if (trimSpaces) { normalizeEOL = normalizeEOL.trim(); } if (escape) { if (node instanceof HtmlBlock) { if (normalizeEOL.length() > 0 && normalizeEOL.charAt(normalizeEOL.length() - 1) == '\n') { // leave off the trailing EOL normalizeEOL = normalizeEOL.substring(0, normalizeEOL.length() - 1); } html.raw("<p>").text(normalizeEOL).raw("</p>"); } else { html.text(normalizeEOL); } } else { html.rawPre((normalizeEOL)); } if (node instanceof HtmlBlock) { html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); } }
@Override public void run() { docx.setRunFormatProvider(new SourceCodeRunFormatProvider<>(docx, options.noCharacterStyles, options.codeHighlightShading)); docx.text(node.getChars().normalizeEOL()); } });
public void renderInlineHtml(HtmlInlineBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; html.raw("`").raw(node.getChars().normalizeEOL()).raw("`"); }
public void renderInlineHtml(HtmlInlineBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; html.raw("{{").raw(node.getChars().normalizeEOL()).raw("}}"); }
@SuppressWarnings("MethodMayBeStatic") void render(CodeBlock node, NodeRendererContext context, HtmlWriter html) { if (node.getParent() instanceof IndentedCodeBlock) { html.text(node.getContentChars().trimTailBlankLines().normalizeEndWithEOL()); } else { html.text(node.getContentChars().normalizeEOL()); } }
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(); } }
public void renderHtmlBlock(HtmlBlockBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; html.line().raw("{code:html}").line(); html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code:html}").line(); }
public void renderHtmlBlock(HtmlBlockBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; html.line().raw("{code:html}").line(); html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code:html}").line(); }
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }
private void render(final FencedCodeBlock node, final NodeRendererContext context, HtmlWriter html) { final BasedSequence info = node.getInfoDelimitedByAny(options.blockInfoDelimiters); if (options.renderBlockMath && info.equals("math")) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).attr(Attribute.CLASS_ATTR, options.blockMathClass).withAttr().tag("div").line().openPre(); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.closePre().tag("/div"); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); } else if (options.renderBlockMermaid && info.equals("mermaid")) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).attr(Attribute.CLASS_ATTR, options.blockMermaidClass).withAttr().tag("div").line().openPre(); if (codeContentBlock) { context.renderChildren(node); } else { html.text(node.getContentChars().normalizeEOL()); } html.closePre().tag("/div"); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); } else { context.delegateRender(); } }
void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { html.line(); html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre(); BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { BasedSequence language = node.getInfoDelimitedByAny(" "); html.attr("class", context.getHtmlOptions().languageClassPrefix + language.unescape()); } else { 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().normalizeEOL()); } html.tag("/code"); html.tag("/pre").closePre(); html.lineIf(context.getHtmlOptions().htmlBlockCloseTagEol); }
html.tag("dd"); html.raw(options.renderedHtmlPrefix) .rawIndentedPre(text.normalizeEOL()) .raw(options.renderedHtmlSuffix) .line(); html.tagVoidLine("hr"); html.raw(options.renderedHtmlPrefix) .rawIndentedPre(text.normalizeEOL()) .raw(options.renderedHtmlSuffix) .line();
public static void renderInlineHtml(HtmlInlineBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; if (escape) { html.text(node.getChars().normalizeEOL()); } else { html.rawPre(node.getChars().normalizeEOL()); } }
final BasedSequence interSpace = BasedSequenceImpl.of(state.getLine().baseSubSequence(lastChildAnyNot.getEndOffset(), state.getLine().getStartOffset()).normalizeEOL()); if (interSpace.countChars('\n') >= 2) { return BlockStart.none();
public void renderHtmlBlock(HtmlBlockBase node, NodeRendererContext context, HtmlWriter html, boolean suppress, boolean escape) { if (suppress) return; html.line().raw("{code:html}").line(); html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code:html}").line(); }
if (options.doubleBlankLineBreaksList) { final BasedSequence interSpace = paragraphPreviousNonBlank == null ? BasedSequence.NULL : BasedSequenceImpl.of(paragraphPreviousNonBlank.getChars().baseSubSequence(paragraphPreviousNonBlank.getChars().getEndOffset(), paragraph.getChars().getStartOffset()).normalizeEOL()); hadPreviousList = paragraphPreviousNonBlank instanceof DefinitionList && interSpace.countChars('\n') < 2; } else {
private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) { BasedSequence info = node.getInfo(); if (info.isNotNull() && !info.isBlank()) { html.line().raw("{code:lang=" + info.unescape() + "}").line(); } else { html.line().raw("{code}").line(); } html.raw(node.getContentChars().normalizeEOL()); html.line().raw("{code}").blankLine(); }