citation-js 0.5.0-alpha.8 → 0.5.2

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/index.js CHANGED
@@ -120,12 +120,29 @@ Cite.parse = Object.assign({
120
120
  csl: core.plugins.input.util.clean,
121
121
 
122
122
  bibjson: require('@citation-js/plugin-bibjson').parsers.json.record,
123
- bibtex: ((bibtex) => ({
124
- json: bibtex.parsers.json.parse,
125
- prop: bibtex.parsers.prop.parse,
126
- text: bibtex.parsers.text.parse,
127
- type: bibtex.parsers.type.parse
128
- }))(require('@citation-js/plugin-bibtex/lib/input')),
123
+ bibtex: ((parsers, entries, types) => ({
124
+ json (entries) {
125
+ return entries.parse([].concat(entries))
126
+ },
127
+ prop (field, value) {
128
+ const parsed = entries.parse([{
129
+ type: 'book',
130
+ properties: { [field]: value }
131
+ }])[0]
132
+ const key = Object.keys(parsed).find(([key]) => key !== 'type')
133
+ return [key, parsed[key]]
134
+ },
135
+ text (file) {
136
+ return parsers['@biblatex/text'].parse(file)
137
+ },
138
+ type (type) {
139
+ return types[type] || 'book'
140
+ }
141
+ }))(
142
+ require('@citation-js/plugin-bibtex/lib/input').formats,
143
+ require('@citation-js/plugin-bibtex/lib/input/entries'),
144
+ require('@citation-js/plugin-bibtex/lib/mapping/bibtexTypes').target
145
+ ),
129
146
  bibtxt: ((bibtxt) => ({
130
147
  text: bibtxt.parse,
131
148
  textEntry: bibtxt.textEntry
@@ -158,13 +175,26 @@ Cite.get = Object.assign({
158
175
  name: name.format,
159
176
  date: date.format,
160
177
 
161
- bibtex: {
162
- json: require('@citation-js/plugin-bibtex/lib/output/json').default,
163
- label: require('@citation-js/plugin-bibtex/lib/output/label').default,
164
- text: require('@citation-js/plugin-bibtex/lib/output/text').default,
165
- type: require('@citation-js/plugin-bibtex/lib/output/type').default
166
- },
167
- bibtxt: require('@citation-js/plugin-bibtex/lib/output/bibtxt').default,
178
+ bibtex: ((formatters, entries, converters, types) => ({
179
+ json (entry) {
180
+ return entries.formatBibtex([entry])[0]
181
+ },
182
+ label ({ id, 'citation-label': label, author, issued, 'year-suffix': suffix, title }) {
183
+ return converters.LABEL.toSource(id, label, author, issued, suffix, title)
184
+ },
185
+ text (entries, asHtml) {
186
+ return formatters.bibtex(entries, { format: asHtml ? 'html' : 'text' })
187
+ },
188
+ type (type) {
189
+ return types[type] || 'misc'
190
+ }
191
+ }))(
192
+ require('@citation-js/plugin-bibtex/lib/output').default,
193
+ require('@citation-js/plugin-bibtex/lib/output/entries'),
194
+ require('@citation-js/plugin-bibtex/lib/mapping/shared').Converters,
195
+ require('@citation-js/plugin-bibtex/lib/mapping/bibtexTypes').target
196
+ ),
197
+ bibtxt: require('@citation-js/plugin-bibtex/lib/output/bibtxt').format,
168
198
  json: require('@citation-js/core/lib/plugin-common/output').default.data,
169
199
  label: require('@citation-js/core/lib/plugin-common/output').default.label
170
200
  }, Cite.plugins.output)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "citation-js",
3
- "version": "0.5.0-alpha.8",
3
+ "version": "0.5.2",
4
4
  "description": "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.",
5
5
  "main": "index.js",
6
6
  "jsdelivr": "build/citation.min.js",
@@ -28,34 +28,34 @@
28
28
  "/build/citation.min.js"
29
29
  ],
30
30
  "dependencies": {
31
- "@citation-js/cli": "0.5.0-alpha.8",
32
- "@citation-js/core": "0.5.0-alpha.7",
31
+ "@citation-js/cli": "^0.5.2",
32
+ "@citation-js/core": "^0.5.2",
33
33
  "@citation-js/date": "0.4.4",
34
34
  "@citation-js/name": "0.4.2",
35
- "@citation-js/plugin-bibjson": "0.5.0-alpha.7",
36
- "@citation-js/plugin-bibtex": "0.5.0-alpha.8",
37
- "@citation-js/plugin-csl": "0.5.0-alpha.8",
38
- "@citation-js/plugin-doi": "0.5.0-alpha.7",
39
- "@citation-js/plugin-ris": "0.5.0-alpha.7",
40
- "@citation-js/plugin-wikidata": "0.5.0-alpha.7",
41
- "citeproc": "^2.4.6"
35
+ "@citation-js/plugin-bibjson": "^0.5.2",
36
+ "@citation-js/plugin-bibtex": "^0.5.2",
37
+ "@citation-js/plugin-csl": "^0.5.2",
38
+ "@citation-js/plugin-doi": "^0.5.2",
39
+ "@citation-js/plugin-ris": "^0.5.2",
40
+ "@citation-js/plugin-wikidata": "^0.5.2",
41
+ "citeproc": "^2.4.59"
42
42
  },
43
43
  "devDependencies": {
44
- "@babel/core": "^7.10.4",
45
- "@babel/preset-env": "^7.10.4",
44
+ "@babel/core": "^7.12.10",
45
+ "@babel/preset-env": "^7.12.11",
46
46
  "babelify": "^10.0.0",
47
- "browserify": "^16.5.1",
48
- "core-js": "^3.6.5",
47
+ "browserify": "^16.5.2",
48
+ "core-js": "^3.8.3",
49
49
  "disc": "^1.3.2",
50
50
  "glob": "^7.1.6",
51
- "jsdoc": "^3.6.4",
51
+ "jsdoc": "^3.6.6",
52
52
  "markdown-toc": "^1.2.0",
53
53
  "minami": "^1.2.3",
54
54
  "mocha": "^6.2.3",
55
- "regenerator-runtime": "^0.13.5",
56
- "semver": "^7.3.2",
55
+ "regenerator-runtime": "^0.13.7",
56
+ "semver": "^7.3.4",
57
57
  "standard": "^14.3.4",
58
- "uglify-js": "^3.10.0"
58
+ "uglify-js": "^3.12.5"
59
59
  },
60
60
  "scripts": {
61
61
  "lint": "standard",
@@ -76,7 +76,9 @@
76
76
  },
77
77
  "author": "Lars Willighagen (https://larsgw.github.io)",
78
78
  "license": "MIT",
79
- "bin": "bin/cmd.js",
79
+ "bin": {
80
+ "citation-js": "bin/cmd.js"
81
+ },
80
82
  "man": "bin/man/citation-js.1",
81
83
  "bugs": {
82
84
  "url": "https://github.com/larsgw/citation.js/issues"