Revision: 29431
          http://sourceforge.net/p/bibdesk/svn/29431
Author:   hofman
Date:     2025-08-18 15:51:32 +0000 (Mon, 18 Aug 2025)
Log Message:
-----------
add newlines between bibtex item strings

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2025-08-18 15:07:18 UTC (rev 29430)
+++ trunk/bibdesk/BibDocument.m 2025-08-18 15:51:32 UTC (rev 29431)
@@ -2040,7 +2040,7 @@
 - (NSString *)previewBibTeXStringForPublications:(NSArray *)items{
     
     if([items count]) NSParameterAssert([[items objectAtIndex:0] 
isKindOfClass:[BibItem class]]);
-
+    
        NSUInteger numberOfPubs = [items count];
        NSMutableString *bibString = [[NSMutableString alloc] 
initWithCapacity:(numberOfPubs * 100)];
     BDSKMacroResolver *aMacroResolver = [[items firstObject] macroResolver] ?: 
[self macroResolver];
@@ -2058,35 +2058,37 @@
     [bibString appendString:[[BDSKMacroResolver defaultMacroResolver] 
bibTeXString]];
     [bibString appendString:[aMacroResolver bibTeXString]];
        
-       BibItem *aParent = nil;
-       NSMutableArray *selItems = [[NSMutableArray alloc] 
initWithCapacity:numberOfPubs];
-       NSMutableSet *parentItems = [[NSMutableSet alloc] 
initWithCapacity:numberOfPubs];
-       NSMutableArray *selParentItems = [[NSMutableArray alloc] 
initWithCapacity:numberOfPubs];
+    NSMutableArray *selItems = [NSMutableArray array];
+       NSMutableSet *parentItems = [NSMutableSet set];
+       NSMutableArray *selParentItems = [NSMutableArray array];
     
        for (BibItem *aPub in items) {
-               [selItems addObject:aPub];
-
-               if(aParent = [aPub crossrefParent])
+        BibItem *aParent = [aPub crossrefParent];
+        if (aParent)
                        [parentItems addObject:aParent];
        }
        
-       for (BibItem *aPub in selItems) {
+       for (BibItem *aPub in items) {
                if([parentItems containsObject:aPub]){
                        [parentItems removeObject:aPub];
                        [selParentItems addObject:aPub];
                }else{
+            [selItems addObject:aPub];
             [bibString appendString:[aPub bibTeXStringWithOptions:options]];
+            [bibString appendString:@"\n"];
                }
        }
        
        for (BibItem *aPub in selParentItems) {
         [bibString appendString:[aPub bibTeXStringWithOptions:options]];
+        [bibString appendString:@"\n"];
        }
        
        for (BibItem *aPub in parentItems) {
         [bibString appendString:[aPub bibTeXStringWithOptions:options]];
+        [bibString appendString:@"\n"];
        }
-                                       
+    
        return bibString;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to