Skip to content

Commit

Permalink
End inside cloze
Browse files Browse the repository at this point in the history
  • Loading branch information
xiety committed Apr 13, 2024
1 parent 0814867 commit ec8446e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions AnkiPoetry.Engine/BaseCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ public abstract class BaseCreator<T>
private static string ColorLine(string text, int n, int colors)
=> $"<div class=\"line{n % colors}\">" + text + "</div>";

private static string AddLineNumber(int lineNumber, string text, int colors)
=> ColorLine($"{lineNumber,3}. {text}", lineNumber, colors);

protected static string GetLineText(string text, MyLine line, int colors)
=> AddLineNumber(line.LineNumber, AddPrefixPostfix(text, line), colors);

private static string AddPrefixPostfix(string text, MyLine line)
protected static string AddLineNumber(int lineNumber, string text, int colors)
=> ColorLine($"{lineNumber,3}. {text}", lineNumber, colors);

protected static string AddPrefixPostfix(string text, MyLine line)
=> line.LineType switch
{
LineType.Norm => text,
Expand Down
3 changes: 2 additions & 1 deletion AnkiPoetry.Engine/LineCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ public class LineCreator : BaseCreatorPerLine<Card>
{
protected override IEnumerable<Card> CreateCard(string number, string beginning, MyLine to, int colors)
{
var cloze = GetLineText(MakeCloze(to.Text), to, colors);
var text = MakeCloze(AddPrefixPostfix(to.Text, to));
var cloze = AddLineNumber(to.LineNumber, text, colors);
yield return new(number, beginning + cloze);
}

Expand Down

0 comments on commit ec8446e

Please sign in to comment.