Skip to content

Commit

Permalink
Word Export: Add missing Before/After/Between content
Browse files Browse the repository at this point in the history
- Add between content for CrossRreference types.
- Add before and after content for LexicalRelations->Targets.

Note: I think passing child to AddCollection() is the correct
node for the collection being added. The other implementations
of AddCollection() do not use this parameter so they are not
affected.
This fixes one of the issues identified in LT-21808.

Change-Id: I2bfbea70752fb0acfdd98d550753256b54783e33
  • Loading branch information
mark-sil committed Sep 4, 2024
1 parent 394b590 commit a2c841b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Src/xWorks/ConfiguredLcmGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2005,12 +2005,12 @@ private static void GenerateContentForLexRefCollection(ConfigurableDictionaryNod
var organizedRefs = SortAndFilterLexRefsAndTargets(collection, cmOwner, config);

// Now that we have things in the right order, try outputting one type at a time
bool first = true;
bool firstIteration = true;
foreach (var referenceList in organizedRefs)
{
var xBldr = GenerateCrossReferenceChildren(config, pubDecorator, referenceList, cmOwner, settings);
settings.ContentGenerator.BetweenCrossReferenceType(xBldr, config, first);
first = false;
settings.ContentGenerator.BetweenCrossReferenceType(xBldr, config, firstIteration);
firstIteration = false;
bldr.Append(xBldr);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Src/xWorks/ILcmContentGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ IFragment GenerateGroupingNode(ConfigurableDictionaryNode config, object field,
IFragment AddLexReferences(ConfigurableDictionaryNode config, bool generateLexType, IFragment lexTypeContent, string className, IFragment referencesContent, bool typeBefore);
void BeginCrossReference(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string className);
void EndCrossReference(IFragmentWriter writer);
void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool first);
void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem);
IFragment WriteProcessedSenses(ConfigurableDictionaryNode config, bool isBlock, IFragment senseContent, string className, IFragment sharedCollectionInfo);
IFragment AddAudioWsContent(string wsId, Guid linkTarget, IFragment fileContent);
IFragment GenerateErrorContent(StringBuilder badStrBuilder);
Expand Down
2 changes: 1 addition & 1 deletion Src/xWorks/LcmJsonGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void EndCrossReference(IFragmentWriter writer)
((JsonFragmentWriter)writer).InsertRawJson(",");
}

public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool first)
public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem)
{
}

Expand Down
4 changes: 2 additions & 2 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,10 +1621,10 @@ public void EndCrossReference(IFragmentWriter writer)
return;
}

public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool first)
public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem)
{
// Add Between text if it is not the first item in the collection.
if (!first && !string.IsNullOrEmpty(node.Between))
if (!firstItem && !string.IsNullOrEmpty(node.Between))
{
var betweenRun = CreateBeforeAfterBetweenRun(node.Between);
((DocFragment)content).DocBody.PrependChild(betweenRun);
Expand Down
2 changes: 1 addition & 1 deletion Src/xWorks/LcmXhtmlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ public void EndCrossReference(IFragmentWriter writer)
EndObject(writer);
}

public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool first)
public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem)
{
}

Expand Down

0 comments on commit a2c841b

Please sign in to comment.