diff --git a/Src/xWorks/ConfiguredLcmGenerator.cs b/Src/xWorks/ConfiguredLcmGenerator.cs index dfde8ff89a..1fd8220138 100644 --- a/Src/xWorks/ConfiguredLcmGenerator.cs +++ b/Src/xWorks/ConfiguredLcmGenerator.cs @@ -2005,9 +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 firstIteration = true; foreach (var referenceList in organizedRefs) { var xBldr = GenerateCrossReferenceChildren(config, pubDecorator, referenceList, cmOwner, settings); + settings.ContentGenerator.BetweenCrossReferenceType(xBldr, config, firstIteration); + firstIteration = false; bldr.Append(xBldr); } } @@ -2119,7 +2122,7 @@ private static IFragment GenerateCrossReferenceChildren(ConfigurableDictionaryNo if (!content.IsNullOrEmpty()) { // targets - settings.ContentGenerator.AddCollection(xw, config, IsBlockProperty(child), + settings.ContentGenerator.AddCollection(xw, child, IsBlockProperty(child), CssGenerator.GetClassAttributeForConfig(child), content); settings.StylesGenerator.AddStyles(child); } diff --git a/Src/xWorks/ILcmContentGenerator.cs b/Src/xWorks/ILcmContentGenerator.cs index e15bf53fab..753a07dc08 100644 --- a/Src/xWorks/ILcmContentGenerator.cs +++ b/Src/xWorks/ILcmContentGenerator.cs @@ -61,6 +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 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); diff --git a/Src/xWorks/LcmJsonGenerator.cs b/Src/xWorks/LcmJsonGenerator.cs index 88c4a40604..9564b8fbca 100644 --- a/Src/xWorks/LcmJsonGenerator.cs +++ b/Src/xWorks/LcmJsonGenerator.cs @@ -411,6 +411,10 @@ public void EndCrossReference(IFragmentWriter writer) ((JsonFragmentWriter)writer).InsertRawJson(","); } + public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem) + { + } + /// /// Generates data for all senses of an entry. For better processing of json add sharedGramInfo as a separate property object /// diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index 40e6de8ae9..45c0a1516c 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -1440,10 +1440,24 @@ public void EndEntry(IFragmentWriter writer) } public void AddCollection(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string className, IFragment content) { + // Add Before text. + if (!string.IsNullOrEmpty(config.Before)) + { + var beforeRun = CreateBeforeAfterBetweenRun(config.Before); + ((WordFragmentWriter)writer).WordFragment.DocBody.Append(beforeRun); + } + if (!content.IsNullOrEmpty()) { ((WordFragmentWriter)writer).WordFragment.Append(content); } + + // Add After text. + if (!string.IsNullOrEmpty(config.After)) + { + var afterRun = CreateBeforeAfterBetweenRun(config.After); + ((WordFragmentWriter)writer).WordFragment.DocBody.Append(afterRun); + } } public void BeginObjectProperty(IFragmentWriter writer, ConfigurableDictionaryNode config, bool isBlockProperty, string getCollectionItemClassAttribute) { @@ -1606,6 +1620,17 @@ public void EndCrossReference(IFragmentWriter writer) { return; } + + public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem) + { + // Add Between text if it is not the first item in the collection. + if (!firstItem && !string.IsNullOrEmpty(node.Between)) + { + var betweenRun = CreateBeforeAfterBetweenRun(node.Between); + ((DocFragment)content).DocBody.PrependChild(betweenRun); + } + } + public IFragment WriteProcessedSenses(ConfigurableDictionaryNode config, bool isBlock, IFragment senseContent, string className, IFragment sharedGramInfo) { // Add Before text for the senses. diff --git a/Src/xWorks/LcmXhtmlGenerator.cs b/Src/xWorks/LcmXhtmlGenerator.cs index 782b60372a..bf3ad8b81c 100644 --- a/Src/xWorks/LcmXhtmlGenerator.cs +++ b/Src/xWorks/LcmXhtmlGenerator.cs @@ -992,6 +992,10 @@ public void EndCrossReference(IFragmentWriter writer) EndObject(writer); } + public void BetweenCrossReferenceType(IFragment content, ConfigurableDictionaryNode node, bool firstItem) + { + } + public IFragment WriteProcessedSenses(ConfigurableDictionaryNode config, bool isBlock, IFragment sensesContent, string classAttribute, IFragment sharedGramInfo) { sharedGramInfo.Append(sensesContent);