org.commonmark.node.BlockQuote Java Examples
The following examples show how to use
org.commonmark.node.BlockQuote.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CorePlugin.java From Markwon with Apache License 2.0 | 6 votes |
@Override public void configureSpansFactory(@NonNull MarkwonSpansFactory.Builder builder) { // reuse this one for both code-blocks (indent & fenced) final CodeBlockSpanFactory codeBlockSpanFactory = new CodeBlockSpanFactory(); builder .setFactory(StrongEmphasis.class, new StrongEmphasisSpanFactory()) .setFactory(Emphasis.class, new EmphasisSpanFactory()) .setFactory(BlockQuote.class, new BlockQuoteSpanFactory()) .setFactory(Code.class, new CodeSpanFactory()) .setFactory(FencedCodeBlock.class, codeBlockSpanFactory) .setFactory(IndentedCodeBlock.class, codeBlockSpanFactory) .setFactory(ListItem.class, new ListItemSpanFactory()) .setFactory(Heading.class, new HeadingSpanFactory()) .setFactory(Link.class, new LinkSpanFactory()) .setFactory(ThematicBreak.class, new ThematicBreakSpanFactory()); }
Example #2
Source File: MarkwonVisitorImplTest.java From Markwon with Apache License 2.0 | 6 votes |
@Test public void non_registered_nodes_children_visited() { // if a node is encountered, but we have no registered visitor -> just visit children // (node.firstChild.accept) final MarkwonVisitorImpl impl = new MarkwonVisitorImpl( mock(MarkwonConfiguration.class), mock(RenderProps.class), mock(SpannableBuilder.class), Collections.<Class<? extends Node>, MarkwonVisitor.NodeVisitor<? extends Node>>emptyMap(), mock(MarkwonVisitor.BlockHandler.class)); final BlockQuote node = mock(BlockQuote.class); final Node child = mock(Node.class); when(node.getFirstChild()).thenReturn(child); impl.visit(node); verify(node, times(1)).getFirstChild(); verify(child, times(1)).accept(eq(impl)); }
Example #3
Source File: BlockquoteHandler.java From Markwon with Apache License 2.0 | 6 votes |
@Override public void handle( @NonNull MarkwonVisitor visitor, @NonNull MarkwonHtmlRenderer renderer, @NonNull HtmlTag tag) { if (tag.isBlock()) { visitChildren(visitor, renderer, tag.getAsBlock()); } final MarkwonConfiguration configuration = visitor.configuration(); final SpanFactory factory = configuration.spansFactory().get(BlockQuote.class); if (factory != null) { SpannableBuilder.setSpans( visitor.builder(), factory.getSpans(configuration, visitor.renderProps()), tag.start(), tag.end() ); } }
Example #4
Source File: CorePlugin.java From Markwon with Apache License 2.0 | 5 votes |
/** * @return a set with enabled by default block types * @since 4.4.0 */ @NonNull public static Set<Class<? extends Block>> enabledBlockTypes() { return new HashSet<>(Arrays.asList( BlockQuote.class, Heading.class, FencedCodeBlock.class, HtmlBlock.class, ThematicBreak.class, ListBlock.class, IndentedCodeBlock.class )); }
Example #5
Source File: MarkwonSpansFactoryTest.java From Markwon with Apache License 2.0 | 5 votes |
@Test public void instance_require_fail() { try { builder.build().require(BlockQuote.class); fail(); } catch (NullPointerException e) { assertTrue(e.getMessage(), e.getMessage().contains(BlockQuote.class.getName())); } }
Example #6
Source File: BlockQuoteParser.java From 1Rramp-Android with MIT License | 4 votes |
@Override public BlockQuote getBlock() { return block; }
Example #7
Source File: MarkwonVisitorImpl.java From Markwon with Apache License 2.0 | 4 votes |
@Override public void visit(BlockQuote blockQuote) { visit((Node) blockQuote); }
Example #8
Source File: BlockQuoteParser.java From commonmark-java with BSD 2-Clause "Simplified" License | 4 votes |
@Override public BlockQuote getBlock() { return block; }