Skip to content
Browse files

Correct fake ellipses.

  • Loading branch information...
1 parent 6637629 commit 858a450fe6012d2dbd7308034259213dba6d264d @Kodiologist committed Mar 17, 2012
Showing with 5 additions and 9 deletions.
  1. +2 −0 Perl/Citematic.pm
  2. +1 −1 Perl/test_citematic.pl
  3. +2 −5 Python/apa.py
  4. +0 −3 Python/test_apa.py
View
2 Perl/Citematic.pm
@@ -227,6 +227,8 @@ sub format_nonjournal_title
$s =~ s/`([^`']+)'/"$1"/g;
# Correct matched single quotes that should be double quotes.
$s =~ s/(\s|\A)'([^`' ][^`']*[^`' ])'(\s|\z)/$1"$2"$3/g;
+ # Correct fake ellipses.
+ $s =~ s/\.\.\.//g;
$s;}
sub format_publisher
View
2 Perl/test_citematic.pl
@@ -207,7 +207,7 @@ sub apa
'Rational decision making in business organizations',
'…trailing period not left in title (2)';
is apa(year => 2002, author => ['Bosch-Domènech', 'Montalvo']),
- 'Bosch-Domènech, A., Montalvo, J. G., Nagel, R., & Satorra, A. (2002). One, two, (three), infinity, ...: Newspaper and lab beauty-contest experiments. <i>American Economic Review, 92</i>(5), 1687–1701. doi:10.1257/000282802762024737',
+ 'Bosch-Domènech, A., Montalvo, J. G., Nagel, R., & Satorra, A. (2002). One, two, (three), infinity, : Newspaper and lab beauty-contest experiments. <i>American Economic Review, 92</i>(5), 1687–1701. doi:10.1257/000282802762024737',
'American Economic Review (surname with a diacritic and title with parentheses)';
is apa(year => 1997, author => ['weber', 'milliman']),
'Weber, E. U., & Milliman, R. A. (1997). Perceived risk attitudes: Relating risk perception to risky choice. <i>Management Science, 43</i>(2), 123–144. doi:10.1287/mnsc.43.2.123',
View
7 Python/apa.py
@@ -23,7 +23,8 @@ class APABibber(object):
def __init__(self, std_apa_style_path):
with open(std_apa_style_path, encoding = 'UTF-8') as f:
self.std_apa_style = f.read()
- self.style = sub(' encoding="UTF-8"', '', self.std_apa_style)
+ self.style = sub(' encoding="UTF-8"', '',
+ self.std_apa_style, count = 1)
# lxml doesn't like the encoding declaration.
self.style = sub(r'(<macro name="secondary-contributors">\s+<choose>\s+<if type=")',
r'\1book ', self.style, count = 1)
@@ -84,10 +85,6 @@ def bib(self, ds,
s = s.replace(' ', ' ')
s = sub(r'([.!?…])\.', r'\1', s)
- s = s.replace('..', '...')
- # These instances of ".." are assumed to be fake
- # ellipses ("...") that we accidentally truncated with
- # the previous statement.
s = s.replace('&amp;', '&')
s = sub('(\S)&', r'\1, &', s)
s = sub(r'</i>, <i>(\d)', r', \1', s)
View
3 Python/test_apa.py
@@ -72,9 +72,6 @@ def test_journal_article():
assert (j(title = 'And then…') ==
'Bloggs, J., & Hacker, J. R. (1983). And then… <i>Sciency Times, 30</i>, 293–315. doi:10.zzz/zzzzzz')
# Title ending with ellipsis
- assert (j(title = 'And then...') ==
- 'Bloggs, J., & Hacker, J. R. (1983). And then... <i>Sciency Times, 30</i>, 293–315. doi:10.zzz/zzzzzz')
- # Title ending with fake ellipsis
assert (j(page = 'S15–Z90') ==
'Bloggs, J., & Hacker, J. R. (1983). The main title. <i>Sciency Times, 30</i>, S15–Z90. doi:10.zzz/zzzzzz')
# Page numbers that aren't numbers

0 comments on commit 858a450

Please sign in to comment.
Something went wrong with that request. Please try again.