Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Dec 27, 2024
1 parent b397405 commit 3fcb340
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions JL.Core/Mining/MiningUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,13 +720,10 @@ public static async Task MineToFile(LookupResult lookupResult, string currentTex

if (miningParameters.TryGetValue(jlField, out string? value))
{
string jlFieldContent = value.ReplaceLineEndings("\\n").Replace("\t", " ", StringComparison.Ordinal).Trim();
if (!string.IsNullOrEmpty(jlFieldContent))
{
_ = lineToMine.Append(CultureInfo.InvariantCulture, $"{jlField.GetDescription()}: ")
.Append(jlFieldContent)
.Append(i < jlFields.Length - 1 ? '\t' : '\n');
}
string jlFieldContent = value.ReplaceLineEndings("\\n").Replace("\t", " ", StringComparison.Ordinal);
_ = lineToMine.Append(CultureInfo.InvariantCulture, $"{jlField.GetDescription()}: ")
.Append(jlFieldContent)
.Append(i < jlFields.Length - 1 ? '\t' : '\n');
}
}

Expand Down Expand Up @@ -780,7 +777,7 @@ public static async Task MineToFile(LookupResult lookupResult, string currentTex

(string firstFieldName, JLField firstField) = ankiConfig.Fields.GetAt(0);
string? firstFieldValue = GetMiningParameter(firstField, lookupResult, currentText, currentCharPosition);
if (string.IsNullOrEmpty(firstFieldValue))
if (firstFieldValue is null)
{
continue;
}
Expand Down Expand Up @@ -978,7 +975,7 @@ private static Dictionary<string, string> ConvertFields(OrderedDictionary<string
Dictionary<string, string> dict = new(StringComparer.Ordinal);
foreach ((string key, JLField value) in userFields)
{
if (miningParams.TryGetValue(value, out string? fieldValue) && !string.IsNullOrEmpty(fieldValue))
if (miningParams.TryGetValue(value, out string? fieldValue))
{
dict.Add(key, fieldValue);
}
Expand Down

0 comments on commit 3fcb340

Please sign in to comment.