Permalink
Browse files

Correct the use of single quotes in titles.

  • Loading branch information...
1 parent f46d39d commit 2b473fbf6d1ce9aa4c7bad1a38742e940e5fed1a @Kodiologist committed Mar 6, 2012
Showing with 6 additions and 1 deletion.
  1. +3 −1 Citematic.pm
  2. +3 −0 tests
View
@@ -207,7 +207,7 @@ sub format_nonjournal_title
# But we'll try to fix it.
if ($s =~ /[[:lower:]]/)
# The Title Is Probably Capitalized Like This.
- {$s =~ s {[- (]\K([[:upper:]])([^-. ()]+)}
+ {$s =~ s {[- ('"]\K([[:upper:]])([^-. ()'"]+)}
{my $lower = lc($1) . $2;
if ($speller->check($lower))
{$lower;}
@@ -222,6 +222,8 @@ sub format_nonjournal_title
$s =~ s/([:?])\W+(\w)/$1 . ' ' . uc $2/ge;
# Correct GNU-style single quotes that should be double quotes.
$s =~ s/`([^`']+)'/"$1"/g;
+ # Correct matched single quotes that should be double quotes.
+ $s =~ s/(\s|\A)'([^`' ][^`']*[^`' ])'(\s|\z)/$1"$2"$3/g;
$s;}
sub format_publisher
View
3 tests
@@ -162,6 +162,9 @@ is apa(title => ['happiness makes us selfish']),
is apa(year => 1997, author => ['landolt', 'dutton']),
'Landolt, M. A., & Dutton, D. G. (1997). Power and personality: An analysis of gay male intimate abuse. <i>Sex Roles, 37</i>(5, 6), 335–359. doi:10.1023/A:1025649306193',
'Sex Roles (article attributed to multiple issues)';
+is apa(year => 2006, author => ['wheeler', 'george', 'marlatt']),
+ 'Wheeler, J. G., George, W. H., & Marlatt, G. A. (2006). Relapse prevention for sexual offenders: Considerations for the "abstinence violation effect". <i>Sexual Abuse, 18</i>(3), 233–248. doi:10.1177/107906320601800302',
+ 'Sexual Abuse (single quotes in given form of title)';
is apa(year => 1997, author => ['holdershaw', 'gendall']),
'Holdershaw, J., Gendall, P., & Garland, R. (1997). The widespread use of odd pricing in the retail sector. <i>Marketing Bulletin, 8</i>, 53–58.',
'Marketing Bulletin (last author missing from EBSCO record)';

0 comments on commit 2b473fb

Please sign in to comment.