Skip to content

Commit

Permalink
[Cite:output] Fix reference bugs in Cite#get()
Browse files Browse the repository at this point in the history
See #50
  • Loading branch information
larsgw committed Jun 3, 2017
1 parent 9b7dd5f commit 0002f53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions lib/Cite/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ var get = function get(options) {

switch ([type, styleType].join()) {
case 'html,citation':
var useLang = (0, _locales2.default)(lang) ? lang : 'en-US';
var useTemplate = template || (0, _styles2.default)(styleFormat);
var cbItem = (0, _items2.default)(_data);
var cbLocale = locale ? function () {
return locale;
} : _locales2.default;
var cbItem = (0, _items2.default)(_data);
var useTemplate = template || (0, _styles2.default)(styleFormat);
var useLang = (0, _locales2.default)(lang) ? lang : 'en-US';

var citeproc = (0, _engines2.default)(styleFormat, useLang, useTemplate, cbItem, cbLocale);
var sortedIds = citeproc.updateItems(this.getIds());
Expand Down Expand Up @@ -172,10 +172,10 @@ var get = function get(options) {
if (format === 'real') {
if (type === 'json') {
result = JSON.parse(result);
} else if (document && document.createElement && type === 'html') {
} else if (type === 'html' && typeof document !== 'undefined' && document.createElement) {
var tmp = document.createElement('div');
tmp.innerHTML = result;
result = result.childNodes;
result = tmp.childNodes;
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Cite/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ const get = function (options) {

switch ([type, styleType].join()) {
case 'html,citation':
const cbLocale = locale ? () => locale : fetchCSLLocale
const cbItem = fetchCSLItemCallback(_data)
const useTemplate = template || fetchCSLStyle(styleFormat)
const useLang = fetchCSLLocale(lang) ? lang : 'en-US'
const useTemplate = template || fetchCSLStyle(styleFormat)
const cbItem = fetchCSLItemCallback(_data)
const cbLocale = locale ? () => locale : fetchCSLLocale

const citeproc = fetchCSLEngine(styleFormat, useLang, useTemplate, cbItem, cbLocale)
const sortedIds = citeproc.updateItems(this.getIds())
Expand Down Expand Up @@ -118,10 +118,10 @@ const get = function (options) {
if (format === 'real') {
if (type === 'json') {
result = JSON.parse(result)
} else if (document && document.createElement && type === 'html') {
var tmp = document.createElement('div')
} else if (type === 'html' && typeof document !== 'undefined' && document.createElement) {
const tmp = document.createElement('div')
tmp.innerHTML = result
result = result.childNodes
result = tmp.childNodes
}
}

Expand Down

0 comments on commit 0002f53

Please sign in to comment.