Skip to content

Commit

Permalink
Word Export: Prevent extra Before/After content for senses
Browse files Browse the repository at this point in the history
When senses are in separate paragraphs we were still adding
the before and after content that was around the collection
of senses.  It is now only added when not in separate paragraphs.

Change-Id: I89dc3703a42b22455ac41a8420cc0ac66a9ffc30
  • Loading branch information
mark-sil committed Sep 5, 2024
1 parent 3c17a3a commit ac90ccd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,17 +1633,21 @@ public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryN

public IFragment WriteProcessedSenses(ConfigurableDictionaryNode config, bool isBlock, IFragment senseContent, string className, IFragment sharedGramInfo)
{
// Add Before text for the senses.
if (!string.IsNullOrEmpty(config.Before))
bool eachInAParagraph = config != null &&
config.DictionaryNodeOptions is DictionaryNodeSenseOptions &&
((DictionaryNodeSenseOptions)(config.DictionaryNodeOptions)).DisplayEachSenseInAParagraph;

// Add Before text for the senses if they were not displayed in separate paragraphs.
if (!eachInAParagraph && !string.IsNullOrEmpty(config.Before))
{
var beforeRun = CreateBeforeAfterBetweenRun(config.Before);
((DocFragment)sharedGramInfo).DocBody.PrependChild(beforeRun);
}

sharedGramInfo.Append(senseContent);

// Add After text for the senses.
if (!string.IsNullOrEmpty(config.After))
// Add After text for the senses if they were not displayed in separate paragraphs.
if (!eachInAParagraph && !string.IsNullOrEmpty(config.After))
{
var afterRun = CreateBeforeAfterBetweenRun(config.After);
((DocFragment)sharedGramInfo).DocBody.Append(afterRun);
Expand Down

0 comments on commit ac90ccd

Please sign in to comment.