mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-25 04:04:22 -04:00
[HTML] Fix repeated single quotes behavior with nested formatting
Closes #288
This commit is contained in:
parent
9711a8cca4
commit
de9e7caaeb
1 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using DiscordChatExporter.Core.Markdown.Ast;
|
using DiscordChatExporter.Core.Markdown.Ast;
|
||||||
|
@ -63,13 +64,13 @@ namespace DiscordChatExporter.Core.Markdown
|
||||||
(p, m) => new FormattedNode(TextFormatting.Quote, Parse(p.Slice(m.Groups[1]))));
|
(p, m) => new FormattedNode(TextFormatting.Quote, Parse(p.Slice(m.Groups[1]))));
|
||||||
|
|
||||||
// Repeatedly capture any character until the end of the line
|
// Repeatedly capture any character until the end of the line
|
||||||
// This one is tricky as it ends up producing multiple separate captures
|
// This one is tricky as it ends up producing multiple separate captures which need to be joined
|
||||||
private static readonly IMatcher<Node> RepeatedSingleLineQuoteNodeMatcher = new RegexMatcher<Node>(
|
private static readonly IMatcher<Node> RepeatedSingleLineQuoteNodeMatcher = new RegexMatcher<Node>(
|
||||||
new Regex("(?:^>\\s(.+\n?)){2,}", DefaultRegexOptions),
|
new Regex("(?:^>\\s(.+\n?)){2,}", DefaultRegexOptions),
|
||||||
(p, m) =>
|
(p, m) =>
|
||||||
{
|
{
|
||||||
var children = m.Groups[1].Captures.Select(c => c.Value).SelectMany(Parse).ToArray();
|
var content = string.Concat(m.Groups[1].Captures.Select(c => c.Value));
|
||||||
return new FormattedNode(TextFormatting.Quote, children);
|
return new FormattedNode(TextFormatting.Quote, Parse(content));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Capture any character until the end of the input
|
// Capture any character until the end of the input
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue