Skip to content

Commit d0adf35

Browse files
committed
BibTeX: round-trip citation keys.
Imported .bib keys were being replaced by citeKeyFormat = "%a_%t_%y"; Preserve them so users can sync pre-existing LaTeX projects with Zotero.
1 parent e9335d5 commit d0adf35

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

BibTeX.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"inRepository": true,
2020
"translatorType": 3,
21-
"lastUpdated": "2024-03-25 14:51:02"
21+
"lastUpdated": "2025-11-28 19:44:26"
2222
}
2323

2424
/*
@@ -976,7 +976,12 @@ function beginRecord(type, closeChar) {
976976
}
977977
delete item.backupLocation;
978978
}
979-
979+
if (item.itemID) {
980+
item._extraFields.push({ field: "citation key", value: item.itemID });
981+
//item.citationKey = item.itemID;
982+
delete item.itemID;
983+
}
984+
980985
if (!item.date) {
981986
item.date = dateFieldsToDate(item.year, item.month, item.day);
982987
}
@@ -3133,7 +3138,7 @@ var testCases = [
31333138
}
31343139
],
31353140
"date": "2001",
3136-
"itemID": "Adams2001",
3141+
"extra": "citation key: Adams2001",
31373142
"pages": "493–518",
31383143
"publicationTitle": "Bulletin of Volcanology",
31393144
"volume": "62",
@@ -3175,7 +3180,7 @@ var testCases = [
31753180
],
31763181
"date": "1964",
31773182
"edition": "ninth Dover printing, tenth GPO printing",
3178-
"itemID": "abramowitz+stegun",
3183+
"extra": "citation key: abramowitz+stegun",
31793184
"place": "New York",
31803185
"publisher": "Dover",
31813186
"attachments": [],
@@ -3200,7 +3205,7 @@ var testCases = [
32003205
],
32013206
"date": "2008",
32023207
"ISBN": "0385527403",
3203-
"itemID": "Torre2008",
3208+
"extra": "citation key: Torre2008",
32043209
"publisher": "Doubleday",
32053210
"attachments": [],
32063211
"tags": [],
@@ -3228,7 +3233,7 @@ var testCases = [
32283233
"creatorType": "author"
32293234
}
32303235
],
3231-
"itemID": "author:06",
3236+
"extra": "citation key: author:06",
32323237
"pages": "330—331",
32333238
"attachments": [],
32343239
"tags": [],
@@ -3251,7 +3256,7 @@ var testCases = [
32513256
}
32523257
],
32533258
"date": "2006-10",
3254-
"itemID": "conference:06",
3259+
"extra": "citation key: conference:06",
32553260
"attachments": [],
32563261
"tags": [],
32573262
"notes": [],
@@ -3276,7 +3281,7 @@ var testCases = [
32763281
"date": "2001",
32773282
"ISBN": "0-69-697269-4",
32783283
"edition": "1st,",
3279-
"itemID": "hicks2001",
3284+
"extra": "citation key: hicks2001",
32803285
"place": "Palo Alto",
32813286
"publisher": "Stanford Press",
32823287
"attachments": [],
@@ -3301,8 +3306,8 @@ var testCases = [
33013306
}
33023307
],
33033308
"date": "2009",
3309+
"extra": "citation key: Oliveira_2009",
33043310
"issue": "29",
3305-
"itemID": "Oliveira_2009",
33063311
"pages": "29",
33073312
"publicationTitle": "Oil & Gas Journal",
33083313
"volume": "107",
@@ -3321,7 +3326,7 @@ var testCases = [
33213326
"itemType": "journalArticle",
33223327
"title": "non-braking space: ; accented characters: ñ and ñ; tilde operator: ∼",
33233328
"creators": [],
3324-
"itemID": "test-ticket1661",
3329+
"extra": "citation key: test-ticket1661",
33253330
"attachments": [],
33263331
"tags": [],
33273332
"notes": [],
@@ -3355,7 +3360,7 @@ var testCases = [
33553360
],
33563361
"date": "2012",
33573362
"DOI": "10.1007/s13127-011-0069-8",
3358-
"itemID": "Frit2",
3363+
"extra": "citation key: Frit2",
33593364
"pages": "71-80",
33603365
"publicationTitle": "Actes du 4<sup>ème</sup> Congrès Français d'Acoustique",
33613366
"volume": "12",
@@ -3381,7 +3386,7 @@ var testCases = [
33813386
}
33823387
],
33833388
"date": "2012",
3384-
"itemID": "american_rights_at_work_public_2012",
3389+
"extra": "citation key: american_rights_at_work_public_2012",
33853390
"url": "http://www.americanrightsatwork.org/blogcategory-275/",
33863391
"attachments": [],
33873392
"tags": [],
@@ -3398,7 +3403,7 @@ var testCases = [
33983403
"itemType": "journalArticle",
33993404
"title": "Zotero: single attachment",
34003405
"creators": [],
3401-
"itemID": "zoteroFilePath1",
3406+
"extra": "citation key: zoteroFilePath1",
34023407
"attachments": [
34033408
{
34043409
"title": "Test",
@@ -3414,7 +3419,7 @@ var testCases = [
34143419
"itemType": "journalArticle",
34153420
"title": "Zotero: multiple attachments",
34163421
"creators": [],
3417-
"itemID": "zoteroFilePaths2",
3422+
"extra": "citation key: zoteroFilePaths2",
34183423
"attachments": [
34193424
{
34203425
"title": "Test1",
@@ -3435,7 +3440,7 @@ var testCases = [
34353440
"itemType": "journalArticle",
34363441
"title": "Zotero: linked attachments (old)",
34373442
"creators": [],
3438-
"itemID": "zoteroFilePaths3",
3443+
"extra": "citation key: zoteroFilePaths3",
34393444
"attachments": [],
34403445
"tags": [],
34413446
"notes": [],
@@ -3445,7 +3450,7 @@ var testCases = [
34453450
"itemType": "journalArticle",
34463451
"title": "Zotero: linked attachments",
34473452
"creators": [],
3448-
"itemID": "zoteroFilePaths4",
3453+
"extra": "citation key: zoteroFilePaths4",
34493454
"attachments": [
34503455
{
34513456
"title": "Test",
@@ -3461,7 +3466,7 @@ var testCases = [
34613466
"itemType": "journalArticle",
34623467
"title": "Mendeley: single attachment",
34633468
"creators": [],
3464-
"itemID": "mendeleyFilePaths1",
3469+
"extra": "citation key: mendeleyFilePaths1",
34653470
"url": "https://forums.zotero.org/discussion/28347/unable-to-get-pdfs-stored-on-computer-into-zotero-standalone/",
34663471
"attachments": [
34673472
{
@@ -3478,7 +3483,7 @@ var testCases = [
34783483
"itemType": "journalArticle",
34793484
"title": "Mendeley: escaped characters",
34803485
"creators": [],
3481-
"itemID": "mendeleyFilePaths2",
3486+
"extra": "citation key: mendeleyFilePaths2",
34823487
"attachments": [
34833488
{
34843489
"title": "Attachment",
@@ -3494,7 +3499,7 @@ var testCases = [
34943499
"itemType": "journalArticle",
34953500
"title": "Citavi: single attachment",
34963501
"creators": [],
3497-
"itemID": "citaviFilePaths1",
3502+
"extra": "citation key: citaviFilePaths1",
34983503
"url": "https://forums.zotero.org/discussion/35909/bibtex-import-from-citavi-including-pdf-attachments/",
34993504
"attachments": [
35003505
{
@@ -3517,7 +3522,7 @@ var testCases = [
35173522
"itemType": "journalArticle",
35183523
"title": "extbackslash extbackslash{}: {",
35193524
"creators": [],
3520-
"itemID": "BibTeXEscapeTest1",
3525+
"extra": "citation key: BibTeXEscapeTest1",
35213526
"attachments": [],
35223527
"tags": [],
35233528
"notes": [],
@@ -3637,9 +3642,8 @@ var testCases = [
36373642
"date": "2013-03",
36383643
"DOI": "10.1161/CIR.0b013e318288b4dd",
36393644
"ISSN": "1524-4539",
3640-
"extra": "PMID: 23439512",
3645+
"extra": "PMID: 23439512\ncitation key: sasson_increasing_2013",
36413646
"issue": "12",
3642-
"itemID": "sasson_increasing_2013",
36433647
"language": "eng",
36443648
"pages": "1342–1350",
36453649
"publicationTitle": "Circulation",
@@ -3698,8 +3702,7 @@ var testCases = [
36983702
}
36993703
],
37003704
"DOI": "10.12345/123456",
3701-
"extra": "LCCN: L123456\nMR: MR123456\nZbl: ZM123456\nPMID: P123456\nPMCID: PMC123456\narXiv: AX123456",
3702-
"itemID": "smith_testing_????",
3705+
"extra": "LCCN: L123456\nMR: MR123456\nZbl: ZM123456\nPMID: P123456\nPMCID: PMC123456\narXiv: AX123456\ncitation key: smith_testing_????",
37033706
"attachments": [],
37043707
"tags": [],
37053708
"notes": [],
@@ -3721,8 +3724,7 @@ var testCases = [
37213724
"creatorType": "author"
37223725
}
37233726
],
3724-
"extra": "DOI: 10.12345/123456\nLCCN: L123456\nMR: MR123456\nZbl: ZM123456\nPMID: P123456\nPMCID: PMC123456\narXiv: AX123456",
3725-
"itemID": "smith_testing_????",
3727+
"extra": "DOI: 10.12345/123456\nLCCN: L123456\nMR: MR123456\nZbl: ZM123456\nPMID: P123456\nPMCID: PMC123456\narXiv: AX123456\ncitation key: smith_testing_????",
37263728
"attachments": [],
37273729
"tags": [],
37283730
"notes": [],
@@ -3745,7 +3747,7 @@ var testCases = [
37453747
}
37463748
],
37473749
"date": "2009",
3748-
"itemID": "DBLP:ms/Hoffmann2008",
3750+
"extra": "citation key: DBLP:ms/Hoffmann2008",
37493751
"thesisType": "Master's Thesis",
37503752
"university": "Diplomarbeit, Universität Trier, FB IV, DBIS/DBLP",
37513753
"url": "http://dblp.uni-trier.de/papers/DiplomarbeitOliverHoffmann.pdf",
@@ -3765,7 +3767,7 @@ var testCases = [
37653767
}
37663768
],
37673769
"date": "2009",
3768-
"itemID": "DBLP:phd/Ackermann2009",
3770+
"extra": "citation key: DBLP:phd/Ackermann2009",
37693771
"thesisType": "PhD Thesis",
37703772
"university": "University of Paderborn",
37713773
"url": "http://digital.ub.uni-paderborn.de/hs/content/titleinfo/1561",
@@ -3808,8 +3810,7 @@ var testCases = [
38083810
"date": "2007",
38093811
"DOI": "10.1145/1281192.1281230",
38103812
"ISBN": "978-1-59593-609-7",
3811-
"extra": "event-place: San Jose, California, USA",
3812-
"itemID": "Giannotti:2007:TPM:1281192.1281230",
3813+
"extra": "event-place: San Jose, California, USA\ncitation key: Giannotti:2007:TPM:1281192.1281230",
38133814
"pages": "330–339",
38143815
"place": "New York, NY, USA",
38153816
"proceedingsTitle": "Proceedings of the 13th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining",
@@ -3856,8 +3857,8 @@ var testCases = [
38563857
],
38573858
"date": "2015",
38583859
"DOI": "10.1515/zfsoz-2015-0604",
3860+
"extra": "citation key: madoc40756",
38593861
"issue": "6",
3860-
"itemID": "madoc40756",
38613862
"language": "Deutsch",
38623863
"pages": "426–446",
38633864
"publicationTitle": "Zeitschrift für Soziologie : ZfS",
@@ -3886,8 +3887,7 @@ var testCases = [
38863887
"date": "2013",
38873888
"DOI": "10.1016/j.aim.2013.04.020",
38883889
"ISSN": "0001-8708",
3889-
"extra": "MR: 3077863",
3890-
"itemID": "MR3077863",
3890+
"extra": "MR: 3077863\ncitation key: MR3077863",
38913891
"journalAbbreviation": "Adv. Math.",
38923892
"pages": "1–15",
38933893
"publicationTitle": "Advances in Mathematics",
@@ -3915,7 +3915,7 @@ var testCases = [
39153915
}
39163916
],
39173917
"date": "2011",
3918-
"itemID": "madoc44942",
3918+
"extra": "citation key: madoc44942",
39193919
"language": "isl",
39203920
"pages": "36–44",
39213921
"place": "Reykjavik",
@@ -3942,7 +3942,7 @@ var testCases = [
39423942
}
39433943
],
39443944
"date": "2019",
3945-
"itemID": "example-electronic-string",
3945+
"extra": "citation key: example-electronic-string",
39463946
"url": "https://www.zotero.org/",
39473947
"attachments": [],
39483948
"tags": [],
@@ -3971,7 +3971,7 @@ var testCases = [
39713971
}
39723972
],
39733973
"date": "1942-03",
3974-
"itemID": "sweig42",
3974+
"extra": "citation key: sweig42",
39753975
"publisher": "D\\ëad Po<sub>eee</sub>t Society",
39763976
"attachments": [],
39773977
"tags": [],
@@ -4055,7 +4055,7 @@ var testCases = [
40554055
}
40564056
],
40574057
"date": "2020-12",
4058-
"itemID": "batsis:rural",
4058+
"extra": "citation key: batsis:rural",
40594059
"publicationTitle": "BMC Geriatrics",
40604060
"rights": "the authors",
40614061
"url": "https://www.cs.dartmouth.edu/~kotz/research/batsis-rural/index.html",
@@ -4091,8 +4091,8 @@ var testCases = [
40914091
],
40924092
"date": "2021-06-18",
40934093
"abstractNote": "This document defines methodologies for benchmarking EVPN and PBB- EVPN performance. EVPN is defined in RFC 7432, and is being deployed in Service Provider networks. Specifically, this document defines the methodologies for benchmarking EVPN/PBB-EVPN convergence, data plane performance, and control plane performance.",
4094+
"extra": "citation key: ietf-bmwg-evpntest-09",
40944095
"institution": "Internet Engineering Task Force",
4095-
"itemID": "ietf-bmwg-evpntest-09",
40964096
"reportNumber": "draft-ietf-bmwg-evpntest-09",
40974097
"reportType": "Internet-Draft",
40984098
"url": "https://datatracker.ietf.org/doc/html/draft-ietf-bmwg-evpntest-09",
@@ -4157,7 +4157,7 @@ var testCases = [
41574157
}
41584158
],
41594159
"date": "2009",
4160-
"itemID": "NIPS2009_0188e8b8",
4160+
"extra": "citation key: NIPS2009_0188e8b8",
41614161
"proceedingsTitle": "Advances in Neural Information Processing Systems",
41624162
"publisher": "Curran Associates, Inc.",
41634163
"url": "https://proceedings.neurips.cc/paper/2009/file/0188e8b8b014829e2fa0f430f0a95961-Paper.pdf",
@@ -4190,8 +4190,8 @@ var testCases = [
41904190
],
41914191
"date": "2023",
41924192
"DOI": "10.1134/S1063778823010131",
4193+
"extra": "citation key: Borissov:2855446",
41934194
"issue": "6",
4194-
"itemID": "Borissov:2855446",
41954195
"pages": "970-975",
41964196
"publicationTitle": "Phys. At. Nucl.",
41974197
"url": "https://cds.cern.ch/record/2855446",
@@ -4223,7 +4223,7 @@ var testCases = [
42234223
}
42244224
],
42254225
"date": "1998",
4226-
"itemID": "derbis1998poczucie",
4226+
"extra": "citation key: derbis1998poczucie",
42274227
"publisher": "Stowarzyszenie Psychologia i Architektura",
42284228
"attachments": [],
42294229
"tags": [],

0 commit comments

Comments
 (0)