From 221509520debf6eb14e8844d826f548c4f0d4b61 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sun, 16 Aug 2015 16:25:53 +0200 Subject: [PATCH] Fix markup detection DocumentWriter. --- Tests/Formatter/DocumentWriterTest.cs | 6 ++++-- zaaReloaded2/Formatter/DocumentWriter.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/Formatter/DocumentWriterTest.cs b/Tests/Formatter/DocumentWriterTest.cs index 74d3075..bb74e46 100755 --- a/Tests/Formatter/DocumentWriterTest.cs +++ b/Tests/Formatter/DocumentWriterTest.cs @@ -100,9 +100,11 @@ namespace Tests.Formatter [Test] public void TextMarkup() { - _docWriter.Document = new Document(); - _docWriter.WriteLine("This is not bold. This is bold!"); + DocumentWriter output = new DocumentWriter(); + _docWriter.Parent = output; + _docWriter.Write("This is not bold. This is bold!\rThis not."); _docWriter.Flush(); + Assert.AreEqual("This is not bold. This is bold!\rThis not.", output.Text); } } } diff --git a/zaaReloaded2/Formatter/DocumentWriter.cs b/zaaReloaded2/Formatter/DocumentWriter.cs index 1b9356b..ad1acfd 100755 --- a/zaaReloaded2/Formatter/DocumentWriter.cs +++ b/zaaReloaded2/Formatter/DocumentWriter.cs @@ -227,7 +227,7 @@ namespace zaaReloaded2.Formatter StringBuilder _buffer; // Put pattern in parentheses so they will not be discarded by Regex.Split // The splitting pattern must not contain subgroups! - static readonly Regex _markupRegex = new Regex(@"(<[^>]+>)"); + static readonly Regex _markupRegex = new Regex(@"(<[^ >]+>)"); static readonly Regex _styleRegex = new Regex(@"[^>]+)>");