private void render(Node node, NodeFormatterContext context, MarkdownWriter markdown) { BasedSequence chars = node.getChars(); if (node instanceof Block) { BasedSequence contentChars = ((Block) node).getContentChars(); if (chars.isNotNull()) { BasedSequence prefix = chars.prefixOf(contentChars); if (!prefix.isEmpty()) { markdown.append(prefix); } } context.renderChildren(node); if (chars.isNotNull()) { BasedSequence suffix = chars.suffixOf(contentChars); if (!suffix.isEmpty()) { markdown.append(suffix); } } } else { if (formatterOptions.keepSoftLineBreaks) { markdown.append(chars); } else { markdown.append(stripSoftLineBreak(chars)); } } }
private void render(final DefinitionItem node, final NodeFormatterContext context, final MarkdownWriter markdown) { BasedSequence openMarkerChars = node.getChars().prefixOf(node.getFirstChild().getChars()); BasedSequence openMarker = openMarkerChars.subSequence(0,1); BasedSequence openMarkerSpaces = openMarkerChars.subSequence(1); if (options.markerSpaces >= 1 && openMarkerSpaces.length() != options.markerSpaces) { openMarkerSpaces = SubSequence.of(RepeatedCharSequence.of(' ', options.markerSpaces)); } switch (options.markerType) { case ANY: break; case COLON: openMarker = SubSequence.of(":"); break; case TILDE: openMarker = SubSequence.of("~"); break; } markdown.line().append(openMarker).append(openMarkerSpaces); markdown.pushPrefix().addPrefix(RepeatedCharSequence.of(' ', context.getFormatterOptions().itemContentIndent ? openMarker.length() + openMarkerSpaces.length() : listOptions.getItemIndent())); context.renderChildren(node); markdown.popPrefix(); if (!context.getOptions().get(BLANK_LINES_IN_AST)) { // add blank lines after last paragraph item Node child = node.getLastChild(); if (child instanceof Paragraph && ((Paragraph) child).isTrailingBlankLine()) { markdown.blankLine(); } } }
docx.text(node.getChars().unescape()); } else { docx.text(node.getChars().prefixOf(node.getChildChars()).unescape()); docx.renderChildren(node); docx.text(node.getChars().suffixOf(node.getChildChars()).unescape());
html.text(node.getChars().unescape()); } else { html.text(node.getChars().prefixOf(node.getChildChars()).unescape()); renderChildrenSourceLineWrapped(node, node.getText(), context, html); html.text(node.getChars().suffixOf(node.getChildChars()).unescape());
private void render(Node node, NodeFormatterContext context, MarkdownWriter markdown) { BasedSequence chars = node.getChars(); if (node instanceof Block) { BasedSequence contentChars = ((Block) node).getContentChars(); if (chars.isNotNull()) { BasedSequence prefix = chars.prefixOf(contentChars); if (!prefix.isEmpty()) { markdown.append(prefix); } } context.renderChildren(node); if (chars.isNotNull()) { BasedSequence suffix = chars.suffixOf(contentChars); if (!suffix.isEmpty()) { markdown.append(suffix); } } } else { if (formatterOptions.keepSoftLineBreaks) { markdown.append(chars); } else { markdown.append(stripSoftLineBreak(chars)); } } }
private void render(final DefinitionItem node, final NodeFormatterContext context, final MarkdownWriter markdown) { BasedSequence openMarkerChars = node.getChars().prefixOf(node.getFirstChild().getChars()); BasedSequence openMarker = openMarkerChars.subSequence(0,1); BasedSequence openMarkerSpaces = openMarkerChars.subSequence(1); if (options.markerSpaces >= 1 && openMarkerSpaces.length() != options.markerSpaces) { openMarkerSpaces = SubSequence.of(RepeatedCharSequence.of(' ', options.markerSpaces)); } switch (options.markerType) { case ANY: break; case COLON: openMarker = SubSequence.of(":"); break; case TILDE: openMarker = SubSequence.of("~"); break; } markdown.line().append(openMarker).append(openMarkerSpaces); markdown.pushPrefix().addPrefix(RepeatedCharSequence.of(' ', context.getFormatterOptions().itemContentIndent ? openMarker.length() + openMarkerSpaces.length() : listOptions.getItemIndent())); context.renderChildren(node); markdown.popPrefix(); if (!context.getOptions().get(BLANK_LINES_IN_AST)) { // add blank lines after last paragraph item Node child = node.getLastChild(); if (child instanceof Paragraph && ((Paragraph) child).isTrailingBlankLine()) { markdown.blankLine(); } } }
html.text(node.getChars().unescape()); } else { html.text(node.getChars().prefixOf(node.getChildChars()).unescape()); renderChildrenSourceLineWrapped(node, node.getText(), context, html); html.text(node.getChars().suffixOf(node.getChildChars()).unescape());