Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n.d. is special. Treat such dates special #825

Merged
merged 5 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,7 @@ public function tidy_parameter($param) {
$this->forget('year');
return;
}
if ($this->get($param) === 'n.d.') return; // Special no-date code that citation template recognize.
// Issue should follow year with no break. [A bit of redundant execution but simpler.]
case 'issue':
// Remove leading zeroes
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/TemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,20 @@ public function testISODates() {
$this->assertNull($prepared->get('year'));
}

public function testND() { // n.d. is special case that template recognize. Must protect
$text = '{{Cite journal|date =n.d.}}';
$expanded = $this->process_citation($text);
$this->assertEquals($text, $expanded->parsed_text());

$text = '{{Cite journal|year=no date}}';
$expanded = $this->process_citation($text);
$this->assertEquals($text, $expanded->parsed_text());

$text = '{{Cite journal|year=(not dated)}}';
$expanded = $this->process_citation($text);
$this->assertEquals($text, $expanded->parsed_text());
}

public function testRIS() {
$text = '{{Cite journal | TY - JOUR
AU - Shannon, Claude E.
Expand Down