From 8d47c9b3dab5f4c4610b43b2f0efd57efbd78e04 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Fri, 12 Jul 2024 13:58:01 +0700 Subject: [PATCH] correct headword code to trim and switch to lexeme form when citation form is empty --- backend/FwLite/LcmCrdt/Objects/Entry.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/FwLite/LcmCrdt/Objects/Entry.cs b/backend/FwLite/LcmCrdt/Objects/Entry.cs index 453d648dd..df29f6d4a 100644 --- a/backend/FwLite/LcmCrdt/Objects/Entry.cs +++ b/backend/FwLite/LcmCrdt/Objects/Entry.cs @@ -34,11 +34,11 @@ public string Headword(WritingSystemId ws) { var word = CitationForm[ws]; if (string.IsNullOrEmpty(word)) word = LexemeForm[ws]; - return word; + return word.Trim(); } protected static Expression> HeadwordExpression() => - (e, ws) => Json.Value(e.CitationForm, ms => ms[ws]) ?? Json.Value(e.LexemeForm, ms => ms[ws]); + (e, ws) => (string.IsNullOrEmpty(Json.Value(e.CitationForm, ms => ms[ws])) ? Json.Value(e.LexemeForm, ms => ms[ws]) : Json.Value(e.CitationForm, ms => ms[ws]))!.Trim(); public Guid[] GetReferences() {