@citestyle/ris 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -30
- package/package.json +19 -4
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @citestyle/ris
|
|
2
2
|
|
|
3
|
-
RIS
|
|
3
|
+
Parse RIS files into CSL-JSON and export CSL-JSON back to RIS. RIS (Research Information Systems) is the tagged format used by PubMed, Scopus, Web of Science, Zotero, and most reference managers for bulk export.
|
|
4
|
+
|
|
5
|
+
Use this to bring exported references into the Citestyle formatting pipeline, or to generate RIS files for sharing with other tools.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,11 +10,9 @@ RIS parser and serializer. Converts between RIS (Research Information Systems) t
|
|
|
8
10
|
npm install @citestyle/ris
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### Parse RIS to CSL-JSON
|
|
13
|
+
## Parse RIS to CSL-JSON
|
|
14
14
|
|
|
15
|
-
```
|
|
15
|
+
```javascript
|
|
16
16
|
import { parseRis } from '@citestyle/ris'
|
|
17
17
|
|
|
18
18
|
const ris = `
|
|
@@ -30,18 +30,19 @@ ER -
|
|
|
30
30
|
`
|
|
31
31
|
|
|
32
32
|
const items = parseRis(ris)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
|
|
34
|
+
items[0].title // "A Study of Climate Change"
|
|
35
|
+
items[0].author.length // 2
|
|
36
|
+
items[0].page // "100-108" (SP + EP merged automatically)
|
|
37
|
+
items[0].DOI // "10.1038/example"
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
## Export CSL-JSON to RIS
|
|
40
41
|
|
|
41
|
-
```
|
|
42
|
+
```javascript
|
|
42
43
|
import { exportRis } from '@citestyle/ris'
|
|
43
44
|
|
|
44
|
-
const
|
|
45
|
+
const output = exportRis([{
|
|
45
46
|
id: '1',
|
|
46
47
|
type: 'article-journal',
|
|
47
48
|
title: 'A Study of Climate Change',
|
|
@@ -54,48 +55,51 @@ const items = [{
|
|
|
54
55
|
volume: '14',
|
|
55
56
|
page: '100-108',
|
|
56
57
|
DOI: '10.1038/example',
|
|
57
|
-
}]
|
|
58
|
+
}])
|
|
58
59
|
|
|
59
|
-
const output = exportRis(items)
|
|
60
60
|
// TY - JOUR
|
|
61
61
|
// AU - Smith, John
|
|
62
62
|
// AU - Doe, Jane
|
|
63
63
|
// TI - A Study of Climate Change
|
|
64
|
+
// JF - Nature Climate Change
|
|
64
65
|
// ...
|
|
65
66
|
// ER -
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
## Full pipeline: RIS to formatted bibliography
|
|
69
70
|
|
|
70
|
-
```
|
|
71
|
+
```javascript
|
|
71
72
|
import { parseRis } from '@citestyle/ris'
|
|
72
73
|
import { createRegistry } from '@citestyle/registry'
|
|
73
74
|
import * as apa from '@citestyle/styles/apa'
|
|
74
75
|
|
|
75
|
-
const
|
|
76
|
-
const items = parseRis(ris)
|
|
76
|
+
const items = parseRis(readFileSync('export.ris', 'utf-8'))
|
|
77
77
|
|
|
78
78
|
const registry = createRegistry(apa)
|
|
79
79
|
registry.addItems(items)
|
|
80
80
|
|
|
81
81
|
const bibliography = registry.getBibliography()
|
|
82
|
-
bibliography.forEach(entry =>
|
|
82
|
+
bibliography.forEach(entry => {
|
|
83
|
+
console.log(entry.html) // Semantic HTML with CSS classes and linked DOIs
|
|
84
|
+
console.log(entry.text) // Plain text for copy-paste
|
|
85
|
+
})
|
|
83
86
|
```
|
|
84
87
|
|
|
85
88
|
## API
|
|
86
89
|
|
|
87
|
-
### `parseRis(str)`
|
|
90
|
+
### `parseRis(str) → CslItem[]`
|
|
91
|
+
|
|
92
|
+
Parse a RIS string into CSL-JSON items.
|
|
88
93
|
|
|
89
|
-
|
|
94
|
+
**Handles**:
|
|
95
|
+
- 30+ RIS type codes (`JOUR`, `BOOK`, `CHAP`, `THES`, `CONF`, `RPRT`, `GEN`, etc.)
|
|
96
|
+
- Repeatable tags (`AU` for multiple authors, `KW` for keywords)
|
|
97
|
+
- Automatic page merging from `SP` (start page) + `EP` (end page) tags
|
|
98
|
+
- Date parsing from `PY` and `DA` tags
|
|
99
|
+
- Editor (`A2`/`ED`), translator, and other contributor roles
|
|
90
100
|
|
|
91
|
-
**
|
|
92
|
-
- 30+ RIS type codes (JOUR, BOOK, CHAP, THES, CONF, RPRT, etc.)
|
|
93
|
-
- Repeatable tags (AU for multiple authors, KW for keywords)
|
|
94
|
-
- SP + EP page merging into a single page range
|
|
95
|
-
- Date parsing from PY and DA tags
|
|
96
|
-
- Editor (A2/ED), translator, and other contributor roles
|
|
97
|
-
- Common in exports from PubMed, Scopus, Web of Science, and Zotero
|
|
101
|
+
**Compatible with exports from**: PubMed, Scopus, Web of Science, Zotero, Mendeley, EndNote, Google Scholar.
|
|
98
102
|
|
|
99
|
-
### `exportRis(items)`
|
|
103
|
+
### `exportRis(items) → string`
|
|
100
104
|
|
|
101
|
-
Serialize
|
|
105
|
+
Serialize CSL-JSON items to a RIS string. Each record is delimited by `TY` (type) and `ER` (end of record) tags.
|
package/package.json
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citestyle/ris",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "RIS ↔ CSL-JSON parser and serializer",
|
|
5
|
+
"author": "Uniweb",
|
|
6
|
+
"homepage": "https://github.com/uniweb/csl/tree/main/packages/ris",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/uniweb/csl.git",
|
|
10
|
+
"directory": "packages/ris"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ris",
|
|
14
|
+
"csl",
|
|
15
|
+
"parser",
|
|
16
|
+
"serializer",
|
|
17
|
+
"citation",
|
|
18
|
+
"pubmed",
|
|
19
|
+
"bibliography"
|
|
20
|
+
],
|
|
5
21
|
"type": "module",
|
|
6
22
|
"exports": {
|
|
7
23
|
".": {
|
|
@@ -15,7 +31,7 @@
|
|
|
15
31
|
"README.md"
|
|
16
32
|
],
|
|
17
33
|
"dependencies": {
|
|
18
|
-
"@citestyle/types": "0.0
|
|
34
|
+
"@citestyle/types": "1.0.0"
|
|
19
35
|
},
|
|
20
36
|
"devDependencies": {
|
|
21
37
|
"vitest": "^3.1.1"
|
|
@@ -25,7 +41,6 @@
|
|
|
25
41
|
},
|
|
26
42
|
"license": "MIT",
|
|
27
43
|
"scripts": {
|
|
28
|
-
"test": "vitest run --passWithNoTests"
|
|
29
|
-
"lint": "echo 'TODO: configure linter'"
|
|
44
|
+
"test": "vitest run --passWithNoTests"
|
|
30
45
|
}
|
|
31
46
|
}
|