larsgw / citation.js

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.
https://citation.js.org/
MIT License
219 stars 30 forks source link

RIS input - missing piece data #191

Closed TanguyHefnaoui closed 4 years ago

TanguyHefnaoui commented 4 years ago

First of all, thanks for implementing this feature.

citation-js version: 0.4.10 OS: windows 10 Pro

Some data is not fetched from my RIS files.

Here is my RIS:

TY  - JOUR
T1  - The human gene mutation database: 2008 update
A1  - Stenson, Peter D
A1  - Mort, Matthew
A1  - Ball, Edward V
A1  - Howells, Katy
A1  - Phillips, Andrew D
A1  - Thomas, Nick ST
A1  - Cooper, David N
JO  - Genome medicine
VL  - 1
IS  - 1
SP  - 13
SN  - 1756-994X
Y1  - 2009
PB  - BioMed Central
ER  -

Here is my code:

let parsed;
try {
      parsed = new Cite(content);
} catch (e) {
        console.log(e.message)
}
let res = parsed.format('data', {format: 'object'});
console.log(res);

I my final res var, the expected data is here but the Y1 - 2009 part is missing.

Am I doing something wrong somewhere?

larsgw commented 4 years ago

When I run that code (try it online) I do see an issued property with a value of { 'date-parts': [[2009]] }. Are you expecting the Y1 somewhere else?

TanguyHefnaoui commented 4 years ago

This is my output:

ISBN: "1756-994X\r"
_graph: Array(5) [ {…}, {…}, {…}, … ]
​​author: Array(7) [ {…}, {…}, {…}, … ]
​​"container-title": "Genome medicine\r"
​​id: "temp_id_4386139949432388"
​​issue: "1\r"
​​"page-first": "13\r"
​​publisher: "BioMed Central\rER  -\r"
​​title: "The human gene mutation database: 2008 update\r"
​​volume: "1\r"

The issued property is missing and I just noticed those \r in each property...

FYI: node version: 8.9.4 npm version: 5.6.0

I am using those old versions for several version and can't update them...

larsgw commented 4 years ago

Okay, seems like my line-splitting code doesn't handle \r\n right. I'll take a look this afternoon.

larsgw commented 4 years ago

This has been released in v0.5.0-alpha.3.

TanguyHefnaoui commented 4 years ago

Working great! Thanks again!