Skip to content
Permalink
Browse files

Prefer citation_year when before citation_online_date (zotero#1484)

Closes zotero#1408.
  • Loading branch information...
zuphilip authored and adam3smith committed Nov 29, 2017
1 parent 99c07d8 commit f79de81db9f7d6411ba287dfbf8d6012a1679e19
Showing with 74 additions and 24 deletions.
  1. +68 −18 Embedded Metadata.js
  2. +6 −6 Project MUSE.js
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-08-26 11:30:00"
"lastUpdated": "2017-11-25 17:49:05"
}

/*
@@ -463,8 +463,20 @@ function addHighwireMetadata(doc, newItem) {

//fall back to some other date options
if(!newItem.date) {
newItem.date = getContentText(doc, 'citation_online_date')
|| getContentText(doc, 'citation_year');
var onlineDate = getContentText(doc, 'citation_online_date');
var citationYear = getContentText(doc, 'citation_year');

if (onlineDate && citationYear) {
onlineDate = ZU.strToISO(onlineDate);
if (citationYear < onlineDate.substr(0,4)) {
// online date can be years after the citation year
newItem.date = citationYear;
} else {
newItem.date = onlineDate;
}
} else {
newItem.date = onlineDate || citationYear;
}
}

//prefer ISSN over eISSN
@@ -624,7 +636,8 @@ function tryOgAuthors(doc) {
var authors = [];
var ogAuthors = ZU.xpath(doc, '//meta[@property="article:author" or @property="video:director" or @property="music:musician"]');
for (var i = 0; i<ogAuthors.length; i++) {
if (ogAuthors[i].content && ogAuthors[i].content.search(/(https?:\/\/)?[\da-z\.-]+\.[a-z\.]{2,6}/) < 0) {

if (ogAuthors[i].content && ogAuthors[i].content.search(/(https?:\/\/)?[\da-z\.-]+\.[a-z\.]{2,6}/) < 0 && ogAuthors[i].content !== "false") {
authors.push(ZU.cleanAuthor(ogAuthors[i].content, "author"))
}
}
@@ -1014,7 +1027,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.scielosp.org/scielo.php?script=sci_abstract&pid=S0034-89102007000900015&lng=en&nrm=iso&tlng=en",
"url": "https://scielosp.org/scielo.php?script=sci_abstract&pid=S0034-89102007000900015&lng=en&nrm=iso&tlng=en",
"items": [
{
"itemType": "journalArticle",
@@ -1041,13 +1054,16 @@ var testCases = [
"creatorType": "author"
}
],
"date": "12/2007",
"date": "2007-12",
"DOI": "10.1590/S0034-89102007000900015",
"ISSN": "0034-8910",
"libraryCatalog": "www.scielosp.org",
"ISSN": "0034-8910, 0034-8910, 1518-8787",
"abstractNote": "OBJETIVO: Descrever as impressões, experiências, conhecimentos, crenças e a receptividade de usuários de drogas injetáveis para participar das estratégias de testagem rápida para HIV. MÉTODOS: Estudo qualitativo exploratório foi conduzido entre usuários de drogas injetáveis, de dezembro de 2003 a fevereiro de 2004, em cinco cidades brasileiras, localizadas em quatro regiões do País. Um roteiro de entrevista semi-estruturado contendo questões fechadas e abertas foi usado para avaliar percepções desses usuários sobre procedimentos e formas alternativas de acesso e testagem. Foram realizadas 106 entrevistas, aproximadamente 26 por região. RESULTADOS: Características da população estudada, opiniões sobre o teste rápido e preferências por usar amostras de sangue ou saliva foram apresentadas junto com as vantagens e desvantagens associadas a cada opção. Os resultados mostraram a viabilidade do uso de testes rápidos entre usuários de drogas injetáveis e o interesse deles quanto à utilização destes métodos, especialmente se puderem ser equacionadas questões relacionadas à confidencialidade e confiabilidade dos testes. CONCLUSÕES: Os resultados indicam que os testes rápidos para HIV seriam bem recebidos por essa população. Esses testes podem ser considerados uma ferramenta valiosa, ao permitir que mais usuários de drogas injetáveis conheçam sua sorologia para o HIV e possam ser referidos para tratamento, como subsidiar a melhoria das estratégias de testagem entre usuários de drogas injetáveis.",
"journalAbbreviation": "Rev. Saúde Pública, Rev. saúde pública",
"language": "pt",
"libraryCatalog": "scielosp.org",
"pages": "94-100",
"publicationTitle": "Revista de Saúde Pública",
"url": "http://www.scielosp.org/scielo.php?script=sci_abstract&pid=S0034-89102007000900015&lng=en&nrm=iso&tlng=pt",
"url": "https://scielosp.org/scielo.php?script=sci_abstract&pid=S0034-89102007000900015&lng=en&nrm=iso&tlng=en",
"volume": "41",
"attachments": [
{
@@ -1114,21 +1130,16 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.salon.com/2012/10/10/junot_diaz_my_stories_come_from_trauma/",
"url": "https://www.salon.com/2012/10/10/junot_diaz_my_stories_come_from_trauma/",
"items": [
{
"itemType": "webpage",
"title": "Junot Díaz: My stories come from trauma",
"creators": [
{
"firstName": "Gregg",
"lastName": "Barrios",
"creatorType": "author"
}
],
"creators": [],
"date": "2012-10-10 15:36:00",
"abstractNote": "The effervescent author of \"This is How You Lose Her\" explains the darkness coursing through his fiction",
"shortTitle": "Junot Díaz",
"url": "http://www.salon.com/2012/10/10/junot_diaz_my_stories_come_from_trauma/",
"url": "https://www.salon.com/2012/10/10/junot_diaz_my_stories_come_from_trauma/",
"websiteTitle": "Salon",
"attachments": [
{
@@ -1450,6 +1461,45 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://muse.jhu.edu/article/234097",
"items": [
{
"itemType": "journalArticle",
"title": "Serfs on the Move: Peasant Seasonal Migration in Pre-Reform Russia, 1800–61",
"creators": [
{
"firstName": "Boris B.",
"lastName": "Gorshkov",
"creatorType": "author"
}
],
"date": "2000",
"DOI": "10.1353/kri.2008.0061",
"ISSN": "1538-5000",
"issue": "4",
"libraryCatalog": "muse.jhu.edu",
"pages": "627-656",
"publicationTitle": "Kritika: Explorations in Russian and Eurasian History",
"shortTitle": "Serfs on the Move",
"url": "https://muse.jhu.edu/article/234097",
"volume": "1",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-06-03 17:36:44"
"lastUpdated": "2017-11-25 17:50:03"
}

/*
@@ -123,7 +123,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "2006/07/20",
"date": "2006-07-20",
"ISSN": "1477-464X",
"issue": "1",
"libraryCatalog": "Project MUSE",
@@ -195,7 +195,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "2013/12/12",
"date": "2013-12-12",
"DOI": "10.1353/tech.2013.0137",
"ISSN": "1097-3729",
"abstractNote": "This article uses coverage of the fiftieth anniversary of the Pill as an example of what Richard Hirsh describes as the “real world” role of historians of technology. It explores how the presentation of historical topics on the world wide web has complicated how the history of technology is conveyed to the public. The article shows that that the Pill is especially suited to demonstrating the public role of historians of technology because, as the most popular form of reversible birth control, it has touched the lives of millions of Americans. Thus, an exploration of how the Pill’s fiftieth anniversary was covered illustrates how historians can use their expertise to provide a nuanced interpretation of a controversial topic in the history of technology.",
@@ -232,10 +232,10 @@ var testCases = [
"creatorType": "author"
}
],
"date": "2014/08/13",
"date": "2014-08-13",
"DOI": "10.1353/lar.2014.0030",
"ISSN": "1542-4278",
"abstractNote": "This article highlights an important paradox: in Argentina between 2003 and 2013 the center-left Peronist government’s approach to governance mirrors that of the center-right Peronist administration of the 1990s. While the latter centralized authority to pursue neoliberal reforms, the former have centralized authority in the name of expanding government intervention in the economy. In both cases, corruption has tended to go unchecked due to insufficient government accountability. Therefore, although economic policies and political rhetoric have changed dramatically, government corruption remains a constant of the Argentine political system due to the executive branch’s ability to emasculate constitutional checks and balances., Este artículo pone de relieve una paradoja importante: en la Argentina entre 2003 y 2013 los gobiernos peronistas de centro-izquierda reflejan los de la administración peronista de centro-derecha de la década de 1990. Mientras en los años noventa la concentración del poder presidencial se usó para promover reformas neoliberales, en los 2000 la autoridad centralizada se persiguió en nombre de la expansión de la intervención gubernamental en la economía. En ambos casos, la corrupción ha tendido a pasar inadvertida debido a la insuficiencia de la rendición de cuentas del gobierno. Por lo tanto, aunque las políticas económicas y la retórica política han cambiado drásticamente, la corrupción gubernamental sigue siendo una constante del sistema político argentino, gracias a la capacidad del Poder Ejecutivo para nulificar a los controles y equilibrios constitucionales",
"abstractNote": "This article highlights an important paradox: in Argentina between 2003 and 2013 the center-left Peronist government’s approach to governance mirrors that of the center-right Peronist administration of the 1990s. While the latter centralized authority to pursue neoliberal reforms, the former have centralized authority in the name of expanding government intervention in the economy. In both cases, corruption has tended to go unchecked due to insufficient government accountability. Therefore, although economic policies and political rhetoric have changed dramatically, government corruption remains a constant of the Argentine political system due to the executive branch’s ability to emasculate constitutional checks and balances.",
"issue": "2",
"libraryCatalog": "Project MUSE",
"pages": "173-195",
@@ -260,4 +260,4 @@ var testCases = [
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

0 comments on commit f79de81

Please sign in to comment.
You can’t perform that action at this time.