diff --git a/bibtexParse.js b/bibtexParse.js index 4bac1ac..796962b 100644 --- a/bibtexParse.js +++ b/bibtexParse.js @@ -172,7 +172,7 @@ } else if (this.tryMatch('"')) { return this.value_quotes(); } else { - var k = this.key(); + var k = this.key().trim(); if (k.match("^[0-9]+$")) return k; else if (this.months.indexOf(k.toLowerCase()) >= 0) diff --git a/test/proceedings.js b/test/proceedings.js new file mode 100644 index 0000000..098f553 --- /dev/null +++ b/test/proceedings.js @@ -0,0 +1,28 @@ +import test from 'ava'; + +const bibtexParse = require('../bibtexParse'); + +const input = `@proceedings{Last:2020:P20I3, + doi = {10.22152/programming-journal.org/2020/4/issue3}, + editor = {Last, First}, + month = {February}, + publisher = {AOSA Inc.}, + title = {The Art, Science, and Engineering of Programming}, + url = {https://programming-journal.org/2020/4/issue3/}, + volume = 4, + year = 2020 +}` + +const output = [ { citationKey: 'Last:2020:P20I3', + entryType: 'proceedings', + entryTags: + { title: 'The Art, Science, and Engineering of Programming', + year: '2020', + month: 'February', + editor: 'Last, First', + publisher: 'AOSA Inc.', + volume: '4', + doi: '10.22152/programming-journal.org/2020/4/issue3', + url: 'https://programming-journal.org/2020/4/issue3/' } } ] + +test('proceedings should parse', t => t.deepEqual(output, bibtexParse.toJSON(input)));