/// <inheritdoc /> public (TBlockOptions, TExtensionOptions) CreateOptions(BlockProcessor blockProcessor, LeafBlock leafBlock) { TExtensionOptions extensionOptions = _extensionOptionsFactory.Create(blockProcessor); TBlockOptions blockOptions = _blockOptionsFactory.Create(extensionOptions.DefaultBlockOptions, leafBlock); return(blockOptions, extensionOptions); }
/// <summary> /// Creates a <see cref="FlexiCardBlock"/>. /// </summary> /// <param name="blockProcessor">The <see cref="BlockProcessor"/> processing the <see cref="FlexiCardBlock"/>.</param> /// <param name="blockParser">The <see cref="BlockParser"/> parsing the <see cref="FlexiCardBlock"/>.</param> /// <exception cref="BlockException">Thrown if <paramref name="blockProcessor"/>'s <see cref="BlockProcessor.CurrentContainer"/> is not /// a <see cref="ProxyFlexiCardsBlock"/>.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="blockProcessor"/> is <c>null</c>.</exception> public override FlexiCardBlock Create(BlockProcessor blockProcessor, BlockParser blockParser) { if (!(blockProcessor.CurrentContainer is ProxyFlexiCardsBlock proxyFlexiCardsBlock)) { throw new BlockException(nameof(FlexiCardBlock), blockProcessor.LineIndex, blockProcessor.Column, string.Format(Strings.BlockException_Shared_BlockCanOnlyExistWithinASpecificTypeOfBlock, nameof(FlexiCardBlock), nameof(FlexiCardsBlock))); } IFlexiCardBlockOptions flexiCardBlockOptions = _flexiCardBlockOptionsFactory. Create(proxyFlexiCardsBlock.FlexiCardsBlockOptions.DefaultCardOptions, blockProcessor); // Create block return(new FlexiCardBlock(flexiCardBlockOptions.Url, flexiCardBlockOptions.BackgroundIcon, flexiCardBlockOptions.Attributes, blockParser) { Column = blockProcessor.Column, Span = new SourceSpan(blockProcessor.Start, 0) // MultipartBlockParser will update end // Line is assigned by BlockProcessor }); }