diff --git a/KoeBook.Core/Models/AiStory.cs b/KoeBook.Core/Models/AiStory.cs index 5edfb89..fa33710 100644 --- a/KoeBook.Core/Models/AiStory.cs +++ b/KoeBook.Core/Models/AiStory.cs @@ -15,26 +15,26 @@ public class AiStory public Line[][] Lines { get; init; } = []; public record Line( - [property: XmlElement("Text", typeof(TextElement), IsNullable = false), XmlElement("Ruby", typeof(Ruby), IsNullable = false)] InlineElement[] Inlines) + [property: XmlElement("Text", typeof(Text), IsNullable = false), XmlElement("Ruby", typeof(Ruby), IsNullable = false)] InlineElement[] Inlines) { private Line() : this([]) { } - public string GetText() => string.Concat(Inlines.Select(e => e.Text)); + public string GetText() => string.Concat(Inlines.Select(e => e.Html)); public string GetScript() => string.Concat(Inlines.Select(e => e.Script)); } public abstract record class InlineElement { - public abstract string Text { get; } + public abstract string Html { get; } public abstract string Script { get; } } - public record TextElement([property: XmlText] string InnerText) : InlineElement + public record Text([property: XmlText] string InnerText) : InlineElement { - private TextElement() : this("") { } + private Text() : this("") { } - public override string Text => InnerText; + public override string Html => InnerText; public override string Script => InnerText; } @@ -44,7 +44,7 @@ public record Ruby( { private Ruby() : this("", "") { } - public override string Text => Rb; + public override string Html => $"{Rb}{Rt}"; public override string Script => Rt; } } diff --git a/KoeBook/Views/CreateStoryPage.xaml.cs b/KoeBook/Views/CreateStoryPage.xaml.cs index e68e8ff..a4d8c70 100644 --- a/KoeBook/Views/CreateStoryPage.xaml.cs +++ b/KoeBook/Views/CreateStoryPage.xaml.cs @@ -40,7 +40,7 @@ private void ViewModel_PropertyChanged(object? sender, System.ComponentModel.Pro l.SelectMany(l => l.Inlines.Select(Inline (inline) => inline switch { - AiStory.TextElement text => new Run() { Text = text.InnerText }, + AiStory.Text text => new Run() { Text = text.InnerText }, AiStory.Ruby ruby => new Run() { Text = ruby.Rt }, _ => throw new UnreachableException(), }).Append(new LineBreak())