Revision: 29450
          http://sourceforge.net/p/bibdesk/svn/29450
Author:   hofman
Date:     2025-08-24 14:30:32 +0000 (Sun, 24 Aug 2025)
Log Message:
-----------
remove now unused autodiscover from web frame method

Modified Paths:
--------------
    trunk/bibdesk/BDSKTextImportController.m
    trunk/bibdesk/de.lproj/Localizable.strings
    trunk/bibdesk/en.lproj/Localizable.strings
    trunk/bibdesk/fr.lproj/Localizable.strings

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2025-08-24 14:27:30 UTC (rev 
29449)
+++ trunk/bibdesk/BDSKTextImportController.m    2025-08-24 14:30:32 UTC (rev 
29450)
@@ -1603,158 +1603,6 @@
 
 #pragma mark Auto-Discovery methods
 
-- (void)autoDiscoverFromFrameDictionary:(NSDictionary *)metaTagDict {
-    BDSKTypeManager *typeMan = [BDSKTypeManager sharedManager];
-    BibItem *item = [self publication];
-     
-    for (NSString *metaName in metaTagDict) {
-        NSString *fieldName = [typeMan fieldNameForDublinCoreTerm:metaName];
-        fieldName = (fieldName ?: [metaName fieldName]);
-        NSString *fieldValue = [metaTagDict objectForKey:metaName];
-        
-        // Special-case DC.date to get month and year, but still insert 
"DC.date"
-        //  to capture the day, which may be useful.
-        if([fieldName isEqualToString:@"Date"]){
-            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-            [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
-            [formatter setDateFormat:@"yyyy-MM-dd"];
-            NSDate *date = [formatter dateFromString:fieldValue];
-            [formatter setDateFormat:@"yyyy"];
-            [item setField:BDSKYearString toValue:[formatter 
stringFromDate:date]];
-            [formatter setDateFormat:@"MM"];
-            [item setField:BDSKMonthString toValue:[formatter 
stringFromDate:date]];
-            // fieldName is "Date" here, don't just insert that.
-            // we use "Date" to generate a nice table column, and we shouldn't 
override that.
-            [item setField:@"DC.date" toValue:fieldValue];
-        }else if([fieldName isEqualToString:BDSKAuthorString]){
-            // DC.creator and DC.contributor both map to Author, so append 
them in the appropriate order
-            NSString *currentVal = [item valueOfField:BDSKAuthorString];
-            if(currentVal != nil){
-                if([metaName isEqualToString:@"DC.creator"])
-                    [item setField:fieldName
-                           toValue:[NSString stringWithFormat:@"%@ and %@", 
fieldValue, currentVal]];
-                else
-                    [item setField:fieldName
-                           toValue:[NSString stringWithFormat:@"%@ and %@", 
currentVal, fieldValue]];
-            }
-        }else{
-            [item setField:fieldName
-                   toValue:fieldValue];
-        }
-        
-    }
-    
-    NSString *bibtexType = [typeMan bibTeXTypeForDublinCoreType:[metaTagDict 
objectForKey:@"DC.type"]] ?: BDSKMiscString;
-    if ([[item pubType] isEqualToString:bibtexType] == NO)
-        [item setPubType:bibtexType];
-    else
-        [self updateTypeAndFields];
-}
-
-- (void)autoDiscoverDataFromFrame:(WebFrame *)frame{
-    
-    WebDataSource *dataSource = [frame dataSource];
-    NSString *MIMEType = [[dataSource mainResource] MIMEType];
-    
-    if ([MIMEType isEqualToString:@"text/plain"]) { 
-        // @@ should we also try other MIME types, such as text/richtext?
-        
-        NSString *string = [[dataSource representation] documentSource];
-        
-        if(string == nil) {
-            NSString *encodingName = [dataSource textEncodingName];
-            NSStringEncoding nsEncoding = [NSString 
encodingForIANACharSetName:encodingName] ?: NSUTF8StringEncoding;
-            string = [[NSString alloc] initWithData:[dataSource data] 
encoding:nsEncoding];
-        }
-        
-        if (string != nil) 
-            [self autoDiscoverDataFromString:string];
-        
-    } else if ([MIMEType isEqualToString:@"text/html"] || [MIMEType 
isEqualToString:@"text/xhtml+xml"]) {
-            
-        // This only reads Dublin Core for now.
-        // In the future, we should handle other HTML encodings like a nascent 
microformat.
-        // perhaps then a separate HTML parser would be useful to keep this 
file small.
-        
-        DOMDocument *domDoc = [frame DOMDocument];
-        
-        DOMNodeList *headList = [domDoc getElementsByTagName:@"head"];
-        if([headList length] != 1) return;
-        DOMNode *headNode = [headList item:0];
-        DOMNodeList *headChildren = [headNode childNodes];
-        NSUInteger i = 0;
-        NSUInteger length = [headChildren length];
-        NSMutableDictionary *metaTagDict = [[NSMutableDictionary alloc] 
initWithCapacity:length];    
-        
-        
-        for (i = 0; i < length; i++) {
-            DOMNode *node = [headChildren item:i];
-            DOMNamedNodeMap *attributes = [node attributes];
-            NSInteger typeIndex = 0;
-            
-            NSString *nodeName = [node nodeName];
-            if([nodeName isEqualToString:@"META"]){
-                
-                NSString *metaName = [[attributes getNamedItem:@"name"] 
nodeValue];
-                NSString *metaVal = [[attributes getNamedItem:@"content"] 
nodeValue];
-                
-                if(metaVal == nil) continue;
-
-                // Catch repeated DC.creator or contributor and append them: 
-                if([metaName isEqualToString:@"DC.creator"] ||
-                   [metaName isEqualToString:@"DC.contributor"]){
-                    NSString *currentVal = [metaTagDict objectForKey:metaName];
-                    if(currentVal != nil){
-                        metaVal = [NSString stringWithFormat:@"%@ and %@", 
currentVal, metaVal];
-                    }
-                }
-                
-                // Catch repeated DC.type and store them separately:
-                if([metaName isEqualToString:@"DC.type"]){
-                    NSString *currentVal = [metaTagDict objectForKey:metaName];
-                    if(currentVal != nil){
-                        metaName = [NSString stringWithFormat:@"DC.type.%ld", 
(long)++typeIndex];
-                    }
-                }
-                
-                if(metaVal && metaName)
-                    [metaTagDict setObject:metaVal
-                                    forKey:metaName];
-
-                
-            }else if([nodeName isEqualToString:@"LINK"]){
-                // it might be the link rel="alternate" class="fulltext"
-                NSString *classVal = [[attributes getNamedItem:@"class"] 
nodeValue];
-                NSString *relVal = [[attributes getNamedItem:@"rel"] 
nodeValue];
-                
-                if( [classVal isEqualToString:@"fulltext"] &&
-                    [relVal isEqualToString:@"alternate"]){
-                    DOMNode *hrefAttr = [attributes getNamedItem:@"href"];
-                    if(hrefAttr)
-                        [metaTagDict setObject:[hrefAttr nodeValue]
-                                        forKey:BDSKUrlString];
-                }
-            }
-        }// for child of HEAD
-        
-        if([metaTagDict count]){
-            if([[self publication] hasBeenEdited]){
-                NSAlert *alert = [[NSAlert alloc] init];
-                [alert setMessageText:NSLocalizedString(@"Autofill 
bibliography information", @"Message in alert dialog when trying to auto-fill 
information in text import")];
-                [alert setInformativeText:NSLocalizedString(@"Do you want me 
to autofill information from Dublin Core META tags? This may overwrite fields 
that are already set.", @"Informative text in alert dialog")];
-                [alert addButtonWithTitle:NSLocalizedString(@"Yes", @"Button 
title")];
-                [alert addButtonWithTitle:NSLocalizedString(@"No", @"Button 
title")];
-                [alert beginSheetModalForWindow:[self window] 
completionHandler:^(NSInteger returnCode){
-                    if (returnCode == NSAlertFirstButtonReturn)
-                        [self autoDiscoverFromFrameDictionary:metaTagDict];
-                }];
-            }else{
-                [self autoDiscoverFromFrameDictionary:metaTagDict];
-            }
-        }
-    }
-}
-
 - (void)autoDiscoverFromStringWithPublication:(BibItem *)pub {
     BibItem *item = [self publication];
     [item setPubFields:[pub pubFields]];

Modified: trunk/bibdesk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)

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