public override IMarkdownToken TryMatch(IMarkdownParser engine, ref string source) { var match = Blockquote.Match(source); if (match.Length == 0) { return(null); } source = source.Substring(match.Length); var capStr = LeadingBlockquote.Replace(match.Value, string.Empty); var c = engine.SwitchContext(MarkdownBlockContext.IsBlockQuote, true); var tokens = engine.Tokenize(capStr); engine.SwitchContext(c); return(new AzureBlockquoteBlockToken(this, engine.Context, tokens, match.Value)); }
public override IMarkdownToken TryMatch(IMarkdownParser engine, IMarkdownParsingContext context) { var match = Blockquote.Match(context.CurrentMarkdown); if (match.Length == 0) { return(null); } var sourceInfo = context.Consume(match.Length); var capStr = LeadingBlockquote.Replace(match.Value, string.Empty); var c = engine.SwitchContext(MarkdownBlockContext.IsBlockQuote, true); var tokens = engine.Tokenize(sourceInfo.Copy(capStr)); engine.SwitchContext(c); return(new AzureBlockquoteBlockToken(this, engine.Context, tokens, sourceInfo)); }
public override IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context) { var match = Blockquote.Match(context.CurrentMarkdown); if (match.Length == 0) { return(null); } var sourceInfo = context.Consume(match.Length); var c = parser.SwitchContext(MarkdownBlockContext.IsBlockQuote, true); var capStr = LeadingBlockquote.Replace(sourceInfo.Markdown, string.Empty); var blockTokens = parser.Tokenize(sourceInfo.Copy(capStr)); blockTokens = TokenHelper.CreateParagraghs(parser, this, blockTokens, true, sourceInfo); parser.SwitchContext(c); return(new MarkdownBlockquoteBlockToken( this, parser.Context, blockTokens, sourceInfo)); }
public override IMarkdownToken TryMatch(IMarkdownParser engine, IMarkdownParsingContext context) { var match = Blockquote.Match(context.CurrentMarkdown); if (match.Length == 0) { return(null); } var sourceInfo = context.Consume(match.Length); return(new TwoPhaseBlockToken( this, engine.Context, sourceInfo, (p, t) => { var capStr = LeadingBlockquote.Replace(t.SourceInfo.Markdown, string.Empty); var c = p.SwitchContext(MarkdownBlockContext.IsBlockQuote, true); var tokens = p.Tokenize(t.SourceInfo.Copy(capStr)); tokens = TokenHelper.ParseInlineToken(p, t.Rule, tokens, true, t.SourceInfo); p.SwitchContext(c); return new AzureBlockquoteBlockToken(this, t.Context, tokens, t.SourceInfo); })); }