Revision: 22178 http://sourceforge.net/p/bibdesk/svn/22178 Author: hofman Date: 2018-04-09 14:39:52 +0000 (Mon, 09 Apr 2018) Log Message: ----------- Remove last comma in faulty bibtex records returned from mathcscinet
Modified Paths: -------------- trunk/bibdesk/BDSKMathSciNetParser.m Modified: trunk/bibdesk/BDSKMathSciNetParser.m =================================================================== --- trunk/bibdesk/BDSKMathSciNetParser.m 2018-04-08 06:30:44 UTC (rev 22177) +++ trunk/bibdesk/BDSKMathSciNetParser.m 2018-04-09 14:39:52 UTC (rev 22178) @@ -150,7 +150,9 @@ // Downloaded BibTeX records sometimes use \"o for umlauts which is incorrect and rejected by the parser. Use a regular expression to find and replace them. Also add brackets to acute and grave accents, so BibDesk translates them to Unicode properly for display. AGRegex * umlautFixer = [AGRegex regexWithPattern:@"(\\\\[\"'`][a-zA-Z])" options:AGRegexMultiline]; - + // Downloaded BibTeX records sometimes have a comma after the last field + AGRegex * lastCommaFixer = [AGRegex regexWithPattern:@"\\},[ \\n]*\\}$" options:AGRegexMultiline]; + // In the returned web page results live inside a <div class="doc"> tag. // Each of them is wrapped in a <pre> tag. // Find these, kill the potentially superfluous whitespace in there and create BibItems for each of them. @@ -167,7 +169,8 @@ NSString * preContent = [node stringValue]; NSString * cleanedRecord = [preContent stringByCollapsingAndTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; cleanedRecord = [umlautFixer replaceWithString:@"{$1}" inString:cleanedRecord]; - + cleanedRecord = [lastCommaFixer replaceWithString:@"}}" inString:cleanedRecord]; + NSError * parseError = nil; NSArray * newPubs = [BDSKBibTeXParser itemsFromString:cleanedRecord owner:owner error: &parseError]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit