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

Category:CS1 maint: MR format && more data types #3652

Merged
merged 5 commits into from
Oct 24, 2020
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
8 changes: 7 additions & 1 deletion Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ public function add_if_new(string $param_name, string $value, string $api = '')
}
return FALSE;

case 'chapter': case 'contribution':
case 'chapter': case 'contribution': case 'article': case 'section': // We do not add article/section, but sometimes found floating in a template
if (!$this->blank(['booktitle', 'book-title']) && $this->has('title')) return FALSE;
if ($this->blank(CHAPTER_ALIASES)) {
return $this->add($param_name, wikify_external_text($value));
Expand Down Expand Up @@ -4295,6 +4295,12 @@ public function tidy_parameter(string $param) : void {
}
}
return;

case 'mr':
if (preg_match("~mr(\d+)$~i", $this->get($param), $matches)) {
$this->set($param, $matches[1]);
}
return;

case 'others': case 'day': case 'month': // Bad idea to have in general
if ($this->blank($param)) $this->forget($param);
Expand Down
2 changes: 1 addition & 1 deletion category.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$category = trim($category);
if ($category === '' && isset($_GET["cat"])) {
$maybe = (string) $_GET["cat"];
if (in_array($maybe, ['CS1 errors: DOI' , 'CS1 maint: PMC format'])) $category = $maybe;
if (in_array($maybe, ['CS1 errors: DOI' , 'CS1 maint: PMC format', 'CS1 maint: MR format'])) $category = $maybe;
}

if (strtolower(substr($category, 0, 9)) == 'category:') $category = trim(substr($category, 9));
Expand Down
8 changes: 6 additions & 2 deletions tests/phpunit/apiFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,12 @@ public function testExpansion_doi_not_from_crossref_europa_monograph() : void {
$this->requires_dx(function() : void {
$expanded = $this->make_citation('{{Cite journal}}');
expand_doi_with_dx($expanded, '10.2788/14231');
$this->assertSame('{{Cite journal|year = 2007|last1 = Vogt|first1 = Jürgen|last2 = Foisneau|first2 = Stéphanie|title = European river and catchment database, version 2.0 (CCM2) : Analysis tools|publisher = Publications Office}}', $expanded->parsed_text());
});
if ($expanded->has('author1')) {
$this->assertSame('{{Cite journal|year = 2007|author1 = European Commission. Joint Research Centre. Institute for Environment Sustainability|last2 = Vogt|first2 = Jürgen|last3 = Foisneau|first3 = Stéphanie|title = European river and catchment database, version 2.0 (CCM2) : Analysis tools|publisher = Publications Office}}', $expanded->parsed_text());
} else {
$this->assertSame('{{Cite journal|year = 2007|last1 = Vogt|first1 = Jürgen|last2 = Foisneau|first2 = Stéphanie|title = European river and catchment database, version 2.0 (CCM2) : Analysis tools|publisher = Publications Office}}', $expanded->parsed_text());
}
});
}

public function testComplexCrossRef() : void {
Expand Down
4 changes: 2 additions & 2 deletions tests/testBaseClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
abstract class testBaseClass extends PHPUnit\Framework\TestCase {
// Change these to temporarily disable sets of tests======================
private $testing_skip_zotero = TRUE; // TODO - broken
private $testing_skip_bibcode= TRUE; // TODO - save searches
private $testing_skip_bibcode= FALSE; //
private $testing_skip_google = FALSE; //
private $testing_skip_wiki = FALSE; //
private $testing_skip_dx = TRUE; // TODO - down partially
private $testing_skip_dx = FALSE; //
private $testing_skip_arxiv = FALSE; //
// =======================================================================

Expand Down