mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02:51 +08:00
parent
eeb3f967b6
commit
3847a8949f
@ -36,5 +36,21 @@ namespace Spectre.Console.Tests.Unit
|
|||||||
// Then
|
// Then
|
||||||
console.Output.ShouldBe("Hello [ World ] !");
|
console.Output.ShouldBe("Hello [ World ] !");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("Hello [link=http://example.com]example.com[/]", "Hello example.com")]
|
||||||
|
[InlineData("Hello [link=http://example.com]http://example.com[/]", "Hello http://example.com")]
|
||||||
|
public void Should_Render_Links_As_Expected(string input, string output)
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var console = new PlainConsole();
|
||||||
|
var markup = new Markup(input);
|
||||||
|
|
||||||
|
// When
|
||||||
|
console.Render(markup);
|
||||||
|
|
||||||
|
// Then
|
||||||
|
console.Output.ShouldBe(output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ namespace Spectre.Console.Internal
|
|||||||
throw new ArgumentNullException(nameof(text));
|
throw new ArgumentNullException(nameof(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
text = Emoji.Replace(text);
|
|
||||||
style ??= Style.Plain;
|
style ??= Style.Plain;
|
||||||
|
|
||||||
var result = new Paragraph();
|
var result = new Paragraph();
|
||||||
@ -47,7 +46,7 @@ namespace Spectre.Console.Internal
|
|||||||
{
|
{
|
||||||
// Get the effecive style.
|
// Get the effecive style.
|
||||||
var effectiveStyle = style.Combine(stack.Reverse());
|
var effectiveStyle = style.Combine(stack.Reverse());
|
||||||
result.Append(token.Value, effectiveStyle);
|
result.Append(Emoji.Replace(token.Value), effectiveStyle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user