@citation-js/plugin-bibtex
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -12,9 +12,10 @@ 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; } | ||
import { orderNamePieces, formatNameParts, getStringCase } from './name.js'; | ||
const commandKeywords = { | ||
'\\begin': 'commandBegin', | ||
'\\end': 'commandEnd' | ||
}; | ||
const text = { | ||
command: { | ||
match: /\\(?:[a-zA-Z]+|.) */, | ||
type: moo.keywords({ | ||
commandBegin: '\\begin', | ||
commandEnd: '\\end' | ||
}), | ||
type: command => commandKeywords[command], | ||
value: s => s.slice(1).trim() | ||
@@ -21,0 +22,0 @@ }, |
@@ -242,4 +242,12 @@ import { util } from '@citation-js/core'; | ||
toSource(id, label, author, issued, suffix, title) { | ||
const safeId = id && id.replace(unsafeChars, '') || 'undefined'; | ||
let safeId; | ||
if (id === null) { | ||
safeId = 'null'; | ||
} else if (id === undefined) { | ||
safeId = 'undefined'; | ||
} else { | ||
safeId = id.toString().replace(unsafeChars, ''); | ||
} | ||
if (config.format.useIdAsLabel) { | ||
@@ -246,0 +254,0 @@ return safeId; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.sentenceCaseLanguages = exports.mathScripts = exports.mathScriptFormatting = exports.ligatures = exports.ligaturePattern = exports.argumentCommands = exports.formatting = exports.formattingCommands = exports.formattingEnvs = exports.defaultStrings = exports.commands = exports.diacritics = exports.fieldTypes = exports.required = void 0; | ||
exports.sentenceCaseLanguages = exports.required = exports.mathScripts = exports.mathScriptFormatting = exports.ligatures = exports.ligaturePattern = exports.formattingEnvs = exports.formattingCommands = exports.formatting = exports.fieldTypes = exports.diacritics = exports.defaultStrings = exports.commands = exports.argumentCommands = void 0; | ||
@@ -9,0 +9,0 @@ var _required2 = _interopRequireDefault(require("./required.json")); |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.bibtexGrammar = void 0; | ||
exports.parse = parse; | ||
exports.bibtexGrammar = void 0; | ||
@@ -10,0 +10,0 @@ var _core = require("@citation-js/core"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.formats = exports.ref = void 0; | ||
exports.ref = exports.formats = void 0; | ||
@@ -9,0 +9,0 @@ var _file = require("./file.js"); |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.formatNameParts = formatNameParts; | ||
exports.getStringCase = getStringCase; | ||
exports.formatNameParts = formatNameParts; | ||
exports.orderNameParts = orderNameParts; | ||
@@ -10,0 +10,0 @@ exports.orderNamePieces = orderNamePieces; |
@@ -31,9 +31,10 @@ "use strict"; | ||
const commandKeywords = { | ||
'\\begin': 'commandBegin', | ||
'\\end': 'commandEnd' | ||
}; | ||
const text = { | ||
command: { | ||
match: /\\(?:[a-zA-Z]+|.) */, | ||
type: _moo.default.keywords({ | ||
commandBegin: '\\begin', | ||
commandEnd: '\\end' | ||
}), | ||
type: command => commandKeywords[command], | ||
value: s => s.slice(1).trim() | ||
@@ -40,0 +41,0 @@ }, |
@@ -6,6 +6,6 @@ "use strict"; | ||
}); | ||
exports.parseBibtex = parseBibtex; | ||
exports.format = format; | ||
exports.formatBibtex = formatBibtex; | ||
exports.parse = parse; | ||
exports.format = format; | ||
exports.parseBibtex = parseBibtex; | ||
@@ -12,0 +12,0 @@ var _shared = require("./shared.js"); |
@@ -6,6 +6,6 @@ "use strict"; | ||
}); | ||
exports.TYPE_KEYS = exports.TYPE = exports.STANDARD_NUMBERS_PATTERN = exports.MONTHS = exports.LABEL = exports.Converters = void 0; | ||
exports.formatLabel = formatLabel; | ||
exports.parseDate = parseDate; | ||
exports.parseMonth = parseMonth; | ||
exports.formatLabel = formatLabel; | ||
exports.Converters = exports.STANDARD_NUMBERS_PATTERN = exports.TYPE_KEYS = exports.MONTHS = exports.LABEL = exports.TYPE = void 0; | ||
@@ -266,4 +266,12 @@ var _core = require("@citation-js/core"); | ||
toSource(id, label, author, issued, suffix, title) { | ||
const safeId = id && id.replace(unsafeChars, '') || 'undefined'; | ||
let safeId; | ||
if (id === null) { | ||
safeId = 'null'; | ||
} else if (id === undefined) { | ||
safeId = 'undefined'; | ||
} else { | ||
safeId = id.toString().replace(unsafeChars, ''); | ||
} | ||
if (_config.default.format.useIdAsLabel) { | ||
@@ -270,0 +278,0 @@ return safeId; |
{ | ||
"name": "@citation-js/plugin-bibtex", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Plugin for BibTeX formats for Citation.js", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@citation-js/core": "^0.5.3" | ||
"@citation-js/core": "^0.5.4" | ||
}, | ||
@@ -46,3 +46,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "665d4cd7983d85e6b8c1358c4ba6410f373b51d1" | ||
"gitHead": "bd67972fd6078b646d4aac84a5fda9bdd9433122" | ||
} |
171712
5279