@citation-js/plugin-bibtex
Advanced tools
Comparing version
@@ -42,14 +42,16 @@ export const defaultStrings = { | ||
'"': '\u0308', | ||
'c': '\u0327', | ||
'b': '\u0331', | ||
'u': '\u0306', | ||
'v': '\u030C', | ||
c: '\u0327', | ||
b: '\u0331', | ||
u: '\u0306', | ||
v: '\u030C', | ||
'.': '\u0307', | ||
'd': '\u0323', | ||
'r': '\u030A', | ||
'H': '\u030B', | ||
'k': '\u0328' | ||
d: '\u0323', | ||
r: '\u030A', | ||
H: '\u030B', | ||
k: '\u0328' | ||
}; | ||
export const commands = { | ||
'~': '\u223C', | ||
_: '\u005f', | ||
'{': '\u007B', | ||
'}': '\u007D', | ||
'c\\ ': '\u00B8', | ||
@@ -85,2 +87,4 @@ href: '', | ||
textasciimacron: '\u00AF', | ||
textasciitilde: '\u223C', | ||
textbackslash: '\u005C', | ||
textbardbl: '\u2016', | ||
@@ -185,3 +189,3 @@ textbrokenbar: '\u00A6', | ||
'!?': '\u2049', | ||
'TEL': '\u2121', | ||
TEL: '\u2121', | ||
'~': '\u00A0' | ||
@@ -191,12 +195,12 @@ }; | ||
'^': { | ||
'0': '\u2070', | ||
'1': '\u00B9', | ||
'2': '\u00B2', | ||
'3': '\u00B3', | ||
'4': '\u2074', | ||
'5': '\u2075', | ||
'6': '\u2076', | ||
'7': '\u2077', | ||
'8': '\u2078', | ||
'9': '\u2079', | ||
0: '\u2070', | ||
1: '\u00B9', | ||
2: '\u00B2', | ||
3: '\u00B3', | ||
4: '\u2074', | ||
5: '\u2075', | ||
6: '\u2076', | ||
7: '\u2077', | ||
8: '\u2078', | ||
9: '\u2079', | ||
'+': '\u207A', | ||
@@ -207,16 +211,16 @@ '-': '\u207B', | ||
')': '\u207E', | ||
'i': '\u2071', | ||
'n': '\u207F' | ||
i: '\u2071', | ||
n: '\u207F' | ||
}, | ||
'_': { | ||
'0': '\u2080', | ||
'1': '\u2081', | ||
'2': '\u2082', | ||
'3': '\u2083', | ||
'4': '\u2084', | ||
'5': '\u2085', | ||
'6': '\u2086', | ||
'7': '\u2087', | ||
'8': '\u2088', | ||
'9': '\u2089', | ||
_: { | ||
0: '\u2080', | ||
1: '\u2081', | ||
2: '\u2082', | ||
3: '\u2083', | ||
4: '\u2084', | ||
5: '\u2085', | ||
6: '\u2086', | ||
7: '\u2087', | ||
8: '\u2088', | ||
9: '\u2089', | ||
'+': '\u208A', | ||
@@ -227,16 +231,16 @@ '-': '\u208B', | ||
')': '\u208E', | ||
'a': '\u2090', | ||
'e': '\u2091', | ||
'o': '\u2092', | ||
'x': '\u2093', | ||
'\u0259': '\u2094', | ||
'h': '\u2095', | ||
'k': '\u2096', | ||
'l': '\u2097', | ||
'm': '\u2098', | ||
'n': '\u2099', | ||
's': '\u209A', | ||
'p': '\u209B', | ||
't': '\u209C' | ||
a: '\u2090', | ||
e: '\u2091', | ||
o: '\u2092', | ||
x: '\u2093', | ||
ə: '\u2094', | ||
h: '\u2095', | ||
k: '\u2096', | ||
l: '\u2097', | ||
m: '\u2098', | ||
n: '\u2099', | ||
s: '\u209A', | ||
p: '\u209B', | ||
t: '\u209C' | ||
} | ||
}; |
@@ -7,5 +7,5 @@ import parseBibTeXProp from './prop'; | ||
const newEntry = {}; | ||
let toMerge = []; | ||
const toMerge = []; | ||
for (let prop in entry.properties) { | ||
for (const prop in entry.properties) { | ||
const oldValue = entry.properties[prop]; | ||
@@ -12,0 +12,0 @@ const [cslField, cslValue] = parseBibTeXProp(prop, oldValue) || []; |
@@ -46,3 +46,3 @@ import { logger } from '@citation-js/core'; | ||
let tokens = text.split(/((?:\\[a-z]+)?{|})/); | ||
let closingTags = []; | ||
const closingTags = []; | ||
let hasTopLevelTag = text[0] === '{' && text[text.length - 1] === '}'; | ||
@@ -53,3 +53,3 @@ tokens = tokens.map((token, index) => { | ||
} else if (token[0] === '\\') { | ||
let tag = richTextMappings[token.slice(1, -1)]; | ||
const tag = richTextMappings[token.slice(1, -1)]; | ||
@@ -87,2 +87,3 @@ if (tag) { | ||
booktitle: 'container-title', | ||
chapter: 'chapter-number', | ||
doi: 'DOI', | ||
@@ -92,2 +93,5 @@ date: 'issued', | ||
editor: true, | ||
type: 'genre', | ||
howpublished: 'publisher', | ||
institution: 'publisher', | ||
isbn: 'ISBN', | ||
@@ -106,2 +110,3 @@ issn: 'ISSN', | ||
publisher: true, | ||
school: 'publisher', | ||
series: 'collection-title', | ||
@@ -119,3 +124,3 @@ title: true, | ||
const parseBibTeXProp = function (name, value) { | ||
if (!propMap.hasOwnProperty(name)) { | ||
if (propMap[name] == null) { | ||
logger.unmapped('[plugin-bibtex]', 'property', name); | ||
@@ -122,0 +127,0 @@ return undefined; |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -44,3 +44,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
}, | ||
entry: _objectSpread({}, whitespace, { | ||
entry: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
otherEntryType: { | ||
@@ -55,3 +55,3 @@ match: /[sS][tT][rR][iI][nN][gG]|[pP][rR][eE][aA][mM][bB][lL][eE]/, | ||
}), | ||
otherEntryContents: _objectSpread({}, whitespace, { | ||
otherEntryContents: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
lbrace: { | ||
@@ -62,3 +62,3 @@ match: /[{(]/, | ||
}), | ||
dataEntryContents: _objectSpread({}, whitespace, { | ||
dataEntryContents: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
lbrace: { | ||
@@ -74,3 +74,3 @@ match: /[{(]/, | ||
}), | ||
fields: _objectSpread({}, whitespace, { | ||
fields: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
identifier, | ||
@@ -94,3 +94,3 @@ number: /-?\d+/, | ||
}), | ||
quotedLiteral: _objectSpread({}, text, { | ||
quotedLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
quote: { | ||
@@ -102,3 +102,3 @@ match: '"', | ||
}), | ||
bracedLiteral: _objectSpread({}, text, { | ||
bracedLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
rbrace: { | ||
@@ -110,3 +110,3 @@ match: '}', | ||
}), | ||
mathLiteral: _objectSpread({}, text, { | ||
mathLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
mathShift: { | ||
@@ -126,3 +126,3 @@ match: '$', | ||
Main() { | ||
let entries = []; | ||
const entries = []; | ||
@@ -192,6 +192,6 @@ while (true) { | ||
EntryBody() { | ||
let properties = {}; | ||
const properties = {}; | ||
while (this.matchToken('identifier')) { | ||
let [field, value] = this.consumeRule('Field'); | ||
const [field, value] = this.consumeRule('Field'); | ||
properties[field] = value; | ||
@@ -308,14 +308,18 @@ this.consumeRule('_'); | ||
Text() { | ||
let raw; | ||
if (this.matchToken('lbrace')) { | ||
return this.consumeRule('BracketText'); | ||
raw = this.consumeRule('BracketText'); | ||
} else if (this.matchToken('mathShift')) { | ||
return this.consumeRule('MathString'); | ||
raw = this.consumeRule('MathString'); | ||
} else if (this.matchToken('whitespace')) { | ||
this.consumeToken('whitespace'); | ||
return ' '; | ||
raw = ' '; | ||
} else if (this.matchToken('command')) { | ||
return this.consumeRule('Command'); | ||
raw = this.consumeRule('Command'); | ||
} else { | ||
return this.consumeToken('text').value.replace(constants.ligaturePattern, ligature => constants.ligatures[ligature]); | ||
raw = this.consumeToken('text').value.replace(constants.ligaturePattern, ligature => constants.ligatures[ligature]); | ||
} | ||
return raw.normalize(); | ||
}, | ||
@@ -322,0 +326,0 @@ |
@@ -22,3 +22,3 @@ import { logger } from '@citation-js/core'; | ||
const parseBibTeXType = function (pubType) { | ||
if (!typeMap.hasOwnProperty(pubType)) { | ||
if (typeMap[pubType] == null) { | ||
logger.unmapped('[plugin-bibtex]', 'publication type', pubType); | ||
@@ -25,0 +25,0 @@ return 'book'; |
@@ -37,4 +37,4 @@ import fetchBibTeXType from './type'; | ||
for (let prop in simple) { | ||
if (src.hasOwnProperty(prop)) { | ||
for (const prop in simple) { | ||
if (src[prop] != null) { | ||
props[simple[prop]] = src[prop] + ''; | ||
@@ -61,3 +61,3 @@ } | ||
if (src.issued && src.issued['date-parts']) { | ||
let dateParts = src.issued['date-parts'][0]; | ||
const dateParts = src.issued['date-parts'][0]; | ||
@@ -64,0 +64,0 @@ if (dateParts.length > 0) { |
@@ -19,7 +19,7 @@ import getBibTeXJSON from './json'; | ||
const richTextMappings = { | ||
'i': '\\textit{', | ||
'b': '\\textbf{', | ||
'sc': '\\textsc{', | ||
'sup': '\\textsuperscript{', | ||
'sub': '\\textsubscript{', | ||
i: '\\textit{', | ||
b: '\\textbf{', | ||
sc: '\\textsc{', | ||
sup: '\\textsuperscript{', | ||
sub: '\\textsubscript{', | ||
'span style="font-variant:small-caps;"': '\\textsc{', | ||
@@ -66,3 +66,3 @@ 'span class="nocase"': '{' | ||
const getBibtex = function (src, dict, opts) { | ||
let entries = src.map(entry => serializeEntry(entry, dict, opts)).join(''); | ||
const entries = src.map(entry => serializeEntry(entry, dict, opts)).join(''); | ||
return dict.bibliographyContainer.join(entries); | ||
@@ -69,0 +69,0 @@ }; |
@@ -49,15 +49,17 @@ "use strict"; | ||
'"': '\u0308', | ||
'c': '\u0327', | ||
'b': '\u0331', | ||
'u': '\u0306', | ||
'v': '\u030C', | ||
c: '\u0327', | ||
b: '\u0331', | ||
u: '\u0306', | ||
v: '\u030C', | ||
'.': '\u0307', | ||
'd': '\u0323', | ||
'r': '\u030A', | ||
'H': '\u030B', | ||
'k': '\u0328' | ||
d: '\u0323', | ||
r: '\u030A', | ||
H: '\u030B', | ||
k: '\u0328' | ||
}; | ||
exports.diacritics = diacritics; | ||
const commands = { | ||
'~': '\u223C', | ||
_: '\u005f', | ||
'{': '\u007B', | ||
'}': '\u007D', | ||
'c\\ ': '\u00B8', | ||
@@ -93,2 +95,4 @@ href: '', | ||
textasciimacron: '\u00AF', | ||
textasciitilde: '\u223C', | ||
textbackslash: '\u005C', | ||
textbardbl: '\u2016', | ||
@@ -195,3 +199,3 @@ textbrokenbar: '\u00A6', | ||
'!?': '\u2049', | ||
'TEL': '\u2121', | ||
TEL: '\u2121', | ||
'~': '\u00A0' | ||
@@ -202,12 +206,12 @@ }; | ||
'^': { | ||
'0': '\u2070', | ||
'1': '\u00B9', | ||
'2': '\u00B2', | ||
'3': '\u00B3', | ||
'4': '\u2074', | ||
'5': '\u2075', | ||
'6': '\u2076', | ||
'7': '\u2077', | ||
'8': '\u2078', | ||
'9': '\u2079', | ||
0: '\u2070', | ||
1: '\u00B9', | ||
2: '\u00B2', | ||
3: '\u00B3', | ||
4: '\u2074', | ||
5: '\u2075', | ||
6: '\u2076', | ||
7: '\u2077', | ||
8: '\u2078', | ||
9: '\u2079', | ||
'+': '\u207A', | ||
@@ -218,16 +222,16 @@ '-': '\u207B', | ||
')': '\u207E', | ||
'i': '\u2071', | ||
'n': '\u207F' | ||
i: '\u2071', | ||
n: '\u207F' | ||
}, | ||
'_': { | ||
'0': '\u2080', | ||
'1': '\u2081', | ||
'2': '\u2082', | ||
'3': '\u2083', | ||
'4': '\u2084', | ||
'5': '\u2085', | ||
'6': '\u2086', | ||
'7': '\u2087', | ||
'8': '\u2088', | ||
'9': '\u2089', | ||
_: { | ||
0: '\u2080', | ||
1: '\u2081', | ||
2: '\u2082', | ||
3: '\u2083', | ||
4: '\u2084', | ||
5: '\u2085', | ||
6: '\u2086', | ||
7: '\u2087', | ||
8: '\u2088', | ||
9: '\u2089', | ||
'+': '\u208A', | ||
@@ -238,17 +242,17 @@ '-': '\u208B', | ||
')': '\u208E', | ||
'a': '\u2090', | ||
'e': '\u2091', | ||
'o': '\u2092', | ||
'x': '\u2093', | ||
'\u0259': '\u2094', | ||
'h': '\u2095', | ||
'k': '\u2096', | ||
'l': '\u2097', | ||
'm': '\u2098', | ||
'n': '\u2099', | ||
's': '\u209A', | ||
'p': '\u209B', | ||
't': '\u209C' | ||
a: '\u2090', | ||
e: '\u2091', | ||
o: '\u2092', | ||
x: '\u2093', | ||
ə: '\u2094', | ||
h: '\u2095', | ||
k: '\u2096', | ||
l: '\u2097', | ||
m: '\u2098', | ||
n: '\u2099', | ||
s: '\u209A', | ||
p: '\u209B', | ||
t: '\u209C' | ||
} | ||
}; | ||
exports.mathScripts = mathScripts; |
@@ -20,3 +20,3 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
@@ -23,0 +23,0 @@ const ref = '@bibtex'; |
@@ -17,5 +17,5 @@ "use strict"; | ||
const newEntry = {}; | ||
let toMerge = []; | ||
const toMerge = []; | ||
for (let prop in entry.properties) { | ||
for (const prop in entry.properties) { | ||
const oldValue = entry.properties[prop]; | ||
@@ -22,0 +22,0 @@ const [cslField, cslValue] = (0, _prop.default)(prop, oldValue) || []; |
@@ -56,3 +56,3 @@ "use strict"; | ||
let tokens = text.split(/((?:\\[a-z]+)?{|})/); | ||
let closingTags = []; | ||
const closingTags = []; | ||
let hasTopLevelTag = text[0] === '{' && text[text.length - 1] === '}'; | ||
@@ -63,3 +63,3 @@ tokens = tokens.map((token, index) => { | ||
} else if (token[0] === '\\') { | ||
let tag = richTextMappings[token.slice(1, -1)]; | ||
const tag = richTextMappings[token.slice(1, -1)]; | ||
@@ -97,2 +97,3 @@ if (tag) { | ||
booktitle: 'container-title', | ||
chapter: 'chapter-number', | ||
doi: 'DOI', | ||
@@ -102,2 +103,5 @@ date: 'issued', | ||
editor: true, | ||
type: 'genre', | ||
howpublished: 'publisher', | ||
institution: 'publisher', | ||
isbn: 'ISBN', | ||
@@ -116,2 +120,3 @@ issn: 'ISSN', | ||
publisher: true, | ||
school: 'publisher', | ||
series: 'collection-title', | ||
@@ -129,3 +134,3 @@ title: true, | ||
const parseBibTeXProp = function (name, value) { | ||
if (!propMap.hasOwnProperty(name)) { | ||
if (propMap[name] == null) { | ||
_core.logger.unmapped('[plugin-bibtex]', 'property', name); | ||
@@ -132,0 +137,0 @@ |
@@ -17,3 +17,3 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
@@ -24,3 +24,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -64,3 +64,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
}, | ||
entry: _objectSpread({}, whitespace, { | ||
entry: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
otherEntryType: { | ||
@@ -75,3 +75,3 @@ match: /[sS][tT][rR][iI][nN][gG]|[pP][rR][eE][aA][mM][bB][lL][eE]/, | ||
}), | ||
otherEntryContents: _objectSpread({}, whitespace, { | ||
otherEntryContents: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
lbrace: { | ||
@@ -82,3 +82,3 @@ match: /[{(]/, | ||
}), | ||
dataEntryContents: _objectSpread({}, whitespace, { | ||
dataEntryContents: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
lbrace: { | ||
@@ -94,3 +94,3 @@ match: /[{(]/, | ||
}), | ||
fields: _objectSpread({}, whitespace, { | ||
fields: _objectSpread(_objectSpread({}, whitespace), {}, { | ||
identifier, | ||
@@ -114,3 +114,3 @@ number: /-?\d+/, | ||
}), | ||
quotedLiteral: _objectSpread({}, text, { | ||
quotedLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
quote: { | ||
@@ -122,3 +122,3 @@ match: '"', | ||
}), | ||
bracedLiteral: _objectSpread({}, text, { | ||
bracedLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
rbrace: { | ||
@@ -130,3 +130,3 @@ match: '}', | ||
}), | ||
mathLiteral: _objectSpread({}, text, { | ||
mathLiteral: _objectSpread(_objectSpread({}, text), {}, { | ||
mathShift: { | ||
@@ -147,3 +147,3 @@ match: '$', | ||
Main() { | ||
let entries = []; | ||
const entries = []; | ||
@@ -213,6 +213,6 @@ while (true) { | ||
EntryBody() { | ||
let properties = {}; | ||
const properties = {}; | ||
while (this.matchToken('identifier')) { | ||
let [field, value] = this.consumeRule('Field'); | ||
const [field, value] = this.consumeRule('Field'); | ||
properties[field] = value; | ||
@@ -329,14 +329,18 @@ this.consumeRule('_'); | ||
Text() { | ||
let raw; | ||
if (this.matchToken('lbrace')) { | ||
return this.consumeRule('BracketText'); | ||
raw = this.consumeRule('BracketText'); | ||
} else if (this.matchToken('mathShift')) { | ||
return this.consumeRule('MathString'); | ||
raw = this.consumeRule('MathString'); | ||
} else if (this.matchToken('whitespace')) { | ||
this.consumeToken('whitespace'); | ||
return ' '; | ||
raw = ' '; | ||
} else if (this.matchToken('command')) { | ||
return this.consumeRule('Command'); | ||
raw = this.consumeRule('Command'); | ||
} else { | ||
return this.consumeToken('text').value.replace(constants.ligaturePattern, ligature => constants.ligatures[ligature]); | ||
raw = this.consumeToken('text').value.replace(constants.ligaturePattern, ligature => constants.ligatures[ligature]); | ||
} | ||
return raw.normalize(); | ||
}, | ||
@@ -343,0 +347,0 @@ |
@@ -30,3 +30,3 @@ "use strict"; | ||
const parseBibTeXType = function (pubType) { | ||
if (!typeMap.hasOwnProperty(pubType)) { | ||
if (typeMap[pubType] == null) { | ||
_core.logger.unmapped('[plugin-bibtex]', 'publication type', pubType); | ||
@@ -33,0 +33,0 @@ |
@@ -49,4 +49,4 @@ "use strict"; | ||
for (let prop in simple) { | ||
if (src.hasOwnProperty(prop)) { | ||
for (const prop in simple) { | ||
if (src[prop] != null) { | ||
props[simple[prop]] = src[prop] + ''; | ||
@@ -73,3 +73,3 @@ } | ||
if (src.issued && src.issued['date-parts']) { | ||
let dateParts = src.issued['date-parts'][0]; | ||
const dateParts = src.issued['date-parts'][0]; | ||
@@ -76,0 +76,0 @@ if (dateParts.length > 0) { |
@@ -30,7 +30,7 @@ "use strict"; | ||
const richTextMappings = { | ||
'i': '\\textit{', | ||
'b': '\\textbf{', | ||
'sc': '\\textsc{', | ||
'sup': '\\textsuperscript{', | ||
'sub': '\\textsubscript{', | ||
i: '\\textit{', | ||
b: '\\textbf{', | ||
sc: '\\textsc{', | ||
sup: '\\textsuperscript{', | ||
sub: '\\textsubscript{', | ||
'span style="font-variant:small-caps;"': '\\textsc{', | ||
@@ -77,3 +77,3 @@ 'span class="nocase"': '{' | ||
const getBibtex = function (src, dict, opts) { | ||
let entries = src.map(entry => serializeEntry(entry, dict, opts)).join(''); | ||
const entries = src.map(entry => serializeEntry(entry, dict, opts)).join(''); | ||
return dict.bibliographyContainer.join(entries); | ||
@@ -80,0 +80,0 @@ }; |
{ | ||
"name": "@citation-js/plugin-bibtex", | ||
"version": "0.5.0-alpha.5", | ||
"version": "0.5.0-alpha.6", | ||
"description": "Plugin for BibTeX formats for Citation.js", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@citation-js/core": "^0.5.0-alpha.5" | ||
"@citation-js/core": "^0.5.0-alpha.6" | ||
}, | ||
@@ -46,3 +46,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "0b7bcc58aca9b9c0938769b7bf5313fade4f1d66" | ||
"gitHead": "7c8ac5c7d4bfd1a6661fdad7ed74a8390d7ab099" | ||
} |
98750
0.77%2406
0.92%