@Test public void calculateBlockParserFactories_givenAFullListOfAllowedNodes_includesAllCoreFactories() { List<BlockParserFactory> customParserFactories = Collections.emptyList(); Set<Class<? extends Block>> nodes = new HashSet<>(Arrays.asList(BlockQuote.class, Heading.class, FencedCodeBlock.class, HtmlBlock.class, ThematicBreak.class, ListBlock.class, IndentedCodeBlock.class)); List<BlockParserFactory> blockParserFactories = DocumentParser.calculateBlockParserFactories(customParserFactories, nodes); assertThat(blockParserFactories.size(), is(CORE_FACTORIES.size())); for (BlockParserFactory factory : CORE_FACTORIES) { assertTrue(hasInstance(blockParserFactories, factory.getClass())); } }
public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) { List<BlockParserFactory> list = new ArrayList<>(); list.addAll(customBlockParserFactories); for (Class<? extends Block> blockType : enabledBlockTypes) { list.add(NODES_TO_CORE_FACTORIES.get(blockType)); } return list; }
DocumentParser implements ParserState { public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) { List<BlockParserFactory> list = new ArrayList<>(); list.addAll(customBlockParserFactories); for (Class<? extends Block> blockType : enabledBlockTypes) { list.add(NODES_TO_CORE_FACTORIES.get(blockType)); } return list; } }
DocumentParser implements ParserState { public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) { List<BlockParserFactory> list = new ArrayList<>(); list.addAll(customBlockParserFactories); for (Class<? extends Block> blockType : enabledBlockTypes) { list.add(NODES_TO_CORE_FACTORIES.get(blockType)); } return list; } DocumentParser(List<BlockParserFactory> blockParserFactories, InlineParserFactory inlineParserFactory,
                          List<DelimiterProcessor> delimiterProcessors, IncludeSourceSpans includeSourceSpans); }
DocumentParser implements ParserState { public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) { List<BlockParserFactory> list = new ArrayList<>(); list.addAll(customBlockParserFactories); for (Class<? extends Block> blockType : enabledBlockTypes) { list.add(NODES_TO_CORE_FACTORIES.get(blockType)); } return list; } DocumentParser(List<BlockParserFactory> blockParserFactories, InlineParserFactory inlineParserFactory,
                          List<DelimiterProcessor> delimiterProcessors, IncludeSourceSpans includeSourceSpans); static Set<Class<? extends Block>> getDefaultBlockParserTypes(); static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes); Document parse(String input); Document parse(Reader input); @Override CharSequence getLine(); int getLineIndex(); @Override int getIndex(); @Override int getNextNonSpaceIndex(); @Override int getColumn(); @Override int getIndent(); @Override boolean isBlank(); @Override BlockParser getActiveBlockParser(); }
DocumentParser implements ParserState { public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) { List<BlockParserFactory> list = new ArrayList<>(); list.addAll(customBlockParserFactories); for (Class<? extends Block> blockType : enabledBlockTypes) { list.add(NODES_TO_CORE_FACTORIES.get(blockType)); } return list; } DocumentParser(List<BlockParserFactory> blockParserFactories, InlineParserFactory inlineParserFactory,
                          List<DelimiterProcessor> delimiterProcessors, IncludeSourceSpans includeSourceSpans); static Set<Class<? extends Block>> getDefaultBlockParserTypes(); static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes); Document parse(String input); Document parse(Reader input); @Override CharSequence getLine(); int getLineIndex(); @Override int getIndex(); @Override int getNextNonSpaceIndex(); @Override int getColumn(); @Override int getIndent(); @Override boolean isBlank(); @Override BlockParser getActiveBlockParser();  }