From bd0a4a3b96d92c8ff47f3451aba34d70f5c51ccc Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 30 May 2010 11:25:25 +0000 Subject: [PATCH] Use citeproc-js as CSL parser. There is an issue with multiple citations in numbered styles that I will probably need Frank's help to track down, but otherwise, this seems to work. Many things are completely untested, including EndNote style support. Currently requires CSL 1.0 styles. In the near future, I hope to use the XSLT stylesheet to transform CSL 0.8 to CSL 1.0. closes #1650: suppress author does not work for multiple sources closes #1505: Edit Biblography Button Strips Year Disambiguation closes #1503: Editing a bibliography resets all reference numbers to 1 (new) closes #1262: Broken pluralization with et al. + other issues closes #1238: Localize quotation marks closes #1191: Harmonize 'plural/pluralize' label attribute with CSL schema closes #1154: Only one works page numbers are added to the citation are when citing multiple works by the same author closes #1097: Disambiguation issues closes #1083: Defect in IEEE CSL with Multiple Citations closes #993: more sophisticated subsequent-author-substitute closes #833: text-transform doesn't work with name --- .../zotero/bindings/styled-textbox.xml | 59 +- chrome/content/zotero/fileInterface.js | 38 +- .../zotero/integration/addCitationDialog.js | 52 +- .../zotero/integration/addCitationDialog.xul | 4 +- .../integration/editBibliographyDialog.js | 72 +- .../zotero/locale/csl/locales-af-ZA.xml | 510 +- .../zotero/locale/csl/locales-ar-AR.xml | 510 +- .../zotero/locale/csl/locales-bg-BG.xml | 510 +- .../zotero/locale/csl/locales-ca-AD.xml | 510 +- .../zotero/locale/csl/locales-cs-CZ.xml | 510 +- .../zotero/locale/csl/locales-da-DK.xml | 510 +- .../zotero/locale/csl/locales-de-AT.xml | 510 +- .../zotero/locale/csl/locales-de-CH.xml | 510 +- .../zotero/locale/csl/locales-de-DE.xml | 510 +- .../zotero/locale/csl/locales-el-GR.xml | 510 +- .../zotero/locale/csl/locales-en-US.xml | 530 +- .../zotero/locale/csl/locales-es-ES.xml | 510 +- .../zotero/locale/csl/locales-et-EE.xml | 510 +- .../zotero/locale/csl/locales-fr-FR.xml | 510 +- .../zotero/locale/csl/locales-he-IL.xml | 510 +- .../zotero/locale/csl/locales-hu-HU.xml | 510 +- .../zotero/locale/csl/locales-is-IS.xml | 510 +- .../zotero/locale/csl/locales-it-IT.xml | 510 +- .../zotero/locale/csl/locales-ja-JP.xml | 510 +- .../zotero/locale/csl/locales-ko-KR.xml | 510 +- .../zotero/locale/csl/locales-mn-MN.xml | 510 +- .../zotero/locale/csl/locales-nb-NO.xml | 510 +- .../zotero/locale/csl/locales-nl-NL.xml | 510 +- .../zotero/locale/csl/locales-pl-PL.xml | 510 +- .../zotero/locale/csl/locales-pt-BR.xml | 510 +- .../zotero/locale/csl/locales-pt-PT.xml | 510 +- .../zotero/locale/csl/locales-ro-RO.xml | 510 +- .../zotero/locale/csl/locales-ru-RU.xml | 510 +- .../zotero/locale/csl/locales-sk-SK.xml | 510 +- .../zotero/locale/csl/locales-sl-SI.xml | 510 +- .../zotero/locale/csl/locales-sr-RS.xml | 510 +- .../zotero/locale/csl/locales-sv-SE.xml | 510 +- .../zotero/locale/csl/locales-th-TH.xml | 510 +- .../zotero/locale/csl/locales-tr-TR.xml | 510 +- .../zotero/locale/csl/locales-uk-UA.xml | 510 +- .../zotero/locale/csl/locales-vi-VN.xml | 510 +- .../zotero/locale/csl/locales-zh-CN.xml | 510 +- .../zotero/locale/csl/locales-zh-TW.xml | 510 +- chrome/content/zotero/rtfScan.js | 66 +- chrome/content/zotero/xpcom/cite.js | 318 + chrome/content/zotero/xpcom/citeproc.js | 7832 +++++++++++++++++ chrome/content/zotero/xpcom/csl.js | 2956 ------- chrome/content/zotero/xpcom/integration.js | 804 +- chrome/content/zotero/xpcom/quickCopy.js | 27 +- chrome/content/zotero/xpcom/style.js | 90 +- chrome/content/zotero/xpcom/zotero.js | 6 +- chrome/locale/en-US/zotero/zotero.properties | 3 +- chrome/skin/default/zotero/timeline/bundle.js | 2 +- components/zotero-service.js | 15 +- 54 files changed, 20131 insertions(+), 11613 deletions(-) create mode 100644 chrome/content/zotero/xpcom/cite.js create mode 100644 chrome/content/zotero/xpcom/citeproc.js delete mode 100644 chrome/content/zotero/xpcom/csl.js diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml index d1c6821312..ad6bc4f15b 100644 --- a/chrome/content/zotero/bindings/styled-textbox.xml +++ b/chrome/content/zotero/bindings/styled-textbox.xml @@ -60,15 +60,30 @@ "":"\\b ", "":"\\b0 ", "
":"\x0B", - "":"\\super ", - "":"\\super0 ", - "":"\\sub ", - "":"\\sub0 ", // there's no way to mimic a tab stop in CSS without // tables, which wouldn't work here. - ' ':"\t" + ' ':"\\tab " }; + this._rtfToHtmlMap = [ + [/\\uc0\{?\\u([0-9]+)\}? ?/g, function(wholeStr, aCode) { return String.fromCharCode(aCode) }], + ["\\t ", ' '], + [/(?:\\par |\\\r?\n)/g, "

"], + [/\\super (.*?)\\nosupersub /g, "$1"], + [/\\sub (.*?)\\nosupersub /g, "$1"], + ]; + + this._htmlToRtfMap = [ + [/[\x7F-\uFFFF]/g, function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+" " }], + ["

", ""], + ["

", "\\par "], + [/<\/?div[^>]*>/g, ""], + ["", "\\super "], + ["", "\\nosupersub "], + ["", "\\sub "], + ["", "\\nosupersub "], + ]; + this._rtfRexMap = [ ["", /small-caps/, @@ -117,7 +132,6 @@ break; case 'change': - Zotero.debug("Event type is " + event.type); break; default: @@ -163,16 +177,9 @@ ", "", "g"); - output = output.replace("

", "\\par ", "g"); - output = output.replace(/<\/?div[^>]*>/g, ""); + for each(var entry in this._htmlToRtfMap) { + output = output.replace(entry[0], entry[1], "g"); + } output = Zotero.Utilities.prototype.trim(output); output = output.replace(" ", " ", "g"); output = Zotero.Utilities.prototype.unescapeHTML(output); @@ -213,8 +220,6 @@ return output; ]]>
", "g"); } - html = '

'+html.replace("\par ", "

")+"

"; - Zotero.debug("setting content to "+html); + for each(var entry in this._rtfToHtmlMap) { + html = html.replace(entry[0], entry[1], "g"); + } + html = '

'+html+"

"; } this._editor.setContent(html); diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index fc9b90b704..b24ec3c07e 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -379,11 +379,11 @@ var Zotero_File_Interface = new function() { createInstance(Components.interfaces.nsITransferable); var clipboardService = Components.classes["@mozilla.org/widget/clipboard;1"]. getService(Components.interfaces.nsIClipboard); - var csl = Zotero.Styles.get(style).csl; - var itemSet = csl.createItemSet(items); + var style = Zotero.Styles.get(style).csl; + style.updateItems([item.id for each(item in items)]); // add HTML - var bibliography = csl.formatBibliography(itemSet, "HTML"); + var bibliography = Zotero.Cite.makeFormattedBibliography(style, "html"); var str = Components.classes["@mozilla.org/supports-string;1"]. createInstance(Components.interfaces.nsISupportsString); str.data = bibliography; @@ -391,7 +391,9 @@ var Zotero_File_Interface = new function() { transferable.setTransferData("text/html", str, bibliography.length*2); // add text (or HTML source) - var bibliography = csl.formatBibliography(itemSet, asHTML ? 'HTML' : 'Text'); + if(!asHTML) { + var bibliography = Zotero.Cite.makeFormattedBibliography(style, "text"); + } var str = Components.classes["@mozilla.org/supports-string;1"]. createInstance(Components.interfaces.nsISupportsString); str.data = bibliography; @@ -416,16 +418,13 @@ var Zotero_File_Interface = new function() { var clipboardService = Components.classes["@mozilla.org/widget/clipboard;1"]. getService(Components.interfaces.nsIClipboard); - var csl = Zotero.Styles.get(style).csl; - var itemSet = csl.createItemSet(items); - var itemIDs = []; - for (var i=0; i - + - + diff --git a/chrome/content/zotero/integration/editBibliographyDialog.js b/chrome/content/zotero/integration/editBibliographyDialog.js index a9ede67e74..ca46708619 100644 --- a/chrome/content/zotero/integration/editBibliographyDialog.js +++ b/chrome/content/zotero/integration/editBibliographyDialog.js @@ -25,9 +25,9 @@ var Zotero_Bibliography_Dialog = new function () { var bibEditInterface; - var itemSet; - var _originalBibEntry; - var _lastSelectedItem; + var _lastSelectedItemID = false; + var _lastSelectedIndex = false; + var _lastSelectedValue = false; this.load = load; this.treeItemSelected = treeItemSelected; @@ -40,10 +40,9 @@ var Zotero_Bibliography_Dialog = new function () { * initialize add citation dialog */ function load() { - document.getElementById('editor').format = "Integration"; + document.getElementById('editor').format = "RTF"; bibEditInterface = window.arguments[0].wrappedJSObject; - itemSet = bibEditInterface.getItemSet(); // load (from selectItemsDialog.js) doLoad(); @@ -56,10 +55,10 @@ var Zotero_Bibliography_Dialog = new function () { * called when an item in the item selection tree is clicked */ function treeItemSelected() { - var items = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js + var selectedItems = itemsView.getSelectedItems(true); // treeview from selectItemsDialog.js // disable add if item already in itemSet - document.getElementById("add").disabled = !items.length || itemSet.getItemsByIds([items[0]])[0]; + document.getElementById("add").disabled = selectedItems.length && bibEditInterface.bibliography[0].entry_ids.indexOf(selectedItems[0].id) !== -1; } /* @@ -72,9 +71,9 @@ var Zotero_Bibliography_Dialog = new function () { document.getElementById("remove").disabled = !selectedListItem; if(selectedListItem) { - _updatePreview(itemSet.getItemsByIds([selectedListItem.value])[0]); + _updatePreview(selectedListItem.value); } else { - _updatePreview(false); + _updatePreview(); } } @@ -82,9 +81,10 @@ var Zotero_Bibliography_Dialog = new function () { * Adds a citation to the reference list */ function add() { - var item = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js + var selectedItem = itemsView.getSelectedItems()[0]; // treeview from selectItemsDialog.js + Zotero.debug(selectedItem); - bibEditInterface.add(item); + bibEditInterface.add(selectedItem.id); document.getElementById("add").disabled = true; _loadItems(); } @@ -94,10 +94,9 @@ var Zotero_Bibliography_Dialog = new function () { */ function remove() { var selectedListItem = document.getElementById("item-list").getSelectedItem(0); - var itemID = selectedListItem.value; - var item = itemSet.getItemsByIds([itemID])[0]; + var itemID = bibEditInterface.bibliography[0].entry_ids[selectedListItem.value]; - if(bibEditInterface.isCited(item)) { + if(bibEditInterface.isCited(itemID)) { var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -113,13 +112,10 @@ var Zotero_Bibliography_Dialog = new function () { if(regenerate != 0) return; } - bibEditInterface.remove(item); + bibEditInterface.remove(itemID); _loadItems(); } - /* - * Called on "Accept" button - */ function accept() { _updatePreview(); } @@ -127,23 +123,39 @@ var Zotero_Bibliography_Dialog = new function () { /* * Updates the contents of the preview pane */ - function _updatePreview(item) { + function _updatePreview(index) { + Zotero.debug("_updatePreview called"); var editor = document.getElementById('editor'); - if(_lastSelectedItem && editor.value != _originalBibEntry) { - Zotero.debug("setting bibliography for "+_lastSelectedItem.getID()+" to "+editor.value); - _lastSelectedItem.setProperty("bibliography-RTF", editor.value); + if(_lastSelectedItemID) { + var newValue = editor.value; + if(_lastSelectedValue != newValue) { + Zotero.debug("setting bibliography for "+_lastSelectedItemID+" to "+newValue); + bibEditInterface.setCustomText(_lastSelectedItemID, newValue); + } } - editor.readonly = !item; - editor.value = _originalBibEntry = (item ? bibEditInterface.preview(item) : ""); - _lastSelectedItem = item; + editor.readonly = index === undefined; + if(index !== undefined) { + Zotero.debug("updating preview of "+index); + var itemID = bibEditInterface.bibliography[0].entry_ids[index]; + editor.value = bibEditInterface.bibliography[1][index]; + _lastSelectedIndex = index; + _lastSelectedItemID = itemID; + _lastSelectedValue = editor.value; + } else { + editor.value = ""; + _lastSelectedIndex = _lastSelectedItemID = _lastSelectedValue = false; + } } /* * loads items from itemSet */ function _loadItems() { + var itemIDs = bibEditInterface.bibliography[0].entry_ids; + var items = Zotero.Items.get(itemIDs); + // delete all existing items from list var itemList = document.getElementById("item-list"); while(itemList.firstChild) { @@ -151,14 +163,12 @@ var Zotero_Bibliography_Dialog = new function () { } // add new items - for(var i=0; i - - - at - in - ibid - toegang verkry - opgehaal - van - voorhande - Verwysings - - source - sources - - n.d. - en - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - reël - reëls - - - note - notes - - - opus - opera - - - bladsy - bladsye - - - paragraaf - paragrawe - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - bl - bll - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - redakteur - redakteurs - - - vertaler - vertalers - - - - - - - red - reds - - - vert - verts - - onder redaksie van - vertaal deur - to - interview by - red - verts - Januarie - Februarie - Maart - April - Mei - Junie - Julie - Augustus - September - Oktober - November - Desember - Jan - Feb - Mrt - Apr - Mei - Jun - Jul - Aug - Sep - Okt - Nov - Des - - + + + + + + + + + + + + + + + at + in + ibid + toegang verkry + opgehaal + van + voorhande + + reference + references + + + ref. + refs. + + n.d. + en + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + reël + reëls + + + note + notes + + + opus + opera + + + bladsy + bladsye + + + paragraaf + paragrawe + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + bl + bll + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + redakteur + redakteurs + + + editor + editors + + + vertaler + vertalers + + + editor & translator + editors & translators + + + + + + + + + red + reds + + + ed. + eds. + + + vert + verts + + + ed. & tran. + eds. & trans. + + + + onder redaksie van + edited by + vertaal deur + edited & translated by + to + interview by + + + red + ed. + verts + ed. & trans. by + + + Januarie + Februarie + Maart + April + Mei + Junie + Julie + Augustus + September + Oktober + November + Desember + + + Jan + Feb + Mrt + Apr + Mei + Jun + Jul + Aug + Sep + Okt + Nov + Des + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ar-AR.xml b/chrome/content/zotero/locale/csl/locales-ar-AR.xml index 4175645d8b..bc2418a6f4 100644 --- a/chrome/content/zotero/locale/csl/locales-ar-AR.xml +++ b/chrome/content/zotero/locale/csl/locales-ar-AR.xml @@ -1,211 +1,299 @@ - - - - عند - في - آيبيد - زير - جلب - من - القادم - مراجع - - source - sources - - - و - et al. - مقابلة - رسالة - مجهول - مجهول - وآخرون - تحت الطبع - ربط مباشر - وثِّقَ - الإنترنت - قُدَّم في - علم الإنسان - علم الفلك - علم الأحياء - علم النبات - علم الكيمياء - الهندسة - أساس عام - جغرافيا - علم الأرض - التاريخ - الإنسانيات - الأدب - الرياضيات - الطب - الفلسفة - الفيزياء - علم النفس - علم الإجتماع - العلوم - العلوم السياسية - العلوم الإجتماعية - العلوم الإلهية - علم الحيوان - - كتاب - كُتُب - - - فصل - فصول - - - عمود - أعمدة - - - رسم توضيحي - رسوم توضيحية - - - ورقة - أوراق - - - عدد - أعداد - - - سطر - أسطر - - - ملاحظة - ملاحظات - - - قطعة موسيقية - أوبرا - - - صفحة - صفحات - - - فقرة - فقرات - - - جزء - أجزاء - - - قسم - أقسام - - - مجلد - مجلدات - - - الطبعة - الطبعات - - - بيت - أبيات - - - sub verbo - s.vv - - ك - ف - عم - ر - و - عد - مم - - ص - ص.ص - - فق - جز - ق - - s.v - s.vv - - - ب - بب - - - مج - مجج - - edition - ط - - - ¶¶ - - - § - §§ - - - - - - - تحرير - تحرير - - - ترجمة - ترجمة - - - - - - - مح - محح - - - تر - ترر - - حرره - ترجمه - إلى - مقابلة بواسطة - مح - مت - يناير - فبراير - مارس - ابريل - مايو - يونيو - يوليو - اغسطس - سبتمبر - اكتوبر - نوفمبر - ديسمبر - يناير - فبراير - مارس - ابريل - مايو - يونيو - يوليو - اغسطس - سبتمبر - اكتوبر - نوفمبر - ديسمبر - - + + + + + + + + + + + + + + + عند + في + آيبيد + زير + جلب + من + القادم + + reference + references + + + ref. + refs. + + + و + et al. + circa + c. + مقابلة + رسالة + مجهول + مجهول + وآخرون + تحت الطبع + ربط مباشر + وثِّقَ + الإنترنت + قُدَّم في + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + علم الإنسان + علم الفلك + علم الأحياء + علم النبات + علم الكيمياء + الهندسة + أساس عام + جغرافيا + علم الأرض + التاريخ + الإنسانيات + linguistics + الأدب + الرياضيات + الطب + الفلسفة + الفيزياء + علم النفس + علم الإجتماع + العلوم + العلوم السياسية + العلوم الإجتماعية + العلوم الإلهية + علم الحيوان + + + + كتاب + كُتُب + + + فصل + فصول + + + عمود + أعمدة + + + رسم توضيحي + رسوم توضيحية + + + ورقة + أوراق + + + عدد + أعداد + + + سطر + أسطر + + + ملاحظة + ملاحظات + + + قطعة موسيقية + أوبرا + + + صفحة + صفحات + + + فقرة + فقرات + + + جزء + أجزاء + + + قسم + أقسام + + + مجلد + مجلدات + + + الطبعة + الطبعات + + + بيت + أبيات + + + sub verbo + s.vv + + + + ك + ف + عم + ر + و + عد + مم + + ص + ص.ص + + فق + جز + ق + + s.v + s.vv + + + ب + بب + + + مج + مجج + + ط + + + + + ¶¶ + + + § + §§ + + + + + + + + + تحرير + تحرير + + + editor + editors + + + ترجمة + ترجمة + + + editor & translator + editors & translators + + + + + + + + + مح + محح + + + ed. + eds. + + + تر + ترر + + + ed. & tran. + eds. & trans. + + + + حرره + edited by + ترجمه + edited & translated by + إلى + مقابلة بواسطة + + + مح + ed. + مت + ed. & trans. by + + + يناير + فبراير + مارس + ابريل + مايو + يونيو + يوليو + اغسطس + سبتمبر + اكتوبر + نوفمبر + ديسمبر + + + يناير + فبراير + مارس + ابريل + مايو + يونيو + يوليو + اغسطس + سبتمبر + اكتوبر + نوفمبر + ديسمبر + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-bg-BG.xml b/chrome/content/zotero/locale/csl/locales-bg-BG.xml index 1580424983..4ac209e103 100644 --- a/chrome/content/zotero/locale/csl/locales-bg-BG.xml +++ b/chrome/content/zotero/locale/csl/locales-bg-BG.xml @@ -1,211 +1,299 @@ - - - - в - в - пак там - отворен на - изтеглен на - от - предстоящ - цитати - - source - sources - - без дата - и - и съавт. - интервю - писмо - анонимен - анон - и други - под печат - онлайн - цитиран - интернет - представен на - антропология - астрономия - биология - ботаника - химия - инженерство - обща база - география - геология - история - хуманитарни науки - литература - математика - медицина - философия - физика - физиология - социология - наука - политически науки - обществени науки - теология - зоология - - книга - книги - - - глава - глави - - - колона - колони - - - фигура - фигури - - - фолио - фолия - - - брой - броеве - - - ред - редове - - - бележка - бележки - - - опус - опуси - - - страница - страници - - - параграф - параграфи - - - част - части - - - раздел - раздели - - - том - томове - - - издание - издания - - - стих - стихове - - - sub verbo - s.vv - - кн - гл - кол - фиг - фол - бр - оп - - с - с-ци - - п - ч - разд - - s.v - s.vv - - - ст - ст-ове - - - том - т-ове - - edition - изд - - - ¶¶ - - - § - §§ - - - автор - автори - - - редактор - редактори - - - преводач - преводачи - - - авт - авт-ри - - - ред - ред-ри - - - прев - прев-чи - - редактиран от - преведен от - до - интервюиран от - ред - прев - Януари - Февруари - Март - Април - Май - Юни - Юли - Август - Септември - Октомври - Ноември - Декември - Яну - Фев - Мар - Апр - Май - Юни - Юли - Авг - Сеп - Окт - Ное - Дек - - + + + + + + + + + + + + + + + в + в + пак там + отворен на + изтеглен на + от + предстоящ + + reference + references + + + ref. + refs. + + без дата + и + и съавт. + circa + c. + интервю + писмо + анонимен + анон + и други + под печат + онлайн + цитиран + интернет + представен на + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + антропология + астрономия + биология + ботаника + химия + инженерство + обща база + география + геология + история + хуманитарни науки + linguistics + литература + математика + медицина + философия + физика + физиология + социология + наука + политически науки + обществени науки + теология + зоология + + + + книга + книги + + + глава + глави + + + колона + колони + + + фигура + фигури + + + фолио + фолия + + + брой + броеве + + + ред + редове + + + бележка + бележки + + + опус + опуси + + + страница + страници + + + параграф + параграфи + + + част + части + + + раздел + раздели + + + том + томове + + + издание + издания + + + стих + стихове + + + sub verbo + s.vv + + + + кн + гл + кол + фиг + фол + бр + оп + + с + с-ци + + п + ч + разд + + s.v + s.vv + + + ст + ст-ове + + + том + т-ове + + изд + + + + + ¶¶ + + + § + §§ + + + + + автор + автори + + + редактор + редактори + + + editor + editors + + + преводач + преводачи + + + editor & translator + editors & translators + + + + + авт + авт-ри + + + ред + ред-ри + + + ed. + eds. + + + прев + прев-чи + + + ed. & tran. + eds. & trans. + + + + редактиран от + edited by + преведен от + edited & translated by + до + интервюиран от + + + ред + ed. + прев + ed. & trans. by + + + Януари + Февруари + Март + Април + Май + Юни + Юли + Август + Септември + Октомври + Ноември + Декември + + + Яну + Фев + Мар + Апр + Май + Юни + Юли + Авг + Сеп + Окт + Ное + Дек + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ca-AD.xml b/chrome/content/zotero/locale/csl/locales-ca-AD.xml index a67e109e2b..7571fe1289 100644 --- a/chrome/content/zotero/locale/csl/locales-ca-AD.xml +++ b/chrome/content/zotero/locale/csl/locales-ca-AD.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - References - - source - sources - - nd - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - line - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + nd + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + line + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-cs-CZ.xml b/chrome/content/zotero/locale/csl/locales-cs-CZ.xml index d4e3c8888d..e8244661b1 100644 --- a/chrome/content/zotero/locale/csl/locales-cs-CZ.xml +++ b/chrome/content/zotero/locale/csl/locales-cs-CZ.xml @@ -1,211 +1,299 @@ - - - - v - v - ibid - přistoupeno - získáno - z - nadcházející - reference - - zdroj - zdroje - - bez data - a - et al. - interview - dopis - anonymous - anon - a další - v tisku - online - citován - internet - prezentován v - antropologie - astronomie - biologie - botanika - chemie - technika - všeobecný základ - geografie - geologie - historie - humanitní - literatura - matematika - medicína - filosofie - fyzika - psychologie - sociologie - věda - politologie - společenská věda - teologie - zoologie - - kniha - knihy - - - kapitola - kapitoly - - - sloupec - sloupce - - - obrázek - obrázky - - - list - listy - - - číslo - číslo - - - řádek - řádky - - - poznámka - poznámky - - - opus - opera - - - strana - strany - - - odstavec - odstavce - - - část - části - - - sekce - sekce - - - ročník - ročníky - - - edice - edice - - - verš - verše - - - sub verbo - s.vv - - kn - kap - sl - obr - l - čís - op - - s - s - - odst - č - sek - - s.v - s.vv - - - v - v - - - roč - roč - - edition - ed - - - ¶¶ - - - § - §§ - - - autor - autoři - - - editor - editoři - - - překladatel - překladatelé - - - - - - - ed - ed - - - překl - překl - - editoval - přeložil - pro - rozhovor vedl - ed - překl - leden - únor - březen - duben - květen - červen - červenec - srpen - září - říjen - listopad - prosinec - led - úno - bře - dub - kvě - čer - čvc - srp - zář - říj - lis - pro - - + + + + + + + + + + + + + + + v + v + ibid + přístup + získáno + z + nadcházející + + reference + references + + + ref. + refs. + + bez data + a + et al. + circa + c. + interview + dopis + anonymous + anon + a další + v tisku + online + citován + internet + prezentován v + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologie + astronomie + biologie + botanika + chemie + technika + všeobecný základ + geografie + geologie + historie + humanitní + linguistics + literatura + matematika + medicína + filosofie + fyzika + psychologie + sociologie + věda + politologie + sociální věda + teologie + zoologie + + + + kniha + knihy + + + kapitola + kapitoly + + + sloupec + sloupce + + + obrázek + obrázky + + + list + listy + + + číslo + číslo + + + řádek + řádky + + + poznámka + poznámky + + + opus + opera + + + strana + strany + + + odstavec + odstavce + + + část + části + + + sekce + sekce + + + ročník + ročníky + + + edice + edice + + + verš + verše + + + sub verbo + s.vv + + + + kn + kap + sl + obr + l + čís + op + + s + s + + odst + č + sek + + s.v + s.vv + + + v + v + + + roč + roč + + ed + + + + + ¶¶ + + + § + §§ + + + + + autor + autoři + + + editor + editoři + + + editor + editors + + + překladatel + překladatelé + + + editor & translator + editors & translators + + + + + + + + + ed + ed + + + ed. + eds. + + + překl + překl + + + ed. & tran. + eds. & trans. + + + + editoval + edited by + přeložil + edited & translated by + pro + rozhovor vedl + + + ed + ed. + překl + ed. & trans. by + + + leden + únor + březen + duben + květen + červen + červenec + srpen + září + říjen + listopad + prosinec + + + led + úno + bře + dub + kvě + čer + čvc + srp + zář + říj + lis + pro + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-da-DK.xml b/chrome/content/zotero/locale/csl/locales-da-DK.xml index 84017e9e13..d9dd957532 100644 --- a/chrome/content/zotero/locale/csl/locales-da-DK.xml +++ b/chrome/content/zotero/locale/csl/locales-da-DK.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - References - - source - sources - - nd - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - line - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + nd + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + line + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-de-AT.xml b/chrome/content/zotero/locale/csl/locales-de-AT.xml index fe2ce84cbc..ae9d74e3ac 100644 --- a/chrome/content/zotero/locale/csl/locales-de-AT.xml +++ b/chrome/content/zotero/locale/csl/locales-de-AT.xml @@ -1,211 +1,299 @@ - - - - at - in - ebd. - zugegriffen - abgerufen - von - i.E. - Quellenangabe - - source - sources - - o.J. - und - u.a. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - Zeile - Zeilen - - - note - notes - - - opus - opera - - - Seite - Seiten - - - Absatz - Absätze - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - Nr - op - - S - S - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - Herausgeber - Herausgeber - - - Übersetzer - Übersetzer - - - - - - - Hrsg - Hrsg - - - Übers - Übers - - Hg. v - Übers. v - to - interview by - ed - trans - Jänner - Februar - März - April - Mai - Juni - Juli - August - September - Oktober - November - Dezember - Jän - Feb - Mar - Apr - Mai - Jun - Jul - Aug - Sep - Okt - Nov - Dez - - + + + + + + + + + + + + + + + at + in + ebd. + zugegriffen + abgerufen + von + i.E. + + reference + references + + + ref. + refs. + + o.J. + und + u.a. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + Zeile + Zeilen + + + note + notes + + + opus + opera + + + Seite + Seiten + + + Absatz + Absätze + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + Nr + op + + S + S + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + Herausgeber + Herausgeber + + + editor + editors + + + Übersetzer + Übersetzer + + + editor & translator + editors & translators + + + + + + + + + Hrsg + Hrsg + + + ed. + eds. + + + Übers + Übers + + + ed. & tran. + eds. & trans. + + + + Hg. v + edited by + Übers. v + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + Jänner + Februar + März + April + Mai + Juni + Juli + August + September + Oktober + November + Dezember + + + Jän + Feb + Mar + Apr + Mai + Jun + Jul + Aug + Sep + Okt + Nov + Dez + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-de-CH.xml b/chrome/content/zotero/locale/csl/locales-de-CH.xml index 3ab5dcdaea..516359f6ca 100644 --- a/chrome/content/zotero/locale/csl/locales-de-CH.xml +++ b/chrome/content/zotero/locale/csl/locales-de-CH.xml @@ -1,211 +1,299 @@ - - - - at - in - ebd. - zugegriffen - abgerufen - von - i.E. - Quellenangabe - - source - sources - - o.J. - und - u.a. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - Zeile - Zeilen - - - note - notes - - - opus - opera - - - Seite - Seiten - - - Absatz - Absätze - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - Nr - op - - S - S - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - Herausgeber - Herausgeber - - - Übersetzer - Übersetzer - - - - - - - Hrsg - Hrsg - - - Übers - Übers - - Hg. v - Übers. v - to - interview by - ed - trans - Januar - Februar - März - April - Mai - Juni - Juli - August - September - Oktober - November - Dezember - Jan - Feb - Mar - Apr - Mai - Jun - Jul - Aug - Sep - Okt - Nov - Dez - - + + + + + + + + + + + + + + + at + in + ebd. + zugegriffen + abgerufen + von + i.E. + + reference + references + + + ref. + refs. + + o.J. + und + u.a. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + Zeile + Zeilen + + + note + notes + + + opus + opera + + + Seite + Seiten + + + Absatz + Absätze + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + Nr + op + + S + S + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + Herausgeber + Herausgeber + + + editor + editors + + + Übersetzer + Übersetzer + + + editor & translator + editors & translators + + + + + + + + + Hrsg + Hrsg + + + ed. + eds. + + + Übers + Übers + + + ed. & tran. + eds. & trans. + + + + Hg. v + edited by + Übers. v + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + Januar + Februar + März + April + Mai + Juni + Juli + August + September + Oktober + November + Dezember + + + Jan + Feb + Mar + Apr + Mai + Jun + Jul + Aug + Sep + Okt + Nov + Dez + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-de-DE.xml b/chrome/content/zotero/locale/csl/locales-de-DE.xml index 17b02e56b9..f9e1457213 100644 --- a/chrome/content/zotero/locale/csl/locales-de-DE.xml +++ b/chrome/content/zotero/locale/csl/locales-de-DE.xml @@ -1,211 +1,299 @@ - - - - auf - in - ebd - zugegriffen - abgerufen - von - i. E. - Quellenangabe - - source - sources - - o. J. - und - u. a. - Interview - Brief - ohne Autor - o. A. - und andere - im Druck - online - zitiert - Internet - gehalten auf der - Anthropologie - Astronomie - Biologie - Botanik - Chemie - Ingenieurswissenschaften - generischer Stil - Geographie - Geologie - Geschichte - Geisteswissenschaften - Literatur - Mathematik - Medizin - Philosophie - Physik - Psychologie - Soziologie - Naturwissenschaften - Politikwissenschaft - Sozialwissenschaften - Theologie - Zoologie - - Buch - Bücher - - - Kapitel - Kapitel - - - Spalte - Spalten - - - Abbildung - Abbildungen - - - Blatt - Blätter - - - Nummer - Nummern - - - Zeile - Zeilen - - - Note - Noten - - - Opus - Opera - - - Seite - Seiten - - - Absatz - Absätze - - - Teil - Teile - - - Abschnitt - Abschnitte - - - Band - Bände - - - Auflage - Auflagen - - - Vers - Verse - - - sub verbo - s.vv - - B - Kap - Sp - Abb - Fol - Nr - op - - S - S - - Abs - Teil - Abschn - - s.v - s.vv - - - V - Vv - - - Bd - Bd - - edition - Aufl - - - ¶¶ - - - § - §§ - - - - - - - Herausgeber - Herausgeber - - - Übersetzer - Übersetzer - - - - - - - Hrsg - Hrsg - - - Übers - Übers - - herausgegeben von - übersetzt von - an - interviewt von - hg. v - übers. v - Januar - Februar - März - April - Mai - Juni - Juli - August - September - Oktober - November - Dezember - Jan - Feb - März - Apr - Mai - Juni - Juli - Aug - Sep - Okt - Nov - Dez - - + + + + + + + + + + + + + + + auf + in + ebd + zugegriffen + abgerufen + von + i. E. + + reference + references + + + ref. + refs. + + o. J. + und + u. a. + circa + c. + Interview + Brief + ohne Autor + o. A. + und andere + im Druck + online + zitiert + Internet + gehalten auf der + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + Anthropologie + Astronomie + Biologie + Botanik + Chemie + Ingenieurswissenschaften + generischer Stil + Geographie + Geologie + Geschichte + Geisteswissenschaften + linguistics + Literatur + Mathematik + Medizin + Philosophie + Physik + Psychologie + Soziologie + Naturwissenschaften + Politikwissenschaft + Sozialwissenschaften + Theologie + Zoologie + + + + Buch + Bücher + + + Kapitel + Kapitel + + + Spalte + Spalten + + + Abbildung + Abbildungen + + + Blatt + Blätter + + + Nummer + Nummern + + + Zeile + Zeilen + + + Note + Noten + + + Opus + Opera + + + Seite + Seiten + + + Absatz + Absätze + + + Teil + Teile + + + Abschnitt + Abschnitte + + + Band + Bände + + + Auflage + Auflagen + + + Vers + Verse + + + sub verbo + s.vv + + + + B + Kap + Sp + Abb + Fol + Nr + op + + S + S + + Abs + Teil + Abschn + + s.v + s.vv + + + V + Vv + + + Bd + Bd + + Aufl + + + + + ¶¶ + + + § + §§ + + + + + + + + + Herausgeber + Herausgeber + + + editor + editors + + + Übersetzer + Übersetzer + + + editor & translator + editors & translators + + + + + + + + + Hrsg + Hrsg + + + ed. + eds. + + + Übers + Übers + + + ed. & tran. + eds. & trans. + + + + herausgegeben von + edited by + übersetzt von + edited & translated by + an + interviewt von + + + hg. v + ed. + übers. v + ed. & trans. by + + + Januar + Februar + März + April + Mai + Juni + Juli + August + September + Oktober + November + Dezember + + + Jan + Feb + März + Apr + Mai + Juni + Juli + Aug + Sep + Okt + Nov + Dez + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-el-GR.xml b/chrome/content/zotero/locale/csl/locales-el-GR.xml index 43bf4668c9..6ed80a468b 100644 --- a/chrome/content/zotero/locale/csl/locales-el-GR.xml +++ b/chrome/content/zotero/locale/csl/locales-el-GR.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - references - - source - sources - - n.d. - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + n.d. + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-en-US.xml b/chrome/content/zotero/locale/csl/locales-en-US.xml index 6b850bd2f3..2b0ea0080e 100644 --- a/chrome/content/zotero/locale/csl/locales-en-US.xml +++ b/chrome/content/zotero/locale/csl/locales-en-US.xml @@ -1,231 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - references - - source - sources - - n.d. - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - - - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - - - ¶¶ - - - § - §§ - - - - - - - - - editor - editors - - - translator - translators - - - - - - - - - ed - eds - - - tran - trans - - - - edited by - translated by - to - interview by - - - ed - trans - - - January - February - March - April - May - June - July - August - September - October - November - December - - - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + n.d. + and + et al. + circa + c. + interview + letter + anonymous + anon. + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + sub verbis + + + + bk. + chap. + col. + fig. + f. + no. + op. + + p. + pp. + + para. + pt. + sec. + + s.v. + s.vv. + + + v. + vv. + + + vol. + vols. + + ed. + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed. + eds. + + + ed. + eds. + + + tran. + trans. + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed. + ed. + trans. + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan. + Feb. + Mar. + Apr. + May + Jun. + Jul. + Aug. + Sep. + Oct. + Nov. + Dec. + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-es-ES.xml b/chrome/content/zotero/locale/csl/locales-es-ES.xml index 5ed29b992e..7020d8aa76 100644 --- a/chrome/content/zotero/locale/csl/locales-es-ES.xml +++ b/chrome/content/zotero/locale/csl/locales-es-ES.xml @@ -1,211 +1,299 @@ - - - - en - en - ibid - accedido - recuperado - a partir de - previsto - Referencias - - source - sources - - s.d. - y - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - libro - libros - - - capítulo - capítulos - - - columna - columnas - - - figura - figuras - - - folio - folios - - - número - números - - - línea - líneas - - - nota - notas - - - opus - opera - - - página - páginas - - - párrafo - párrafos - - - parte - partes - - - sección - secciones - - - volumen - volúmenes - - - edition - editions - - - verso - versos - - - sub verbo - s.vv - - lib - cap - col - fig - f - - op - - pág - págs - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editores - - - traductor - traductores - - - - - - - ed - eds - - - trad - trads - - editado por - traducido por - to - interview by - ed - trad - Enero - Febrero - Marzo - Abril - Mayo - Junio - Julio - Agosto - Septiembre - Octubre - Noviembre - Diciembre - Ene - Feb - Mar - Abr - May - Jun - Jul - Ago - Sep - Oct - Nov - Dic - - + + + + + + + + + + + + + + + en + en + ibid + accedido + recuperado + a partir de + previsto + + reference + references + + + ref. + refs. + + s.d. + y + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + libro + libros + + + capítulo + capítulos + + + columna + columnas + + + figura + figuras + + + folio + folios + + + número + números + + + línea + líneas + + + nota + notas + + + opus + opera + + + página + páginas + + + párrafo + párrafos + + + parte + partes + + + sección + secciones + + + volumen + volúmenes + + + edition + editions + + + verso + versos + + + sub verbo + s.vv + + + + lib + cap + col + fig + f + + op + + pág + págs + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editores + + + editor + editors + + + traductor + traductores + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + trad + trads + + + ed. & tran. + eds. & trans. + + + + editado por + edited by + traducido por + edited & translated by + to + interview by + + + ed + ed. + trad + ed. & trans. by + + + Enero + Febrero + Marzo + Abril + Mayo + Junio + Julio + Agosto + Septiembre + Octubre + Noviembre + Diciembre + + + Ene + Feb + Mar + Abr + May + Jun + Jul + Ago + Sep + Oct + Nov + Dic + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-et-EE.xml b/chrome/content/zotero/locale/csl/locales-et-EE.xml index 59d23cadc8..29dc2d51cd 100644 --- a/chrome/content/zotero/locale/csl/locales-et-EE.xml +++ b/chrome/content/zotero/locale/csl/locales-et-EE.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - references - - source - sources - - n.d. - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + n.d. + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-fr-FR.xml b/chrome/content/zotero/locale/csl/locales-fr-FR.xml index 2befd9385b..17eac66531 100644 --- a/chrome/content/zotero/locale/csl/locales-fr-FR.xml +++ b/chrome/content/zotero/locale/csl/locales-fr-FR.xml @@ -1,211 +1,299 @@ - - - - à - dans - ibid - accédé - retrouvé - de - à venir - références - - source - sources - - sans date - et - et al. - entrevue - lettre - anonyme - anon - et autres - sous presse - en ligne - cité - Internet - présenté au - anthropologie - astronomie - biologie - botanique - chimie - ingénierie - base générique - géographie - géologie - histoire - lettres et sciences humaines - littérature - mathématiques - médecine - philosophie - physique - psychologie - sociologie - sciences de la nature - science politique - sciences sociales - théologie - zoologie - - livre - livres - - - chapitre - chapitres - - - colonne - colonnes - - - figure - figures - - - folio - folios - - - numéro - numéros - - - ligne - lignes - - - note - notes - - - opus - opus - - - page - pages - - - paragraphe - paragraphes - - - tome - tomes - - - rubrique - rubriques - - - volume - volumes - - - édition - éditions - - - vers - vers - - - sub verbo - sub verbo - - liv - chap - col - fig - f - - op - - p - p - - paragr - t - rub - - s.v - s.v - - - v - v - - - vol - vol - - edition - éd - - § - § - - - § - § - - - auteur - auteurs - - - éditeur - éditeurs - - - traducteur - traducteurs - - - aut - aut - - - éd - éd - - - trad - trad - - édité par - traduit par - vers - entrevue par - éd - trad - janvier - février - mars - avril - mai - juin - juillet - août - septembre - octobre - novembre - décembre - jan - fév - mar - avr - mai - jun - jul - aoû - sep - oct - nov - déc - - + + + + + + + + + + + + + + + à + dans + ibid + accédé + retrouvé + de + à venir + + reference + references + + + ref. + refs. + + pas de date + et + et al. + circa + c. + interview + lettre + anonyme + anon + et autres + sous presse + en ligne + cité + Internet + présenté au + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropologie + astronomie + biologie + botanique + chimie + ingénierie + base générique + géographie + géologie + histoire + sciences humaines + linguistics + littérature + mathématiques + médecine + philosophie + physique + psychologie + sociologie + science + science politique + science sociale + théologie + zoologie + + + + livre + livres + + + chapitre + chapitres + + + colonne + colonnes + + + figure + figures + + + folio + folios + + + numéro + numéros + + + ligne + lignes + + + note + notes + + + opus + opus + + + page + pages + + + paragraphe + paragraphes + + + partie + parties + + + section + sections + + + volume + volumes + + + edition + editions + + + verset + versets + + + sub verbo + s.vv + + + + liv + chap + col + fig + f + + op + + p + pp + + par + part + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + éd + + + + § + §§ + + + § + §§ + + + + + + + + + éditeur + éditeurs + + + editor + editors + + + traducteur + traducteurs + + + editor & translator + editors & translators + + + + + + + + + éd + éd + + + ed. + eds. + + + trad + trad + + + ed. & tran. + eds. & trans. + + + + édité par + edited by + traduit par + edited & translated by + vers + interview par + + + éd + ed. + trad + ed. & trans. by + + + Janvier + Février + Mars + Avril + Mai + Juin + Juillet + Août + Septembre + Octobre + Novembre + Décembre + + + Jan + Fév + Mar + Avr + Mai + Jun + Jul + Aoû + Sep + Oct + Nov + Déc + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-he-IL.xml b/chrome/content/zotero/locale/csl/locales-he-IL.xml index 62c7bfd163..0ec9ef4b68 100644 --- a/chrome/content/zotero/locale/csl/locales-he-IL.xml +++ b/chrome/content/zotero/locale/csl/locales-he-IL.xml @@ -1,211 +1,299 @@ - - - - - בתוך - שם - גישה - אוחזר - מתוך - forthcoming - References - - source - sources - - nd - ו - ואחרים - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - ספר - ספרים - - - פרק - פרקים - - - טור - טורים - - - figure - figures - - - folio - folios - - - מספר - מספרים - - - שורה - שורות - - - note - notes - - - אופוס - אופרה - - - עמוד - עמודים - - - paragraph - פיסקה - - - part - parts - - - section - sections - - - כרך - כרכים - - - edition - editions - - - בית - בתים - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - 'עמ - 'עמ - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - עורך - עורכים - - - מתרגם - מתרגמים - - - - - - - ed - eds - - - tran - trans - - נערך ע"י - תורגם ע"י - to - interview by - ed - trans - ינואר - פברואר - מרץ - אפריל - מאי - יוני - יולי - אוגוסט - ספטמבר - אוקטובר - נובמבר - דצמבר - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + + בתוך + שם + גישה + אוחזר + מתוך + forthcoming + + reference + references + + + ref. + refs. + + nd + ו + ואחרים + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + ספר + ספרים + + + פרק + פרקים + + + טור + טורים + + + figure + figures + + + folio + folios + + + מספר + מספרים + + + שורה + שורות + + + note + notes + + + אופוס + אופרה + + + עמוד + עמודים + + + paragraph + פיסקה + + + part + parts + + + section + sections + + + כרך + כרכים + + + edition + editions + + + בית + בתים + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + 'עמ + 'עמ + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + עורך + עורכים + + + editor + editors + + + מתרגם + מתרגמים + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + נערך ע"י + edited by + תורגם ע"י + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + ינואר + פברואר + מרץ + אפריל + מאי + יוני + יולי + אוגוסט + ספטמבר + אוקטובר + נובמבר + דצמבר + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-hu-HU.xml b/chrome/content/zotero/locale/csl/locales-hu-HU.xml index 296eda1355..335d0c6833 100644 --- a/chrome/content/zotero/locale/csl/locales-hu-HU.xml +++ b/chrome/content/zotero/locale/csl/locales-hu-HU.xml @@ -1,211 +1,299 @@ - - - - - in - ibid - elérés - elérés - forrás - megjelenés alatt - hivatkozások - - source - sources - - nd - és - et al. - interjú - levél - név nélkül - nn - és mások - nyomtatás alatt - online - idézi - internet - előadás - antropológia - csillagászat - biológia - botanika - kémia - mérnöki tudományok - általános - földrajz - geológia - történelem - bölcsésztudományok - irodalom - matematika - orvostudomány - filozófia - fizika - pszichológia - szociológia - tudomány - politikatudomány - társadalomtudomány - teológia - zoológia - - könyv - könyv - - - fejezet - fejezet - - - oszlop - oszlop - - - ábra - ábra - - - fóliáns - fóliáns - - - szám - szám - - - sor - sor - - - jegyzet - jegyzet - - - opus - opera - - - oldal - oldal - - - bekezdés - bekezdés - - - rész - rész - - - szakasz - szakasz - - - kötet - kötet - - - edition - editions - - - versszak - versszak - - - sub verbo - s.vv - - könyv - fej - oszl - ábr - fol - sz - op - - o - o - - bek - rész - szak - - s.v - s.vv - - - vsz - vsz - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - szerkesztő - szerkesztő - - - fordító - fordító - - - - - - - szerk - szerk - - - ford - ford - - szerkesztette - fordította - címzett - interjúkészítő - szerk - ford - január - február - március - április - május - június - július - augusztus - szeptember - október - november - december - jan - febr - márc - ápr - máj - jún - júl - aug - szept - okt - nov - dec - - + + + + + + + + + + + + + + + + in + ibid + elérés + elérés + forrás + megjelenés alatt + + reference + references + + + ref. + refs. + + nd + és + et al. + circa + c. + interjú + levél + név nélkül + nn + és mások + nyomtatás alatt + online + idézi + internet + előadás + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropológia + csillagászat + biológia + botanika + kémia + mérnöki tudományok + általános + földrajz + geológia + történelem + bölcsésztudományok + linguistics + irodalom + matematika + orvostudomány + filozófia + fizika + pszichológia + szociológia + tudomány + politikatudomány + társadalomtudomány + teológia + zoológia + + + + könyv + könyv + + + fejezet + fejezet + + + oszlop + oszlop + + + ábra + ábra + + + fóliáns + fóliáns + + + szám + szám + + + sor + sor + + + jegyzet + jegyzet + + + opus + opera + + + oldal + oldal + + + bekezdés + bekezdés + + + rész + rész + + + szakasz + szakasz + + + kötet + kötet + + + edition + editions + + + versszak + versszak + + + sub verbo + s.vv + + + + könyv + fej + oszl + ábr + fol + sz + op + + o + o + + bek + rész + szak + + s.v + s.vv + + + vsz + vsz + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + szerkesztő + szerkesztő + + + editor + editors + + + fordító + fordító + + + editor & translator + editors & translators + + + + + + + + + szerk + szerk + + + ed. + eds. + + + ford + ford + + + ed. & tran. + eds. & trans. + + + + szerkesztette + edited by + fordította + edited & translated by + címzett + interjúkészítő + + + szerk + ed. + ford + ed. & trans. by + + + január + február + március + április + május + június + július + augusztus + szeptember + október + november + december + + + jan + febr + márc + ápr + máj + jún + júl + aug + szept + okt + nov + dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-is-IS.xml b/chrome/content/zotero/locale/csl/locales-is-IS.xml index 707cd47bdc..fdd7582fff 100644 --- a/chrome/content/zotero/locale/csl/locales-is-IS.xml +++ b/chrome/content/zotero/locale/csl/locales-is-IS.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - References - - source - sources - - nd - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - line - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + nd + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + line + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-it-IT.xml b/chrome/content/zotero/locale/csl/locales-it-IT.xml index 4b4e34aee1..cf6c378819 100644 --- a/chrome/content/zotero/locale/csl/locales-it-IT.xml +++ b/chrome/content/zotero/locale/csl/locales-it-IT.xml @@ -1,211 +1,299 @@ - - - - a - in - ibid - consultato - recuperato - da - futuro - Citazioni bibliografiche - - source - sources - - S.d. - e - et al. - intervista - lettera - anonimo - anon - e altri - in stampa - in linea - citato - internet - presentato al - antropologia - astronomia - biologia - botanica - chimica - ingegneria - generica - geografia - geologia - storia - discipline umanistiche - letteratura - matematica - medicina - filosofia - fisica - psicologia - sociologia - scienze - scienze politiche - sociologia - teologia - zoologia - - libro - libri - - - capitolo - capitoli - - - colonna - colonne - - - figura - figure - - - foglio - fogli - - - numero - numeri - - - riga - righe - - - nota - note - - - opera - opere - - - pagina - pagine - - - capoverso - capoversi - - - parte - parti - - - paragrafo - paragrafi - - - volume - volumi - - - edizione - edizioni - - - verso - versi - - - sub verbo - s.vv - - lib - cap - col - fig - fgl - - op - - pag - pagg - - cpv - pt - par - - s.v - s.vv - - - v - vv - - - vol - vol - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - curatore - curatori - - - traduttore - traduttori - - - - - - - cur - cur - - - trad - trad - - a cura di - tradotto da - a - intervista di - cur. da - trad. da - Gennaio - Febbraio - Marzo - Aprile - Maggio - Giugno - Luglio - Agosto - Settembre - Ottobre - Novembre - Dicembre - Gen - Feb - Mar - Apr - Mag - Giu - Lug - Ago - Set - Ott - Nov - Dic - - + + + + + + + + + + + + + + + a + in + ibid + consultato + recuperato + da + futuro + + reference + references + + + ref. + refs. + + S.d. + e + et al. + circa + c. + intervista + lettera + anonimo + anon + e altri + in stampa + in linea + citato + internet + presentato al + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologia + astronomia + biologia + botanica + chimica + ingegneria + generica + geografia + geologia + storia + discipline umanistiche + linguistics + letteratura + matematica + medicina + filosofia + fisica + psicologia + sociologia + scienze + scienze politiche + sociologia + teologia + zoologia + + + + libro + libri + + + capitolo + capitoli + + + colonna + colonne + + + figura + figure + + + foglio + fogli + + + numero + numeri + + + riga + righe + + + nota + note + + + opera + opere + + + pagina + pagine + + + capoverso + capoversi + + + parte + parti + + + paragrafo + paragrafi + + + volume + volumi + + + edizione + edizioni + + + verso + versi + + + sub verbo + s.vv + + + + lib + cap + col + fig + fgl + + op + + pag + pagg + + cpv + pt + par + + s.v + s.vv + + + v + vv + + + vol + vol + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + curatore + curatori + + + editor + editors + + + traduttore + traduttori + + + editor & translator + editors & translators + + + + + + + + + cur + cur + + + ed. + eds. + + + trad + trad + + + ed. & tran. + eds. & trans. + + + + a cura di + edited by + tradotto da + edited & translated by + a + intervista di + + + cur. da + ed. + trad. da + ed. & trans. by + + + Gennaio + Febbraio + Marzo + Aprile + Maggio + Giugno + Luglio + Agosto + Settembre + Ottobre + Novembre + Dicembre + + + Gen + Feb + Mar + Apr + Mag + Giu + Lug + Ago + Set + Ott + Nov + Dic + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ja-JP.xml b/chrome/content/zotero/locale/csl/locales-ja-JP.xml index 7cf8887fdc..10a9aa3dbc 100644 --- a/chrome/content/zotero/locale/csl/locales-ja-JP.xml +++ b/chrome/content/zotero/locale/csl/locales-ja-JP.xml @@ -1,211 +1,299 @@ - - - - at - - 前掲 - アクセス - 読み込み - から - 近刊 - 参考文献 - - source - sources - - 日付なし - - - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - - - - - note - notes - - - opus - opera - - - ページ - ページ - - - 段落 - 段落 - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - - op - - p - p - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - 編集者 - 編集者 - - - 翻訳者 - 翻訳者 - - - - - - - 編集者 - 編集者 - - - 翻訳者 - 翻訳者 - - 編集者: - 翻訳者: - to - interview by - ed - trans - 1月 - 2月 - 3月 - 4月 - 5月 - 6月 - 7月 - 8月 - 9月 - 10月 - 11月 - 12月 - 1月 - 2月 - 3月 - 4月 - 5月 - 6月 - 7月 - 8月 - 9月 - 10月 - 11月 - 12月 - - + + + + + + + + + + + + + + + at + + 前掲 + アクセス + 読み込み + から + 近刊 + + reference + references + + + ref. + refs. + + 日付なし + + + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + + + + + note + notes + + + opus + opera + + + ページ + ページ + + + 段落 + 段落 + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + + op + + p + p + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + 編集者 + 編集者 + + + editor + editors + + + 翻訳者 + 翻訳者 + + + editor & translator + editors & translators + + + + + + + + + 編集者 + 編集者 + + + ed. + eds. + + + 翻訳者 + 翻訳者 + + + ed. & tran. + eds. & trans. + + + + 編集者: + edited by + 翻訳者: + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 + 10月 + 11月 + 12月 + + + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 + 10月 + 11月 + 12月 + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ko-KR.xml b/chrome/content/zotero/locale/csl/locales-ko-KR.xml index c6a39573a6..5f8c991be9 100644 --- a/chrome/content/zotero/locale/csl/locales-ko-KR.xml +++ b/chrome/content/zotero/locale/csl/locales-ko-KR.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - 접근된 - retrieved - (으)로부터 - 근간 - 참고 문헌 - - source - sources - - 일자 없음 - 와/과 - 기타 - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - - - - - note - notes - - - opus - opera - - - 페이지 - 페이지 - - - 단락 - 단락 - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - 편집자 - 편집자 - - - 번역자 - 번역자 - - - - - - - 편집자 - 편집자 - - - 번역자 - 번역자 - - 편집자: - 번역자: - to - interview by - ed - trans - 1월 - 2월 - 3월 - 4월 - 5월 - 6월 - 7월 - 8월 - 9월 - 10월 - 11월 - 12월 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - - + + + + + + + + + + + + + + + at + in + ibid + 접근된 + retrieved + (으)로부터 + 근간 + + reference + references + + + ref. + refs. + + 일자 없음 + 와/과 + 기타 + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + + + + + note + notes + + + opus + opera + + + 페이지 + 페이지 + + + 단락 + 단락 + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + 편집자 + 편집자 + + + editor + editors + + + 번역자 + 번역자 + + + editor & translator + editors & translators + + + + + + + + + 편집자 + 편집자 + + + ed. + eds. + + + 번역자 + 번역자 + + + ed. & tran. + eds. & trans. + + + + 편집자: + edited by + 번역자: + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + 1월 + 2월 + 3월 + 4월 + 5월 + 6월 + 7월 + 8월 + 9월 + 10월 + 11월 + 12월 + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-mn-MN.xml b/chrome/content/zotero/locale/csl/locales-mn-MN.xml index 4b799ce932..6f99f8f13c 100644 --- a/chrome/content/zotero/locale/csl/locales-mn-MN.xml +++ b/chrome/content/zotero/locale/csl/locales-mn-MN.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - references - - source - sources - - n.d. - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + n.d. + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-nb-NO.xml b/chrome/content/zotero/locale/csl/locales-nb-NO.xml index 1e2df2f63c..b9f28b49ee 100644 --- a/chrome/content/zotero/locale/csl/locales-nb-NO.xml +++ b/chrome/content/zotero/locale/csl/locales-nb-NO.xml @@ -1,211 +1,299 @@ - - - - - i - ibid - aksessert - hentet - fra - kommende - referanser - - source - sources - - udatert - og - mfl - intervju - brev - anonym - anon - med flere - i trykk - online - cited - Internett - presentert på - antropologi - astronomi - biologi - botanikk - kjemi - ingeniørvitenskap - generic base - geografi - geologi - historie - humanistiske fag - litteratur - matte - medisin - filosofi - fysikk - fysiologi - sosiologi - naturvitenskap - political science - sosialvitenskap - teologi - zoologi - - bok - bøker - - - kapittel - kapitler - - - kolonne - kolenner - - - figur - figurer - - - folio - folioer - - - nummer - numre - - - linje - linjer - - - note - noter - - - opus - opus - - - side - sider - - - avsnitt - avsnitt - - - del - deler - - - seksjon - seksjoner - - - bind - bind - - - utgave - utgaver - - - vers - vers - - - sub verbo - s.vv - - b - kap - kol - fig - fol - nr - op - - s - s - - avsn - d - sek - - s.v - s.vv - - - v - v - - - bd - bd - - edition - utg - - - ¶¶ - - - § - §§ - - - - - - - redaktør - redaktører - - - oversetter - oversettere - - - - - - - red - red - - - overs - overs - - redigert av - oversatt av - mottatt av - intervjuet av - utg - overs - Januar - Februar - Mars - April - Mai - Juni - Juli - August - September - Oktober - November - Desember - Jan - Feb - Mar - Apr - Mai - Jun - Jul - Aug - Sep - Okt - Nov - Des - - + + + + + + + + + + + + + + + + i + ibid + aksessert + hentet + fra + kommende + + reference + references + + + ref. + refs. + + udatert + og + mfl + circa + c. + intervju + brev + anonym + anon + med flere + i trykk + online + cited + Internett + presentert på + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologi + astronomi + biologi + botanikk + kjemi + ingeniørvitenskap + generic base + geografi + geologi + historie + humanistiske fag + linguistics + litteratur + matte + medisin + filosofi + fysikk + fysiologi + sosiologi + naturvitenskap + political science + sosialvitenskap + teologi + zoologi + + + + bok + bøker + + + kapittel + kapitler + + + kolonne + kolenner + + + figur + figurer + + + folio + folioer + + + nummer + numre + + + linje + linjer + + + note + noter + + + opus + opus + + + side + sider + + + avsnitt + avsnitt + + + del + deler + + + seksjon + seksjoner + + + bind + bind + + + utgave + utgaver + + + vers + vers + + + sub verbo + s.vv + + + + b + kap + kol + fig + fol + nr + op + + s + s + + avsn + d + sek + + s.v + s.vv + + + v + v + + + bd + bd + + utg + + + + + ¶¶ + + + § + §§ + + + + + + + + + redaktør + redaktører + + + editor + editors + + + oversetter + oversettere + + + editor & translator + editors & translators + + + + + + + + + red + red + + + ed. + eds. + + + overs + overs + + + ed. & tran. + eds. & trans. + + + + redigert av + edited by + oversatt av + edited & translated by + mottatt av + intervjuet av + + + utg + ed. + overs + ed. & trans. by + + + Januar + Februar + Mars + April + Mai + Juni + Juli + August + September + Oktober + November + Desember + + + Jan + Feb + Mar + Apr + Mai + Jun + Jul + Aug + Sep + Okt + Nov + Des + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-nl-NL.xml b/chrome/content/zotero/locale/csl/locales-nl-NL.xml index bbe7a51f78..3c6a33f562 100644 --- a/chrome/content/zotero/locale/csl/locales-nl-NL.xml +++ b/chrome/content/zotero/locale/csl/locales-nl-NL.xml @@ -1,211 +1,299 @@ - - - - bij - in - ibid - bezocht - verkregen - van - in voorbereiding - referenties - - referentie - referenties - - geen datum - en - e.a. - interview - brief - anoniem - anon - en anderen - in druk - online - geciteerd - internet - gepresenteerd bij - anthropologie - astronomie - biologie - botanie - scheikunde - techniek - generiek - geografie - geologie - geschiedenis - geesteswetenschappen - literatuur - wiskunde - medicijnen - filosofie - natuurkunde - psychologie - sociologie - wetenschap - politieke wetenschappen - sociale wetenschappen - theologie - zoologie - - boek - boeken - - - hoofdstuk - hoofdstukken - - - column - columns - - - figuur - figuren - - - folio - folio's - - - nummer - nummers - - - regel - regels - - - aantekening - aantekeningen - - - opus - opera - - - pagina - pagina's - - - paragraaf - paragrafen - - - deel - delen - - - sectie - secties - - - volume - volumes - - - editie - edities - - - vers - versen - - - sub verbo - sub verbis - - bk - hfdst - col - fig - f - nr - op - - p - pp - - par - deel - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - redacteur - redacteuren - - - vertaler - vertalers - - - - - - - red - red - - - vert - vert - - bewerkt door - vertaald door - ontvangen door - geinterviewd door - red - vert - januari - februari - maart - april - mei - juni - juli - augustus - september - oktober - november - december - jan - feb - mrt - apr - mei - jun - jul - aug - sep - okt - nov - dec - - + + + + + + + + + + + + + + + bij + in + ibid + bezocht + verkregen + van + in voorbereiding + + reference + references + + + ref. + refs. + + geen datum + en + e.a. + circa + c. + interview + brief + anoniem + anon + en anderen + in druk + online + geciteerd + internet + gepresenteerd bij + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropologie + astronomie + biologie + botanie + scheikunde + techniek + generiek + geografie + geologie + geschiedenis + geesteswetenschappen + linguistics + literatuur + wiskunde + medicijnen + filosofie + natuurkunde + psychologie + sociologie + wetenschap + politieke wetenschappen + sociale wetenschappen + theologie + zoologie + + + + boek + boeken + + + hoofdstuk + hoofdstukken + + + column + columns + + + figuur + figuren + + + folio + folio's + + + nummer + nummers + + + regel + regels + + + aantekening + aantekeningen + + + opus + opera + + + pagina + pagina's + + + paragraaf + paragrafen + + + deel + delen + + + sectie + secties + + + volume + volumes + + + editie + edities + + + vers + versen + + + sub verbo + s.vv + + + + bk + hfdst + col + fig + f + nr + op + + p + pp + + par + deel + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + redacteur + redacteuren + + + editor + editors + + + vertaler + vertalers + + + editor & translator + editors & translators + + + + + + + + + red + red + + + ed. + eds. + + + vert + vert + + + ed. & tran. + eds. & trans. + + + + bewerkt door + edited by + vertaald door + edited & translated by + ontvangen door + geinterviewd door + + + red + ed. + vert + ed. & trans. by + + + januari + februari + maart + april + mei + juni + juli + augustus + september + oktober + november + december + + + jan + feb + mrt + apr + mei + jun + jul + aug + sep + okt + nov + dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-pl-PL.xml b/chrome/content/zotero/locale/csl/locales-pl-PL.xml index ae97ea0a1f..da3f9a9be3 100644 --- a/chrome/content/zotero/locale/csl/locales-pl-PL.xml +++ b/chrome/content/zotero/locale/csl/locales-pl-PL.xml @@ -1,211 +1,299 @@ - - - - at - w - ibid - udostępniono - pobrano - z - w druku - Referencje - - source - sources - - bez daty - i - et al. - wywiad - list - anonim - anonim - i inni - w druku - online - cytowane - internet - zaprezentowano - antropologia - astronomia - biologia - botanika - chemia - inżynieria - generic base - geografia - geologia - historia - humanistyka - literatura - matematyka - medycyna - filozofia - fizyka - psychologia - socjologia - nauki ścisłe - nauki polityczne - nauki społeczne - teologia - zoologia - - książka - książki - - - rozdział - rozdziały - - - kolumna - kolumny - - - rycina - ryciny - - - folio - folios - - - numer - numery - - - wers - wersy - - - notatka - notatki - - - opus - opera - - - strona - strony - - - akapit - akapity - - - część - części - - - sekcja - sekcja - - - tom - tomy - - - wydanie - wydania - - - wers - wersy - - - sub verbo - s.vv - - książka - rozdz - kolumna - ryc - folio - nr - op - - s - s - - akapit - część - sekcja - - s.v - s.vv - - - wers - wersy - - - t - t - - edition - wyd - - - ¶¶ - - - § - §§ - - - - - - - redaktor - redaktorzy - - - tłumacz - tłumacze - - - - - - - red - red - - - tłum - tłum - - zredagowane przez - przetłumaczone przez - dla - przeprowadzony przez - red - tłum - styczeń - luty - marzec - kwiecień - maj - czerwiec - lipiec - sierpień - wrzesień - październik - listopad - grudzień - styczeń - luty - marzec - kwiecień - maj - czerwiec - lipiec - sierpień - wrzesień - październik - listopad - grudzień - - + + + + + + + + + + + + + + + at + w + ibid + udostępniono + pobrano + z + w druku + + reference + references + + + ref. + refs. + + bez daty + i + et al. + circa + c. + wywiad + list + anonim + anonim + i inni + w druku + online + cytowane + internet + zaprezentowano + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologia + astronomia + biologia + botanika + chemia + inżynieria + generic base + geografia + geologia + historia + humanistyka + linguistics + literatura + matematyka + medycyna + filozofia + fizyka + psychologia + socjologia + nauki ścisłe + nauki polityczne + nauki społeczne + teologia + zoologia + + + + książka + książki + + + rozdział + rozdziały + + + kolumna + kolumny + + + rycina + ryciny + + + folio + folios + + + numer + numery + + + wers + wersy + + + notatka + notatki + + + opus + opera + + + strona + strony + + + akapit + akapity + + + część + części + + + sekcja + sekcja + + + tom + tomy + + + wydanie + wydania + + + wers + wersy + + + sub verbo + s.vv + + + + książka + rozdz + kolumna + ryc + folio + nr + op + + s + s + + akapit + część + sekcja + + s.v + s.vv + + + wers + wersy + + + t + t + + wyd + + + + + ¶¶ + + + § + §§ + + + + + + + + + redaktor + redaktorzy + + + editor + editors + + + tłumacz + tłumacze + + + editor & translator + editors & translators + + + + + + + + + red + red + + + ed. + eds. + + + tłum + tłum + + + ed. & tran. + eds. & trans. + + + + zredagowane przez + edited by + przetłumaczone przez + edited & translated by + dla + przeprowadzony przez + + + red + ed. + tłum + ed. & trans. by + + + styczeń + luty + marzec + kwiecień + maj + czerwiec + lipiec + sierpień + wrzesień + październik + listopad + grudzień + + + styczeń + luty + marzec + kwiecień + maj + czerwiec + lipiec + sierpień + wrzesień + październik + listopad + grudzień + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-pt-BR.xml b/chrome/content/zotero/locale/csl/locales-pt-BR.xml index c11aaa16af..da9cdeab5d 100644 --- a/chrome/content/zotero/locale/csl/locales-pt-BR.xml +++ b/chrome/content/zotero/locale/csl/locales-pt-BR.xml @@ -1,211 +1,299 @@ - - - - em - in - ibidem - acessado - recuperado - de - a ser publicado - referências - - source - sources - - [s.d.] - e - et al. - entrevista - carta - anônimo - anon - e outros - no prelo - online - citado - internet - apresentado em - antropologia - astronomia - biologia - botânica - química - engenharia - base genérica - geografia - geologia - história - humanidades - literatura - matemática - medicina - philosofia - física - psicologia - sociologia - ciências - ciências políticas - ciências sociais - teologia - zoologia - - livro - livros - - - capítulo - capítulos - - - coluna - colunas - - - figura - figuras - - - folio - folios - - - número - números - - - linha - linhas - - - nota - notas - - - opus - opera - - - página - páginas - - - parágrafo - parágrafos - - - parte - partes - - - seção - seções - - - volume - volumes - - - edição - edições - - - verso - versos - - - sub verbo - s.vv - - liv - cap - col - fig - f - n - op - - p - pp - - para - pt - seç - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - organizador - organizadores - - - tradutor - tradutores - - - - - - - org - orgs - - - trad - trads - - organizado por - traduzido por - para - intrevista de - org - trad - janeiro - fevereiro - março - abril - maio - junho - julho - agosto - setembro - outubro - novembro - dezembro - jan - fev - mar - abr - maio - jun - jul - ago - set - out - nov - dez - - + + + + + + + + + + + + + + + em + in + ibidem + acessado + recuperado + de + a ser publicado + + reference + references + + + ref. + refs. + + [s.d.] + e + et al. + circa + c. + entrevista + carta + anônimo + anon + e outros + no prelo + online + citado + internet + apresentado em + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologia + astronomia + biologia + botânica + química + engenharia + base genérica + geografia + geologia + história + humanidades + linguistics + literatura + matemática + medicina + philosofia + física + psicologia + sociologia + ciências + ciências políticas + ciências sociais + teologia + zoologia + + + + livro + livros + + + capítulo + capítulos + + + coluna + colunas + + + figura + figuras + + + folio + folios + + + número + números + + + linha + linhas + + + nota + notas + + + opus + opera + + + página + páginas + + + parágrafo + parágrafos + + + parte + partes + + + seção + seções + + + volume + volumes + + + edição + edições + + + verso + versos + + + sub verbo + s.vv + + + + liv + cap + col + fig + f + n + op + + p + pp + + para + pt + seç + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + organizador + organizadores + + + editor + editors + + + tradutor + tradutores + + + editor & translator + editors & translators + + + + + + + + + org + orgs + + + ed. + eds. + + + trad + trads + + + ed. & tran. + eds. & trans. + + + + organizado por + edited by + traduzido por + edited & translated by + para + intrevista de + + + org + ed. + trad + ed. & trans. by + + + janeiro + fevereiro + março + abril + maio + junho + julho + agosto + setembro + outubro + novembro + dezembro + + + jan + fev + mar + abr + maio + jun + jul + ago + set + out + nov + dez + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-pt-PT.xml b/chrome/content/zotero/locale/csl/locales-pt-PT.xml index 731306e9ed..030fcf85af 100644 --- a/chrome/content/zotero/locale/csl/locales-pt-PT.xml +++ b/chrome/content/zotero/locale/csl/locales-pt-PT.xml @@ -1,211 +1,299 @@ - - - - em - em - ibid - acedido - obtido - de - a publicar - Referências - - source - sources - - sem data - e - et al. - entrevista - carta - anónimo - anón - e outros - no prelo - em linha - citado - internet - apresentado na - antropologia - astronomia - biologia - botânica - química - engenharia - base genérica - geografia - geologia - história - humanidades - literatura - matemática - medicina - filosofia - física - psicologia - sociologia - ciência - ciência política - ciência social - teologia - zoologia - - livro - livros - - - capítulo - capítulos - - - coluna - colunas - - - figura - figuras - - - fólio - fólios - - - número - número - - - linha - linhas - - - nota - notas - - - opus - opera - - - página - páginas - - - parágrafo - parágrafos - - - parte - partes - - - secção - secções - - - volume - volumes - - - edição - edições - - - versículo - versículos - - - sub verbo - s.vv - - liv - cap - col - fig - f - n - op - - p - pp - - par - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - autor - autores - - - editor - editores - - - tradutor - tradutores - - - aut - auts - - - ed - eds - - - trad - trads - - editado por - traduzido por - para - entrevistado por - ed - trad - Janeiro - Fevereiro - Março - Abril - Maio - Junho - Julho - Agosto - Setembro - Outubro - Novembro - Dezembro - Jan - Fev - Mar - Abr - Mai - Jun - Jul - Ago - Set - Out - Nov - Dez - - + + + + + + + + + + + + + + + em + em + ibid + acedido + obtido + de + a publicar + + reference + references + + + ref. + refs. + + sem data + e + et al. + circa + c. + entrevista + carta + anónimo + anón + e outros + no prelo + em linha + citado + internet + apresentado na + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologia + astronomia + biologia + botânica + química + engenharia + base genérica + geografia + geologia + história + humanidades + linguistics + literatura + matemática + medicina + filosofia + física + psicologia + sociologia + ciência + ciência política + ciência social + teologia + zoologia + + + + livro + livros + + + capítulo + capítulos + + + coluna + colunas + + + figura + figuras + + + fólio + fólios + + + número + número + + + linha + linhas + + + nota + notas + + + opus + opera + + + página + páginas + + + parágrafo + parágrafos + + + parte + partes + + + secção + secções + + + volume + volumes + + + edição + edições + + + versículo + versículos + + + sub verbo + s.vv + + + + liv + cap + col + fig + f + n + op + + p + pp + + par + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editores + + + editor + editors + + + tradutor + tradutores + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + trad + trads + + + ed. & tran. + eds. & trans. + + + + editado por + edited by + traduzido por + edited & translated by + para + entrevistado por + + + ed + ed. + trad + ed. & trans. by + + + Janeiro + Fevereiro + Março + Abril + Maio + Junho + Julho + Agosto + Setembro + Outubro + Novembro + Dezembro + + + Jan + Fev + Mar + Abr + Mai + Jun + Jul + Ago + Set + Out + Nov + Dez + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ro-RO.xml b/chrome/content/zotero/locale/csl/locales-ro-RO.xml index 384a76a17c..55cb546561 100644 --- a/chrome/content/zotero/locale/csl/locales-ro-RO.xml +++ b/chrome/content/zotero/locale/csl/locales-ro-RO.xml @@ -1,211 +1,299 @@ - - - - la - în - ibidem - data de acces - data de preluare - din - în curs de apariție - Bibliografie - - sursă - surse - - f.a. - și - et al. - interviu - scrisoare - anonim - anon - și alții - sub tipar - online - citat - internet - prezentat la - antropologie - astronomie - biologie - botanică - chimie - inginerie - general (de bază) - geografie - geologie - istorie - umanioare - literatură - matematică - medicină - filosofie - fizică - psihologie - sociologie - știință - știinţe politice - științe sociale - teologie - zoologie - - cartea - cărțile - - - capitolul - capitolele - - - coloana - coloanele - - - figura - figurile - - - folio - folio - - - numărul - numerele - - - linia - liniile - - - nota - notele - - - opusul - opusurile - - - pagina - paginile - - - paragraful - paragrafele - - - partea - părțile - - - secțiunea - secțiunile - - - volumul - volumele - - - ediția - edițiile - - - versetul - versetele - - - sub verbo - s.vv - - cart - cap - col - fig - fol - nr - op - - p - pp - - par - part - sec - - s.v - s.vv - - - v - vv - - - vol - vol - - edition - ed - - - ¶¶ - - - § - §§ - - - autor - autori - - - editor - editori - - - traducător - traducători - - - aut - aut - - - ed - ed - - - trad - trad - - ediţie de - traducere de - în - interviu de - ed - trad - ianuarie - februarie - martie - aprilie - mai - iunie - iulie - august - septembrie - octombrie - noiembrie - decembrie - ian - feb - mar - apr - mai - iun - iul - aug - sep - oct - nov - dec - - + + + + + + + + + + + + + + + la + în + ibidem + accesat în + preluat în + din + în curs de apariţie + + reference + references + + + ref. + refs. + + f.a. + şi + et al. + circa + c. + interviu + scrisoare + anonim + anon + şi alţii + sub tipar + online + citat + internet + prezentat la + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologie + astronomie + biologie + botanică + chimie + inginerie + general (de bază) + geografie + geologie + istorie + umanioare + linguistics + literatură + matematică + medicină + filosofie + fizică + psihologie + sociologie + ştiinţă + ştiinţe politice + ştiinţe sociale + teologie + zoologie + + + + cartea + cărţile + + + capitolul + capitolele + + + coloana + coloanele + + + figura + figurile + + + folio + folio + + + numărul + numerele + + + linia + liniile + + + nota + notele + + + opusul + opusurile + + + pagina + paginile + + + paragraful + paragrafele + + + partea + părţile + + + secţiunea + secţiunile + + + volumul + volumele + + + ediţia + ediţiile + + + versetul + versetele + + + sub verbo + s.vv + + + + cart + cap + col + fig + fol + nr + op + + p + pp + + par + part + sec + + s.v + s.vv + + + v + vv + + + vol + vol + + ed + + + + + ¶¶ + + + § + §§ + + + + + autor + autori + + + editor + editori + + + editor + editors + + + traducător + traducători + + + editor & translator + editors & translators + + + + + aut + aut + + + ed + ed + + + ed. + eds. + + + trad + trad + + + ed. & tran. + eds. & trans. + + + + ediţie de + edited by + traducere de + edited & translated by + în + interviu de + + + ed + ed. + trad + ed. & trans. by + + + ianuarie + februarie + martie + aprilie + mai + iunie + iulie + august + septembrie + octombrie + noiembrie + decembrie + + + ian + feb + mar + apr + mai + iun + iul + aug + sep + oct + nov + dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-ru-RU.xml b/chrome/content/zotero/locale/csl/locales-ru-RU.xml index 816cf2545f..752ba7657d 100644 --- a/chrome/content/zotero/locale/csl/locales-ru-RU.xml +++ b/chrome/content/zotero/locale/csl/locales-ru-RU.xml @@ -1,211 +1,299 @@ - - - - на - в - так же - вызвано - извлечено - от - грядущие - ссылки - - источник - источники - - нет даты - и - и др. - интервью - письмо - анонимно - анон - и другие - в печати - онлайн - цитированно - Интернет - представлено на - антропология - астрономия - биология - ботаника - химия - инженерное дело - общая основа - география - геология - история - гуманитарные науки - литература - математика - медицина - философия - физика - психология - социология - естественные науки - политология - общественные науки - теология - зоология - - книга - книги - - - глава - главы - - - колонка - колонки - - - рисунок - рисунки - - - лист - листы - - - номер - номера - - - линия - линии - - - запись - записи - - - опус - опусы - - - страница - страницы - - - параграф - параграфы - - - часть - части - - - раздел - разделы - - - том - тома - - - издание - издания - - - стих - стихи - - - под рубрикой - под рубриками - - кн - гл - кол - рис - л - ном - оп - - p - pp - - пар - ч - разд - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - изд - - - ¶¶ - - - § - §§ - - - - - - - редактор - редакторы - - - переводчик - переводчики - - - - - - - ред-р - ред-ры - - - перев-к - перев-и - - отредактировано - переведено - - интервью взято - ред - перев - Январь - Февраль - Март - Апрель - Май - Июнь - Июль - Август - Сентябрь - Октябрь - Ноябрь - Декабрь - Янв - Фев - Мар - Апр - Май - Июн - Июл - Авг - Сен - Окт - Ноя - Дек - - + + + + + + + + + + + + + + + at + в + так же + вызвано + извлечено + от + грядущие + + reference + references + + + ref. + refs. + + нет даты + и + и др. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + линия + линии + + + note + notes + + + opus + opera + + + страницы + страницы + + + параграф + параграфы + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + ном + op + + стр-а + стр-ы + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + редактор + редакторы + + + editor + editors + + + переводчик + переводчики + + + editor & translator + editors & translators + + + + + + + + + ред-р + ред-ры + + + ed. + eds. + + + перев-к + перев-и + + + ed. & tran. + eds. & trans. + + + + отредактировано + edited by + переведено + edited & translated by + to + interview by + + + ред + ed. + перев + ed. & trans. by + + + Январь + Февраль + Март + Апрель + Май + Июнь + Июль + Август + Сентябрь + Октябрь + Ноябрь + Декабрь + + + Янв + Фев + Мар + Апр + Май + Июн + Июл + Авг + Сен + Окт + Ноя + Дек + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-sk-SK.xml b/chrome/content/zotero/locale/csl/locales-sk-SK.xml index 4bfc5fa701..c15bdcb7e0 100644 --- a/chrome/content/zotero/locale/csl/locales-sk-SK.xml +++ b/chrome/content/zotero/locale/csl/locales-sk-SK.xml @@ -1,211 +1,299 @@ - - - - v - v - ibid - cit - cit - z - nadchádzajúci - referencie - - source - sources - - n.d. - a - et al - osobná komunikácia - list - anonym - anon - and ďalší - v tlači - online - cit - internet - prezentované na - antropológia - astronómia - biológia - botanika - chémia - strojárstvo/technika - všeobecný základ - geografia - geológia - história - humanitné vedy - literatúra - matematika - medicína - filozofia - fyzika - psychológia - sociológia - veda - politické vedy - sociálne vedy - teológia - zoológia - - kniha - knihy - - - kapitola - kapitoly - - - stĺpec - stĺpce - - - obrázok - obrázky - - - list - listy - - - číslo - čísla - - - riadok - riadky - - - poznámka - poznámky - - - opus - opera - - - strana - strany - - - odstavec - odstavce - - - časť - časti - - - sekcia - sekcie - - - ročník - ročníky - - - vydanie - vydania - - - verš - verše - - - sub verbo - s.vv - - k - kap - stĺp - obr - l - č - op - - s - s - - par - č - sek - - s.v - s.vv - - - v - v - - - roč - roč - - edition - vyd - - - - - - § - § - - - autor - autori - - - editor - editori - - - prekladateľ - prekladatelia - - - aut - aut - - - ed - ed - - - prek - prek - - editoval - preložil - adresát - rozhovor urobil - ed - prel - január - február - marec - apríl - máj - jún - júl - august - september - október - november - december - jan - feb - mar - apr - máj - jún - júl - aug - sep - okt - nov - dec - - + + + + + + + + + + + + + + + v + v + ibid + cit + cit + z + nadchádzajúci + + reference + references + + + ref. + refs. + + n.d. + a + et al + circa + c. + osobná komunikácia + list + anonym + anon + and ďalší + v tlači + online + cit + internet + prezentované na + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropológia + astronómia + biológia + botanika + chémia + strojárstvo/technika + všeobecný základ + geografia + geológia + história + humanitné vedy + linguistics + literatúra + matematika + medicína + filozofia + fyzika + psychológia + sociológia + veda + politické vedy + sociálne vedy + teológia + zoológia + + + + kniha + knihy + + + kapitola + kapitoly + + + stĺpec + stĺpce + + + obrázok + obrázky + + + list + listy + + + číslo + čísla + + + riadok + riadky + + + poznámka + poznámky + + + opus + opera + + + strana + strany + + + odstavec + odstavce + + + časť + časti + + + sekcia + sekcie + + + ročník + ročníky + + + vydanie + vydania + + + verš + verše + + + sub verbo + s.vv + + + + k + kap + stĺp + obr + l + č + op + + s + s + + par + č + sek + + s.v + s.vv + + + v + v + + + roč + roč + + vyd + + + + + + + + § + § + + + + + + + + + editor + editori + + + editor + editors + + + prekladateľ + prekladatelia + + + editor & translator + editors & translators + + + + + + + + + ed + ed + + + ed. + eds. + + + prek + prek + + + ed. & tran. + eds. & trans. + + + + editoval + edited by + preložil + edited & translated by + adresát + rozhovor urobil + + + ed + ed. + prel + ed. & trans. by + + + január + február + marec + apríl + máj + jún + júl + august + september + október + november + december + + + jan + feb + mar + apr + máj + jún + júl + aug + sep + okt + nov + dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-sl-SI.xml b/chrome/content/zotero/locale/csl/locales-sl-SI.xml index 76420d4d44..f9fb8314c4 100644 --- a/chrome/content/zotero/locale/csl/locales-sl-SI.xml +++ b/chrome/content/zotero/locale/csl/locales-sl-SI.xml @@ -1,211 +1,299 @@ - - - - pri - v - isto - dostopano - pridobljeno - od - pred izidom - sklici - - vir - viri - - b.d. - in - idr. - intervju - pismo - anonimni - anon - in drugi - v tisku - na spletu - citirano - internet - predstavljeno na - antropologija - astronomija - biologija - botanika - kemija - strojništvo - splošno - geografija - geologija - zgodovina - humanistika - literatura - matematika - medicina - filozofija - fizika - psihologija - sociologija - znanost - politologija - družbene vede - teologija - zoologija - - knjiga - knjige - - - poglavje - poglavja - - - stolpec - stolpci - - - slika - slike - - - folio - folii - - - številka - številke - - - vrstica - vrstice - - - opomba - opombe - - - opus - opera - - - stran - strani - - - odstavek - odstavki - - - del - deli - - - odsek - odseki - - - letnik - letniki - - - izdaja - izdaje - - - verz - verzi - - - sub verbo - s.vv - - knj - pogl - sto - sl - f - št - op - - str - str - - odst - del - odsk - - s.v - s.vv - - - v - v - - - let - let - - edition - iz - - - ¶¶ - - - § - §§ - - - - - - - urednik - uredniki - - - prevajalec - prevajalci - - - - - - - ur - ur - - - prev - prev - - uredil - prevedel - za - intervjuval - ur - prev - januar - februar - marec - april - maj - junij - julij - avgust - september - oktober - november - december - jan - feb - mar - apr - maj - jun - jul - avg - sep - okt - nov - dec - - + + + + + + + + + + + + + + + pri + v + isto + dostopano + pridobljeno + od + pred izidom + + reference + references + + + ref. + refs. + + b.d. + in + idr. + circa + c. + intervju + pismo + anonimni + anon + in drugi + v tisku + na spletu + citirano + internet + predstavljeno na + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologija + astronomija + biologija + botanika + kemija + strojništvo + splošno + geografija + geologija + zgodovina + humanistika + linguistics + literatura + matematika + medicina + filozofija + fizika + psihologija + sociologija + znanost + politologija + družbene vede + teologija + zoologija + + + + knjiga + knjige + + + poglavje + poglavja + + + stolpec + stolpci + + + slika + slike + + + folio + folii + + + številka + številke + + + vrstica + vrstice + + + opomba + opombe + + + opus + opera + + + stran + strani + + + odstavek + odstavki + + + del + deli + + + odsek + odseki + + + letnik + letniki + + + izdaja + izdaje + + + verz + verzi + + + sub verbo + s.vv + + + + knj + pogl + sto + sl + f + št + op + + str + str + + odst + del + odsk + + s.v + s.vv + + + v + v + + + let + let + + iz + + + + + ¶¶ + + + § + §§ + + + + + + + + + urednik + uredniki + + + editor + editors + + + prevajalec + prevajalci + + + editor & translator + editors & translators + + + + + + + + + ur + ur + + + ed. + eds. + + + prev + prev + + + ed. & tran. + eds. & trans. + + + + uredil + edited by + prevedel + edited & translated by + za + intervjuval + + + ur + ed. + prev + ed. & trans. by + + + januar + februar + marec + april + maj + junij + julij + avgust + september + oktober + november + december + + + jan + feb + mar + apr + maj + jun + jul + avg + sep + okt + nov + dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-sr-RS.xml b/chrome/content/zotero/locale/csl/locales-sr-RS.xml index dfd2595d73..e0fd0ce49b 100644 --- a/chrome/content/zotero/locale/csl/locales-sr-RS.xml +++ b/chrome/content/zotero/locale/csl/locales-sr-RS.xml @@ -1,211 +1,299 @@ - - - - на - у - ibid - приступљено - преузето - од - долазећи - референце - - source - sources - - без датума - и - и остали - интервју - писмо - анонимна - анон. - и остали - у штампи - на Интернету - цитирано - Интернет - представљено на - антропологија - астрономија - биологија - ботаника - хемија - инжињерство - уопштена основа - географија - геологија - историја - култура и уметност - литература - математика - медицина - филозофија - физика - психологија - социологија - наука - политичка наука - друштвена наука - теологија - зоологија - - књига - књиге - - - поглавље - поглавља - - - колона - колоне - - - цртеж - цртежи - - - фолио - фолији - - - број - бројеви - - - линија - линије - - - белешка - белешке - - - опус - опера - - - страница - странице - - - параграф - параграфи - - - део - делова - - - одељак - одељака - - - том - томова - - - издање - издања - - - строфа - строфе - - - sub verbo - s.vv - - књига - Пог. - кол. - црт. - фолио - изд. - оп. - - стр. - стр. - - пар. - део - од. - - s.v - s.vv - - - стр. - стр. - - - том - томови - - edition - изд. - - - ¶¶ - - - § - §§ - - - - - - - уредник - урединици - - - преводилац - преводиоци - - - - - - - ур. - ур. - - - прев. - прев. - - уредио - превео - прима - интервјуисао - ур. - прев. - Јануар - Фебруар - Март - Април - Мај - Јуни - Јули - Август - Септембар - Октобар - Новембар - Децембар - Јан. - Феб. - Март - Апр. - Мај - Јуни - Јули - Авг. - Сеп. - Окт. - Нов. - Дец. - - + + + + + + + + + + + + + + + на + у + ibid + приступљено + преузето + од + долазећи + + reference + references + + + ref. + refs. + + без датума + и + и остали + circa + c. + интервју + писмо + анонимна + анон. + и остали + у штампи + на Интернету + цитирано + Интернет + представљено на + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + антропологија + астрономија + биологија + ботаника + хемија + инжињерство + уопштена основа + географија + геологија + историја + култура и уметност + linguistics + литература + математика + медицина + филозофија + физика + психологија + социологија + наука + политичка наука + друштвена наука + теологија + зоологија + + + + књига + књиге + + + поглавље + поглавља + + + колона + колоне + + + цртеж + цртежи + + + фолио + фолији + + + број + бројеви + + + линија + линије + + + белешка + белешке + + + опус + опера + + + страница + странице + + + параграф + параграфи + + + део + делова + + + одељак + одељака + + + том + томова + + + издање + издања + + + строфа + строфе + + + sub verbo + s.vv + + + + књига + Пог. + кол. + црт. + фолио + изд. + оп. + + стр. + стр. + + пар. + део + од. + + s.v + s.vv + + + стр. + стр. + + + том + томови + + изд. + + + + + ¶¶ + + + § + §§ + + + + + + + + + уредник + урединици + + + editor + editors + + + преводилац + преводиоци + + + editor & translator + editors & translators + + + + + + + + + ур. + ур. + + + ed. + eds. + + + прев. + прев. + + + ed. & tran. + eds. & trans. + + + + уредио + edited by + превео + edited & translated by + прима + интервјуисао + + + ур. + ed. + прев. + ed. & trans. by + + + Јануар + Фебруар + Март + Април + Мај + Јуни + Јули + Август + Септембар + Октобар + Новембар + Децембар + + + Јан. + Феб. + Март + Апр. + Мај + Јуни + Јули + Авг. + Сеп. + Окт. + Нов. + Дец. + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-sv-SE.xml b/chrome/content/zotero/locale/csl/locales-sv-SE.xml index b8c78f9a2d..7256163491 100644 --- a/chrome/content/zotero/locale/csl/locales-sv-SE.xml +++ b/chrome/content/zotero/locale/csl/locales-sv-SE.xml @@ -1,211 +1,299 @@ - - - - vid - i - ibid - åtkomstdatum - hämtad - från - kommande - Referenser - - source - sources - - nd - och - m.fl. - intervju - brev - anonym - anon - och andra - i tryck - online - citerad - internet - presenterad vid - antropologi - astronomi - biologi - botanik - kemi - teknik - generic base - geografi - geologi - historia - humaniora - litteraturvetenskap - matematik - medicin - filosofi - fysik - psykologi - sociologi - vetenskap - statsvetenskap - samhällsvetenskap - teologi - zoologi - - bok - böcker - - - kapitel - kapitel - - - kolumn - kolumner - - - figur - figurer - - - folio - folios - - - nummer - nummer - - - rad - rader - - - not - noter - - - opus - opera - - - sida - sidor - - - stycke - stycken - - - dek - delar - - - avnitt - avsnitt - - - volym - volumer - - - upplaga - upplagor - - - vers - verser - - - sub verbo - s.vv - - bok - kap - kol - fig - f - num - op - - s - ss - - st - del - avs - - s.v - s.vv - - - vers - verser - - - vol - vols - - edition - uppl - - - ¶¶ - - - § - §§ - - - - - - - redaktör - redaktörer - - - översättare - översättare - - - - - - - red - reds - - - övers - övers - - redigerad av - översatt av - till - intervju av - red - övers - Januari - Februari - Mars - April - Maj - Juni - Juli - Augusti - September - Oktober - November - December - Jan - Feb - Mar - Apr - Maj - Jun - Jul - Aug - Sep - Okt - Nov - Dec - - + + + + + + + + + + + + + + + vid + i + ibid + åtkomstdatum + hämtad + från + kommande + + reference + references + + + ref. + refs. + + nd + och + m.fl. + circa + c. + intervju + brev + anonym + anon + och andra + i tryck + online + citerad + internet + presenterad vid + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropologi + astronomi + biologi + botanik + kemi + teknik + generic base + geografi + geologi + historia + humaniora + linguistics + litteraturvetenskap + matematik + medicin + filosofi + fysik + psykologi + sociologi + vetenskap + statsvetenskap + samhällsvetenskap + teologi + zoologi + + + + bok + böcker + + + kapitel + kapitel + + + kolumn + kolumner + + + figur + figurer + + + folio + folios + + + nummer + nummer + + + rad + rader + + + not + noter + + + opus + opera + + + sida + sidor + + + stycke + stycken + + + dek + delar + + + avnitt + avsnitt + + + volym + volumer + + + upplaga + upplagor + + + vers + verser + + + sub verbo + s.vv + + + + bok + kap + kol + fig + f + num + op + + s + ss + + st + del + avs + + s.v + s.vv + + + vers + verser + + + vol + vols + + uppl + + + + + ¶¶ + + + § + §§ + + + + + + + + + redaktör + redaktörer + + + editor + editors + + + översättare + översättare + + + editor & translator + editors & translators + + + + + + + + + red + reds + + + ed. + eds. + + + övers + övers + + + ed. & tran. + eds. & trans. + + + + redigerad av + edited by + översatt av + edited & translated by + till + intervju av + + + red + ed. + övers + ed. & trans. by + + + Januari + Februari + Mars + April + Maj + Juni + Juli + Augusti + September + Oktober + November + December + + + Jan + Feb + Mar + Apr + Maj + Jun + Jul + Aug + Sep + Okt + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-th-TH.xml b/chrome/content/zotero/locale/csl/locales-th-TH.xml index c6d74b3227..8858f3ff42 100644 --- a/chrome/content/zotero/locale/csl/locales-th-TH.xml +++ b/chrome/content/zotero/locale/csl/locales-th-TH.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - references - - source - sources - - n.d. - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + n.d. + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-tr-TR.xml b/chrome/content/zotero/locale/csl/locales-tr-TR.xml index 1be3e7f8b1..d9d9a1a54e 100644 --- a/chrome/content/zotero/locale/csl/locales-tr-TR.xml +++ b/chrome/content/zotero/locale/csl/locales-tr-TR.xml @@ -1,211 +1,299 @@ - - - - de - içinde - ibid - erişildi - erişildi - den - gelecek - referans - - source - sources - - tarih yok - ve - ve diğ. - interview - letter - isimsiz - isimsiz - ve diğ. - basımda - çevrimiçi - kaynak - internet - sunulan - antropoloji - astronomi - biyoloji - botanik - kimya - mühendislik - generic-base - coğrafya - jeoloji - tarih - humanities - edebiyat - matematik - tıp - felsefe - fizik - pisikoloji - sosyoloji - bilim - siyaset bilimi - sosyal bilimler - din bilimi - hayvanbilimi - - kitap - kitaplar - - - bölüm - bölümler - - - sütun - sütunlar - - - şekil - şekiller - - - folyo - folyo - - - sayı - sayılar - - - satır - satırlar - - - not - notlar - - - opus - opera - - - sayfa - sayfalar - - - paragraf - paragraflar - - - kısım - kısımlar - - - bölüm - bölümler - - - cilt - ciltler - - - edition - editions - - - dize - dizeler - - - sub verbo - s.vv - - kit - böl - süt - şek - f - sayı - op - - s - ss - - para - kıs - böl - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editör - editörler - - - çevirmen - çevirmenler - - - - - - - ed - ed - - - çev - çev - - editör - çeviren - to - Röportaj yapan - ed - çev - Ocak - Şubat - Mart - Nisan - Mayıs - Haziran - Temmuz - Ağustos - Eylül - Ekim - Kasım - Aralık - Oca - Şub - Mar - Nis - May - Haz - Tem - Ağu - Eyl - Eki - Kas - Ara - - + + + + + + + + + + + + + + + de + içinde + ibid + erişildi + erişildi + den + gelecek + + reference + references + + + ref. + refs. + + tarih yok + ve + ve diğ. + circa + c. + interview + letter + isimsiz + isimsiz + ve diğ. + basımda + çevrimiçi + kaynak + internet + sunulan + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + antropoloji + astronomi + biyoloji + botanik + kimya + mühendislik + generic-base + coğrafya + jeoloji + tarih + humanities + linguistics + edebiyat + matematik + tıp + felsefe + fizik + pisikoloji + sosyoloji + bilim + siyaset bilimi + sosyal bilimler + din bilimi + hayvanbilimi + + + + kitap + kitaplar + + + bölüm + bölümler + + + sütun + sütunlar + + + şekil + şekiller + + + folyo + folyo + + + sayı + sayılar + + + satır + satırlar + + + not + notlar + + + opus + opera + + + sayfa + sayfalar + + + paragraf + paragraflar + + + kısım + kısımlar + + + bölüm + bölümler + + + cilt + ciltler + + + edition + editions + + + dize + dizeler + + + sub verbo + s.vv + + + + kit + böl + süt + şek + f + sayı + op + + s + ss + + para + kıs + böl + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editör + editörler + + + editor + editors + + + çevirmen + çevirmenler + + + editor & translator + editors & translators + + + + + + + + + ed + ed + + + ed. + eds. + + + çev + çev + + + ed. & tran. + eds. & trans. + + + + editör + edited by + çeviren + edited & translated by + to + Röportaj yapan + + + ed + ed. + çev + ed. & trans. by + + + Ocak + Şubat + Mart + Nisan + Mayıs + Haziran + Temmuz + Ağustos + Eylül + Ekim + Kasım + Aralık + + + Oca + Şub + Mar + Nis + May + Haz + Tem + Ağu + Eyl + Eki + Kas + Ara + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-uk-UA.xml b/chrome/content/zotero/locale/csl/locales-uk-UA.xml index d8aedca4ee..7dd29b6625 100644 --- a/chrome/content/zotero/locale/csl/locales-uk-UA.xml +++ b/chrome/content/zotero/locale/csl/locales-uk-UA.xml @@ -1,211 +1,299 @@ - - - - на - в - ibid - accessed - retrieved - із - forthcoming - посилання - - source - sources - - n.d. - і - et al. - інтервю - лист - анонімний - анон. - та інші - у пресі - online - cited - інтернет - presented at the - антропологія - астрономія - біологія - ботаніка - хімія - інженерія - generic base - географія - геологія - історія - гуманітарні - література - математика - медицина - філософія - фізика - психологія - соціологія - наука - політичні науки - соціальні науки - теологія - зоологія - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - lines - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - Січень - Лютий - Березень - Квітень - Травень - Червень - Липень - Серпень - Вересень - Жовтень - Листопад - Грудень - Січ - Лют - Бер - Квіт - Трав - Чер - Лип - Сер - Вер - Жов - Лис - Груд - - + + + + + + + + + + + + + + + на + в + ibid + accessed + retrieved + із + forthcoming + + reference + references + + + ref. + refs. + + n.d. + і + et al. + circa + c. + інтервю + лист + анонімний + анон. + та інші + у пресі + online + cited + інтернет + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + антропологія + астрономія + біологія + ботаніка + хімія + інженерія + generic base + географія + геологія + історія + гуманітарні + linguistics + література + математика + медицина + філософія + фізика + психологія + соціологія + наука + політичні науки + соціальні науки + теологія + зоологія + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + Січень + Лютий + Березень + Квітень + Травень + Червень + Липень + Серпень + Вересень + Жовтень + Листопад + Грудень + + + Січ + Лют + Бер + Квіт + Трав + Чер + Лип + Сер + Вер + Жов + Лис + Груд + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-vi-VN.xml b/chrome/content/zotero/locale/csl/locales-vi-VN.xml index aa86d6e2da..2d8f83098b 100644 --- a/chrome/content/zotero/locale/csl/locales-vi-VN.xml +++ b/chrome/content/zotero/locale/csl/locales-vi-VN.xml @@ -1,211 +1,299 @@ - - - - at - trong - n.t. - truy cập - truy vấn - từ - sắp tới - tham khảo - - source - sources - - không ngày - - và c.s. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - dòng - dòng - - - note - notes - - - opus - opera - - - trang - trang - - - đoạn văn - đoạn văn - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - số p.h - op - - tr - tr - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - biên tập viên - biên tập viên - - - biên dịch viên - biên dịch viên - - - - - - - b.t.v - b.t.v - - - b.d.v - b.d.v - - biên tập bởi - biên dịch bởi - to - interview by - b.t - b.d - Tháng Giêng - Tháng Hai - Tháng Ba - Tháng Tư - Tháng Năm - Tháng Sáu - Tháng Bảy - Tháng Tám - Tháng Chín - Tháng Mười - Tháng Mười-Một - Tháng Chạp - tháng 1 - tháng 2 - tháng 3 - tháng 4 - tháng 5 - tháng 6 - tháng 7 - tháng 8 - tháng 9 - tháng 10 - tháng 11 - tháng 12 - - + + + + + + + + + + + + + + + at + trong + n.t. + truy cập + truy vấn + từ + sắp tới + + reference + references + + + ref. + refs. + + không ngày + + và c.s. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + dòng + dòng + + + note + notes + + + opus + opera + + + trang + trang + + + đoạn văn + đoạn văn + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + số p.h + op + + tr + tr + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + biên tập viên + biên tập viên + + + editor + editors + + + biên dịch viên + biên dịch viên + + + editor & translator + editors & translators + + + + + + + + + b.t.v + b.t.v + + + ed. + eds. + + + b.d.v + b.d.v + + + ed. & tran. + eds. & trans. + + + + biên tập bởi + edited by + biên dịch bởi + edited & translated by + to + interview by + + + b.t + ed. + b.d + ed. & trans. by + + + Tháng Giêng + Tháng Hai + Tháng Ba + Tháng Tư + Tháng Năm + Tháng Sáu + Tháng Bảy + Tháng Tám + Tháng Chín + Tháng Mười + Tháng Mười-Một + Tháng Chạp + + + tháng 1 + tháng 2 + tháng 3 + tháng 4 + tháng 5 + tháng 6 + tháng 7 + tháng 8 + tháng 9 + tháng 10 + tháng 11 + tháng 12 + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-zh-CN.xml b/chrome/content/zotero/locale/csl/locales-zh-CN.xml index 512e6bc133..5bbefa43c2 100644 --- a/chrome/content/zotero/locale/csl/locales-zh-CN.xml +++ b/chrome/content/zotero/locale/csl/locales-zh-CN.xml @@ -1,211 +1,299 @@ - - - - at - in - ibid - accessed - retrieved - from - forthcoming - References - - source - sources - - nd - and - et al. - interview - letter - anonymous - anon - and others - in press - online - cited - internet - presented at the - anthropology - astronomy - biology - botany - chemistry - engineering - generic base - geography - geology - history - humanities - literature - math - medicine - philosophy - physics - psychology - sociology - science - political science - social science - theology - zoology - - book - books - - - chapter - chapters - - - column - columns - - - figure - figures - - - folio - folios - - - number - numbers - - - line - line - - - note - notes - - - opus - opera - - - page - pages - - - paragraph - paragraph - - - part - parts - - - section - sections - - - volume - volumes - - - edition - editions - - - verse - verses - - - sub verbo - s.vv - - bk - chap - col - fig - f - no - op - - p - pp - - para - pt - sec - - s.v - s.vv - - - v - vv - - - vol - vols - - edition - ed - - - ¶¶ - - - § - §§ - - - - - - - editor - editors - - - translator - translators - - - - - - - ed - eds - - - tran - trans - - edited by - translated by - to - interview by - ed - trans - January - February - March - April - May - June - July - August - September - October - November - December - Jan - Feb - Mar - Apr - May - Jun - Jul - Aug - Sep - Oct - Nov - Dec - - + + + + + + + + + + + + + + + at + in + ibid + accessed + retrieved + from + forthcoming + + reference + references + + + ref. + refs. + + nd + and + et al. + circa + c. + interview + letter + anonymous + anon + and others + in press + online + cited + internet + presented at the + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + anthropology + astronomy + biology + botany + chemistry + engineering + generic base + geography + geology + history + humanities + linguistics + literature + math + medicine + philosophy + physics + psychology + sociology + science + political science + social science + theology + zoology + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + line + + + note + notes + + + opus + opera + + + page + pages + + + paragraph + paragraph + + + part + parts + + + section + sections + + + volume + volumes + + + edition + editions + + + verse + verses + + + sub verbo + s.vv + + + + bk + chap + col + fig + f + no + op + + p + pp + + para + pt + sec + + s.v + s.vv + + + v + vv + + + vol + vols + + ed + + + + + ¶¶ + + + § + §§ + + + + + + + + + editor + editors + + + editor + editors + + + translator + translators + + + editor & translator + editors & translators + + + + + + + + + ed + eds + + + ed. + eds. + + + tran + trans + + + ed. & tran. + eds. & trans. + + + + edited by + edited by + translated by + edited & translated by + to + interview by + + + ed + ed. + trans + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/locale/csl/locales-zh-TW.xml b/chrome/content/zotero/locale/csl/locales-zh-TW.xml index 3c18d95d21..7dbdc1020a 100644 --- a/chrome/content/zotero/locale/csl/locales-zh-TW.xml +++ b/chrome/content/zotero/locale/csl/locales-zh-TW.xml @@ -1,211 +1,299 @@ - - - - - - 同上出處 - 被取用 - 被取回 - - 將來的 - 參考資料 - - 來源 - 來源 - - 無日期 - - 等人 - 訪問 - 信件 - 不具名的 - 無名 - 及其他 - 印行中 - 在線上 - 被引用 - 網際網路 - 簡報於 - 人類學 - 天文學 - 生物學 - 植物學 - 化學 - 工程學 - 一般基礎 - 地理學 - 地質學 - 歷史學 - 人文學科 - 文學 - 數學 - 醫學 - 哲學 - 物理學 - 心理學 - 社會學 - 自然科學 - 政治科學 - 社會科學 - 神學 - 動物學 - - - - - - - - - - - - - - - - - - 對開紙 - 對開紙 - - - 期數 - 期數 - - - - - - - 筆記 - 筆記 - - - 作品 - 作品 - - - - - - - 段落 - 段落 - - - - - - - - - - - - - - - 版本 - 版本 - - - 詩句 - 詩句 - - - 詞下 - 詞下 - - - - - - - - - - - - - - - - - 詞下 - 詞下 - - - - - - - - - - edition - - - - ¶¶ - - - § - §§ - - - 作者 - 作者 - - - 編輯 - 編輯 - - - 翻譯 - 翻譯 - - - - - - - - - - - - - - 編者是 - 譯者是 - 授與 - 訪問者是 - - - 一月 - 二月 - 三月 - 四月 - 五月 - 六月 - 七月 - 八月 - 九月 - 十月 - 十一月 - 十二月 - 1月 - 2月 - 3月 - 4月 - 5月 - 6月 - 7月 - 8月 - 9月 - 10月 - 11月 - 12月 - - + + + + + + + + + + + + + + + + + 同上出處 + 被取用 + 被取回 + + 將來的 + + reference + references + + + ref. + refs. + + 無日期 + + 等人 + circa + c. + 訪問 + 信件 + 不具名的 + 無名 + 及其他 + 印行中 + 在線上 + 被引用 + 網際網路 + 簡報於 + AD + BC + + + + + + + + + st + nd + rd + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + 人類學 + 天文學 + 生物學 + 植物學 + 化學 + 工程學 + 一般基礎 + 地理學 + 地質學 + 歷史學 + 人文學科 + linguistics + 文學 + 數學 + 醫學 + 哲學 + 物理學 + 心理學 + 社會學 + 自然科學 + 政治科學 + 社會科學 + 神學 + 動物學 + + + + + + + + + + + + + + + + + + + + 對開紙 + 對開紙 + + + 期數 + 期數 + + + + + + + 筆記 + 筆記 + + + 作品 + 作品 + + + + + + + 段落 + 段落 + + + + + + + + + + + + + + + 版本 + 版本 + + + 詩句 + 詩句 + + + sub verbo + s.vv + + + + + + + + + + + + + + + + + + + s.v + s.vv + + + + + + + + + + + + + + + ¶¶ + + + § + §§ + + + + + 作者 + 作者 + + + 編輯 + 編輯 + + + editor + editors + + + 翻譯 + 翻譯 + + + editor & translator + editors & translators + + + + + + + + + + + + + ed. + eds. + + + + + + + ed. & tran. + eds. & trans. + + + + 編者是 + edited by + 譯者是 + edited & translated by + 授與 + 訪問者是 + + + + ed. + + ed. & trans. by + + + 一月 + 二月 + 三月 + 四月 + 五月 + 六月 + 七月 + 八月 + 九月 + 十月 + 十一月 + 十二月 + + + 1月 + 2月 + 3月 + 4月 + 5月 + 6月 + 7月 + 8月 + 9月 + 10月 + 11月 + 12月 + + + Spring + Summer + Autumn + Winter + + \ No newline at end of file diff --git a/chrome/content/zotero/rtfScan.js b/chrome/content/zotero/rtfScan.js index e7c498ba71..0da1d4c5fb 100644 --- a/chrome/content/zotero/rtfScan.js +++ b/chrome/content/zotero/rtfScan.js @@ -495,58 +495,47 @@ var Zotero_RTFScan = new function() { function _formatRTF() { // load style and create ItemSet with all items - var style = Zotero.Styles.get(document.getElementById("style-listbox").selectedItem.value).csl; + var zStyle = Zotero.Styles.get(document.getElementById("style-listbox").selectedItem.value) + var style = zStyle.csl; + style.setOutputFormat("rtf"); var isNote = style.class == "note"; - var itemSet = style.createItemSet(); // create citations var k = 0; var cslCitations = []; + var itemIDs = {}; var shouldBeSubsequent = {}; for(var i=0; i)/g); + lst = str.split(//g); + myret = [lst[0]]; + for (pos = 1, len = lst.length; pos < len; pos += 1) { + myret.push(mx[pos - 1]); + myret.push(lst[pos]); + } + lst = myret.slice(); + len = lst.length - 1; + for (pos = len; pos > 1; pos += -2) { + m = lst[pos].match(/<\/span>/); + if (m) { + idx = lst[pos].indexOf("
"); + buf1 = lst[pos].slice(0, idx); + buf2 = lst[pos].slice(idx + 7); + lst[pos - 1] += buf1 + ""; + lst[pos] = buf2; + } else { + buf1 = lst.slice(0, pos - 1); + if (pos < (lst.length - 1)) { + buf2 = lst[pos - 1] + lst[pos]; + } else { + buf2 = lst[pos - 1] + lst[pos] + lst[pos + 1]; + } + lst = buf1.push(buf2).concat(lst.slice(pos + 2)); + } + } + return lst; + }, + TAG_USEALL: function (str) { + var ret, open, close, end; + ret = [""]; + open = str.indexOf("<"); + close = str.indexOf(">"); + while (open > -1 && close > -1) { + if (open > close) { + end = open + 1; + } else { + end = close + 1; + } + if (open < close && str.slice(open + 1, close).indexOf("<") === -1) { + ret[ret.length - 1] += str.slice(0, open); + ret.push(str.slice(open, close + 1)); + ret.push(""); + str = str.slice(end); + } else { + ret[ret.length - 1] += str.slice(0, close + 1); + str = str.slice(end); + } + open = str.indexOf("<"); + close = str.indexOf(">"); + } + ret[ret.length - 1] += str; + return ret; + }, + SKIP_WORDS: ["a", "the", "an"], + FORMAT_KEY_SEQUENCE: [ + "@strip-periods", + "@font-style", + "@font-variant", + "@font-weight", + "@text-decoration", + "@vertical-align", + "@quotes" + ], + SUFFIX_CHARS: "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", + ROMAN_NUMERALS: [ + [ "", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix" ], + [ "", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc" ], + [ "", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm" ], + [ "", "m", "mm", "mmm", "mmmm", "mmmmm"] + ], + CREATORS: [ + "author", + "editor", + "contributor", + "translator", + "recipient", + "interviewer", + "composer", + "original-author", + "container-author", + "collection-editor" + ], + LANG_BASES: { + af: "af_ZA", + ar: "ar_AR", + bg: "bg_BG", + ca: "ca_AD", + cs: "cs_CZ", + da: "da_DK", + de: "de_DE", + el: "el_GR", + en: "en_US", + es: "es_ES", + et: "et_EE", + fr: "fr_FR", + he: "he_IL", + hu: "hu_HU", + is: "is_IS", + it: "it_IT", + ja: "ja_JP", + ko: "ko_KR", + mn: "mn_MN", + nb: "nb_NO", + nl: "nl_NL", + pl: "pl_PL", + pt: "pt_PT", + ro: "ro_RO", + ru: "ru_RU", + sk: "sk_SK", + sl: "sl_SI", + sr: "sr_RS", + sv: "sv_SE", + th: "th_TH", + tr: "tr_TR", + uk: "uk_UA", + vi: "vi_VN", + zh: "zh_CN" + }, + locale: {}, + locale_opts: {}, + locale_dates: {} +}; +CSL.TERMINAL_PUNCTUATION_REGEXP = new RegExp("^([" + CSL.TERMINAL_PUNCTUATION.join("") + "])(.*)"); +var CSL_E4X = function () {}; +CSL_E4X.prototype.clean = function (xml) { + xml = xml.replace(/<\?[^?]+\?>/g, ""); + xml = xml.replace(/]+>/g, ""); + xml = xml.replace(/^\s+/g, ""); + xml = xml.replace(/\s+$/g, ""); + return xml; +}; +CSL_E4X.prototype.children = function (myxml) { + return myxml.children(); +}; +CSL_E4X.prototype.nodename = function (myxml) { + var ret = myxml.localName(); + return ret; +}; +CSL_E4X.prototype.attributes = function (myxml) { + var ret, attrs, attr, key, xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + ret = new Object(); + attrs = myxml.attributes(); + for each (attr in attrs) { + key = "@" + attr.localName(); + if (key.slice(0,5) == "@e4x_") { + continue; + } + ret[key] = attr.toString(); + } + return ret; +}; +CSL_E4X.prototype.content = function (myxml) { + return myxml.toString(); +}; +CSL_E4X.prototype.namespace = { + "xml":"http://www.w3.org/XML/1998/namespace" +} +CSL_E4X.prototype.numberofnodes = function (myxml) { + return myxml.length(); +}; +CSL_E4X.prototype.getAttributeName = function (attr) { + var ret = attr.localName(); + return ret; +} +CSL_E4X.prototype.getAttributeValue = function (myxml,name,namespace) { + var xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + if (namespace) { + var ns = new Namespace(this.namespace[namespace]); + var ret = myxml.@ns::[name].toString(); + } else { + if (name) { + var ret = myxml.attribute(name).toString(); + } else { + var ret = myxml.toString(); + } + } + return ret; +} +CSL_E4X.prototype.getNodeValue = function (myxml,name) { + var xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + if (name){ + return myxml[name].toString(); + } else { + return myxml.toString(); + } +} +CSL_E4X.prototype.setAttributeOnNodeIdentifiedByNameAttribute = function (myxml,nodename,attrname,attr,val) { + var xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + if (attr[0] != '@'){ + attr = '@'+attr; + } + myxml[nodename].(@name == attrname)[0][attr] = val; +} +CSL_E4X.prototype.deleteNodeByNameAttribute = function (myxml,val) { + delete myxml.*.(@name==val)[0]; +} +CSL_E4X.prototype.deleteAttribute = function (myxml,attr) { + delete myxml["@"+attr]; +} +CSL_E4X.prototype.setAttribute = function (myxml,attr,val) { + myxml['@'+attr] = val; +} +CSL_E4X.prototype.nodeCopy = function (myxml) { + return myxml.copy(); +} +CSL_E4X.prototype.getNodesByName = function (myxml,name,nameattrval) { + var xml, ret; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + ret = myxml.descendants(name); + if (nameattrval){ + ret = ret.(@name == nameattrval); + } + return ret; +} +CSL_E4X.prototype.nodeNameIs = function (myxml,name) { + var xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + if (myxml.localName().toString() == name){ + return true; + } + return false; +} +CSL_E4X.prototype.makeXml = function (myxml) { + var xml; + if ("xml" == typeof myxml){ + myxml = myxml.toXMLString(); + }; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + xml = new Namespace("http://www.w3.org/XML/1998/namespace"); + if (myxml){ + myxml = myxml.replace(/\s*<\?[^>]*\?>\s*\n*/g, ""); + myxml = new XML(myxml); + } else { + myxml = new XML(); + } + return myxml; +}; +CSL_E4X.prototype.insertChildNodeAfter = function (parent,node,pos,datexml) { + var myxml, xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + myxml = XML(datexml.toXMLString()); + parent.insertChildAfter(node,myxml); + delete parent.*[pos]; + return parent; +}; +CSL_E4X.prototype.addInstitutionNodes = function(myxml) { + var institution_long, institution_short, children, node, xml; + default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); + institution_long = ; + institution_short = ; + for each (node in myxml..names) { + if ("xml" == typeof node && node.elements("name").length() > 0) { + if (!node.institution.toString()) { + node.name += institution_long; + } + } + } +}; +CSL.Output = {}; +CSL.Output.Queue = function (state) { + this.levelname = ["top"]; + this.state = state; + this.queue = []; + this.empty = new CSL.Token("empty"); + var tokenstore = {}; + tokenstore.empty = this.empty; + this.formats = new CSL.Stack(tokenstore); + this.current = new CSL.Stack(this.queue); +}; +CSL.Output.Queue.prototype.getToken = function (name) { + var ret = this.formats.value()[name]; + return ret; +}; +CSL.Output.Queue.prototype.mergeTokenStrings = function (base, modifier) { + var base_token, modifier_token, ret, key; + base_token = this.formats.value()[base]; + modifier_token = this.formats.value()[modifier]; + ret = base_token; + if (modifier_token) { + if (!base_token) { + base_token = new CSL.Token(base, CSL.SINGLETON); + base_token.decorations = []; + } + ret = new CSL.Token(base, CSL.SINGLETON); + key = ""; + for (key in base_token.strings) { + if (base_token.strings.hasOwnProperty(key)) { + ret.strings[key] = base_token.strings[key]; + } + } + for (key in modifier_token.strings) { + if (modifier_token.strings.hasOwnProperty(key)) { + ret.strings[key] = modifier_token.strings[key]; + } + } + ret.decorations = base_token.decorations.concat(modifier_token.decorations); + } + return ret; +}; +CSL.Output.Queue.prototype.addToken = function (name, modifier, token) { + var newtok, attr; + newtok = new CSL.Token("output"); + if ("string" === typeof token) { + token = this.formats.value()[token]; + } + if (token && token.strings) { + for (attr in token.strings) { + if (token.strings.hasOwnProperty(attr)) { + newtok.strings[attr] = token.strings[attr]; + } + } + newtok.decorations = token.decorations; + } + if ("string" === typeof modifier) { + newtok.strings.delimiter = modifier; + } + this.formats.value()[name] = newtok; +}; +CSL.Output.Queue.prototype.pushFormats = function (tokenstore) { + if (!tokenstore) { + tokenstore = {}; + } + tokenstore.empty = this.empty; + this.formats.push(tokenstore); +}; +CSL.Output.Queue.prototype.popFormats = function (tokenstore) { + this.formats.pop(); +}; +CSL.Output.Queue.prototype.startTag = function (name, token) { + var tokenstore = {}; + tokenstore[name] = token; + this.pushFormats(tokenstore); + this.openLevel(name); +}; +CSL.Output.Queue.prototype.endTag = function () { + this.closeLevel(); + this.popFormats(); +}; +CSL.Output.Queue.prototype.openLevel = function (token, ephemeral) { + var blob, curr, x, has_ephemeral; + if (!this.formats.value()[token]) { + throw "CSL processor error: call to nonexistent format token \"" + token + "\""; + } + blob = new CSL.Blob(this.formats.value()[token], false, token); + if (this.state.tmp.count_offset_characters && blob.strings.prefix.length) { + this.state.tmp.offset_characters += blob.strings.prefix.length; + } + if (this.state.tmp.count_offset_characters && blob.strings.suffix.length) { + this.state.tmp.offset_characters += blob.strings.suffix.length; + } + curr = this.current.value(); + has_ephemeral = false; + for (x in this.state.tmp.names_cut.variable) { + if (this.state.tmp.names_cut.variable.hasOwnProperty(x)) { + has_ephemeral = x; + break; + } + } + if (ephemeral && (!has_ephemeral || ephemeral === has_ephemeral)) { + if (!this.state.tmp.names_cut.variable[ephemeral]) { + this.state.tmp.names_cut.variable[ephemeral] = []; + this.state.tmp.names_cut.used = ephemeral; + } + this.state.tmp.names_cut.variable[ephemeral].push([curr, curr.blobs.length]); + } + curr.push(blob); + this.current.push(blob); +}; +CSL.Output.Queue.prototype.closeLevel = function (name) { + if (name && name !== this.current.value().levelname) { + CSL.error("Level mismatch error: wanted " + name + " but found " + this.current.value().levelname); + } + this.current.pop(); +}; +CSL.Output.Queue.prototype.append = function (str, tokname) { + var token, blob, curr; + if ("undefined" === typeof str) { + return; + } + if ("number" === typeof str) { + str = "" + str; + } + if (this.state.tmp.element_trace && this.state.tmp.element_trace.value() === "suppress-me") { + return; + } + blob = false; + if (!tokname) { + token = this.formats.value().empty; + } else if (tokname === "literal") { + token = true; + } else if ("string" === typeof tokname) { + token = this.formats.value()[tokname]; + } else { + token = tokname; + } + if (!token) { + throw "CSL processor error: unknown format token name: " + tokname; + } + if ("string" === typeof str && str.length) { + this.last_char_rendered = str.slice(-1); + str = str.replace(/\s+'/g, " \'").replace(/^'/g, " \'"); + this.state.tmp.term_predecessor = true; + } + blob = new CSL.Blob(token, str); + if (this.state.tmp.count_offset_characters && blob.strings.prefix) { + this.state.tmp.offset_characters += blob.strings.prefix.length; + } + if (this.state.tmp.count_offset_characters && blob.strings.suffix) { + this.state.tmp.offset_characters += blob.strings.suffix.length; + } + curr = this.current.value(); + if ("string" === typeof blob.blobs) { + this.state.tmp.term_predecessor = true; + } + if (this.state.tmp.count_offset_characters) { + if ("string" === typeof str) { + this.state.tmp.offset_characters += blob.strings.prefix.length; + this.state.tmp.offset_characters += blob.strings.suffix.length; + this.state.tmp.offset_characters += blob.blobs.length; + } else if ("undefined" !== str.num) { + this.state.tmp.offset_characters += str.strings.prefix.length; + this.state.tmp.offset_characters += str.strings.suffix.length; + this.state.tmp.offset_characters += str.formatter.format(str.num).length; + } + } + this.state.parallel.AppendBlobPointer(curr); + if ("string" === typeof str) { + curr.push(blob); + if (blob.strings["text-case"]) { + blob.blobs = CSL.Output.Formatters[blob.strings["text-case"]](this.state, str); + } + this.state.fun.flipflopper.init(str, blob); + this.state.fun.flipflopper.processTags(); + } else { + curr.push(str); + } +}; +CSL.Output.Queue.prototype.string = function (state, myblobs, blob) { + var blobs, ret, blob_last_chars, blob_delimiter, i, params, blobjr, last_str, last_char, b, use_suffix, qres, addtoret, span_split, j, res, blobs_start, blobs_end, key, pos, len, ppos, llen, ttype, ltype, terminal, leading; + blobs = myblobs.slice(); + ret = []; + if (blobs.length === 0) { + return ret; + } + if (!blob) { + CSL.Output.Queue.normalizePrefixPunctuation(blobs, true); + } + blob_last_chars = []; + if (blob) { + blob_delimiter = blob.strings.delimiter; + } else { + blob_delimiter = ""; + } + len = blobs.length; + for (pos = 0; pos < len; pos += 1) { + blobjr = blobs[pos]; + if ("string" === typeof blobjr.blobs) { + last_str = ""; + if (blobjr.strings.suffix) { + last_str = blobjr.strings.suffix; + } else if (blobjr.blobs) { + last_str = blobjr.blobs; + } + last_char = last_str.slice(-1); + if ("number" === typeof blobjr.num) { + ret.push(blobjr); + blob_last_chars.push(last_char); + } else if (blobjr.blobs) { + b = blobjr.blobs; + if (!state.tmp.suppress_decorations) { + llen = blobjr.decorations.length; + for (ppos = 0; ppos < llen; ppos += 1) { + params = blobjr.decorations[ppos]; + b = state.fun.decorate[params[0]][params[1]](state, b); + } + } + use_suffix = blobjr.strings.suffix; + if (b[(b.length - 1)] === "." && use_suffix && use_suffix[0] === ".") { + use_suffix = use_suffix.slice(1); + } + qres = this.swapQuotePunctuation(b, use_suffix); + b = qres[0]; + use_suffix = qres[1]; + if (b && b.length) { + b = blobjr.strings.prefix + b + use_suffix; + ret.push(b); + blob_last_chars.push(last_char); + } + } + } else if (blobjr.blobs.length) { + res = state.output.string(state, blobjr.blobs, blobjr); + addtoret = res[0]; + if (ret.slice(-1)[0] && addtoret.slice(-1)[0]) { + ttype = typeof ret.slice(-1)[0]; + ltype = typeof addtoret.slice(-1)[0]; + if ("string" === ttype && "string" === ltype) { + terminal = ret.slice(-1)[0].slice(-1); + leading = addtoret.slice(-1)[0].slice(0, 1); + if (CSL.TERMINAL_PUNCTUATION.indexOf(terminal) > -1 && CSL.TERMINAL_PUNCTUATION.indexOf(leading) > -1) { + ret[(ret.length - 1)] = ret[(ret.length - 1)].slice(0, -1); + } + } + } + ret = ret.concat(addtoret); + blob_last_chars = blob_last_chars.concat(res[1]); + } else { + continue; + } + } + span_split = 0; + len = ret.length; + for (pos = 0; pos < len; pos += 1) { + if ("string" === typeof ret[pos]) { + span_split = (parseInt(pos, 10) + 1); + } + } + if (blob && (blob.decorations.length || blob.strings.suffix || blob.strings.prefix)) { + span_split = ret.length; + } + res = state.output.renderBlobs(ret.slice(0, span_split), blob_delimiter, blob_last_chars); + blobs_start = res[0]; + blob_last_chars = res[1].slice(); + if (blobs_start && blob && (blob.decorations.length || blob.strings.suffix || blob.strings.prefix)) { + if (!state.tmp.suppress_decorations) { + len = blob.decorations.length; + for (pos = 0; pos < len; pos += 1) { + params = blob.decorations[pos]; + if (["@bibliography", "@display"].indexOf(params[0]) > -1) { + continue; + } + blobs_start = state.fun.decorate[params[0]][params[1]](state, blobs_start); + } + } + b = blobs_start; + use_suffix = blob.strings.suffix; + if (b[(b.length - 1)] === "." && use_suffix && use_suffix[0] === ".") { + use_suffix = use_suffix.slice(1); + } + qres = this.swapQuotePunctuation(b, use_suffix); + b = qres[0]; + if (b && b.length) { + use_suffix = qres[1]; + b = blob.strings.prefix + b + use_suffix; + } + blobs_start = b; + if (!state.tmp.suppress_decorations) { + len = blob.decorations.length; + for (pos = 0; pos < len; pos += 1) { + params = blob.decorations[pos]; + if (["@bibliography", "@display"].indexOf(params[0]) === -1) { + continue; + } + blobs_start = state.fun.decorate[params[0]][params[1]](state, blobs_start); + } + } + } + blobs_end = ret.slice(span_split, ret.length); + if (!blobs_end.length && blobs_start) { + ret = [blobs_start]; + } else if (blobs_end.length && !blobs_start) { + ret = blobs_end; + } else if (blobs_start && blobs_end.length) { + ret = [blobs_start].concat(blobs_end); + } + if ("undefined" === typeof blob) { + this.queue = []; + this.current.mystack = []; + this.current.mystack.push(this.queue); + if (state.tmp.suppress_decorations) { + res = state.output.renderBlobs(ret); + ret = res[0]; + blob_last_chars = res[1].slice(); + } + } else if ("boolean" === typeof blob) { + res = state.output.renderBlobs(ret); + ret = res[0]; + blob_last_chars = res[1].slice(); + } + if (blob) { + return [ret, blob_last_chars.slice()]; + } else { + return ret; + } +}; +CSL.Output.Queue.prototype.clearlevel = function () { + var blob, pos, len; + blob = this.current.value(); + len = blob.blobs.length; + for (pos = 0; pos < len; pos += 1) { + blob.blobs.pop(); + } +}; +CSL.Output.Queue.prototype.renderBlobs = function (blobs, delim, blob_last_chars) { + var state, ret, ret_last_char, use_delim, i, blob, pos, len, ppos, llen, pppos, lllen, res, str, params; + if (!delim) { + delim = ""; + } + if (!blob_last_chars) { + blob_last_chars = []; + } + state = this.state; + ret = ""; + ret_last_char = []; + use_delim = ""; + len = blobs.length; + for (pos = 0; pos < len; pos += 1) { + if (blobs[pos].checkNext) { + blobs[pos].checkNext(blobs[(pos + 1)]); + } + } + len = blobs.length; + for (pos = 0; pos < len; pos += 1) { + blob = blobs[pos]; + if (ret) { + use_delim = delim; + } + if (blob && "string" === typeof blob) { + if (use_delim && blob_last_chars[(pos - 1)] === use_delim[0]) { + use_delim = use_delim.slice(1); + } + res = this.swapQuotePunctuation(ret, use_delim); + ret = res[0]; + use_delim = res[1]; + ret += use_delim; + ret += blob; + ret_last_char = blob_last_chars.slice(-1); + } else if (blob.status !== CSL.SUPPRESS) { + str = blob.formatter.format(blob.num); + if (blob.strings["text-case"]) { + str = CSL.Output.Formatters[blob.strings["text-case"]](this.state, str); + } + if (!state.tmp.suppress_decorations) { + llen = blob.decorations.length; + for (ppos = 0; ppos < llen; ppos += 1) { + params = blob.decorations[ppos]; + str = state.fun.decorate[params[0]][params[1]](state, str); + } + } + str = blob.strings.prefix + str + blob.strings.suffix; + if (blob.status === CSL.END) { + ret += blob.range_prefix; + } else if (blob.status === CSL.SUCCESSOR) { + ret += blob.successor_prefix; + } else if (blob.status === CSL.START) { + ret += ""; + } else if (blob.status === CSL.SEEN) { + ret += blob.successor_prefix; + } + ret += str; + ret_last_char = blob_last_chars.slice(-1); + } + } + return [ret, ret_last_char]; +}; +CSL.Output.Queue.prototype.swapQuotePunctuation = function (ret, use_delim) { + var pre_quote, pos, len; + if (ret.length && this.state.getOpt("punctuation-in-quote") && this.state.opt.close_quotes_array.indexOf(ret.slice(-1)) > -1) { + if (use_delim) { + pos = use_delim.indexOf(" "); + if (pos === -1) { + pos = use_delim.length; + } + if (pos > -1) { + if (CSL.SWAPPING_PUNCTUATION.indexOf(use_delim.slice(0, 1)) > -1) { + pre_quote = use_delim.slice(0, pos); + use_delim = use_delim.slice(pos); + } else { + pre_quote = ""; + } + } else { + pre_quote = use_delim; + use_delim = ""; + } + ret = ret.slice(0, (ret.length - 1)) + pre_quote + ret.slice((ret.length - 1)); + } + } + return [ret, use_delim]; +}; +CSL.Output.Queue.normalizePrefixPunctuation = function (blobs, top) { + var pos, len, m, punct, suff, predecessor, rex; + punct = ""; + if ("object" === typeof blobs[0] && blobs[0].blobs.length) { + CSL.Output.Queue.normalizePrefixPunctuation(blobs[0].blobs); + } + if ("object" === typeof blobs) { + len = blobs.length - 1; + for (pos = len; pos > 0; pos += -1) { + if (!blobs[pos].blobs) { + continue; + } + m = blobs[pos].strings.prefix.match(CSL.TERMINAL_PUNCTUATION_REGEXP); + if (m) { + blobs[pos].strings.prefix = m[2]; + predecessor = blobs[(pos - 1)]; + CSL.Output.Queue.appendPunctuationToSuffix(predecessor, m[1]); + } + if ("object" === typeof blobs[pos] && blobs[pos].blobs.length) { + CSL.Output.Queue.normalizePrefixPunctuation(blobs[pos].blobs); + } + } + } +}; +CSL.Output.Queue.appendPunctuationToSuffix = function (predecessor, punct) { + var suff, newpredecessor; + suff = predecessor.strings.suffix; + if (suff) { + if (CSL.TERMINAL_PUNCTUATION.indexOf(suff.slice(-1)) === -1) { + predecessor.strings.suffix += punct; + } + } else { + if ("string" === typeof predecessor.blobs) { + if (CSL.TERMINAL_PUNCTUATION.indexOf(predecessor.blobs.slice(-1)) === -1) { + predecessor.strings.suffix += punct; + } + } else { + newpredecessor = predecessor.blobs.slice(-1)[0]; + if (newpredecessor) { + CSL.Output.Queue.appendPunctuationToSuffix(newpredecessor, punct); + } + } + } +}; +CSL.localeResolve = function (langstr) { + var ret, langlst; + ret = {}; + if ("undefined" === typeof langstr) { + langstr = "en_US"; + } + langlst = langstr.split(/[\-_]/); + ret.base = CSL.LANG_BASES[langlst[0]]; + if (langlst.length === 1 || langlst[1] === "x") { + ret.best = ret.base.replace("_", "-"); + } else { + ret.best = langlst.slice(0, 2).join("-"); + } + ret.bare = langlst[0]; + return ret; +}; +CSL.localeSet = function (sys, myxml, lang_in, lang_out) { + var blob, locale, nodes, attributes, pos, ppos, term, form, termname, styleopts, attr, date, attrname, len; + lang_in = lang_in.replace("_", "-"); + lang_out = lang_out.replace("_", "-"); + if (!this.locale[lang_out]) { + this.locale[lang_out] = {}; + this.locale[lang_out].terms = {}; + this.locale[lang_out].opts = {}; + this.locale[lang_out].dates = {}; + } + locale = sys.xml.makeXml(); + if (sys.xml.nodeNameIs(myxml, 'locale')) { + locale = myxml; + } else { + nodes = sys.xml.getNodesByName(myxml, "locale"); + for (pos = 0, len = sys.xml.numberofnodes(nodes); pos < len; pos += 1) { + if (true) { + blob = nodes[pos]; + if (sys.xml.getAttributeValue(blob, 'lang', 'xml') === lang_in) { + locale = blob; + break; + } + } + } + } + nodes = sys.xml.getNodesByName(locale, 'term'); + for (pos = 0, len = sys.xml.numberofnodes(nodes); pos < len; pos += 1) { + if (true) { + term = nodes[pos]; + termname = sys.xml.getAttributeValue(term, 'name'); + if ("undefined" === typeof this.locale[lang_out].terms[termname]) { + this.locale[lang_out].terms[termname] = {}; + } + form = "long"; + if (sys.xml.getAttributeValue(term, 'form')) { + form = sys.xml.getAttributeValue(term, 'form'); + } + if (sys.xml.numberofnodes(sys.xml.getNodesByName(term, 'multiple'))) { + this.locale[lang_out].terms[termname][form] = []; + this.locale[lang_out].terms[sys.xml.getAttributeValue(term, 'name')][form][0] = sys.xml.getNodeValue(term, 'single'); + this.locale[lang_out].terms[sys.xml.getAttributeValue(term, 'name')][form][1] = sys.xml.getNodeValue(term, 'multiple'); + } else { + this.locale[lang_out].terms[sys.xml.getAttributeValue(term, 'name')][form] = sys.xml.getNodeValue(term); + } + } + } + nodes = sys.xml.getNodesByName(locale, 'style-options'); + for (pos = 0, len = sys.xml.numberofnodes(nodes); pos < len; pos += 1) { + if (true) { + styleopts = nodes[pos]; + attributes = sys.xml.attributes(styleopts); + for (attrname in attributes) { + if (attributes.hasOwnProperty(attrname)) { + if (attributes[attrname] === "true") { + this.locale[lang_out].opts[attrname.slice(1)] = true; + } else { + this.locale[lang_out].opts[attrname.slice(1)] = false; + } + } + } + } + } + nodes = sys.xml.getNodesByName(locale, 'date'); + for (pos = 0, len = sys.xml.numberofnodes(nodes); pos < len; pos += 1) { + if (true) { + date = nodes[pos]; + this.locale[lang_out].dates[sys.xml.getAttributeValue(date, "form")] = date; + } + } +}; +CSL.substituteOne = function (template) { + return function (state, list) { + if (!list) { + return ""; + } else { + return template.replace("%%STRING%%", list); + } + }; +}; +CSL.substituteTwo = function (template) { + return function (param) { + var template2 = template.replace("%%PARAM%%", param); + return function (state, list) { + if (!list) { + return ""; + } else { + return template2.replace("%%STRING%%", list); + } + }; + }; +}; +CSL.Mode = function (mode) { + var decorations, params, param, func, val, args; + decorations = {}; + params = CSL.Output.Formats[mode]; + for (param in params) { + if (true) { + if ("@" !== param.slice(0, 1)) { + decorations[param] = params[param]; + continue; + } + func = false; + val = params[param]; + args = param.split('/'); + if (typeof val === "string" && val.indexOf("%%STRING%%") > -1) { + if (val.indexOf("%%PARAM%%") > -1) { + func = CSL.substituteTwo(val); + } else { + func = CSL.substituteOne(val); + } + } else if (typeof val === "boolean" && !val) { + func = CSL.Output.Formatters.passthrough; + } else if (typeof val === "function") { + func = val; + } else { + throw "CSL.Compiler: Bad " + mode + " config entry for " + param + ": " + val; + } + if (args.length === 1) { + decorations[args[0]] = func; + } else if (args.length === 2) { + if (!decorations[args[0]]) { + decorations[args[0]] = {}; + } + decorations[args[0]][args[1]] = func; + } + } + } + return decorations; +}; +CSL.setDecorations = function (state, attributes) { + var ret, key, pos; + ret = []; + for (pos in CSL.FORMAT_KEY_SEQUENCE) { + if (true) { + key = CSL.FORMAT_KEY_SEQUENCE[pos]; + if (attributes[key]) { + ret.push([key, attributes[key]]); + delete attributes[key]; + } + } + } + return ret; +}; +CSL.cloneAmbigConfig = function (config, oldconfig, itemID) { + var ret, param, pos, ppos, len, llen; + ret = {}; + ret.names = []; + ret.givens = []; + ret.year_suffix = false; + ret.disambiguate = false; + len = config.names.length; + for (pos = 0; pos < len; pos += 1) { + param = config.names[pos]; + if (oldconfig && oldconfig.names[pos] !== param) { + this.tmp.taintedItemIDs[itemID] = true; + oldconfig = false; + } + ret.names[pos] = param; + } + len = config.givens.length; + for (pos = 0; pos < len; pos += 1) { + param = []; + llen = config.givens[pos].length; + for (ppos = 0; ppos < llen; ppos += 1) { + if (oldconfig && oldconfig.givens[pos] && oldconfig.givens[pos][ppos] !== config.givens[pos][ppos]) { + this.tmp.taintedItemIDs[itemID] = true; + oldconfig = false; + } + param.push(config.givens[pos][ppos]); + } + ret.givens.push(param); + } + if (oldconfig && oldconfig.year_suffix !== config.year_suffix) { + this.tmp.taintedItemIDs[itemID] = true; + oldconfig = false; + } + ret.year_suffix = config.year_suffix; + if (oldconfig && oldconfig.year_suffix !== config.year_suffix) { + this.tmp.taintedItemIDs[itemID] = true; + oldconfig = false; + } + ret.disambiguate = config.disambiguate; + return ret; +}; +CSL.tokenExec = function (token, Item, item) { + var next, maybenext, exec, pos, len, debug; + debug = false; + next = token.next; + maybenext = false; + if (token.evaluator) { + next = token.evaluator(token, this, Item, item); + } + len = token.execs.length; + for (pos = 0; pos < len; pos += 1) { + exec = token.execs[pos]; + maybenext = exec.call(token, this, Item, item); + if (maybenext) { + next = maybenext; + } + } + if (false) { + CSL.debug(token.name + " (" + token.tokentype + ") ---> done"); + } + return next; +}; +CSL.expandMacro = function (macro_key_token) { + var mkey, start_token, key, end_token, navi, macroxml, newoutput, mergeoutput, end_of_macro; + mkey = macro_key_token.postponed_macro; + if (this.build.macro_stack.indexOf(mkey) > -1) { + throw "CSL processor error: call to macro \"" + mkey + "\" would cause an infinite loop"; + } else { + this.build.macro_stack.push(mkey); + } + macro_key_token.tokentype = CSL.START; + CSL.Node.group.build.call(macro_key_token, this, this[this.build.area].tokens, true); + macroxml = this.sys.xml.getNodesByName(this.cslXml, 'macro', mkey); + if (!this.sys.xml.getNodeValue(macroxml)) { + throw "CSL style error: undefined macro \"" + mkey + "\""; + } + navi = new this.getNavi(this, macroxml); + CSL.buildStyle.call(this, navi); + end_of_macro = new CSL.Token("group", CSL.END); + CSL.Node.group.build.call(end_of_macro, this, this[this.build.area].tokens, true); + this.build.macro_stack.pop(); +}; +CSL.XmlToToken = function (state, tokentype) { + var name, txt, attrfuncs, attributes, decorations, token, key, target; + name = state.sys.xml.nodename(this); + if (state.build.skip && state.build.skip !== name) { + return; + } + if (!name) { + txt = state.sys.xml.content(this); + if (txt) { + state.build.text = txt; + } + return; + } + if (!CSL.Node[state.sys.xml.nodename(this)]) { + throw "Undefined node name \"" + name + "\"."; + } + attrfuncs = []; + attributes = state.sys.xml.attributes(this); + decorations = CSL.setDecorations.call(this, state, attributes); + token = new CSL.Token(name, tokentype); + if (tokentype !== CSL.END) { + for (key in attributes) { + if (attributes.hasOwnProperty(key)) { + try { + CSL.Attributes[key].call(token, state, "" + attributes[key]); + } catch (e) { + if (e === "TypeError: Cannot call method \"call\" of undefined") { + throw "Unknown attribute \"" + key + "\" in node \"" + name + "\" while processing CSL file"; + } else { + throw "CSL processor error, " + key + " attribute: " + e; + } + } + } + } + token.decorations = decorations; + } + target = state[state.build.area].tokens; + CSL.Node[name].build.call(token, state, target); +}; +CSL.dateParser = function (txt) { + var jiy_list, jiy, jiysplitter, jy, jmd, jr, pos, key, val, yearlast, yearfirst, number, rangesep, fuzzychar, chars, rex, rexdash, rexdashslash, rexslashdash, seasonstrs, seasonrexes, seasonstr, monthstrs, monthstr, monthrexes, seasonrex, len, jiymatchstring, jiymatcher; + jiy_list = [ + ["\u660E\u6CBB", 1867], + ["\u5927\u6B63", 1911], + ["\u662D\u548C", 1925], + ["\u5E73\u6210", 1988] + ]; + jiy = {}; + len = jiy_list.length; + for (pos = 0; pos < len; pos += 1) { + key = jiy_list[pos][0]; + val = jiy_list[pos][1]; + jiy[key] = val; + } + jiymatchstring = []; + for (pos = 0; pos < len; pos += 1) { + val = jiy_list[pos][0]; + jiymatchstring.push(val); + } + jiymatchstring = jiymatchstring.join("|"); + jiysplitter = "(?:" + jiymatchstring + ")(?:[0-9]+)"; + jiysplitter = new RegExp(jiysplitter); + jiymatcher = "(?:" + jiymatchstring + ")(?:[0-9]+)"; + jiymatcher = new RegExp(jiymatcher, "g"); + jmd = /(\u6708|\u5E74)/g; + jy = /\u65E5/; + jr = /\u301c/g; + yearlast = "(?:[?0-9]{1,2}%%NUMD%%){0,2}[?0-9]{4}(?![0-9])"; + yearfirst = "[?0-9]{4}(?:%%NUMD%%[?0-9]{1,2}){0,2}(?![0-9])"; + number = "[?0-9]{1,3}"; + rangesep = "[%%DATED%%]"; + fuzzychar = "[?~]"; + chars = "[a-zA-Z]+"; + rex = "(" + yearfirst + "|" + yearlast + "|" + number + "|" + rangesep + "|" + fuzzychar + "|" + chars + ")"; + rexdash = new RegExp(rex.replace(/%%NUMD%%/g, "-").replace(/%%DATED%%/g, "-")); + rexdashslash = new RegExp(rex.replace(/%%NUMD%%/g, "-").replace(/%%DATED%%/g, "\/")); + rexslashdash = new RegExp(rex.replace(/%%NUMD%%/g, "\/").replace(/%%DATED%%/g, "-")); + seasonstrs = ["spr", "sum", "fal", "win"]; + seasonrexes = []; + len = seasonstrs.length; + for (pos = 0; pos < len; pos += 1) { + seasonrex = new RegExp(seasonstrs[pos] + ".*"); + seasonrexes.push(seasonrex); + } + monthstrs = "jan feb mar apr may jun jul aug sep oct nov dec"; + monthstrs = monthstrs.split(" "); + monthrexes = []; + len = monthstrs.length; + for (pos = 0; pos < len; pos += 1) { + monthstr = monthstrs[pos]; + rex = new RegExp(monthstr); + monthrexes.push(rex); + } + this.parse = function (txt) { + var slash, dash, lst, l, m, number, note, thedate, slashcount, range_delim, date_delim, ret, delim_pos, delims, isrange, suff, date, breakme, item, pos, delim, ppos, element, pppos, len, llen, lllen, mm, slst, mmpos; + m = txt.match(jmd); + if (m) { + txt = txt.replace(jy, ""); + txt = txt.replace(jmd, "-"); + txt = txt.replace(jr, "/"); + txt = txt.replace("-/", "/"); + txt = txt.replace(/-$/,""); + slst = txt.split(jiysplitter); + lst = []; + mm = txt.match(jiymatcher); + var mmx = []; + for (pos = 0, len = mm.length; pos < len; pos += 1) { + mmx = mmx.concat(mm[pos].match(/([^0-9]+)([0-9]+)/).slice(1)); + } + for (pos = 0, len = slst.length; pos < len; pos += 1) { + lst.push(slst[pos]); + if (pos !== (len - 1)) { + mmpos = (pos * 2); + lst.push(mmx[mmpos]); + lst.push(mmx[mmpos + 1]); + } + } + l = lst.length; + for (pos = 1; pos < l; pos += 3) { + lst[pos + 1] = jiy[lst[pos]] + parseInt(lst[pos + 1], 10); + lst[pos] = ""; + } + txt = lst.join(""); + txt = txt.replace(/\s*-\s*$/, "").replace(/\s*-\s*\//, "/"); + txt = txt.replace(/\.\s*$/, ""); + txt = txt.replace(/\.(?! )/, ""); + slash = txt.indexOf("/"); + dash = txt.indexOf("-"); + } + txt = txt.replace(/([A-Za-z])\./g, "$1"); + number = ""; + note = ""; + thedate = {}; + if (txt.slice(0, 1) === "\"" && txt.slice(-1) === "\"") { + thedate.literal = txt.slice(1, -1); + return thedate; + } + if (slash > -1 && dash > -1) { + slashcount = txt.split("/"); + if (slashcount.length > 3) { + range_delim = "-"; + date_delim = "/"; + lst = txt.split(rexslashdash); + } else { + range_delim = "/"; + date_delim = "-"; + lst = txt.split(rexdashslash); + } + } else { + txt = txt.replace("/", "-"); + range_delim = "-"; + date_delim = "-"; + lst = txt.split(rexdash); + } + ret = []; + len = lst.length; + for (pos = 0; pos < len; pos += 1) { + item = lst[pos]; + m = item.match(/^\s*([\-\/]|[a-zA-Z]+|[\-~?0-9]+)\s*$/); + if (m) { + ret.push(m[1]); + } + } + delim_pos = ret.indexOf(range_delim); + delims = []; + isrange = false; + if (delim_pos > -1) { + delims.push([0, delim_pos]); + delims.push([(delim_pos + 1), ret.length]); + isrange = true; + } else { + delims.push([0, ret.length]); + } + suff = ""; + len = delims.length; + for (pos = 0; pos < len; pos += 1) { + delim = delims[pos]; + date = ret.slice(delim[0], delim[1]); + llen = date.length; + for (ppos = 0; ppos < llen; ppos += 1) { + element = date[ppos]; + if (element.indexOf(date_delim) > -1) { + this.parseNumericDate(thedate, date_delim, suff, element); + continue; + } + if (element.match(/[0-9]{4}/)) { + thedate[("year" + suff)] = element.replace(/^0*/, ""); + continue; + } + breakme = false; + lllen = monthrexes.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + if (element.toLocaleLowerCase().match(monthrexes[pppos])) { + thedate[("month" + suff)] = "" + (parseInt(pppos, 10) + 1); + breakme = true; + break; + } + if (breakme) { + continue; + } + if (element.match(/^[0-9]+$/)) { + number = parseInt(element, 10); + } + if (element.toLocaleLowerCase().match(/^bc/) && number) { + thedate[("year" + suff)] = "" + (number * -1); + number = ""; + continue; + } + if (element.toLocaleLowerCase().match(/^ad/) && number) { + thedate[("year" + suff)] = "" + number; + number = ""; + continue; + } + } + breakme = false; + lllen = seasonrexes.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + if (element.toLocaleLowerCase().match(seasonrexes[pppos])) { + thedate[("season" + suff)] = "" + (parseInt(pppos, 10) + 1); + breakme = true; + break; + } + } + if (breakme) { + continue; + } + if (element === "~" || element === "?" || element === "c" || element.match(/^cir/)) { + thedate.fuzzy = "" + 1; + continue; + } + if (element.toLocaleLowerCase().match(/(?:mic|tri|hil|eas)/) && !thedate[("season" + suff)]) { + note = element; + continue; + } + } + if (number) { + thedate[("day" + suff)] = number; + number = ""; + } + if (note && !thedate[("season" + suff)]) { + thedate[("season" + suff)] = note; + note = ""; + } + suff = "_end"; + } + if (isrange) { + len = CSL.DATE_PARTS_ALL.length; + for (pos = 0; pos < len; pos += 1) { + item = CSL.DATE_PARTS_ALL[pos]; + if (thedate[item] && !thedate[(item + "_end")]) { + thedate[(item + "_end")] = thedate[item]; + } else if (!thedate[item] && thedate[(item + "_end")]) { + thedate[item] = thedate[(item + "_end")]; + } + } + } + if (!thedate.year) { + thedate = { "literal": txt }; + } + return thedate; + }; + this.parseNumericDate = function (ret, delim, suff, txt) { + var lst, pos, len; + lst = txt.split(delim); + len = lst.length; + for (pos = 0; pos < len; pos += 1) { + if (lst[pos].length === 4) { + ret[("year" + suff)] = lst[pos].replace(/^0*/, ""); + if (!pos) { + lst = lst.slice(1); + } else { + lst = lst.slice(0, pos); + } + break; + } + } + len = lst.length; + for (pos = 0; pos < len; pos += 1) { + lst[pos] = parseInt(lst[pos], 10); + } + if (lst.length === 1) { + ret[("month" + suff)] = "" + lst[0]; + } else if (lst.length === 2) { + if (lst[0] > 12) { + ret[("month" + suff)] = "" + lst[1]; + ret[("day" + suff)] = "" + lst[0]; + } else { + ret[("month" + suff)] = "" + lst[0]; + ret[("day" + suff)] = "" + lst[1]; + } + } + }; +}; +CSL.Engine = function (sys, style, lang, xmlmode) { + var attrs, langspec, localexml, locale; + this.processor_version = "1.0.16"; + this.csl_version = "1.0"; + this.sys = sys; + this.sys.xml = new CSL.System.Xml.Parsing(); + if ("string" !== typeof style) { + style = ""; + } + this.parallel = new CSL.Parallel(this); + this.transform = new CSL.Transform(this); + this.setAbbreviations = function (nick) { + this.transform.setAbbreviations(nick); + }; + this.opt = new CSL.Engine.Opt(); + this.tmp = new CSL.Engine.Tmp(); + this.build = new CSL.Engine.Build(); + this.fun = new CSL.Engine.Fun(); + this.configure = new CSL.Engine.Configure(); + this.citation_sort = new CSL.Engine.CitationSort(); + this.bibliography_sort = new CSL.Engine.BibliographySort(); + this.citation = new CSL.Engine.Citation(this); + this.bibliography = new CSL.Engine.Bibliography(); + this.output = new CSL.Output.Queue(this); + this.dateput = new CSL.Output.Queue(this); + this.cslXml = this.sys.xml.makeXml(style); + this.sys.xml.addInstitutionNodes(this.cslXml); + attrs = this.sys.xml.attributes(this.cslXml); + if ("undefined" === typeof attrs["@sort-separator"]) { + this.sys.xml.setAttribute(this.cslXml, "sort-separator", ", "); + } + if ("undefined" === typeof attrs["@name-delimiter"]) { + this.sys.xml.setAttribute(this.cslXml, "name-delimiter", ", "); + } + this.opt["initialize-with-hyphen"] = true; + this.setStyleAttributes(); + CSL.Util.Names.initNameSlices(this); + this.opt.xclass = sys.xml.getAttributeValue(this.cslXml, "class"); + lang = this.opt["default-locale"][0]; + langspec = CSL.localeResolve(lang); + this.opt.lang = langspec.best; + if (!CSL.locale[langspec.best]) { + localexml = sys.xml.makeXml(sys.retrieveLocale(langspec.best)); + CSL.localeSet.call(CSL, sys, localexml, langspec.best, langspec.best); + } + this.locale = {}; + locale = sys.xml.makeXml(); + if (!this.locale[langspec.best]) { + CSL.localeSet.call(this, sys, this.cslXml, "", langspec.best); + CSL.localeSet.call(this, sys, this.cslXml, langspec.bare, langspec.best); + CSL.localeSet.call(this, sys, this.cslXml, langspec.best, langspec.best); + } + this.buildTokenLists("citation"); + this.buildTokenLists("bibliography"); + this.configureTokenLists(); + this.registry = new CSL.Registry(this); + this.splice_delimiter = false; + this.fun.dateparser = new CSL.dateParser(); + this.fun.flipflopper = new CSL.Util.FlipFlopper(this); + this.setCloseQuotesArray(); + this.fun.ordinalizer.init(this); + this.fun.long_ordinalizer.init(this); + this.fun.page_mangler = CSL.Util.PageRangeMangler.getFunction(this); + this.setOutputFormat("html"); +}; +CSL.Engine.prototype.setCloseQuotesArray = function () { + var ret; + ret = []; + ret.push(this.getTerm("close-quote")); + ret.push(this.getTerm("close-inner-quote")); + ret.push('"'); + ret.push("'"); + this.opt.close_quotes_array = ret; +}; +CSL.Engine.prototype.buildTokenLists = function (area) { + var area_nodes, navi; + area_nodes = this.sys.xml.getNodesByName(this.cslXml, area); + if (!this.sys.xml.getNodeValue(area_nodes)) { + return; + } + navi = new this.getNavi(this, area_nodes); + this.build.area = area; + CSL.buildStyle.call(this, navi); +}; +CSL.Engine.prototype.setStyleAttributes = function () { + var dummy, attr, key, attributes, attrname; + dummy = {}; + dummy.name = this.sys.xml.nodename(this.cslXml); + attributes = this.sys.xml.attributes(this.cslXml); + for (attrname in attributes) { + if (attributes.hasOwnProperty(attrname)) { + CSL.Attributes[attrname].call(dummy, this, attributes[attrname]); + } + } +}; +CSL.buildStyle = function (navi) { + if (navi.getkids()) { + CSL.buildStyle.call(this, navi); + } else { + if (navi.getbro()) { + CSL.buildStyle.call(this, navi); + } else { + while (navi.nodeList.length > 1) { + if (navi.remember()) { + CSL.buildStyle.call(this, navi); + } + } + } + } +}; +CSL.Engine.prototype.getNavi = function (state, myxml) { + this.sys = state.sys; + this.state = state; + this.nodeList = []; + this.nodeList.push([0, myxml]); + this.depth = 0; +}; +CSL.Engine.prototype.getNavi.prototype.remember = function () { + var node; + this.depth += -1; + this.nodeList.pop(); + node = this.nodeList[this.depth][1][(this.nodeList[this.depth][0])]; + CSL.XmlToToken.call(node, this.state, CSL.END); + return this.getbro(); +}; +CSL.Engine.prototype.getNavi.prototype.getbro = function () { + var sneakpeek; + sneakpeek = this.nodeList[this.depth][1][(this.nodeList[this.depth][0] + 1)]; + if (sneakpeek) { + this.nodeList[this.depth][0] += 1; + return true; + } else { + return false; + } +}; +CSL.Engine.prototype.getNavi.prototype.getkids = function () { + var currnode, sneakpeek, pos, node, len; + currnode = this.nodeList[this.depth][1][this.nodeList[this.depth][0]]; + sneakpeek = this.sys.xml.children(currnode); + if (this.sys.xml.numberofnodes(sneakpeek) === 0) { + CSL.XmlToToken.call(currnode, this.state, CSL.SINGLETON); + return false; + } else { + for (pos in sneakpeek) { + if (true) { + node = sneakpeek[pos]; + if ("date" === this.sys.xml.nodename(node)) { + currnode = CSL.Util.fixDateNode.call(this, currnode, pos, node); + sneakpeek = this.sys.xml.children(currnode); + } + } + } + CSL.XmlToToken.call(currnode, this.state, CSL.START); + this.depth += 1; + this.nodeList.push([0, sneakpeek]); + return true; + } +}; +CSL.Engine.prototype.getNavi.prototype.getNodeListValue = function () { + return this.nodeList[this.depth][1]; +}; +CSL.Engine.prototype.setOutputFormat = function (mode) { + this.opt.mode = mode; + this.fun.decorate = CSL.Mode(mode); + if (!this.output[mode]) { + this.output[mode] = {}; + this.output[mode].tmp = {}; + } +}; +CSL.Engine.prototype.getTerm = function (term, form, plural) { + var ret = CSL.Engine.getField(CSL.LOOSE, this.locale[this.opt.lang].terms, term, form, plural); + if (typeof ret === "undefined") { + ret = CSL.Engine.getField(CSL.STRICT, CSL.locale[this.opt.lang].terms, term, form, plural); + } + return ret; +}; +CSL.Engine.prototype.getDate = function (form) { + if (this.locale[this.opt.lang].dates[form]) { + return this.locale[this.opt.lang].dates[form]; + } else { + return CSL.locale[this.opt.lang].dates[form]; + } +}; +CSL.Engine.prototype.getOpt = function (arg) { + if ("undefined" !== typeof this.locale[this.opt.lang].opts[arg]) { + return this.locale[this.opt.lang].opts[arg]; + } else { + return CSL.locale[this.opt.lang].opts[arg]; + } +}; +CSL.Engine.prototype.getVariable = function (Item, varname, form, plural) { + return CSL.Engine.getField(CSL.LOOSE, Item, varname, form, plural); +}; +CSL.Engine.prototype.getDateNum = function (ItemField, partname) { + if ("undefined" === typeof ItemField) { + return 0; + } else { + return ItemField[partname]; + } +}; +CSL.Engine.getField = function (mode, hash, term, form, plural) { + var ret, forms, f, pos, len; + ret = ""; + if ("undefined" === typeof hash[term]) { + if (mode === CSL.STRICT) { + throw "Error in getField: term\"" + term + "\" does not exist."; + } else { + return undefined; + } + } + forms = []; + if (form === "symbol") { + forms = ["symbol", "short"]; + } else if (form === "verb-short") { + forms = ["verb-short", "verb"]; + } else if (form !== "long") { + forms = [form]; + } + forms = forms.concat(["long"]); + len = forms.length; + for (pos = 0; pos < len; pos += 1) { + f = forms[pos]; + if ("string" === typeof hash[term] || "number" === typeof hash[term]) { + ret = hash[term]; + } else if ("undefined" !== typeof hash[term][f]) { + if ("string" === typeof hash[term][f] || "number" === typeof hash[term][f]) { + ret = hash[term][f]; + } else { + if ("number" === typeof plural) { + ret = hash[term][f][plural]; + } else { + ret = hash[term][f][0]; + } + } + break; + } + } + return ret; +}; +CSL.Engine.prototype.configureTokenLists = function () { + var dateparts_master, area, pos, token, dateparts, part, ppos, pppos, len, llen, lllen; + dateparts_master = ["year", "month", "day"]; + len = CSL.AREAS.length; + for (pos = 0; pos < len; pos += 1) { + area = CSL.AREAS[pos]; + llen = this[area].tokens.length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + token = this[area].tokens[ppos]; + if ("date" === token.name && CSL.END === token.tokentype) { + dateparts = []; + } + if ("date-part" === token.name && token.strings.name) { + lllen = dateparts_master.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + part = dateparts_master[pppos]; + if (part === token.strings.name) { + dateparts.push(token.strings.name); + } + } + } + if ("date" === token.name && CSL.START === token.tokentype) { + dateparts.reverse(); + token.dateparts = dateparts; + } + token.next = (ppos + 1); + if (token.name && CSL.Node[token.name].configure) { + CSL.Node[token.name].configure.call(token, this, ppos); + } + } + } + this.version = CSL.version; + return this.state; +}; +CSL.Engine.prototype.getNameSubFields = function (names) { + var pos, ppos, pppos, count, ret, mode, use_static_ordering, name, newname, addme, updateme, part, o, p, m, newopt, len, llen, lllen, i, key, str, lang; + count = -1; + ret = []; + mode = "locale-name"; + use_static_ordering = false; + if (this.tmp.area.slice(-5) === "_sort") { + mode = "locale-sort"; + } + len = names.length; + for (pos = 0; pos < len; pos += 1) { + newname = {}; + for (key in names[pos]) { + if (names[pos].hasOwnProperty(key)) { + newname[key] = names[pos][key]; + } + } + if (newname.given && !newname.family) { + newname.family = ""; + } else if (newname.family && !newname.given) { + newname.given = ""; + } + addme = true; + updateme = false; + llen = CSL.MINIMAL_NAME_FIELDS; + for (ppos = 0; ppos < len; ppos += 1) { + part = CSL.MINIMAL_NAME_FIELDS[ppos]; + p = newname[part]; + if (p) { + if (newname[part].length && newname[part][0] !== ":") { + if (newname["static-ordering"]) { + use_static_ordering = true; + } else if (!newname[part].match(CSL.ROMANESQUE_REGEXP)) { + use_static_ordering = true; + } else { + use_static_ordering = false; + } + } + newname["static-ordering"] = use_static_ordering; + m = p.match(/^(:[\-a-zA-Z0-9]+:\s+)/); + if (m) { + str = p.slice(m[1].length); + lang = m[1].slice(1).replace(/:\s+$/, ""); + addme = false; + lllen = this.opt[mode].length; + for (pppos = 0; pppos < len; pppos += 1) { + o = this.opt[mode][pppos]; + if (lang === o) { + updateme = true; + newname[part] = str; + break; + } + } + if (!updateme) { + if (this.opt.lang) { + if (this.opt.lang.indexOf("-") > -1) { + newopt = this.opt.lang.slice(0, this.opt.lang.indexOf("-")); + } else { + newopt = this.opt.lang; + } + if (lang === newopt) { + updateme = true; + newname[part] = str; + if (newname[part].match(CSL.ROMANESQUE_REGEXP)) { + newname["static-ordering"] = false; + } + } + } + } + } + } + } + if (addme) { + ret.push(newname); + count += 1; + } else if (updateme) { + for (key in newname) { + if (newname.hasOwnProperty(key)) { + ret[count][key] = newname[key]; + } + } + } + if (!newname.literal && !newname.given && newname.family) { + newname.literal = newname.family; + } + if (newname.literal) { + delete newname.family; + delete newname.given; + } + } + return ret; +}; +CSL.Engine.prototype.retrieveItems = function (ids) { + var ret, pos, len; + ret = []; + len = ids.length; + for (pos = 0; pos < len; pos += 1) { + ret.push(this.sys.retrieveItem(ids[pos])); + } + return ret; +}; +CSL.Engine.prototype.dateParseArray = function (date_obj) { + var ret, field, dpos, ppos, dp, exts, llen, pos, len, pppos, lllen; + ret = {}; + for (field in date_obj) { + if (field === "date-parts") { + dp = date_obj["date-parts"]; + if (dp.length > 1) { + if (dp[0].length !== dp[1].length) { + CSL.error("CSL data error: element mismatch in date range input."); + } + } + exts = ["", "_end"]; + llen = dp.length; + for (ppos = 0; ppos < llen; ppos += 1) { + lllen = CSL.DATE_PARTS.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + ret[(CSL.DATE_PARTS[pppos] + exts[ppos])] = dp[ppos][pppos]; + } + } + } else if (date_obj.hasOwnProperty(field)) { + ret[field] = date_obj[field]; + } + } + return ret; +}; +CSL.Engine.prototype.setOpt = function (token, name, value) { + if (token.name === "style") { + this.opt[name] = value; + } else if (["citation", "bibliography"].indexOf(token.name) > -1) { + this[token.name].opt[name] = value; + } else if (["name-form", "name-delimiter", "names-delimiter"].indexOf(name) === -1) { + token.strings[name] = value; + } +}; +CSL.Engine.prototype.fixOpt = function (token, name, localname) { + if ("citation" === token.name || "bibliography" === token.name) { + if (! this[token.name].opt[name] && "undefined" !== this.opt[name]) { + this[token.name].opt[name] = this.opt[name]; + } + } + if ("name" === token.name || "names" === token.name) { + if (! token.strings[localname] && "undefined" !== typeof this[this.build.area].opt[name]) { + token.strings[localname] = this[this.build.area].opt[name]; + } + } +}; +CSL.Engine.Opt = function () { + this.has_disambiguate = false; + this.mode = "html"; + this.dates = {}; + this["locale-sort"] = []; + this["locale-pri"] = []; + this["locale-sec"] = []; + this["locale-name"] = []; + this["default-locale"] = ["en"]; + this.update_mode = CSL.NONE; + this["et-al-min"] = 0; + this["et-al-use-first"] = 1; + this["et-al-subsequent-min"] = false; + this["et-al-subsequent-use-first"] = false; + this["demote-non-dropping-particle"] = "display-and-sort"; +}; +CSL.Engine.Tmp = function () { + this.names_max = new CSL.Stack(); + this.names_base = new CSL.Stack(); + this.givens_base = new CSL.Stack(); + this.value = []; + this.namepart_decorations = {}; + this.namepart_type = false; + this.area = "citation"; + this.can_substitute = new CSL.Stack(0, CSL.LITERAL); + this.element_rendered_ok = false; + this.element_trace = new CSL.Stack("style"); + this.nameset_counter = 0; + this.term_sibling = new CSL.Stack([false, false, false], CSL.LITERAL); + this.term_predecessor = false; + this.jump = new CSL.Stack(0, CSL.LITERAL); + this.decorations = new CSL.Stack(); + this.tokenstore_stack = new CSL.Stack(); + this.last_suffix_used = ""; + this.last_names_used = []; + this.last_years_used = []; + this.years_used = []; + this.names_used = []; + this.taintedItemIDs = false; + this.taintedCitationIDs = false; + this.initialize_with = new CSL.Stack(); + this.disambig_request = false; + this["name-as-sort-order"] = false; + this.suppress_decorations = false; + this.disambig_settings = new CSL.AmbigConfig(); + this.bib_sort_keys = []; + this.prefix = new CSL.Stack("", CSL.LITERAL); + this.suffix = new CSL.Stack("", CSL.LITERAL); + this.delimiter = new CSL.Stack("", CSL.LITERAL); + this.names_cut = {}; +}; +CSL.Engine.Fun = function () { + this.match = new CSL.Util.Match(); + this.suffixator = new CSL.Util.Suffixator(CSL.SUFFIX_CHARS); + this.romanizer = new CSL.Util.Romanizer(); + this.ordinalizer = new CSL.Util.Ordinalizer(); + this.long_ordinalizer = new CSL.Util.LongOrdinalizer(); +}; +CSL.Engine.Build = function () { + this["alternate-term"] = false; + this.in_bibliography = false; + this.in_style = false; + this.skip = false; + this.postponed_macro = false; + this.layout_flag = false; + this.name = false; + this.form = false; + this.term = false; + this.macro = {}; + this.macro_stack = []; + this.text = false; + this.lang = false; + this.area = "citation"; + this.substitute_level = new CSL.Stack(0, CSL.LITERAL); + this.render_nesting_level = 0; + this.render_seen = false; +}; +CSL.Engine.Configure = function () { + this.fail = []; + this.succeed = []; +}; +CSL.Engine.Citation = function (state) { + this.opt = {}; + this.tokens = []; + this.srt = new CSL.Registry.Comparifier(state, "citation_sort"); + this.opt.collapse = []; + this.opt["disambiguate-add-names"] = false; + this.opt["disambiguate-add-givenname"] = false; + this.opt["near-note-distance"] = 5; + this.opt.topdecor = []; +}; +CSL.Engine.Bibliography = function () { + this.opt = {}; + this.tokens = []; + this.opt.collapse = []; + this.opt["disambiguate-add-names"] = false; + this.opt["disambiguate-add-givenname"] = false; + this.opt.topdecor = []; + this.opt.layout_decorations = []; + this.opt.layout_prefix = ""; + this.opt.layout_suffix = ""; + this.opt.layout_delimiter = ""; + this.opt["line-spacing"] = 1; + this.opt["entry-spacing"] = 1; +}; +CSL.Engine.BibliographySort = function () { + this.tokens = []; + this.opt = {}; + this.opt.sort_directions = []; + this.keys = []; + this.opt.topdecor = []; +}; +CSL.Engine.CitationSort = function () { + this.tokens = []; + this.opt = {}; + this.opt.sort_directions = []; + this.keys = []; + this.opt.topdecor = []; +}; +CSL.Engine.prototype.setCitationId = function (citation) { + var ret, id, direction; + ret = false; + if (!citation.citationID) { + ret = true; + id = Math.floor(Math.random() * 100000000000000); + while (true) { + direction = 0; + if (!this.registry.citationreg.citationById[id]) { + citation.citationID = id.toString(32); + break; + } else if (!direction && id < 50000000000000) { + direction = 1; + } else { + direction = -1; + } + if (direction === 1) { + id += 1; + } else { + id += -1; + } + } + } + this.registry.citationreg.citationById[citation.citationID] = citation; + return ret; +}; +CSL.Engine.prototype.updateItems = function (idList) { + var debug = false; + this.registry.init(idList); + this.registry.dodeletes(this.registry.myhash); + this.registry.doinserts(this.registry.mylist); + this.registry.dorefreshes(); + this.registry.rebuildlist(); + this.registry.setdisambigs(); + this.registry.setsortkeys(); + this.registry.sorttokens(); + this.registry.renumber(); + this.registry.yearsuffix(); + return this.registry.getSortedIds(); +}; +CSL.Engine.prototype.updateUncitedItems = function (idList) { + var debug = false; + this.registry.init(idList, true); + this.registry.doinserts(this.registry.mylist); + this.registry.douncited(); + this.registry.rebuildlist(); + this.registry.setdisambigs(); + this.registry.setsortkeys(); + this.registry.sorttokens(); + this.registry.renumber(); + this.registry.yearsuffix(); + return this.registry.getSortedIds(); +}; +CSL.Engine.prototype.makeBibliography = function (bibsection) { + var debug, ret, params, maxoffset, item, len, pos, tok, tokk, tokkk, entry_ids, entry_strings; + debug = false; + ret = CSL.getBibliographyEntries.call(this, bibsection); + entry_ids = ret[0]; + entry_strings = ret[1]; + params = { + "maxoffset": 0, + "entryspacing": this.bibliography.opt["entry-spacing"], + "linespacing": this.bibliography.opt["line-spacing"], + "second-field-align": false, + "entry_ids": entry_ids + }; + if (this.bibliography.opt["second-field-align"]) { + params["second-field-align"] = this.bibliography.opt["second-field-align"]; + } + maxoffset = 0; + len = this.registry.reflist.length; + for (pos = 0; pos < len; pos += 1) { + item = this.registry.reflist[pos]; + if (item.offset > params.maxoffset) { + params.maxoffset = item.offset; + } + } + if (this.bibliography.opt.hangingindent) { + params.hangingindent = this.bibliography.opt.hangingindent; + } + params.bibstart = this.fun.decorate.bibstart; + params.bibend = this.fun.decorate.bibend; + return [params, entry_strings]; +}; +CSL.getBibliographyEntries = function (bibsection) { + var ret, input, include, anymatch, allmatch, bib_entry, res, len, pos, item, llen, ppos, spec, lllen, pppos, bib_layout, topblobs, all_item_ids, entry_item_ids, debug, collapse_parallel, i, siblings, skips, sortedItems, eyetem; + ret = []; + this.tmp.area = "bibliography"; + input = this.retrieveItems(this.registry.getSortedIds()); + this.tmp.disambig_override = true; + function eval_string(a, b) { + if (a === b) { + return true; + } + return false; + } + function eval_list(a, lst) { + lllen = lst.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + if (eval_string(a, lst[pppos])) { + return true; + } + } + return false; + } + function eval_spec(a, b) { + if ((a === "none" || !a) && !b) { + return true; + } + if ("string" === typeof b) { + return eval_string(a, b); + } else if (!b) { + return false; + } else { + return eval_list(a, b); + } + } + skips = {}; + all_item_ids = []; + len = input.length; + for (pos = 0; pos < len; pos += 1) { + item = input[pos]; + if (skips[item.id]) { + continue; + } + if (bibsection) { + include = true; + if (bibsection.include) { + include = false; + llen = bibsection.include.length; + for (ppos = 0; ppos < llen; ppos += 1) { + spec = bibsection.include[ppos]; + if (eval_spec(spec.value, item[spec.field])) { + include = true; + break; + } + } + } else if (bibsection.exclude) { + anymatch = false; + llen = bibsection.exclude.length; + for (ppos = 0; ppos < llen; ppos += 1) { + spec = bibsection.exclude[ppos]; + if (eval_spec(spec.value, item[spec.field])) { + anymatch = true; + break; + } + } + if (anymatch) { + include = false; + } + } else if (bibsection.select) { + include = false; + allmatch = true; + llen = bibsection.select.length; + for (ppos = 0; ppos < llen; ppos += 1) { + spec = bibsection.select[ppos]; + if (!eval_spec(spec.value, item[spec.field])) { + allmatch = false; + } + } + if (allmatch) { + include = true; + } + } + if (bibsection.quash) { + allmatch = true; + llen = bibsection.quash.length; + for (ppos = 0; ppos < llen; ppos += 1) { + spec = bibsection.quash[ppos]; + if (!eval_spec(spec.value, item[spec.field])) { + allmatch = false; + } + } + if (allmatch) { + include = false; + } + } + if (!include) { + continue; + } + } + bib_entry = new CSL.Token("group", CSL.START); + bib_entry.decorations = [["@bibliography", "entry"]].concat(this[this.build.area].opt.layout_decorations); + this.output.startTag("bib_entry", bib_entry); + sortedItems = [[{id: item.id}, item]]; + entry_item_ids = []; + if (this.registry.registry[item.id].master) { + collapse_parallel = true; + this.parallel.StartCitation(sortedItems); + this.output.queue[0].strings.delimiter = ", "; + entry_item_ids.push(CSL.getCite.call(this, item)); + skips[item.id] = true; + siblings = this.registry.registry[item.id].siblings; + for (ppos = 0, llen = siblings.length; ppos < llen; ppos += 1) { + i = this.registry.registry[item.id].siblings[ppos]; + eyetem = this.sys.retrieveItem(i); + entry_item_ids.push(CSL.getCite.call(this, eyetem)); + skips[eyetem.id] = true; + } + this.parallel.ComposeSet(); + this.parallel.PruneOutputQueue(); + } else if (!this.registry.registry[item.id].siblings) { + entry_item_ids.push(CSL.getCite.call(this, item)); + } + all_item_ids.push(entry_item_ids); + this.output.endTag("bib_entry"); + if (this.output.queue[0].blobs.length && this.output.queue[0].blobs[0].blobs.length) { + if (collapse_parallel) { + topblobs = this.output.queue[0].blobs; + collapse_parallel = false; + } else { + topblobs = this.output.queue[0].blobs[0].blobs; + } + llen = topblobs.length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + if (topblobs[ppos].blobs && topblobs[ppos].blobs.length !== 0) { + topblobs[ppos].strings.suffix += this[this.build.area].opt.layout_suffix; + break; + } + } + topblobs[0].strings.prefix = this[this.build.area].opt.layout_prefix + topblobs[0].strings.prefix; + } + res = this.output.string(this, this.output.queue)[0]; + if (!res) { + res = "\n[CSL STYLE ERROR: reference with no printed form.]\n"; + } + ret.push(res); + } + this.tmp.disambig_override = false; + return [all_item_ids, ret]; +}; +CSL.Engine.prototype.appendCitationCluster = function (citation, has_bibliography) { + var pos, len, c, citationsPre; + citationsPre = []; + len = this.registry.citationreg.citationByIndex.length; + for (pos = 0; pos < len; pos += 1) { + c = this.registry.citationreg.citationByIndex[pos]; + citationsPre.push([c.citationID, c.properties.noteIndex]); + } + return this.processCitationCluster(citation, citationsPre, []); +}; +CSL.Engine.prototype.processCitationCluster = function (citation, citationsPre, citationsPost, has_bibliography) { + var sortedItems, new_citation, pos, len, item, citationByIndex, c, Item, newitem, k, textCitations, noteCitations, update_items, citations, first_ref, last_ref, ipos, ilen, cpos, onecitation, oldvalue, ibidme, suprame, useme, items, i, key, prev_locator, curr_locator, param, ret, obj, ppos, llen, lllen, pppos, ppppos, llllen, cids, note_distance; + this.tmp.taintedItemIDs = {}; + this.tmp.taintedCitationIDs = {}; + sortedItems = []; + new_citation = this.setCitationId(citation); + len = citation.citationItems.length; + for (pos = 0; pos < len; pos += 1) { + item = citation.citationItems[pos]; + Item = this.sys.retrieveItem(item.id); + newitem = [Item, item]; + sortedItems.push(newitem); + citation.citationItems[pos].item = Item; + } + if (sortedItems && sortedItems.length > 1 && this.citation_sort.tokens.length > 0) { + len = sortedItems.length; + for (pos = 0; pos < len; pos += 1) { + sortedItems[pos][1].sortkeys = CSL.getSortKeys.call(this, sortedItems[pos][0], "citation_sort"); + } + sortedItems.sort(this.citation.srt.compareCompositeKeys); + } + citation.sortedItems = sortedItems; + citationByIndex = []; + len = citationsPre.length; + for (pos = 0; pos < len; pos += 1) { + c = citationsPre[pos]; + this.registry.citationreg.citationById[c[0]].properties.noteIndex = c[1]; + citationByIndex.push(this.registry.citationreg.citationById[c[0]]); + } + citationByIndex.push(citation); + len = citationsPost.length; + for (pos = 0; pos < len; pos += 1) { + c = citationsPost[pos]; + this.registry.citationreg.citationById[c[0]].properties.noteIndex = c[1]; + citationByIndex.push(this.registry.citationreg.citationById[c[0]]); + } + this.registry.citationreg.citationByIndex = citationByIndex; + this.registry.citationreg.citationsByItemId = {}; + if (this.opt.update_mode === CSL.POSITION || true) { + textCitations = []; + noteCitations = []; + } + update_items = []; + len = citationByIndex.length; + for (pos = 0; pos < len; pos += 1) { + citationByIndex[pos].properties.index = pos; + llen = citationByIndex[pos].sortedItems.length; + for (ppos = 0; ppos < llen; ppos += 1) { + item = citationByIndex[pos].sortedItems[ppos]; + if (!this.registry.citationreg.citationsByItemId[item[1].id]) { + this.registry.citationreg.citationsByItemId[item[1].id] = []; + update_items.push(item[1].id); + } + if (this.registry.citationreg.citationsByItemId[item[1].id].indexOf(citationByIndex[pos]) === -1) { + this.registry.citationreg.citationsByItemId[item[1].id].push(citationByIndex[pos]); + } + } + if (this.opt.update_mode === CSL.POSITION || true) { + if (citationByIndex[pos].properties.noteIndex) { + noteCitations.push(citationByIndex[pos]); + } else { + textCitations.push(citationByIndex[pos]); + } + } + } + if (!has_bibliography) { + this.updateItems(update_items); + } + if (this.opt.update_mode === CSL.POSITION || true) { + for (pos = 0; pos < 2; pos += 1) { + citations = [textCitations, noteCitations][pos]; + first_ref = {}; + last_ref = {}; + llen = citations.length; + for (ppos = 0; ppos < llen; ppos += 1) { + onecitation = citations[ppos]; + lllen = citations[ppos].sortedItems.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + item = citations[ppos].sortedItems[pppos]; + oldvalue = {}; + oldvalue.position = item[1].position; + oldvalue["first-reference-note-number"] = item[1]["first-reference-note-number"]; + oldvalue["near-note"] = item[1]["near-note"]; + item[1]["first-reference-note-number"] = 0; + item[1]["near-note"] = false; + if ("number" !== typeof first_ref[item[1].id]) { + if (!onecitation.properties.noteIndex) { + onecitation.properties.noteIndex = 0; + } + first_ref[item[1].id] = onecitation.properties.noteIndex; + last_ref[item[1].id] = onecitation.properties.noteIndex; + item[1].position = CSL.POSITION_FIRST; + } else { + ibidme = false; + suprame = false; + if (ppos > 0 && parseInt(pppos, 10) === 0) { + items = citations[(ppos - 1)].sortedItems; + useme = false; + if ((citations[(ppos - 1)].sortedItems[0][1].id === item[1].id && citations[ppos - 1].properties.noteIndex >= (citations[ppos].properties.noteIndex - 1)) || citations[(ppos - 1)].sortedItems[0][1].id === this.registry.registry[item[1].id].parallel) { + useme = true; + } + llllen = items.slice(1).length; + for (ppppos = 0; ppppos < llllen; ppppos += 1) { + i = items.slice(1)[ppppos]; + if (!this.registry.registry[i[1].id].parallel || this.registry.registry[i[1].id].parallel === this.registry.registry[i[1].id]) { + useme = false; + } + } + if (useme) { + ibidme = true; + } else { + suprame = true; + } + } else if (pppos > 0 && onecitation.sortedItems[(pppos - 1)][1].id === item[1].id) { + ibidme = true; + } else { + suprame = true; + } + if (ibidme) { + if (pppos > 0) { + prev_locator = onecitation.sortedItems[(pppos - 1)][1].locator; + } else { + prev_locator = citations[(ppos - 1)].sortedItems[0][1].locator; + } + curr_locator = item[1].locator; + } + if (ibidme && prev_locator && !curr_locator) { + ibidme = false; + suprame = true; + } + if (ibidme) { + if (!prev_locator && curr_locator) { + item[1].position = CSL.POSITION_IBID_WITH_LOCATOR; + } else if (!prev_locator && !curr_locator) { + item[1].position = CSL.POSITION_IBID; + } else if (prev_locator && curr_locator === prev_locator) { + item[1].position = CSL.POSITION_IBID; + } else if (prev_locator && curr_locator && curr_locator !== prev_locator) { + item[1].position = CSL.POSITION_IBID_WITH_LOCATOR; + } else { + ibidme = false; // just to be clear + suprame = true; + } + } + if (suprame) { + item[1].position = CSL.POSITION_SUBSEQUENT; + if (first_ref[item[1].id] !== onecitation.properties.noteIndex) { + item[1]["first-reference-note-number"] = first_ref[item[1].id]; + } + } + } + if (onecitation.properties.noteIndex) { + cids = this.registry.citationreg.citationsByItemId[item[0].id]; + for (ppppos = (cids.length - 1); ppppos > -1; ppppos += -1) { + if (cids[ppppos].properties.noteIndex < onecitation.properties.noteIndex) { + note_distance = onecitation.properties.noteIndex - cids[ppppos].properties.noteIndex; + if (note_distance <= this.citation.opt["near-note-distance"]) { + item[1]["near-note"] = true; + } + } + } + } + if (onecitation.citationID !== citation.citationID) { + llllen = CSL.POSITION_TEST_VARS.length; + for (ppppos = 0; ppppos < llllen; ppppos += 1) { + param = CSL.POSITION_TEST_VARS[ppppos]; + if (item[1][param] !== oldvalue[param]) { + this.tmp.taintedCitationIDs[onecitation.citationID] = true; + } + } + } + } + } + } + } + for (key in this.tmp.taintedItemIDs) { + if (this.tmp.taintedItemIDs.hasOwnProperty(key)) { + citations = this.registry.citationreg.citationsByItemId[key]; + for (pos = 0, len = citations.length; pos < len; pos += 1) { + this.tmp.taintedCitationIDs[citations[pos].citationID] = true; + } + } + } + ret = []; + for (key in this.tmp.taintedCitationIDs) { + if (this.tmp.taintedCitationIDs.hasOwnProperty(key)) { + obj = []; + citation = this.registry.citationreg.citationById[key]; + obj.push(citation.properties.index); + obj.push(this.process_CitationCluster.call(this, citation.sortedItems)); + ret.push(obj); + } + } + this.tmp.taintedItemIDs = false; + this.tmp.taintedCitationIDs = false; + obj = []; + obj.push(citationsPre.length); + obj.push(this.process_CitationCluster.call(this, sortedItems)); + ret.push(obj); + ret.sort(function (a, b) { + if (a[0] > b[0]) { + return 1; + } else if (a[0] < b[0]) { + return -1; + } else { + return 0; + } + }); + return ret; +}; +CSL.Engine.prototype.process_CitationCluster = function (sortedItems) { + var str; + this.parallel.StartCitation(sortedItems); + str = CSL.getCitationCluster.call(this, sortedItems); + return str; +}; +CSL.Engine.prototype.makeCitationCluster = function (rawList) { + var inputList, newitem, str, pos, len, item, Item; + inputList = []; + len = rawList.length; + for (pos = 0; pos < len; pos += 1) { + item = rawList[pos]; + Item = this.sys.retrieveItem(item.id); + newitem = [Item, item]; + inputList.push(newitem); + } + if (inputList && inputList.length > 1 && this.citation_sort.tokens.length > 0) { + len = inputList.length; + for (pos = 0; pos < len; pos += 1) { + rawList[pos].sortkeys = CSL.getSortKeys.call(this, inputList[pos][0], "citation_sort"); + } + inputList.sort(this.citation.srt.compareCompositeKeys); + } + this.parallel.StartCitation(inputList); + str = CSL.getCitationCluster.call(this, inputList); + return str; +}; +CSL.getAmbiguousCite = function (Item, disambig) { + var use_parallels, ret; + if (disambig) { + this.tmp.disambig_request = disambig; + } else { + this.tmp.disambig_request = false; + } + this.tmp.area = "citation"; + use_parallels = this.parallel.use_parallels; + this.parallel.use_parallels = false; + this.tmp.suppress_decorations = true; + this.tmp.just_looking = true; + CSL.getCite.call(this, Item, {position: 1}); + ret = this.output.string(this, this.output.queue); + this.tmp.just_looking = false; + this.tmp.suppress_decorations = false; + this.parallel.use_parallels = use_parallels; + return ret; +}; +CSL.getSpliceDelimiter = function (last_collapsed) { + if (last_collapsed && ! this.tmp.have_collapsed && this.citation.opt["after-collapse-delimiter"]) { + this.tmp.splice_delimiter = this.citation.opt["after-collapse-delimiter"]; + } + return this.tmp.splice_delimiter; +}; +CSL.getCitationCluster = function (inputList, citationID) { + var delimiter, result, objects, myparams, len, pos, item, last_collapsed, params, empties, composite, compie, myblobs, Item, llen, ppos, obj; + this.tmp.area = "citation"; + delimiter = ""; + result = ""; + objects = []; + this.tmp.last_suffix_used = ""; + this.tmp.last_names_used = []; + this.tmp.last_years_used = []; + this.tmp.backref_index = []; + if (citationID) { + this.registry.citationreg.citationById[citationID].properties.backref_index = false; + this.registry.citationreg.citationById[citationID].properties.backref_citation = false; + } + myparams = []; + len = inputList.length; + for (pos = 0; pos < len; pos += 1) { + Item = inputList[pos][0]; + item = inputList[pos][1]; + last_collapsed = this.tmp.have_collapsed; + params = {}; + if (pos > 0) { + CSL.getCite.call(this, Item, item, inputList[(pos - 1)][1].id); + } else { + this.tmp.term_predecessor = false; + CSL.getCite.call(this, Item, item); + } + if (pos === (inputList.length - 1)) { + this.parallel.ComposeSet(); + } + params.splice_delimiter = CSL.getSpliceDelimiter.call(this, last_collapsed); + if (item && item["author-only"]) { + this.tmp.suppress_decorations = true; + } + params.suppress_decorations = this.tmp.suppress_decorations; + params.have_collapsed = this.tmp.have_collapsed; + myparams.push(params); + } + this.parallel.PruneOutputQueue(this); + empties = 0; + myblobs = this.output.queue.slice(); + len = myblobs.length; + for (pos = 0; pos < len; pos += 1) { + this.output.queue = [myblobs[pos]]; + this.tmp.suppress_decorations = myparams[pos].suppress_decorations; + this.tmp.splice_delimiter = myparams[pos].splice_delimiter; + if (myblobs[pos].parallel_delimiter) { + this.tmp.splice_delimiter = myblobs[pos].parallel_delimiter; + } + this.tmp.have_collapsed = myparams[pos].have_collapsed; + composite = this.output.string(this, this.output.queue); + this.tmp.suppress_decorations = false; + if (item && item["author-only"]) { + return composite; + } + if ("object" === typeof composite && composite.length === 0 && !item["suppress-author"]) { + composite.push("[CSL STYLE ERROR: reference with no printed form.]"); + } + if (objects.length && "string" === typeof composite[0]) { + composite.reverse(); + objects.push(this.tmp.splice_delimiter + composite.pop()); + } else { + composite.reverse(); + compie = composite.pop(); + if ("undefined" !== typeof compie) { + objects.push(compie); + } + } + composite.reverse(); + llen = composite.length; + for (ppos = 0; ppos < llen; ppos += 1) { + obj = composite[ppos]; + if ("string" === typeof obj) { + objects.push(this.tmp.splice_delimiter + obj); + continue; + } + compie = composite.pop(); + if ("undefined" !== typeof compie) { + objects.push(compie); + } + } + if (objects.length === 0 && !inputList[pos][1]["suppress-author"]) { + empties += 1; + } + } + result += this.output.renderBlobs(objects)[0]; + if (result) { + if (result.slice(-1) === this.citation.opt.layout_suffix.slice(0)) { + result = result.slice(0, -1); + } + result = this.citation.opt.layout_prefix + result + this.citation.opt.layout_suffix; + if (!this.tmp.suppress_decorations) { + len = this.citation.opt.layout_decorations.length; + for (pos = 0; pos < len; pos += 1) { + params = this.citation.opt.layout_decorations[pos]; + result = this.fun.decorate[params[0]][params[1]](this, result); + } + } + } + return result; +}; +CSL.getCite = function (Item, item, prevItemID) { + var next; + this.parallel.StartCite(Item, item, prevItemID); + CSL.citeStart.call(this, Item); + next = 0; + while (next < this[this.tmp.area].tokens.length) { + next = CSL.tokenExec.call(this, this[this.tmp.area].tokens[next], Item, item); + } + CSL.citeEnd.call(this, Item); + this.parallel.CloseCite(this); + return Item.id; +}; +CSL.citeStart = function (Item) { + this.tmp.have_collapsed = true; + this.tmp.render_seen = false; + if (this.tmp.disambig_request && ! this.tmp.disambig_override) { + this.tmp.disambig_settings = this.tmp.disambig_request; + } else if (this.registry.registry[Item.id] && ! this.tmp.disambig_override) { + this.tmp.disambig_request = this.registry.registry[Item.id].disambig; + this.tmp.disambig_settings = this.registry.registry[Item.id].disambig; + } else { + this.tmp.disambig_settings = new CSL.AmbigConfig(); + } + this.tmp.names_used = []; + this.tmp.nameset_counter = 0; + this.tmp.years_used = []; + this.tmp.names_max.clear(); + this.tmp.splice_delimiter = this[this.tmp.area].opt.delimiter; + this.bibliography_sort.keys = []; + this.citation_sort.keys = []; + this.tmp.count_offset_characters = false; + this.tmp.offset_characters = 0; + this.tmp.has_done_year_suffix = false; + CSL.Util.Names.initNameSlices(this); +}; +CSL.citeEnd = function (Item) { + if (this.tmp.last_suffix_used && this.tmp.last_suffix_used.match(/[\-.,;:]$/)) { + this.tmp.splice_delimiter = " "; + } else if (this.tmp.prefix.value() && this.tmp.prefix.value().match(/^[.,:;a-z]/)) { + this.tmp.splice_delimiter = " "; + } + this.tmp.last_suffix_used = this.tmp.suffix.value(); + this.tmp.last_years_used = this.tmp.years_used.slice(); + this.tmp.last_names_used = this.tmp.names_used.slice(); + if (this.tmp.disambig_restore && this.registry.registry[Item.id]) { + this.registry.registry[Item.id].disambig = this.tmp.disambig_restore; + } + this.tmp.disambig_request = false; + if (!this.tmp.suppress_decorations && this.tmp.offset_characters) { + this.registry.registry[Item.id].offset = this.tmp.offset_characters; + } +}; +CSL.Node = {}; +CSL.Node.bibliography = { + build: function (state, target) { + if (this.tokentype === CSL.START) { + state.fixOpt(this, "names-delimiter", "delimiter"); + state.fixOpt(this, "name-delimiter", "delimiter"); + state.fixOpt(this, "name-form", "form"); + state.fixOpt(this, "and", "and"); + state.fixOpt(this, "delimiter-precedes-last", "delimiter-precedes-last"); + state.fixOpt(this, "initialize-with", "initialize-with"); + state.fixOpt(this, "name-as-sort-order", "name-as-sort-order"); + state.fixOpt(this, "sort-separator", "sort-separator"); + state.fixOpt(this, "et-al-min", "et-al-min"); + state.fixOpt(this, "et-al-use-first", "et-al-use-first"); + state.fixOpt(this, "et-al-subsequent-min", "et-al-subsequent-min"); + state.fixOpt(this, "et-al-subsequent-use-first", "et-al-subsequent-use-first"); + state.build.area_return = state.build.area; + state.build.area = "bibliography"; + } + if (this.tokentype === CSL.END) { + state.build.area = state.build.area_return; + } + target.push(this); + } +}; +CSL.Node.choose = { + build: function (state, target) { + var func; + if (this.tokentype === CSL.START) { + func = function (state, Item) { + state.tmp.jump.push(undefined, CSL.LITERAL); + }; + } + if (this.tokentype === CSL.END) { + func = function (state, Item) { + state.tmp.jump.pop(); + }; + } + this.execs.push(func); + target.push(this); + }, + configure: function (state, pos) { + if (this.tokentype === CSL.END) { + state.configure.fail.push((pos)); + state.configure.succeed.push((pos)); + } else { + state.configure.fail.pop(); + state.configure.succeed.pop(); + } + } +}; +CSL.Node.citation = { + build: function (state, target) { + if (this.tokentype === CSL.START) { + state.fixOpt(this, "names-delimiter", "delimiter"); + state.fixOpt(this, "name-delimiter", "delimiter"); + state.fixOpt(this, "name-form", "form"); + state.fixOpt(this, "and", "and"); + state.fixOpt(this, "delimiter-precedes-last", "delimiter-precedes-last"); + state.fixOpt(this, "initialize-with", "initialize-with"); + state.fixOpt(this, "name-as-sort-order", "name-as-sort-order"); + state.fixOpt(this, "sort-separator", "sort-separator"); + state.fixOpt(this, "et-al-min", "et-al-min"); + state.fixOpt(this, "et-al-use-first", "et-al-use-first"); + state.fixOpt(this, "et-al-subsequent-min", "et-al-subsequent-min"); + state.fixOpt(this, "et-al-subsequent-use-first", "et-al-subsequent-use-first"); + state.build.area_return = state.build.area; + state.build.area = "citation"; + } + if (this.tokentype === CSL.END) { + state.build.area = state.build.area_return; + } + } +}; +CSL.Node.date = { + build: function (state, target) { + var func, date_obj, tok, len, pos, part, dpx, parts, mypos, start, end; + if (this.tokentype === CSL.START || this.tokentype === CSL.SINGLETON) { + state.build.date_parts = []; + state.build.date_variables = this.variables; + if (!state.build.sort_flag) { + CSL.Util.substituteStart.call(this, state, target); + } + func = function (state, Item) { + var key, dp; + state.tmp.element_rendered_ok = false; + state.tmp.donesies = []; + state.tmp.dateparts = []; + dp = []; + if (this.variables.length) { + state.parallel.StartVariable(this.variables[0]); + date_obj = Item[this.variables[0]]; + if ("undefined" === typeof date_obj) { + date_obj = {"date-parts": [[0]] }; + } + if (date_obj.raw) { + state.tmp.date_object = state.fun.dateparser.parse(date_obj.raw); + } else if (date_obj["date-parts"]) { + state.tmp.date_object = state.dateParseArray(date_obj); + } + len = this.dateparts.length; + for (pos = 0; pos < len; pos += 1) { + part = this.dateparts[pos]; + if ("undefined" !== typeof state.tmp.date_object[(part + "_end")]) { + dp.push(part); + } else if (part === "month" && "undefined" !== typeof state.tmp.date_object.season_end) { + dp.push(part); + } + } + dpx = []; + parts = ["year", "month", "day"]; + len = parts.length; + for (pos = 0; pos < len; pos += 1) { + if (dp.indexOf(parts[pos]) > -1) { + dpx.push(parts[pos]); + } + } + dp = dpx.slice(); + if (state.tmp.area.slice(-5) !== "_sort" && ("" + Item.volume) === "" + state.tmp.date_object.year) { + for (key in state.tmp.date_object) { + if (state.tmp.date_object.hasOwnProperty(key)) { + if (key.slice(0, 4) === "year") { + delete state.tmp.date_object[key]; + } + } + } + } + mypos = 2; + len = dp.length; + for (pos = 0; pos < len; pos += 1) { + part = dp[pos]; + start = state.tmp.date_object[part]; + end = state.tmp.date_object[(part + "_end")]; + if (start !== end) { + mypos = pos; + break; + } + } + state.tmp.date_collapse_at = dp.slice(mypos); + } else { + state.tmp.date_object = false; + } + }; + this.execs.push(func); + func = function (state, Item) { + state.output.startTag("date", this); + var tok = new CSL.Token("date-part", CSL.SINGLETON); + if (state.tmp.date_object.literal) { + state.parallel.AppendToVariable(state.tmp.date_object.literal); + state.output.append(state.tmp.date_object.literal, tok); + state.tmp.date_object = {}; + } + tok.strings.suffix = " "; + }; + this.execs.push(func); + } + if (state.build.sort_flag && (this.tokentype === CSL.END || this.tokentype === CSL.SINGLETON)) { + tok = new CSL.Token("key", CSL.SINGLETON); + tok.dateparts = state.build.date_parts.slice(); + tok.variables = state.build.date_variables; + CSL.Node.key.build.call(tok, state, target); + state.build.sort_flag = false; + } + if (!state.build.sort_flag && (this.tokentype === CSL.END || this.tokentype === CSL.SINGLETON)) { + func = function (state, Item) { + state.output.endTag(); + state.parallel.CloseVariable("date"); + }; + this.execs.push(func); + } + target.push(this); + if (this.tokentype === CSL.END || this.tokentype === CSL.SINGLETON) { + if (!state.build.sort_flag) { + CSL.Util.substituteEnd.call(this, state, target); + } + } + } +}; +CSL.Node["date-part"] = { + build: function (state, target) { + var func, pos, len, decor, first_date, value, value_end, real, have_collapsed, invoked, precondition, known_year, bc, ad, bc_end, ad_end, ready, curr, dcurr, number, num, formatter, item; + if (!this.strings.form) { + this.strings.form = "long"; + } + state.build.date_parts.push(this.strings.name); + func = function (state, Item) { + first_date = true; + value = ""; + value_end = ""; + state.tmp.donesies.push(this.strings.name); + if (state.tmp.date_object) { + value = state.tmp.date_object[this.strings.name]; + value_end = state.tmp.date_object[(this.strings.name + "_end")]; + } + if ("year" === this.strings.name && value === 0 && !state.tmp.suppress_decorations) { + value = false; + } + real = !state.tmp.suppress_decorations; + have_collapsed = state.tmp.have_collapsed; + invoked = state[state.tmp.area].opt.collapse === "year-suffix" || state[state.tmp.area].opt.collapse === "year-suffix-ranged"; + precondition = state[state.tmp.area].opt["disambiguate-add-year-suffix"]; + if (real && precondition && invoked) { + state.tmp.years_used.push(value); + known_year = state.tmp.last_years_used.length >= state.tmp.years_used.length; + if (known_year && have_collapsed) { + if (state.tmp.last_years_used[(state.tmp.years_used.length - 1)] === value) { + value = false; + } + } + } + if ("undefined" !== typeof value) { + bc = false; + ad = false; + bc_end = false; + ad_end = false; + if ("year" === this.strings.name) { + if (parseInt(value, 10) < 500 && parseInt(value, 10) > 0) { + ad = state.getTerm("ad"); + } + if (parseInt(value, 10) < 0) { + bc = state.getTerm("bc"); + value = (parseInt(value, 10) * -1); + } + if (value_end) { + if (parseInt(value_end, 10) < 500 && parseInt(value_end, 10) > 0) { + ad_end = state.getTerm("ad"); + } + if (parseInt(value_end, 10) < 0) { + bc_end = state.getTerm("bc"); + value_end = (parseInt(value_end, 10) * -1); + } + } + } + state.parallel.AppendToVariable(value); + if (this.strings.form) { + value = CSL.Util.Dates[this.strings.name][this.strings.form](state, value); + if (value_end) { + value_end = CSL.Util.Dates[this.strings.name][this.strings.form](state, value_end); + } + } + state.output.openLevel("empty"); + if (state.tmp.date_collapse_at.length) { + ready = true; + len = state.tmp.date_collapse_at.length; + for (pos = 0; pos < len; pos += 1) { + item = state.tmp.date_collapse_at[pos]; + if (state.tmp.donesies.indexOf(item) === -1) { + ready = false; + break; + } + } + if (ready) { + if ("" + value_end !== "0") { + if (state.dateput.queue.length === 0) { + first_date = true; + } + state.dateput.append(value_end, this); + if (first_date) { + state.dateput.current.value()[0].strings.prefix = ""; + } + } + state.output.append(value, this); + curr = state.output.current.value(); + curr.blobs[(curr.blobs.length - 1)].strings.suffix = ""; + state.output.append(this.strings["range-delimiter"], "empty"); + dcurr = state.dateput.current.value(); + curr.blobs = curr.blobs.concat(dcurr); + state.dateput.string(state, state.dateput.queue); + state.tmp.date_collapse_at = []; + } else { + state.output.append(value, this); + if (state.tmp.date_collapse_at.indexOf(this.strings.name) > -1) { + if ("" + value_end !== "0") { + if (state.dateput.queue.length === 0) { + first_date = true; + } + state.dateput.openLevel("empty"); + state.dateput.append(value_end, this); + if (first_date) { + state.dateput.current.value().blobs[0].strings.prefix = ""; + } + if (bc) { + state.dateput.append(bc); + } + if (ad) { + state.dateput.append(ad); + } + state.dateput.closeLevel(); + } + } + } + } else { + state.output.append(value, this); + } + if (bc) { + state.output.append(bc); + } + if (ad) { + state.output.append(ad); + } + state.output.closeLevel(); + } else if ("month" === this.strings.name) { + if (state.tmp.date_object.season) { + value = "" + state.tmp.date_object.season; + if (value && value.match(/^[1-4]$/)) { + state.tmp.term_sibling.replace([false, false, true]); + state.output.append(state.getTerm(("season-0" + value)), this); + } else if (value) { + state.output.append(value, this); + } + } + } + state.tmp.value = []; + if (!state.opt.has_year_suffix && "year" === this.strings.name) { + if (state.registry.registry[Item.id] && state.registry.registry[Item.id].disambig[2] && !state.tmp.has_done_year_suffix) { + state.tmp.has_done_year_suffix = true; + num = parseInt(state.registry.registry[Item.id].disambig[2], 10); + number = new CSL.NumericBlob(num, this); + formatter = new CSL.Util.Suffixator(CSL.SUFFIX_CHARS); + number.setFormatter(formatter); + state.output.append(number, "literal"); + } + } + }; + this.execs.push(func); + if ("undefined" === typeof this.strings["range-delimiter"]) { + this.strings["range-delimiter"] = "-"; + } + target.push(this); + } +}; +CSL.Node["else-if"] = { + build: function (state, target) { + var func, tryposition; + if (this.tokentype === CSL.START) { + if ("number" === typeof this.strings.position) { + tryposition = this.strings.position; + func = function (state, Item, item) { + if (item && "undefined" === typeof item.position) { + item.position = 0; + } + if (item && typeof item.position === "number") { + if (item.position === 0 && tryposition === 0) { + return true; + } else if (tryposition > 0 && item.position >= tryposition) { + return true; + } + } else if (tryposition === 0) { + return true; + } + return false; + }; + this.tests.push(func); + } + if (this.strings["near-note-distance-check"]) { + func = function (state, Item, item) { + if (item && item["near-note"]) { + return true; + } + return false; + }; + this.tests.push(func); + } + if (! this.evaluator) { + this.evaluator = state.fun.match.any; + } + } + if (this.tokentype === CSL.END) { + func = function (state, Item) { + var next = this[state.tmp.jump.value()]; + return next; + }; + this.execs.push(func); + } + target.push(this); + }, + configure: function (state, pos) { + if (this.tokentype === CSL.START) { + this.fail = state.configure.fail.slice(-1)[0]; + this.succeed = this.next; + state.configure.fail[(state.configure.fail.length - 1)] = pos; + } else { + this.succeed = state.configure.succeed.slice(-1)[0]; + this.fail = this.next; + } + } +}; +CSL.Node["else"] = { + build: function (state, target) { + target.push(this); + }, + configure: function (state, pos) { + if (this.tokentype === CSL.START) { + state.configure.fail[(state.configure.fail.length - 1)] = pos; + } + } +}; +CSL.Node["et-al"] = { + build: function (state, target) { + var func; + if (state.build.area === "citation") { + func = function (state, Item) { + state.output.addToken("et-al-pers", false, this); + state.output.addToken("et-al-org", false, this); + }; + this.execs.push(func); + } else if (state.build.area === "bibliography") { + func = function (state, Item) { + state.output.addToken("et-al-pers", false, this); + state.output.addToken("et-al-org", false, this); + }; + this.execs.push(func); + } + target.push(this); + } +}; +CSL.Node.group = { + build: function (state, target, quashquash) { + var func, execs; + if (this.tokentype === CSL.START) { + CSL.Util.substituteStart.call(this, state, target); + if (state.build.substitute_level.value()) { + state.build.substitute_level.replace((state.build.substitute_level.value() + 1)); + } + if (!quashquash || true) { + func = function (state, Item) { + state.tmp.term_sibling.push([false, false, false], CSL.LITERAL); + }; + this.execs.push(func); + } + func = function (state, Item) { + state.output.startTag("group", this); + }; + execs = []; + execs.push(func); + this.execs = execs.concat(this.execs); + } else { + if (!quashquash || true) { + func = function (state, Item) { + var flag = state.tmp.term_sibling.value(); + state.output.endTag(); + if (!flag[2] && (flag[1] || (!flag[1] && !flag[0]))) { + if (state.output.current.value().blobs) { + state.output.current.value().blobs.pop(); + } + } + state.tmp.term_sibling.pop(); + if ((flag[2] || (!flag[1] && flag[0])) && state.tmp.term_sibling.mystack.length > 1) { + state.tmp.term_sibling.replace([false, false, true]); + } + }; + this.execs.push(func); + } + } + target.push(this); + if (this.tokentype === CSL.END) { + if (state.build.substitute_level.value()) { + state.build.substitute_level.replace((state.build.substitute_level.value() - 1)); + } + CSL.Util.substituteEnd.call(this, state, target); + } + } +}; +CSL.Node["if"] = { + build: function (state, target) { + var tryposition, func; + if (this.tokentype === CSL.START) { + if ("number" === typeof this.strings.position) { + tryposition = this.strings.position; + func = function (state, Item, item) { + if (item && "undefined" === typeof item.position) { + item.position = 0; + } + if (item && typeof item.position === "number") { + if (item.position === 0 && tryposition === 0) { + return true; + } else if (tryposition > 0 && item.position >= tryposition) { + return true; + } + } else if (tryposition === 0) { + return true; + } + return false; + }; + this.tests.push(func); + } + if (this.strings["near-note-distance-check"]) { + func = function (state, Item, item) { + if (item && item["near-note"]) { + return true; + } + return false; + }; + this.tests.push(func); + } + if (!this.evaluator) { + this.evaluator = state.fun.match.any; + } + } + if (this.tokentype === CSL.END) { + func = function (state, Item) { + var next = this[state.tmp.jump.value()]; + return next; + }; + this.execs.push(func); + } + target.push(this); + }, + configure: function (state, pos) { + if (this.tokentype === CSL.START) { + this.fail = state.configure.fail.slice(-1)[0]; + this.succeed = this.next; + } else { + this.succeed = state.configure.succeed.slice(-1)[0]; + this.fail = this.next; + } + } +}; +CSL.Node.info = { + build: function (state, target) { + if (this.tokentype === CSL.START) { + state.build.skip = "info"; + } else { + state.build.skip = false; + } + } +}; +CSL.Node.institution = { + build: function (state, target) { + if ([CSL.SINGLETON, CSL.START].indexOf(this.tokentype) > -1) { + var func = function (state, Item) { + state.output.addToken("institution", false, this); + }; + this.execs.push(func); + } + target.push(this); + }, + configure: function (state, pos) { + if ([CSL.SINGLETON, CSL.START].indexOf(this.tokentype) > -1) { + state.build.has_institution = true; + } + } +}; +CSL.Node["institution-part"] = { + build: function (state, target) { + var func; + if ("long" === this.strings.name) { + if (this.strings["if-short"]) { + func = function (state, Item) { + state.output.addToken("institution-if-short", false, this); + }; + } else { + func = function (state, Item) { + state.output.addToken("institution-long", false, this); + }; + } + } else if ("short" === this.strings.name) { + func = function (state, Item) { + state.output.addToken("institution-short", false, this); + }; + } + this.execs.push(func); + target.push(this); + } +}; +CSL.Node.key = { + build: function (state, target) { + var start_key, func, sort_direction, variable, names_start_token, name_token, names_end_token, single_text, token, pos, keypos, ppos, len, llen, tok, gtok, saveme, end_key, tlen, tlst, debug; + debug = false; + start_key = new CSL.Token("key", CSL.START); + start_key.strings["et-al-min"] = this.strings["et-al-min"]; + start_key.strings["et-al-use-first"] = this.strings["et-al-use-first"]; + func = function (state, Item) { + state.tmp.done_vars = []; + }; + start_key.execs.push(func); + sort_direction = []; + if (this.strings.sort_direction === CSL.DESCENDING) { + sort_direction.push(1); + sort_direction.push(-1); + } else { + sort_direction.push(-1); + sort_direction.push(1); + } + state[state.build.area].opt.sort_directions.push(sort_direction); + func = function (state, Item) { + state.tmp.sort_key_flag = true; + if (this.strings["et-al-min"]) { + state.tmp["et-al-min"] = this.strings["et-al-min"]; + } + if (this.strings["et-al-use-first"]) { + state.tmp["et-al-use-first"] = this.strings["et-al-use-first"]; + } + }; + start_key.execs.push(func); + target.push(start_key); + if (this.variables.length) { + variable = this.variables[0]; + if (CSL.CREATORS.indexOf(variable) > -1) { + names_start_token = new CSL.Token("names", CSL.START); + names_start_token.tokentype = CSL.START; + names_start_token.variables = this.variables; + CSL.Node.names.build.call(names_start_token, state, target); + name_token = new CSL.Token("name", CSL.SINGLETON); + name_token.tokentype = CSL.SINGLETON; + name_token.strings["name-as-sort-order"] = "all"; + CSL.Node.name.build.call(name_token, state, target); + names_end_token = new CSL.Token("names", CSL.END); + names_end_token.tokentype = CSL.END; + CSL.Node.names.build.call(names_end_token, state, target); + } else { + single_text = new CSL.Token("text", CSL.SINGLETON); + single_text.dateparts = this.dateparts; + if (CSL.NUMERIC_VARIABLES.indexOf(variable) > -1) { + func = function (state, Item) { + var num, m; + num = false; + if ("citation-number" === variable) { + num = state.registry.registry[Item.id].seq.toString(); + } else { + num = Item[variable]; + } + if (num) { + m = num.match(/\s*(-{0,1}[0-9]+)/); + if (m) { + num = parseInt(m[1], 10); + if (num < 0) { + num = 99999999999999999999 + num; + } + num = "" + num; + while (num.length < 20) { + num = "0" + num; + } + } + } + state.output.append(num, this); + }; + } else if (CSL.DATE_VARIABLES.indexOf(variable) > -1) { + func = function (state, Item) { + var dp, elem, value, e, yr, prefix; + dp = Item[variable]; + if ("undefined" === typeof dp) { + dp = {"date-parts": [[0]] }; + if (!dp.year) { + state.tmp.empty_date = true; + } + } + if ("undefined" === typeof this.dateparts) { + this.dateparts = ["year", "month", "day"]; + } + if (dp.raw) { + dp = state.fun.dateparser.parse(dp.raw); + } else if (dp["date-parts"]) { + dp = state.dateParseArray(dp); + } + if ("undefined" === typeof dp) { + dp = {}; + } + len = CSL.DATE_PARTS_INTERNAL.length; + for (pos = 0; pos < len; pos += 1) { + elem = CSL.DATE_PARTS_INTERNAL[pos]; + value = 0; + e = elem; + if (e.slice(-4) === "_end") { + e = e.slice(0, -4); + } + if (dp[elem] && this.dateparts.indexOf(e) > -1) { + value = dp[elem]; + } + if (elem.slice(0, 4) === "year") { + yr = CSL.Util.Dates[e].numeric(state, value); + prefix = "Y"; + if (yr[0] === "-") { + prefix = "X"; + yr = yr.slice(1); + yr = 9999 - parseInt(yr, 10); + } + state.output.append(CSL.Util.Dates[elem.slice(0, 4)].numeric(state, (prefix + yr))); + } else { + state.output.append(CSL.Util.Dates[e]["numeric-leading-zeros"](state, value)); + } + } + }; + } else if ("title" === variable) { + state.transform.init("empty", "title"); + state.transform.setTransformLocale("locale-sort"); + state.transform.setTransformFallback(true); + func = state.transform.getOutputFunction(); + } else { + func = function (state, Item) { + var varval = Item[variable]; + state.output.append(varval, "empty"); + }; + } + single_text.execs.push(func); + target.push(single_text); + } + } else { // macro + token = new CSL.Token("text", CSL.SINGLETON); + token.postponed_macro = this.postponed_macro; + tlen = target.length; + keypos = false; + CSL.expandMacro.call(state, token); + len = target.slice(tlen).length; + for (pos = 0; pos < len; pos += 1) { + tok = target.slice(tlen)[pos]; + if (tok && tok.name === "text" && tok.dateparts) { + keypos = pos; + break; + } + } + if (keypos) { + saveme = target[(parseInt(keypos, 10) + parseInt(tlen, 10))]; + len = target.length - 1; + for (pos = len; pos > tlen; pos += -1) { + target.pop(); + } + target.push(saveme); + gtok = new CSL.Token("group", CSL.END); + target.push(gtok); + } + } + end_key = new CSL.Token("key", CSL.END); + func = function (state, Item) { + var keystring = state.output.string(state, state.output.queue); + if ("string" !== typeof keystring || state.tmp.empty_date) { + keystring = undefined; + state.tmp.empty_date = false; + } + state[state.tmp.area].keys.push(keystring); + state.tmp.value = []; + }; + end_key.execs.push(func); + func = function (state, Item) { + state.tmp["et-al-min"] = false; + state.tmp["et-al-use-first"] = false; + state.tmp.sort_key_flag = false; + }; + end_key.execs.push(func); + target.push(end_key); + } +}; +CSL.Node.label = { + build: function (state, target) { + var func, term, plural, form, debug; + debug = false; + if (state.build.name_flag) { + this.strings.label_position = CSL.AFTER; + } else { + this.strings.label_position = CSL.BEFORE; + } + func = function (state, Item) { + state.output.addToken("label", false, this); + }; + this.execs.push(func); + if (state.build.term) { + term = state.build.term; + plural = 0; + if (!this.strings.form) { + this.strings.form = "long"; + } + form = this.strings.form; + if ("number" === typeof this.strings.plural) { + plural = this.strings.plural; + } + func = function (state, Item, item) { + var myterm; + if ("locator" === term) { + if (item && item.label) { + myterm = item.label; + } + } + if (!myterm) { + myterm = "page"; + } + myterm = state.getTerm(myterm, form, plural); + if (this.strings["include-period"]) { + myterm += "."; + } + state.output.append(myterm, this); + }; + this.execs.push(func); + state.build.plural = false; + state.build.term = false; + state.build.form = false; + } + target.push(this); + } +}; +CSL.Node.layout = { + build: function (state, target) { + var func, prefix_token, suffix_token; + if (this.tokentype === CSL.START) { + state.build.layout_flag = true; + state[state.tmp.area].opt.topdecor = [this.decorations]; + state[(state.tmp.area + "_sort")].opt.topdecor = [this.decorations]; + func = function (state, Item) { + state.tmp.done_vars = []; + state.tmp.rendered_name = false; + }; + this.execs.push(func); + func = function (state, Item) { + state.tmp.sort_key_flag = false; + state[state.tmp.area].opt.delimiter = ""; + if (this.strings.delimiter) { + state[state.tmp.area].opt.delimiter = this.strings.delimiter; + } + }; + this.execs.push(func); + func = function (state, Item) { + state.tmp.nameset_counter = 0; + }; + this.execs.push(func); + state[state.build.area].opt.layout_prefix = this.strings.prefix; + state[state.build.area].opt.layout_suffix = this.strings.suffix; + state[state.build.area].opt.layout_delimiter = this.strings.delimiter; + state[state.build.area].opt.layout_decorations = this.decorations; + func = function (state, Item) { + state.output.openLevel("empty"); + }; + this.execs.push(func); + target.push(this); + if (state.build.area === "citation") { + prefix_token = new CSL.Token("text", CSL.SINGLETON); + func = function (state, Item, item) { + var sp; + if (item && item.prefix) { + sp = ""; + if (item.prefix.match(CSL.ROMANESQUE_REGEXP)) { + sp = " "; + } + state.output.append((item.prefix + sp), this); + } + }; + prefix_token.execs.push(func); + target.push(prefix_token); + } + } + if (this.tokentype === CSL.END) { + state.build.layout_flag = false; + if (state.build.area === "citation") { + suffix_token = new CSL.Token("text", CSL.SINGLETON); + func = function (state, Item, item) { + var sp; + if (item && item.suffix) { + sp = ""; + if (item.suffix.match(CSL.ROMANESQUE_REGEXP)) { + sp = " "; + } + state.output.append((sp + item.suffix), this); + } + }; + suffix_token.execs.push(func); + target.push(suffix_token); + } + func = function (state, Item) { + if (state.tmp.area === "bibliography") { + if (state.bibliography.opt["second-field-align"]) { + state.output.endTag(); + } + } + state.output.closeLevel(); + }; + this.execs.push(func); + target.push(this); + } + } +}; +CSL.Node.macro = { + build: function (state, target) {} +}; +CSL.Node.name = { + build: function (state, target) { + var func, pos, len, attrname; + if ([CSL.SINGLETON, CSL.START].indexOf(this.tokentype) > -1) { + state.fixOpt(this, "name-delimiter", "delimiter"); + state.fixOpt(this, "name-form", "form"); + state.fixOpt(this, "and", "and"); + state.fixOpt(this, "delimiter-precedes-last", "delimiter-precedes-last"); + state.fixOpt(this, "initialize-with", "initialize-with"); + state.fixOpt(this, "name-as-sort-order", "name-as-sort-order"); + state.fixOpt(this, "sort-separator", "sort-separator"); + state.fixOpt(this, "et-al-min", "et-al-min"); + state.fixOpt(this, "et-al-use-first", "et-al-use-first"); + state.fixOpt(this, "et-al-subsequent-min", "et-al-subsequent-min"); + state.fixOpt(this, "et-al-subsequent-use-first", "et-al-subsequent-use-first"); + state.build.nameattrs = {}; + len = CSL.NAME_ATTRIBUTES.length; + for (pos = 0; pos < len; pos += 1) { + attrname = CSL.NAME_ATTRIBUTES[pos]; + state.build.nameattrs[attrname] = this.strings[attrname]; + } + state.build.form = this.strings.form; + state.build.name_flag = true; + func = function (state, Item, item) { + if ("undefined" === typeof item) { + item = {}; + } + if (item.position) { + if (! state.tmp["et-al-min"]) { + if (this.strings["et-al-subsequent-min"]) { + state.tmp["et-al-min"] = this.strings["et-al-subsequent-min"]; + } else { + state.tmp["et-al-min"] = this.strings["et-al-min"]; + } + } + if (! state.tmp["et-al-use-first"]) { + if (this.strings["et-al-subsequent-use-first"]) { + state.tmp["et-al-use-first"] = this.strings["et-al-subsequent-use-first"]; + } else { + state.tmp["et-al-use-first"] = this.strings["et-al-use-first"]; + } + } + } else { + if (! state.tmp["et-al-min"]) { + state.tmp["et-al-min"] = this.strings["et-al-min"]; + } + if (! state.tmp["et-al-use-first"]) { + state.tmp["et-al-use-first"] = this.strings["et-al-use-first"]; + } + } + }; + this.execs.push(func); + func = function (state, Item) { + state.output.addToken("name", false, this); + }; + this.execs.push(func); + } + target.push(this); + } +}; +CSL.Node["name-part"] = { + build: function (state, target) { + var func; + func = function (state, Item) { + state.output.addToken(this.strings.name, false, this); + }; + this.execs.push(func); + target.push(this); + } +}; +CSL.Node.names = { + build: function (state, target) { + var debug, func, len, pos, attrname; + debug = false; + if (this.tokentype === CSL.START || this.tokentype === CSL.SINGLETON) { + CSL.Util.substituteStart.call(this, state, target); + state.build.substitute_level.push(1); + state.fixOpt(this, "names-delimiter", "delimiter"); + func = function (state, Item, item) { + var namesets, nameset, names, rawlist, after_people_set, pers_seen, in_orgs, last_type, name, len, pos, variable, rawvar, llen, ppos, lllen, pppos, lllst, end, mynameset, tnamesets, frontnames, pair, offset, swaplist; + state.parallel.StartVariable("names"); + if (state.tmp.value.length === 0) { + namesets = []; + len = this.variables.length; + if (len && state.opt.xclass === "in-text") { + len = 1; + } + for (pos = 0; pos < len; pos += 1) { + variable = this.variables[pos]; + if (Item[variable]) { + rawvar = Item[variable]; + if ("string" === typeof Item[variable]) { + rawvar = [{literal: Item[variable]}]; + } + rawlist = state.getNameSubFields(rawvar); + names = []; + tnamesets = []; + nameset = {names: []}; + frontnames = []; + llen = rawlist.length; + for (ppos = 0; ppos < llen; ppos += 1) { + name = rawlist[ppos]; + if (name.literal) { + nameset.variable = variable; + nameset.species = "org"; + if (name.literal.slice(0, 1) === '"' && name.literal.slice(-1)) { + lllst = [name.literal.slice(1, -1)]; + } else { + lllst = name.literal.split(/,\s+/); + } + lllen = lllst.length; + for (pppos = 0; pppos < lllen; pppos += 1) { + name = {literal: lllst[pppos]}; + nameset.names.push(name); + } + tnamesets.push(nameset); + nameset = {names: []}; + } else { + nameset.variable = variable; + nameset.species = "pers"; + nameset.names.push(name); + if (rawlist.length === (ppos + 1) || rawlist[ppos + 1].literal) { + tnamesets.push(nameset); + nameset = {names: []}; + } + } + } + if (tnamesets.length > 1 && tnamesets.slice(-1)[0].species === "pers") { + frontnames = tnamesets.slice(-1); + tnamesets = tnamesets.slice(0, tnamesets.length - 1); + if (tnamesets.length > 0) { + tnamesets[0].after_people = true; + } + } else { + frontnames = []; + } + if (tnamesets.length > 0 && tnamesets.slice(-1)[0].species === "org" && !(state.opt.xclass === "in-text" && state.tmp.area.slice(0, 8) === "citation")) { + tnamesets[0].organization_first = true; + tnamesets.slice(-1)[0].organization_last = true; + if (frontnames.length) { + frontnames[0].free_agent_start = true; + tnamesets.slice(-1)[0].free_agent_end = true; + } + } + if (frontnames.length === 0) { + if (tnamesets.length > 1) { + if (tnamesets[0].species === "pers") { + tnamesets[1].trailers1_start = true; + if (tnamesets.length === 2) { + tnamesets[1].trailers1a_end = true; + } else { + tnamesets[1].trailers1b_end = true; + } + if (tnamesets.length > 2) { + tnamesets[2].trailers2_start = true; + tnamesets.slice(-1)[0].trailers2_end = true; + } + } else { + tnamesets[1].trailers2_start = true; + tnamesets.slice(-1)[0].trailers2_end = true; + } + } + } else { + tnamesets[0].trailers3_start = true; + tnamesets.slice(-1)[0].trailers3_end = true; + } + tnamesets = frontnames.concat(tnamesets); + namesets = namesets.concat(tnamesets); + } + } + if ((state.opt.xclass === "in-text" && state.tmp.area.slice(0, 8) === "citation") || (state.opt.xclass === "note" && item && "number" === typeof item.position && item.position !== CSL.POSITION_FIRST)) { + namesets = namesets.slice(0, 1); + if (namesets.length) { + if (namesets[0].species === "pers") { + namesets[0].organization_first = false; + namesets[0].after_people = false; + namesets[0].free_agent_start = false; + namesets[0].free_agent_end = false; + } else { + namesets[0].organization_last = true; + } + } + } + len = namesets.length; + for (pos = 0; pos < len; pos += 1) { + state.tmp.names_max.push(namesets[pos].names.length); + state.tmp.names_used.push(namesets[pos]); + } + state.tmp.value = namesets.slice(); + } + }; + this.execs.push(func); + } + if (this.tokentype === CSL.START) { + state.build.names_flag = true; + func = function (state, Item) { + state.tmp.can_substitute.push(true); + }; + this.execs.push(func); + func = function (state, Item) { + state.output.startTag("names", this); + state.tmp.name_node = state.output.current.value(); + }; + this.execs.push(func); + } + if (this.tokentype === CSL.END) { + len = CSL.NAME_ATTRIBUTES.length; + for (pos = 0; pos < len; pos += 1) { + attrname = CSL.NAME_ATTRIBUTES[pos]; + if (attrname.slice(0, 5) === "et-al") { + continue; + } + if ("undefined" !== typeof state.build.nameattrs[attrname]) { + this.strings[attrname] = state.build.nameattrs[attrname]; + delete state.build.nameattrs[attrname]; + } + } + func = function (state, Item, item) { + var common_term, nameset, name, local_count, withtoken, namesetIndex, lastones, currentones, compset, display_names, suppress_min, suppress_condition, sane, discretionary_names_length, overlength, et_al, and_term, outer_and_term, use_first, append_last, delim, param, paramx, val, s, myform, myinitials, termname, form, namepart, namesets, llen, ppos, label, plural, last_variable, cutinfo, cut_var, obj, et_al_pers, et_al_org, and_pers, and_org, with_term, chk; + namesets = []; + common_term = CSL.Util.Names.getCommonTerm(state, state.tmp.value); + if (common_term) { + namesets = state.tmp.value.slice(0, 1); + } else { + namesets = state.tmp.value; + } + len = namesets.length; + if (namesets.length && (state.tmp.area === "bibliography" || (state.tmp.area && state.opt.xclass === "note"))) { + cut_var = namesets[0].variable; + cutinfo = state.tmp.names_cut; + if (namesets[0].species === "pers") { + namesets[0].names = namesets[0].names.slice(cutinfo.counts[cut_var]); + if (namesets[0].names.length === 0) { + if (namesets[0].free_agent_start) { + namesets[1].free_agent_start = true; + } + if (namesets[0].organization_first) { + namesets[1].organization_first = true; + } + namesets = namesets.slice(1); + } + } else { + namesets = namesets.slice(0, 1); + if (namesets[0].organization_first) { + namesets[0].organization_last = true; + } + } + if (cutinfo.used === cut_var) { + llen = cutinfo.variable[cut_var].length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + obj = cutinfo.variable[cut_var][ppos]; + obj[0].blobs = obj[0].blobs.slice(0, obj[1]).concat(obj[0].blobs.slice(obj[1] + 1)); + } + } + } + len = namesets.length; + for (pos = 0; pos < len; pos += 1) { + nameset = namesets[pos]; + if ("org" === nameset.species) { + if (state.output.getToken("institution").strings["reverse-order"]) { + nameset.names.reverse(); + } + } + llen = nameset.names.length; + for (ppos = 0; ppos < llen; ppos += 1) { + name = nameset.names[ppos]; + if (name["parse-names"]) { + state.parseName(name); + } + if (name.family && name.family.length && name.family.slice(0, 1) === '"' && name.family.slice(-1)) { + name.family = name.family.slice(1, -1); + } + } + } + local_count = 0; + nameset = {}; + state.output.addToken("term-join"); + state.output.addToken("etal-join"); + state.output.addToken("space", " "); + state.output.addToken("sortsep", state.output.getToken("name").strings["sort-separator"]); + state.output.addToken("suffixsep", " "); + if (!state.output.getToken("et-al-pers")) { + state.output.addToken("et-al-pers"); + } + state.output.getToken("et-al-pers").strings["prefix-single"] = " "; + state.output.getToken("et-al-pers").strings["prefix-multiple"] = ", "; + et_al_pers = state.getTerm("et-al", "long", 0); + if ("undefined" !== typeof state.output.getToken("et-al-pers").strings.term) { + et_al_pers = state.output.getToken("et-al-pers").strings.term; + } + if (!state.output.getToken("et-al-org")) { + state.output.addToken("et-al-org"); + } + state.output.getToken("et-al-org").strings["prefix-single"] = " "; + state.output.getToken("et-al-org").strings["prefix-multiple"] = ", "; + et_al_org = state.getTerm("et-al", "long", 0); + if (!state.output.getToken("and-pers")) { + state.output.addToken("and-pers"); + } + state.output.getToken("and-pers").strings["prefix-single"] = " "; + state.output.getToken("and-pers").strings["prefix-multiple"] = ", "; + and_pers = state.getTerm("and", "long", 0); + if (!state.output.getToken("and-org")) { + state.output.addToken("and-org"); + } + state.output.getToken("and-org").strings["prefix-single"] = " "; + state.output.getToken("and-org").strings["prefix-multiple"] = ", "; + and_org = state.getTerm("and", "long", 0); + state.output.addToken("with"); + state.output.getToken("with").strings.prefix = ", "; + state.output.getToken("with").strings.suffix = " "; + with_term = "with"; + state.output.addToken("trailing-names"); + outer_and_term = " " + state.output.getToken("name").strings.and + " "; + state.output.addToken("institution-outer", outer_and_term); + if (!state.output.getToken("label")) { + state.output.addToken("label"); + } + delim = state.output.getToken("name").strings.delimiter; + state.output.addToken("inner", delim); + state.output.addToken("commasep", ", "); + len = CSL.DECORABLE_NAME_PARTS.length; + for (pos = 0; pos < len; pos += 1) { + namepart = CSL.DECORABLE_NAME_PARTS[pos]; + if (!state.output.getToken(namepart)) { + state.output.addToken(namepart); + } + } + state.output.addToken("dropping-particle", false, state.output.getToken("family")); + state.output.addToken("non-dropping-particle", false, state.output.getToken("family")); + state.output.addToken("suffix", false, state.output.getToken("family")); + state.output.openLevel("term-join"); + if (label && state.output.getToken("label").strings.label_position === CSL.BEFORE) { + state.output.append(label, "label"); + } + len = namesets.length; + for (namesetIndex = 0; namesetIndex < len; namesetIndex += 1) { + nameset = namesets[namesetIndex]; + if (!state.tmp.suppress_decorations && (state[state.tmp.area].opt.collapse === "year" || state[state.tmp.area].opt.collapse === "year-suffix" || state[state.tmp.area].opt.collapse === "year-suffix-ranged")) { + if (state.tmp.last_names_used.length === state.tmp.names_used.length) { + lastones = state.tmp.last_names_used[state.tmp.nameset_counter]; + currentones = state.tmp.names_used[state.tmp.nameset_counter]; + compset = [currentones, lastones]; + if (CSL.Util.Names.getCommonTerm(state, compset)) { + continue; + } else { + state.tmp.have_collapsed = false; + } + } + } + if (!state.tmp.disambig_request) { + state.tmp.disambig_settings.givens[state.tmp.nameset_counter] = []; + } + display_names = nameset.names.slice(); + if ("pers" === nameset.species) { + suppress_min = state.output.getToken("name").strings["suppress-min"]; + if (namesetIndex === 0 && !suppress_min && (state.tmp.area === "bibliography" || (state.tmp.area === "citation" && state.opt.xclass === "note"))) { + state.tmp.names_cut.counts[nameset.variable] = state.tmp["et-al-use-first"]; + } + sane = state.tmp["et-al-min"] >= state.tmp["et-al-use-first"]; + discretionary_names_length = state.tmp["et-al-min"]; + suppress_condition = suppress_min && display_names.length >= suppress_min; + if (suppress_condition) { + continue; + } + if (state.tmp.suppress_decorations) { + if (state.tmp.disambig_request) { + discretionary_names_length = state.tmp.disambig_request.names[state.tmp.nameset_counter]; + } else if (display_names.length >= state.tmp["et-al-min"]) { + discretionary_names_length = state.tmp["et-al-use-first"]; + } + } else { + if (state.tmp.disambig_request && state.tmp["et-al-use-first"] < state.tmp.disambig_request.names[state.tmp.nameset_counter]) { + discretionary_names_length = state.tmp.disambig_request.names[state.tmp.nameset_counter]; + } else if (display_names.length >= state.tmp["et-al-min"]) { + discretionary_names_length = state.tmp["et-al-use-first"]; + } + } + overlength = display_names.length > discretionary_names_length; + et_al = false; + and_term = ""; + if (sane && overlength) { + if (! state.tmp.sort_key_flag) { + et_al = et_al_pers; + if (discretionary_names_length > 1) { + state.output.getToken("et-al-pers").strings.prefix = state.output.getToken("et-al-pers").strings["prefix-multiple"]; + } else { + state.output.getToken("et-al-pers").strings.prefix = state.output.getToken("et-al-pers").strings["prefix-single"]; + } + } + display_names = display_names.slice(0, discretionary_names_length); + } else { + if (state.output.getToken("name").strings.and && ! state.tmp.sort_key_flag && display_names.length > 1) { + and_term = state.output.getToken("name").strings.and; + } + } + state.output.formats.value().name.strings.delimiter = and_term; + } else { + if (namesetIndex === 0 && (state.tmp.area === "bibliography" || (state.tmp.area === "citation" && state.opt.xclass === "note"))) { + state.tmp.names_cut.counts[nameset.variable] = 1; + } + use_first = state.output.getToken("institution").strings["use-first"]; + if (!use_first && namesetIndex === 0) { + use_first = state.output.getToken("institution").strings["substitute-use-first"]; + } + if (!use_first) { + use_first = 0; + } + append_last = state.output.getToken("institution").strings["use-last"]; + if (use_first || append_last) { + s = display_names.slice(); + display_names = []; + display_names = s.slice(0, use_first); + s = s.slice(use_first); + if (append_last) { + if (append_last > s.length) { + append_last = s.length; + } + if (append_last) { + display_names = display_names.concat(s.slice((s.length - append_last))); + } + } + } + } + state.tmp.disambig_settings.names[state.tmp.nameset_counter] = display_names.length; + local_count += display_names.length; + llen = nameset.names.length; + for (ppos = 0; ppos < llen; ppos += 1) { + state.registry.namereg.addname(Item.id, nameset.names[ppos], ppos); + chk = state.tmp.disambig_settings.givens[state.tmp.nameset_counter]; + if ("undefined" === typeof chk) { + state.tmp.disambig_settings.givens.push([]); + } + chk = state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos]; + if ("undefined" === typeof chk) { + myform = state.output.getToken("name").strings.form; + myinitials = this.strings["initialize-with"]; + param = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, 0, myform, myinitials); + state.tmp.disambig_settings.givens[state.tmp.nameset_counter].push(param); + } + myform = state.output.getToken("name").strings.form; + myinitials = this.strings["initialize-with"]; + paramx = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, 0, myform, myinitials); + if (state.tmp.sort_key_flag) { + state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos] = 2; + param = 2; + } else if (state.tmp.disambig_request) { + val = state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos]; + if (val === 1 && "undefined" === typeof this.strings["initialize-with"]) { + val = 2; + } + param = val; + if (state[state.tmp.area].opt["disambiguate-add-givenname"]) { + param = state.registry.namereg.evalname(Item.id, nameset.names[ppos], ppos, param, state.output.getToken("name").strings.form, this.strings["initialize-with"]); + } + } else { + param = paramx; + } + if (!state.tmp.just_looking && item && item.position === CSL.POSITION_FIRST) { + state.tmp.disambig_restore = CSL.cloneAmbigConfig(state.tmp.disambig_settings); + param = paramx; + } + state.tmp.disambig_settings.givens[state.tmp.nameset_counter][ppos] = param; + } + label = false; + if (state.output.getToken("label").strings.label_position) { + if (common_term) { + termname = common_term; + } else { + termname = nameset.variable; + } + if (!state.output.getToken("label").strings.form) { + form = "long"; + } else { + form = state.output.getToken("label").strings.form; + } + if ("number" === typeof state.output.getToken("label").strings.plural) { + plural = state.output.getToken("label").strings.plural; + } else if (nameset.names.length > 1) { + plural = 1; + } else { + plural = 0; + } + label = state.getTerm(termname, form, plural); + } + if (namesetIndex > 0 && nameset.variable !== last_variable) { + state.output.closeLevel("term-join"); + } + if (namesetIndex > 0 && nameset.variable !== last_variable) { + state.output.openLevel("term-join"); + } + if (nameset.trailers3_start) { + state.output.openLevel("trailing-names", cut_var); + } + if (nameset.after_people) { + state.output.append("with", "with"); + } + if (nameset.organization_first) { + state.output.openLevel("institution-outer"); + } + if (nameset.trailers2_start) { + state.output.openLevel("trailing-names", cut_var); + } + if (nameset.organization_first) { + state.output.openLevel("inner"); + } + if (nameset.trailers1_start) { + state.output.openLevel("trailing-names", cut_var); + } + if (nameset.species === "pers") { + state.output.openLevel("etal-join"); // join for etal + CSL.Util.Names.outputNames(state, display_names); + if (et_al) { + state.output.append(et_al, "et-al-pers"); + } + state.output.closeLevel("etal-join"); // etal + } else { + CSL.Util.Institutions.outputInstitutions(state, display_names); + if (nameset.organization_last) { + if (nameset.trailers1a_end) { + state.output.closeLevel("trailing-names"); + } + state.output.closeLevel("inner"); + if (nameset.trailers2_end) { + state.output.closeLevel("trailing-names"); + } + state.output.closeLevel("institution-outer"); + } else { + if (nameset.trailers1b_end) { + state.output.closeLevel("trailing-names"); + } + state.output.closeLevel("inner"); + state.output.openLevel("inner"); + } + } + if (nameset.trailers3_end) { + state.output.closeLevel("trailing-names"); + } + if (namesets.length === namesetIndex + 1 || namesets[namesetIndex + 1].variable !== namesets[namesetIndex].variable) { + if (label && state.tmp.name_label_position !== CSL.BEFORE) { + state.output.append(label, "label"); + } + } + state.tmp.nameset_counter += 1; + last_variable = nameset.variable; + } + state.output.closeLevel("term-join"); + if (state.output.getToken("name").strings.form === "count") { + state.output.clearlevel(); + state.output.append(local_count.toString()); + state.tmp["et-al-min"] = false; + state.tmp["et-al-use-first"] = false; + } + }; + this.execs.push(func); + } + if (this.tokentype === CSL.END) { + func = function (state, Item) { + if (!state.tmp.can_substitute.pop()) { + state.tmp.can_substitute.replace(false, CSL.LITERAL); + } + CSL.Util.Names.reinit(state, Item); + state.output.endTag(); + state.parallel.CloseVariable("names"); + state.tmp["has-institution"] = false; + state.tmp["has-first-person"] = false; + state.tmp["et-al-min"] = false; + state.tmp["et-al-use-first"] = false; + state.tmp.can_block_substitute = false; + }; + this.execs.push(func); + state.build.names_flag = false; + state.build.name_flag = false; + } + target.push(this); + if (this.tokentype === CSL.END || this.tokentype === CSL.SINGLETON) { + state.build.substitute_level.pop(); + CSL.Util.substituteEnd.call(this, state, target); + } + }, + configure: function (state, pos) { + if ([CSL.SINGLETON, CSL.START].indexOf(this.tokentype) > -1) { + if (state.build.has_institution) { + this.strings["has-institution"] = true; + state.build.has_institution = false; + } + } + } +}; +CSL.Node.number = { + build: function (state, target) { + var func; + CSL.Util.substituteStart.call(this, state, target); + if (this.strings.form === "roman") { + this.formatter = state.fun.romanizer; + } else if (this.strings.form === "ordinal") { + this.formatter = state.fun.ordinalizer; + } else if (this.strings.form === "long-ordinal") { + this.formatter = state.fun.long_ordinalizer; + } + if ("undefined" === typeof this.successor_prefix) { + this.successor_prefix = state[state.tmp.area].opt.layout_delimiter; + } + func = function (state, Item) { + var varname, num, number, m; + varname = this.variables[0]; + state.parallel.StartVariable(this.variables[0]); + state.parallel.AppendToVariable(Item[this.variables[0]]); + if (varname === "page-range" || varname === "page-first") { + varname = "page"; + } + num = Item[varname]; + if ("undefined" !== typeof num) { + if (this.variables[0] === "page-first") { + m = num.split(/\s*(?:&|,|-)\s*/); + num = m[0]; + } + m = num.match(/\s*([0-9]+)/); + if (m) { + num = parseInt(m[1], 10); + number = new CSL.NumericBlob(num, this); + state.output.append(number, "literal"); + } else { + state.output.append(num, this); + } + } + state.parallel.CloseVariable("number"); + }; + this.execs.push(func); + target.push(this); + CSL.Util.substituteEnd.call(this, state, target); + } +}; +CSL.Node.sort = { + build: function (state, target) { + if (this.tokentype === CSL.START) { + if (state.build.area === "citation") { + state.parallel.use_parallels = false; + } + state.build.sort_flag = true; + state.build.area_return = state.build.area; + state.build.area = state.build.area + "_sort"; + } + if (this.tokentype === CSL.END) { + state.build.area = state.build.area_return; + state.build.sort_flag = false; + } + } +}; +CSL.Node.substitute = { + build: function (state, target) { + var func; + if (this.tokentype === CSL.START) { + func = function (state, Item) { + state.tmp.can_block_substitute = true; + if (state.tmp.value.length) { + state.tmp.can_substitute.replace(false, CSL.LITERAL); + } + }; + this.execs.push(func); + } + target.push(this); + } +}; +CSL.Node.text = { + build: function (state, target) { + var variable, func, form, plural, id, num, number, formatter, firstoutput, specialdelimiter, label, myname, names, name, year, suffix, term, dp, len, pos, n, m, value, flag; + CSL.Util.substituteStart.call(this, state, target); + if (this.postponed_macro) { + CSL.expandMacro.call(state, this); + } else { + variable = this.variables[0]; + form = "long"; + plural = 0; + if (this.strings.form) { + form = this.strings.form; + } + if (this.strings.plural) { + plural = this.strings.plural; + } + if ("citation-number" === variable || "year-suffix" === variable || "citation-label" === variable) { + if (variable === "citation-number") { + state.opt.update_mode = CSL.NUMERIC; + if ("citation-number" === state[state.tmp.area].opt.collapse) { + this.range_prefix = "-"; + } + this.successor_prefix = state[state.build.area].opt.layout_delimiter; + func = function (state, Item, item) { + id = Item.id; + if (!state.tmp.just_looking) { + if (item && item["author-only"]) { + state.tmp.element_trace.replace("do-not-suppress-me"); + term = CSL.Output.Formatters["capitalize-first"](state, state.getTerm("reference", "long", "singular")); + state.output.append(term + " "); + state.tmp.last_element_trace = true; + } + if (item && item["suppress-author"]) { + if (state.tmp.last_element_trace) { + state.tmp.element_trace.replace("suppress-me"); + } + state.tmp.last_element_trace = false; + } + num = state.registry.registry[id].seq; + number = new CSL.NumericBlob(num, this); + state.output.append(number, "literal"); + } + }; + this.execs.push(func); + } else if (variable === "year-suffix") { + state.opt.has_year_suffix = true; + if (state[state.tmp.area].opt.collapse === "year-suffix-ranged") { + this.range_prefix = "-"; + } + if (state[state.tmp.area].opt["year-suffix-delimiter"]) { + this.successor_prefix = state[state.build.area].opt["year-suffix-delimiter"]; + } + func = function (state, Item) { + if (state.registry.registry[Item.id] && state.registry.registry[Item.id].disambig[2]) { + num = parseInt(state.registry.registry[Item.id].disambig[2], 10); + number = new CSL.NumericBlob(num, this); + formatter = new CSL.Util.Suffixator(CSL.SUFFIX_CHARS); + number.setFormatter(formatter); + state.output.append(number, "literal"); + firstoutput = false; + len = state.tmp.term_sibling.mystack.length; + for (pos = 0; pos < len; pos += 1) { + flag = state.tmp.term_sibling.mystack[pos]; + if (!flag[2] && (flag[1] || (!flag[1] && !flag[0]))) { + firstoutput = true; + break; + } + } + specialdelimiter = state[state.tmp.area].opt["year-suffix-delimiter"]; + if (firstoutput && specialdelimiter && !state.tmp.sort_key_flag) { + state.tmp.splice_delimiter = state[state.tmp.area].opt["year-suffix-delimiter"]; + } + } + }; + this.execs.push(func); + } else if (variable === "citation-label") { + state.opt.has_year_suffix = true; + func = function (state, Item) { + label = Item["citation-label"]; + if (!label) { + myname = state.getTerm("reference", "short", 0); + len = CSL.CREATORS.length; + for (pos = 0; pos < len; pos += 1) { + n = CSL.CREATORS[pos]; + if (Item[n]) { + names = Item[n]; + if (names && names.length) { + name = names[0]; + } + if (name && name.family) { + myname = name.family.replace(/\s+/, ""); + } else if (name && name.literal) { + myname = name.literal; + m = myname.toLowerCase().match(/^(a|the|an\s+)/, ""); + if (m) { + myname = myname.slice(m[1].length); + } + } + } + } + year = "0000"; + if (Item.issued) { + dp = Item.issued["date-parts"]; + if (dp && dp[0] && dp[0][0]) { + year = "" + dp[0][0]; + } + } + label = myname + year; + } + suffix = ""; + if (state.registry.registry[Item.id] && state.registry.registry[Item.id].disambig[2]) { + num = parseInt(state.registry.registry[Item.id].disambig[2], 10); + suffix = state.fun.suffixator.format(num); + } + label += suffix; + state.output.append(label, this); + }; + this.execs.push(func); + } + } else { + if (state.build.term) { + term = state.build.term; + term = state.getTerm(term, form, plural); + if (this.strings["strip-periods"]) { + term = term.replace(/\./g, ""); + } + func = function (state, Item) { + var myterm; + if (term !== "") { + flag = state.tmp.term_sibling.value(); + flag[0] = true; + state.tmp.term_sibling.replace(flag); + } + if (!state.tmp.term_predecessor) { + myterm = CSL.Output.Formatters["capitalize-first"](state, term); + } else { + myterm = term; + } + state.output.append(myterm, this); + }; + this.execs.push(func); + state.build.term = false; + state.build.form = false; + state.build.plural = false; + } else if (this.variables.length) { + func = function (state, Item) { + state.parallel.StartVariable(this.variables[0]); + state.parallel.AppendToVariable(Item[this.variables[0]]); + }; + this.execs.push(func); + if (CSL.MULTI_FIELDS.indexOf(this.variables[0]) > -1) { + if (form === "short") { + state.transform.init(this, this.variables[0], this.variables[0]); + } else { + state.transform.init(this, this.variables[0]); + } + if (state.build.area.slice(-5) === "_sort") { + state.transform.setTransformLocale("locale-sort"); + state.transform.setTransformFallback(true); + func = state.transform.getOutputFunction(); + } else if (form === "short") { + state.transform.setAbbreviationFallback(true); + state.transform.setTransformLocale("locale-pri"); + state.transform.setTransformFallback(true); + if (this.variables[0] === "container-title") { + state.transform.setAlternativeVariableName("journalAbbreviation"); + } else if (["publisher", "publisher-place"].indexOf(this.variables[0]) > -1) { + state.transform.setTransformLocale("default-locale"); + } + func = state.transform.getOutputFunction(); + } else if (this.variables[0] === "title") { + state.transform.setTransformLocale("locale-sec"); + state.transform.setTransformFallback(true); + func = state.transform.getOutputFunction(); + } else { + state.transform.setTransformLocale("locale-pri"); + state.transform.setTransformFallback(true); + if (["publisher", "publisher-place"].indexOf(this.variables[0]) > -1) { + state.transform.setTransformLocale("default-locale"); + } + func = state.transform.getOutputFunction(); + } + } else { + if (CSL.CITE_FIELDS.indexOf(this.variables[0]) > -1) { + func = function (state, Item, item) { + if (item && item[this.variables[0]]) { + state.output.append(item[this.variables[0]], this); + } + }; + } else if (this.variables[0] === "page-first") { + func = function (state, Item) { + var idx, value; + value = state.getVariable(Item, "page", form); + if (value) { + idx = value.indexOf("-"); + if (idx > -1) { + value = value.slice(0, idx); + } + state.output.append(value, this); + } + }; + } else if (this.variables[0] === "page") { + func = function (state, Item) { + var value = state.getVariable(Item, "page", form); + if (value) { + value = state.fun.page_mangler(value); + state.output.append(value, this); + } + }; + } else { + func = function (state, Item) { + var value = state.getVariable(Item, this.variables[0], form); + if (value) { + state.output.append(value, this); + } + }; + } + } + this.execs.push(func); + func = function (state, Item) { + state.parallel.CloseVariable("text"); + }; + this.execs.push(func); + } else if (this.strings.value) { + func = function (state, Item) { + var flag; + flag = state.tmp.term_sibling.value(); + flag[0] = true; + state.tmp.term_sibling.replace(flag); + state.output.append(this.strings.value, this); + }; + this.execs.push(func); + } + } + target.push(this); + } + CSL.Util.substituteEnd.call(this, state, target); + } +}; +CSL.Attributes = {}; +CSL.Attributes["@class"] = function (state, arg) { + state.opt["class"] = arg; +}; +CSL.Attributes["@version"] = function (state, arg) { + state.opt.version = arg; +}; +CSL.Attributes["@value"] = function (state, arg) { + this.strings.value = arg; +}; +CSL.Attributes["@name"] = function (state, arg) { + this.strings.name = arg; +}; +CSL.Attributes["@form"] = function (state, arg) { + this.strings.form = arg; +}; +CSL.Attributes["@date-parts"] = function (state, arg) { + this.strings["date-parts"] = arg; +}; +CSL.Attributes["@range-delimiter"] = function (state, arg) { + this.strings["range-delimiter"] = arg; +}; +CSL.Attributes["@macro"] = function (state, arg) { + this.postponed_macro = arg; +}; +CSL.Attributes["@term"] = function (state, arg) { + if (this.name === "et-al") { + if (CSL.locale[state.opt.lang].terms[arg]) { + this.strings.term = state.getTerm(arg, "long", 0); + } else { + this.strings.term = arg; + } + } else { + state.build.term = arg; + } +}; +CSL.Attributes["@xmlns"] = function (state, arg) {}; +CSL.Attributes["@lang"] = function (state, arg) { + if (arg) { + state.build.lang = arg; + } +}; +CSL.Attributes["@type"] = function (state, arg) { + var types, ret, func, len, pos; + func = function (state, Item) { + types = arg.split(/\s+/); + ret = []; + len = types.length; + for (pos = 0; pos < len; pos += 1) { + ret.push(Item.type === types[pos]); + } + return ret; + }; + this.tests.push(func); +}; +CSL.Attributes["@variable"] = function (state, arg) { + var variables, pos, len, func, output, variable, varlen, needlen, ret, x, myitem, key, flag; + this.variables = arg.split(/\s+/); + if ("label" === this.name && this.variables[0]) { + state.build.term = this.variables[0]; + } else if (["names", "date", "text", "number"].indexOf(this.name) > -1) { + func = function (state, Item) { + variables = this.variables.slice(); + this.variables = []; + len = variables.length; + for (pos = 0; pos < len; pos += 1) { + if (state.tmp.done_vars.indexOf(variables[pos]) === -1) { + this.variables.push(variables[pos]); + } + if (state.tmp.can_block_substitute) { + state.tmp.done_vars.push(variables[pos]); + } + } + }; + this.execs.push(func); + func = function (state, Item, item) { + output = false; + len = this.variables.length; + for (pos = 0; pos < len; pos += 1) { + variable = this.variables[pos]; + if (CSL.DATE_VARIABLES.indexOf(variable) > -1) { + if (!Item[variable] || !Item[variable]['date-parts'] || !Item[variable]['date-parts'].length) { + output = true; + break; + } else if (this.dateparts && this.dateparts.length) { + varlen = Item[variable]['date-parts'][0].length; + needlen = 4; + if (this.dateparts.indexOf("year") > -1) { + needlen = 1; + } else if (this.dateparts.indexOf("month") > -1) { + needlen = 2; + } else if (this.dateparts.indexOf('day') > -1) { + needlen = 3; + } + if (varlen >= needlen) { + output = true; + break; + } + } + } else if ("locator" === variable) { + if (item && item.locator) { + output = true; + break; + } + } else if ("citation-number" === variable) { + output = true; + break; + } else if ("first-reference-note-number" === variable) { + if (item && item["first-reference-note-number"]) { + output = true; + break; + } + } else if ("object" === typeof Item[variable]) { + if (Item[variable].length) { + output = true; + break; + } + } else if ("string" === typeof Item[variable] && Item[variable]) { + output = true; + break; + } else if ("number" === typeof Item[variable]) { + output = true; + break; + } + if (output) { + break; + } + } + flag = state.tmp.term_sibling.value(); + if (output) { + flag[2] = true; + state.tmp.term_sibling.replace(flag); + state.tmp.can_substitute.replace(false, CSL.LITERAL); + } else { + flag[1] = true; + } + }; + this.execs.push(func); + } else if (["if", "else-if"].indexOf(this.name) > -1) { + func = function (state, Item, item) { + var key; + ret = []; + len = this.variables.length; + for (pos = 0; pos < len; pos += 1) { + variable = this.variables[pos]; + x = false; + myitem = Item; + if (item && ["locator", "first-reference-note-number"].indexOf(variable) > -1) { + myitem = item; + } + if (myitem[variable]) { + if ("number" === typeof myitem[variable] || "string" === typeof myitem[variable]) { + x = true; + } else if ("object" === typeof myitem[variable]) { + for (key in myitem[variable]) { + if (myitem[variable].hasOwnProperty(key)) { + x = true; + break; + } + } + } + } + ret.push(x); + } + return ret; + }; + this.tests.push(func); + } +}; +CSL.Attributes["@suffix"] = function (state, arg) { + this.strings.suffix = arg; +}; +CSL.Attributes["@prefix"] = function (state, arg) { + this.strings.prefix = arg; +}; +CSL.Attributes["@delimiter"] = function (state, arg) { + this.strings.delimiter = arg; +}; +CSL.Attributes["@match"] = function (state, arg) { + var evaluator; + if (this.tokentype === CSL.START) { + if ("none" === arg) { + evaluator = state.fun.match.none; + } else if ("any" === arg) { + evaluator = state.fun.match.any; + } else if ("all" === arg) { + evaluator = state.fun.match.all; + } else { + throw "Unknown match condition \"" + arg + "\" in @match"; + } + this.evaluator = evaluator; + } +}; +CSL.Attributes["@is-uncertain-date"] = function (state, arg) { + var variables, len, pos, func, variable, ret; + variables = arg.split(/\s+/); + len = variables.length; + func = function (state, Item) { + ret = []; + for (pos = 0; pos < len; pos += 1) { + variable = variables[pos]; + if (Item[variable] && Item[variable].circa) { + ret.push(true); + } else { + ret.push(false); + } + } + return ret; + }; + this.tests.push(func); +}; +CSL.Attributes["@is-numeric"] = function (state, arg) { + var variables, variable, func, val, pos, len, not_numeric_type, ret; + variables = arg.split(/\s+/); + len = variables.length; + func = function (state, Item) { + ret = []; + for (pos = 0; pos < len; pos += 1) { + variable = variables[pos]; + not_numeric_type = CSL.NUMERIC_VARIABLES.indexOf(variable) === -1; + val = Item[variable]; + if (typeof val === "number") { + val = val.toString(); + } + if (not_numeric_type) { + if (Item[variable] && ("" + Item[variable]).match(/[0-9]$/)) { + ret.push(true); + } else { + ret.push(false); + } + } else if (typeof val === "undefined") { + ret.push(false); + } else if (typeof val !== "string") { + ret.push(false); + } else if (val.match(CSL.QUOTED_REGEXP_START) && val.match(CSL.QUOTED_REGEXP_END)) { + ret.push(false); + } else if (val.match(CSL.NUMBER_REGEXP)) { + ret.push(true); + } else { + ret.push(false); + } + } + return ret; + }; + this.tests.push(func); +}; +CSL.Attributes["@names-min"] = function (state, arg) { + this.strings["et-al-min"] = parseInt(arg, 10); +}; +CSL.Attributes["@names-use-first"] = function (state, arg) { + this.strings["et-al-use-first"] = parseInt(arg, 10); +}; +CSL.Attributes["@sort"] = function (state, arg) { + if (arg === "descending") { + this.strings.sort_direction = CSL.DESCENDING; + } +}; +CSL.Attributes["@plural"] = function (state, arg) { + if ("always" === arg) { + this.strings.plural = 1; + } else if ("never" === arg) { + this.strings.plural = 0; + } +}; +CSL.Attributes["@locator"] = function (state, arg) { + var func; + if (["if", "else-if"].indexOf(this.name) > -1) { + func = function (state, Item, item) { + var label; + if ("undefined" === typeof item || !item.label) { + label = "page"; + } else { + label = item.label; + } + if (arg === label) { + return true; + } + return false; + }; + this.tests.push(func); + } +}; +CSL.Attributes["@newdate"] = function (state, arg) { +}; +CSL.Attributes["@position"] = function (state, arg) { + state.opt.update_mode = CSL.POSITION; + if (arg === "first") { + this.strings.position = CSL.POSITION_FIRST; + } else if (arg === "subsequent") { + this.strings.position = CSL.POSITION_SUBSEQUENT; + } else if (arg === "ibid") { + this.strings.position = CSL.POSITION_IBID; + } else if (arg === "ibid-with-locator") { + this.strings.position = CSL.POSITION_IBID_WITH_LOCATOR; + } else if (arg === "near-note") { + this.strings["near-note-distance-check"] = true; + } +}; +CSL.Attributes["@disambiguate"] = function (state, arg) { + if (this.tokentype === CSL.START && ["if", "else-if"].indexOf(this.name) > -1) { + if (arg === "true") { + state.opt.has_disambiguate = true; + var func = function (state, Item) { + if (state.tmp.disambig_settings.disambiguate) { + return true; + } + return false; + }; + this.tests.push(func); + } + } +}; +CSL.Attributes["@givenname-disambiguation-rule"] = function (state, arg) { + if (CSL.GIVENNAME_DISAMBIGUATION_RULES.indexOf(arg) > -1) { + state[this.name].opt["givenname-disambiguation-rule"] = arg; + } +}; +CSL.Attributes["@collapse"] = function (state, arg) { + if (arg) { + state[this.name].opt.collapse = arg; + } +}; +CSL.Attributes["@names-delimiter"] = function (state, arg) { + state.setOpt(this, "names-delimiter", arg); +}; +CSL.Attributes["@name-form"] = function (state, arg) { + state.setOpt(this, "name-form", arg); +}; +CSL.Attributes["@name-delimiter"] = function (state, arg) { + state.setOpt(this, "name-delimiter", arg); +}; +CSL.Attributes["@et-al-min"] = function (state, arg) { + state.setOpt(this, "et-al-min", parseInt(arg, 10)); +}; +CSL.Attributes["@et-al-use-first"] = function (state, arg) { + state.setOpt(this, "et-al-use-first", parseInt(arg, 10)); +}; +CSL.Attributes["@et-al-subsequent-min"] = function (state, arg) { + state.setOpt(this, "et-al-subsequent-min", parseInt(arg, 10)); +}; +CSL.Attributes["@et-al-subsequent-use-first"] = function (state, arg) { + state.setOpt(this, "et-al-subsequent-use-first", parseInt(arg, 10)); +}; +CSL.Attributes["@truncate-min"] = function (state, arg) { + this.strings["truncate-min"] = parseInt(arg, 10); +}; +CSL.Attributes["@suppress-min"] = function (state, arg) { + this.strings["suppress-min"] = parseInt(arg, 10); +}; +CSL.Attributes["@and"] = function (state, arg) { + var myarg, and; + myarg = "&"; + if ("text" === arg) { + and = state.getTerm("and", "long", 0); + myarg = and; + } + state.setOpt(this, "and", myarg); +}; +CSL.Attributes["@delimiter-precedes-last"] = function (state, arg) { + state.setOpt(this, "delimiter-precedes-last", arg); +}; +CSL.Attributes["@initialize-with"] = function (state, arg) { + state.setOpt(this, "initialize-with", arg); +}; +CSL.Attributes["@name-as-sort-order"] = function (state, arg) { + state.setOpt(this, "name-as-sort-order", arg); +}; +CSL.Attributes["@sort-separator"] = function (state, arg) { + state.setOpt(this, "sort-separator", arg); +}; +CSL.Attributes["@year-suffix-delimiter"] = function (state, arg) { + state[this.name].opt["year-suffix-delimiter"] = arg; +}; +CSL.Attributes["@after-collapse-delimiter"] = function (state, arg) { + state[this.name].opt["after-collapse-delimiter"] = arg; +}; +CSL.Attributes["@subsequent-author-substitute"] = function (state, arg) { + state[this.name].opt["subsequent-author-substitute"] = arg; +}; +CSL.Attributes["@disambiguate-add-names"] = function (state, arg) { + if (arg === "true") { + state[this.name].opt["disambiguate-add-names"] = true; + } +}; +CSL.Attributes["@disambiguate-add-givenname"] = function (state, arg) { + if (arg === "true") { + state[this.name].opt["disambiguate-add-givenname"] = true; + } +}; +CSL.Attributes["@disambiguate-add-year-suffix"] = function (state, arg) { + if (arg === "true") { + state[this.name].opt["disambiguate-add-year-suffix"] = true; + } +}; +CSL.Attributes["@second-field-align"] = function (state, arg) { + if (arg === "flush" || arg === "margin") { + state[this.name].opt["second-field-align"] = arg; + } +}; +CSL.Attributes["@hanging-indent"] = function (state, arg) { + if (arg === "true") { + state[this.name].opt.hangingindent = 2; + } +}; +CSL.Attributes["@line-spacing"] = function (state, arg) { + if (arg && arg.match(/^[.0-9]+$/)) { + state[this.name].opt["line-spacing"] = parseFloat(arg, 10); + } +}; +CSL.Attributes["@entry-spacing"] = function (state, arg) { + if (arg && arg.match(/^[.0-9]+$/)) { + state[this.name].opt["entry-spacing"] = parseFloat(arg, 10); + } +}; +CSL.Attributes["@near-note-distance"] = function (state, arg) { + state[this.name].opt["near-note-distance"] = parseInt(arg, 10); +}; +CSL.Attributes["@page-range-format"] = function (state, arg) { + state.opt["page-range-format"] = arg; +}; +CSL.Attributes["@text-case"] = function (state, arg) { + this.strings["text-case"] = arg; +}; +CSL.Attributes["@page-range-format"] = function (state, arg) { + state.opt["page-range-format"] = arg; +}; +CSL.Attributes["@default-locale"] = function (state, arg) { + var lst, len, pos, m, ret; + m = arg.match(/-x-(sort|pri|sec|name)-/g); + if (m) { + for (pos = 0, len = m.length; pos < len; pos += 1) { + m[pos] = m[pos].replace(/^-x-/, "").replace(/-$/, ""); + } + } + lst = arg.split(/-x-(?:sort|pri|sec|name)-/); + ret = [lst[0]]; + for (pos = 1, len = lst.length; pos < len; pos += 1) { + ret.push(m[pos - 1]); + ret.push(lst[pos]); + } + lst = ret.slice(); + len = lst.length; + for (pos = 1; pos < len; pos += 2) { + state.opt[("locale-" + lst[pos])].push(lst[(pos + 1)].replace(/^\s*/g, "").replace(/\s*$/g, "")); + } + if (lst.length) { + state.opt["default-locale"] = lst.slice(0, 1); + } else { + state.opt["default-locale"] = ["en"]; + } +}; +CSL.Attributes["@demote-non-dropping-particle"] = function (state, arg) { + state.opt["demote-non-dropping-particle"] = arg; +}; +CSL.Attributes["@initialize-with-hyphen"] = function (state, arg) { + if (arg === "false") { + state.opt["initialize-with-hyphen"] = false; + } +}; +CSL.Attributes["@institution-parts"] = function (state, arg) { + this.strings["institution-parts"] = arg; +}; +CSL.Attributes["@if-short"] = function (state, arg) { + if (arg === "true") { + this.strings["if-short"] = true; + } +}; +CSL.Attributes["@substitute-use-first"] = function (state, arg) { + if (arg.match(/^[0-9]+$/)) { + this.strings["substitute-use-first"] = parseInt(arg, 10); + } +}; +CSL.Attributes["@use-first"] = function (state, arg) { + if (arg.match(/^[0-9]+$/)) { + this.strings["use-first"] = parseInt(arg, 10); + } +}; +CSL.Attributes["@use-last"] = function (state, arg) { + if (arg.match(/^[0-9]+$/)) { + this.strings["use-last"] = parseInt(arg, 10); + } +}; +CSL.Attributes["@reverse-order"] = function (state, arg) { + if ("true" === arg) { + this.strings["reverse-order"] = true; + } +}; +CSL.Attributes["@display"] = function (state, arg) { + this.strings.cls = arg; +}; +var XML_PARSING; +var CSL_E4X; +var CSL_CHROME; +var DOMParser; +if ("undefined" !== typeof CSL_E4X) { + XML_PARSING = CSL_E4X; +} else { + XML_PARSING = CSL_CHROME; +} +CSL.System = {}; +CSL.System.Xml = { + "Parsing": XML_PARSING +}; +CSL.Stack = function (val, literal) { + this.mystack = []; + if (literal || val) { + this.mystack.push(val); + } +}; +CSL.Stack.prototype.push = function (val, literal) { + if (literal || val) { + this.mystack.push(val); + } else { + this.mystack.push(""); + } +}; +CSL.Stack.prototype.clear = function () { + this.mystack = []; +}; +CSL.Stack.prototype.replace = function (val, literal) { + if (this.mystack.length === 0) { + throw "Internal CSL processor error: attempt to replace nonexistent stack item with " + val; + } + if (literal || val) { + this.mystack[(this.mystack.length - 1)] = val; + } else { + this.mystack[(this.mystack.length - 1)] = ""; + } +}; +CSL.Stack.prototype.pop = function () { + return this.mystack.pop(); +}; +CSL.Stack.prototype.value = function () { + return this.mystack.slice(-1)[0]; +}; +CSL.Stack.prototype.length = function () { + return this.mystack.length; +}; +CSL.Util = {}; +CSL.Util.Match = function () { + var func, pos, len, reslist, res, ppos, llen; + this.any = function (token, state, Item, item) { + var ret = false; + len = token.tests.length; + for (pos = 0; pos < len; pos += 1) { + func = token.tests[pos]; + reslist = func.call(token, state, Item, item); + if ("object" !== typeof reslist) { + reslist = [reslist]; + } + llen = reslist.length; + for (ppos = 0; ppos < llen; ppos += 1) { + if (reslist[ppos]) { + ret = true; + break; + } + } + if (ret) { + break; + } + } + if (ret) { + ret = token.succeed; + state.tmp.jump.replace("succeed"); + } else { + ret = token.fail; + state.tmp.jump.replace("fail"); + } + return ret; + }; + this.none = function (token, state, Item, item) { + var ret = true; + len = this.tests.length; + for (pos = 0; pos < len; pos += 1) { + func = this.tests[pos]; + reslist = func.call(token, state, Item, item); + if ("object" !== typeof reslist) { + reslist = [reslist]; + } + llen = reslist.length; + for (ppos = 0; ppos < llen; ppos += 1) { + if (reslist[ppos]) { + ret = false; + break; + } + } + if (!ret) { + break; + } + } + if (ret) { + ret = token.succeed; + state.tmp.jump.replace("succeed"); + } else { + ret = token.fail; + state.tmp.jump.replace("fail"); + } + return ret; + }; + this.all = function (token, state, Item, item) { + var ret = true; + len = this.tests.length; + for (pos = 0; pos < len; pos += 1) { + func = this.tests[pos]; + reslist = func.call(token, state, Item, item); + if ("object" !== typeof reslist) { + reslist = [reslist]; + } + llen = reslist.length; + for (pos = 0; pos < len; pos += 1) { + if (!reslist[ppos]) { + ret = false; + break; + } + } + if (!ret) { + break; + } + } + if (ret) { + ret = token.succeed; + state.tmp.jump.replace("succeed"); + } else { + ret = token.fail; + state.tmp.jump.replace("fail"); + } + return ret; + }; +}; +CSL.Transform = function (state) { + var debug = false, abbreviations, token, fieldname, subsection, opt; + this["container-title"] = {}; + this["collection-title"] = {}; + this.institution = {}; + this.authority = {}; + this.title = {}; + this.publisher = {}; + this["publisher-place"] = {}; + this.hereinafter = {}; + abbreviations = "default"; + function init(t, f, x) { + token = t; + fieldname = f; + subsection = x; + opt = { + abbreviation_fallback: false, + alternative_varname: false, + transform_locale: false, + transform_fallback: false + }; + } + this.init = init; + function abbreviate(state, Item, altvar, basevalue, mysubsection, use_field) { + var value; + if (!mysubsection) { + return basevalue; + } + value = ""; + if (state.transform[mysubsection]) { + if (state.transform[mysubsection][basevalue]) { + value = state.transform[mysubsection][basevalue]; + } else if ("string" != typeof state.transform[mysubsection][basevalue]) { + state.transform[mysubsection][basevalue] = ""; + } + } + if (!value && Item[altvar] && use_field) { + value = Item[altvar]; + } + if (!value) { + value = basevalue; + } + return value; + } + function getTextSubField(value, locale_type, use_default) { + var m, lst, opt, o, pos, key, ret, len, myret; + if (!value) { + return ""; + } + ret = ""; + m = value.match(/\s*:([\-a-zA-Z0-9]+):\s*/g); + if (m) { + for (pos = 0, len = m.length; pos < len; pos += 1) { + m[pos] = m[pos].replace(/^\s*:/, "").replace(/:\s*$/, ""); + } + } + lst = value.split(/\s*:(?:[\-a-zA-Z0-9]+):\s*/); + myret = [lst[0]]; + for (pos = 1, len = lst.length; pos < len; pos += 1) { + myret.push(m[pos - 1]); + myret.push(lst[pos]); + } + lst = myret.slice(); + opt = state.opt[locale_type]; + if ("undefined" === typeof opt) { + opt = state.opt["default-locale"]; + } + for (key in opt) { + if (opt.hasOwnProperty(key)) { + o = opt[key]; + if (o && lst.indexOf(o) > -1 && lst.indexOf(o) % 2) { + ret = lst[(lst.indexOf(o) + 1)]; + break; + } + } + } + if (!ret && use_default) { + ret = lst[0]; + } + return ret; + } + function setAbbreviationFallback(b) { + opt.abbreviation_fallback = b; + } + this.setAbbreviationFallback = setAbbreviationFallback; + function setAlternativeVariableName(s) { + opt.alternative_varname = s; + } + this.setAlternativeVariableName = setAlternativeVariableName; + function setTransformLocale(s) { + opt.transform_locale = s; + } + this.setTransformLocale = setTransformLocale; + function setTransformFallback(b) { + opt.transform_fallback = b; + } + this.setTransformFallback = setTransformFallback; + function setAbbreviations(name) { + var vartype, pos, len; + if (name) { + abbreviations = name; + } + len = CSL.MULTI_FIELDS.length; + for (pos = 0; pos < len; pos += 1) { + vartype = CSL.MULTI_FIELDS[pos]; + this[vartype] = state.sys.getAbbreviations(abbreviations, vartype); + } + } + this.setAbbreviations = setAbbreviations; + function getOutputFunction() { + var mytoken, mysubsection, myfieldname, abbreviation_fallback, alternative_varname, transform_locale, transform_fallback, getTextSubfield; + mytoken = CSL.Util.cloneToken(token); // the token isn't needed, is it? + mysubsection = subsection; + myfieldname = fieldname; + abbreviation_fallback = opt.abbreviation_fallback; + alternative_varname = opt.alternative_varname; + transform_locale = opt.transform_locale; + transform_fallback = opt.transform_fallback; + if (mysubsection) { + return function (state, Item) { + var value, primary; + value = Item[myfieldname]; + primary = getTextSubField(value, transform_locale, transform_fallback); + primary = abbreviate(state, Item, alternative_varname, primary, mysubsection, true); + state.output.append(primary, this); + }; + } else if (transform_locale === "locale-sec") { + return function (state, Item) { + var primary, secondary, primary_tok, secondary_tok, key, value; + value = Item[myfieldname]; + if (value) { + if ("number" === typeof value) { + value = "" + value; + } + primary = getTextSubField(value, "locale-pri", transform_fallback); + secondary = getTextSubField(value, "locale-sec"); + if (secondary) { + primary_tok = CSL.Util.cloneToken(this); + primary_tok.strings.suffix = ""; + secondary_tok = new CSL.Token("text", CSL.SINGLETON); + secondary_tok.strings.suffix = "]" + this.strings.suffix; + secondary_tok.strings.prefix = " ["; + state.output.append(primary, primary_tok); + state.output.append(secondary, secondary_tok); + } else { + state.output.append(primary, this); + } + } + return null; + }; + } else { + return function (state, Item) { + var value, primary; + value = Item[myfieldname]; + if (value) { + if ("number" === typeof value) { + value = "" + value; + } + primary = getTextSubField(value, transform_locale, transform_fallback); + state.output.append(primary, this); + } + return null; + }; + } + } + this.getOutputFunction = getOutputFunction; + function output(state, basevalue, token_short, token_long, use_fallback) { + var shortvalue; + shortvalue = state.transform.institution[basevalue]; + if (shortvalue) { + state.output.append(shortvalue, token_short); + } else { + if (use_fallback) { + state.output.append(basevalue, token_long); + } + } + } + this.output = output; +}; +CSL.Parallel = function (state) { + this.state = state; + this.sets = new CSL.Stack([]); + this.try_cite = true; + this.use_parallels = true; +}; +CSL.Parallel.prototype.isMid = function (variable) { + return ["volume", "container-title", "issue", "page", "locator", "number"].indexOf(variable) > -1; +}; +CSL.Parallel.prototype.StartCitation = function (sortedItems, out) { + if (this.use_parallels) { + this.sortedItems = sortedItems; + this.sortedItemsPos = -1; + this.sets.clear(); + this.sets.push([]); + this.in_series = true; + this.delim_counter = 0; + this.delim_pointers = []; + if (out) { + this.out = out; + } else { + this.out = this.state.output.queue; + } + } +}; +CSL.Parallel.prototype.StartCite = function (Item, item, prevItemID) { + var position, len, pos, x, curr, master, last_id, prev_locator, curr_locator, is_master, parallel; + if (this.use_parallels) { + if (this.sets.value().length && this.sets.value()[0].itemId === Item.id) { + this.ComposeSet(); + } + this.sortedItemsPos += 1; + if (item) { + position = item.position; + } + this.try_cite = true; + len = CSL.PARALLEL_MATCH_VARS.length; + for (pos = 0; pos < len; pos += 1) { + x = CSL.PARALLEL_MATCH_VARS[pos]; + if (!Item[x] || CSL.PARALLEL_TYPES.indexOf(Item.type) === -1) { + this.try_cite = false; + if (this.in_series) { + this.in_series = false; + } + break; + } + } + this.cite = {}; + this.cite.front = []; + this.cite.mid = []; + this.cite.back = []; + this.cite.back_forceme = []; + this.cite.position = position; + this.cite.itemId = Item.id; + this.cite.prevItemID = prevItemID; + this.target = "front"; + if (this.sortedItems && this.sortedItemsPos > 0 && this.sortedItemsPos < this.sortedItems.length) { + curr = this.sortedItems[this.sortedItemsPos][1]; + last_id = this.sortedItems[(this.sortedItemsPos - 1)][1].id; + master = this.state.registry.registry[last_id].parallel; + prev_locator = false; + if (master === curr.id) { + len = this.sortedItemsPos - 1; + for (pos = len; pos > -1; pos += -1) { + if (this.sortedItems[pos][1].id === Item.id) { + prev_locator = this.sortedItems[pos][1].locator; + break; + } + } + curr_locator = this.sortedItems[this.sortedItemsPos][1].locator; + if (!prev_locator && curr_locator) { + curr.position = CSL.POSITION_IBID_WITH_LOCATOR; + } else if (curr_locator === prev_locator) { + curr.position = CSL.POSITION_IBID; + } else { + curr.position = CSL.POSITION_IBID_WITH_LOCATOR; + } + } + } + this.force_collapse = false; + if (this.state.registry.registry[Item.id].parallel) { + this.force_collapse = true; + } + } +}; +CSL.Parallel.prototype.StartVariable = function (variable) { + if (this.use_parallels && (this.try_cite || this.force_collapse)) { + this.variable = variable; + this.data = {}; + this.data.value = ""; + this.data.blobs = []; + var is_mid = this.isMid(variable); + if (this.target === "front" && is_mid) { + this.target = "mid"; + } else if (this.target === "mid" && !is_mid) { + this.target = "back"; + } else if (this.target === "back" && is_mid) { + this.try_cite = true; + this.in_series = false; + } + this.cite[this.target].push(variable); + } +}; +CSL.Parallel.prototype.AppendBlobPointer = function (blob) { + if (this.use_parallels && (this.try_cite || this.force_collapse) && blob && blob.blobs) { + this.data.blobs.push([blob, blob.blobs.length]); + } +}; +CSL.Parallel.prototype.AppendToVariable = function (str, varname) { + if (this.use_parallels && (this.try_cite || this.force_collapse)) { + if (this.target !== "back" || true) { + this.data.value += "::" + str; + } else { + var prev = this.sets.value()[(this.sets.value().length - 1)]; + if (prev) { + if (prev[this.variable]) { + if (prev[this.variable].value) { + this.data.value += "::" + str; + } + } + } + } + } +}; +CSL.Parallel.prototype.CloseVariable = function (hello) { + if (this.use_parallels && (this.try_cite || this.force_collapse)) { + this.cite[this.variable] = this.data; + if (this.sets.value().length > 0) { + var prev = this.sets.value()[(this.sets.value().length - 1)]; + if (this.target === "front") { + if (!prev[this.variable] || this.data.value !== prev[this.variable].value) { + this.in_series = false; + } + } else if (this.target === "back") { + if (prev[this.variable]) { + if (this.data.value !== prev[this.variable].value && this.sets.value().slice(-1)[0].back_forceme.indexOf(this.variable) === -1) { + this.in_series = false; + } + } + } + } + } +}; +CSL.Parallel.prototype.CloseCite = function () { + var x, pos, len, has_issued; + if (this.use_parallels) { + if (!this.in_series && !this.force_collapse) { + this.ComposeSet(true); + } + if (this.sets.value().length === 0) { + has_issued = false; + for (pos = 0, len = this.cite.back.length; pos < len; pos += 1) { + x = this.cite.back[pos]; + if (x === "issued" && this.cite.issued && this.cite.issued.value) { + has_issued = true; + break; + } + } + if (!has_issued) { + this.cite.back_forceme.push("issued"); + } + } else { + this.cite.back_forceme = this.sets.value().slice(-1)[0].back_forceme; + } + this.sets.value().push(this.cite); + } +}; +CSL.Parallel.prototype.ComposeSet = function (next_output_in_progress) { + var cite, pos, master, len; + if (this.use_parallels) { + if (this.sets.value().length === 1) { + if (!this.in_series) { + this.sets.value().pop(); + this.delim_counter += 1; + } + } else { + len = this.sets.value().length; + for (pos = 0; pos < len; pos += 1) { + if (pos === 0) { + this.delim_counter += 1; + } else { + this.delim_pointers.push(this.delim_counter); + this.delim_counter += 1; + } + cite = this.sets.value()[pos]; + if (CSL.POSITION_FIRST === cite.position) { + if (pos === 0) { + this.state.registry.registry[cite.itemId].master = true; + this.state.registry.registry[cite.itemId].siblings = []; + } else { + if (cite.prevItemID) { + if (!this.state.registry.registry[cite.prevItemID].parallel) { + this.state.registry.registry[cite.itemId].parallel = cite.prevItemID; + } else { + this.state.registry.registry[cite.itemId].parallel = this.state.registry.registry[cite.prevItemID].parallel; + } + this.state.registry.registry[cite.itemId].siblings = this.state.registry.registry[cite.prevItemID].siblings; + this.state.registry.registry[cite.itemId].siblings.push(cite.itemId); + } + } + } + } + this.sets.push([]); + } + this.in_series = true; + } +}; +CSL.Parallel.prototype.PruneOutputQueue = function () { + var len, pos, series, ppos, llen, cite; + if (this.use_parallels) { + len = this.sets.mystack.length; + for (pos = 0; pos < len; pos += 1) { + series = this.sets.mystack[pos]; + if (series.length > 1) { + llen = series.length; + for (ppos = 0; ppos < llen; ppos += 1) { + cite = series[ppos]; + if (ppos === 0) { + this.purgeVariableBlobs(cite, cite.back); + } else if (ppos === (series.length - 1)) { + this.purgeVariableBlobs(cite, cite.front.concat(cite.back_forceme)); + } else { + this.purgeVariableBlobs(cite, cite.front.concat(cite.back)); + } + } + } + } + } +}; +CSL.Parallel.prototype.purgeVariableBlobs = function (cite, varnames) { + var len, pos, varname, b, llen, ppos, out; + if (this.use_parallels) { + out = this.state.output.current.value(); + if ("undefined" === typeof out.length) { + out = out.blobs; + } + for (pos = 0, len = this.delim_pointers.length; pos < len; pos += 1) { + ppos = this.delim_pointers[pos]; + out[ppos].parallel_delimiter = ", "; + } + len = varnames.length - 1; + for (pos = len; pos > -1; pos += -1) { + varname = varnames[pos]; + if (cite[varname]) { + llen = cite[varname].blobs.length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + b = cite[varname].blobs[ppos]; + b[0].blobs = b[0].blobs.slice(0, b[1]).concat(b[0].blobs.slice((b[1] + 1))); + } + } + } + } +}; +CSL.Token = function (name, tokentype) { + this.name = name; + this.strings = {}; + this.strings.delimiter = ""; + this.strings.prefix = ""; + this.strings.suffix = ""; + this.decorations = false; + this.variables = []; + this.execs = []; + this.tokentype = tokentype; + this.evaluator = false; + this.tests = []; + this.succeed = false; + this.fail = false; + this.next = false; +}; +CSL.Util.cloneToken = function (token) { + var newtok, key, pos, len; + if ("string" === typeof token) { + return token; + } + newtok = new CSL.Token(token.name, token.tokentype); + for (key in token.strings) { + if (token.strings.hasOwnProperty(key)) { + newtok.strings[key] = token.strings[key]; + } + } + if (token.decorations) { + newtok.decorations = []; + for (pos = 0, len = token.decorations.length; pos < len; pos += 1) { + newtok.decorations.push(token.decorations[pos].slice()); + } + } + newtok.variables = token.variables.slice(); + return newtok; +}; +CSL.AmbigConfig = function () { + this.maxvals = []; + this.minval = 1; + this.names = []; + this.givens = []; + this.year_suffix = 0; + this.disambiguate = 0; +}; +CSL.Blob = function (token, str, levelname) { + var len, pos, key; + this.levelname = levelname; + if (token) { + this.strings = {}; + for (key in token.strings) { + if (token.strings.hasOwnProperty(key)) { + this.strings[key] = token.strings[key]; + } + } + this.decorations = []; + if (token.decorations === undefined) { + len = 0; + } else { + len = token.decorations.length; + } + for (pos = 0; pos < len; pos += 1) { + this.decorations.push(token.decorations[pos].slice()); + } + } else { + this.strings = {}; + this.strings.prefix = ""; + this.strings.suffix = ""; + this.strings.delimiter = ""; + this.decorations = []; + } + if ("string" === typeof str) { + this.blobs = str; + } else { + this.blobs = []; + } + this.alldecor = [this.decorations]; +}; +CSL.Blob.prototype.push = function (blob) { + if ("string" === typeof this.blobs) { + throw "Attempt to push blob onto string object"; + } else { + blob.alldecor = blob.alldecor.concat(this.alldecor); + this.blobs.push(blob); + } +}; +CSL.NumericBlob = function (num, mother_token) { + this.alldecor = []; + this.num = num; + this.blobs = num.toString(); + this.status = CSL.START; + this.strings = {}; + if (mother_token) { + this.decorations = mother_token.decorations; + this.strings.prefix = mother_token.strings.prefix; + this.strings.suffix = mother_token.strings.suffix; + this.strings["text-case"] = mother_token.strings["text-case"]; + this.successor_prefix = mother_token.successor_prefix; + this.range_prefix = mother_token.range_prefix; + this.splice_prefix = ""; + this.formatter = mother_token.formatter; + if (!this.formatter) { + this.formatter = new CSL.Output.DefaultFormatter(); + } + if (this.formatter) { + this.type = this.formatter.format(1); + } + } else { + this.decorations = []; + this.strings.prefix = ""; + this.strings.suffix = ""; + this.successor_prefix = ""; + this.range_prefix = ""; + this.splice_prefix = ""; + this.formatter = new CSL.Output.DefaultFormatter(); + } +}; +CSL.NumericBlob.prototype.setFormatter = function (formatter) { + this.formatter = formatter; + this.type = this.formatter.format(1); +}; +CSL.Output.DefaultFormatter = function () {}; +CSL.Output.DefaultFormatter.prototype.format = function (num) { + return num.toString(); +}; +CSL.NumericBlob.prototype.checkNext = function (next) { + if (! next || !next.num || this.type !== next.type || next.num !== (this.num + 1)) { + if (this.status === CSL.SUCCESSOR_OF_SUCCESSOR) { + this.status = CSL.END; + } + if ("object" === typeof next) { + next.status = CSL.SEEN; + } + } else { // next number is in the sequence + if (this.status === CSL.START || this.status === CSL.SEEN) { + next.status = CSL.SUCCESSOR; + } else if (this.status === CSL.SUCCESSOR || this.status === CSL.SUCCESSOR_OF_SUCCESSOR) { + if (this.range_prefix) { + next.status = CSL.SUCCESSOR_OF_SUCCESSOR; + this.status = CSL.SUPPRESS; + } else { + next.status = CSL.SUCCESSOR; + } + } + if (this.status === CSL.SEEN) { + this.status = CSL.SUCCESSOR; + } + } +}; +CSL.Util.fixDateNode = function (parent, pos, node) { + var form, variable, datexml, subnode, partname, attr, val, prefix, suffix, children, key, cchildren, kkey, display; + form = this.sys.xml.getAttributeValue(node, "form"); + if (!form) { + return parent; + } + variable = this.sys.xml.getAttributeValue(node, "variable"); + prefix = this.sys.xml.getAttributeValue(node, "prefix"); + suffix = this.sys.xml.getAttributeValue(node, "suffix"); + display = this.sys.xml.getAttributeValue(node, "display"); + datexml = this.sys.xml.nodeCopy(this.state.getDate(form)); + this.sys.xml.setAttribute(datexml, 'variable', variable); + if (prefix) { + this.sys.xml.setAttribute(datexml, "prefix", prefix); + } + if (suffix) { + this.sys.xml.setAttribute(datexml, "suffix", suffix); + } + if (display) { + this.sys.xml.setAttribute(datexml, "display", display); + } + children = this.sys.xml.children(node); + for (key in children) { + if (true) { + subnode = children[key]; + if ("date-part" === this.sys.xml.nodename(subnode)) { + partname = this.sys.xml.getAttributeValue(subnode, "name"); + cchildren = this.sys.xml.attributes(subnode); + for (attr in cchildren) { + if (cchildren.hasOwnProperty(attr)) { + if (attr === "@name") { + continue; + } + val = cchildren[attr]; + this.sys.xml.setAttributeOnNodeIdentifiedByNameAttribute(datexml, "date-part", partname, attr, val); + } + } + } + } + } + this.sys.xml.deleteAttribute(datexml, 'form'); + if ("year" === this.sys.xml.getAttributeValue(node, "date-parts")) { + this.sys.xml.deleteNodeByNameAttribute(datexml, 'month'); + this.sys.xml.deleteNodeByNameAttribute(datexml, 'day'); + } else if ("year-month" === this.sys.xml.getAttributeValue(node, "date-parts")) { + this.sys.xml.deleteNodeByNameAttribute(datexml, 'day'); + } + return this.sys.xml.insertChildNodeAfter(parent, node, pos, datexml); +}; +CSL.Util.Institutions = {}; +CSL.Util.Institutions.outputInstitutions = function (state, display_names) { + var len, pos, name, institution, value, token_long, token_short, parts; + state.output.openLevel("institution"); + len = display_names.length; + for (pos = 0; pos < len; pos += 1) { + name = display_names[pos]; + institution = state.output.getToken("institution"); + value = name.literal; + if (state.transform.institution[value]) { + token_long = state.output.mergeTokenStrings("institution-long", "institution-if-short"); + } else { + token_long = state.output.getToken("institution-long"); + } + token_short = state.output.getToken("institution-short"); + parts = institution.strings["institution-parts"]; + if ("short" === parts) { + state.transform.output(state, value, token_short, token_long, true); + } else if ("short-long" === parts) { + state.transform.output(state, value, token_short); + state.output.append(value, token_long); + } else if ("long-short" === parts) { + state.output.append(value, token_long); + state.transform.output(state, value, token_short); + } else { + state.output.append(value, token_long); + } + } + state.output.closeLevel(); +}; +CSL.Util.Names = {}; +CSL.Util.Names.outputNames = function (state, display_names) { + var segments, and; + segments = new this.StartMiddleEnd(state, display_names); + and = state.output.getToken("name").strings.delimiter; + if (state.output.getToken("name").strings["delimiter-precedes-last"] === "always") { + and = state.output.getToken("inner").strings.delimiter + and; + } else if (state.output.getToken("name").strings["delimiter-precedes-last"] === "never") { + if (!and) { + and = state.output.getToken("inner").strings.delimiter; + } + } else if ((segments.segments.start.length + segments.segments.middle.length) > 1) { + and = state.output.getToken("inner").strings.delimiter + and; + } else { + if (!and) { + and = state.output.getToken("inner").strings.delimiter; + } + } + if (and.match(CSL.STARTSWITH_ROMANESQUE_REGEXP)) { + and = " " + and; + } + if (and.match(CSL.ENDSWITH_ROMANESQUE_REGEXP)) { + and = and + " "; + } + state.output.getToken("name").strings.delimiter = and; + state.output.openLevel("name"); + state.output.openLevel("inner"); + segments.outputSegmentNames("start"); + segments.outputSegmentNames("middle"); + state.output.closeLevel(); // inner + segments.outputSegmentNames("end"); + state.output.closeLevel(); // name +}; +CSL.Util.Names.StartMiddleEnd = function (state, names) { + var start, middle, endstart, end, ret; + this.state = state; + this.nameoffset = 0; + start = names.slice(0, 1); + middle = names.slice(1, (names.length - 1)); + endstart = 1; + if (names.length > 1) { + endstart = (names.length - 1); + } + end = names.slice(endstart, (names.length)); + ret = {}; + ret.start = start; + ret.middle = middle; + ret.end = end; + this.segments = ret; +}; +CSL.Util.Names.StartMiddleEnd.prototype.outputSegmentNames = function (seg) { + var state, value, sequence, pos, len; + state = this.state; + len = this.segments[seg].length; + for (pos = 0; pos < len; pos += 1) { + this.namenum = parseInt(pos, 10); + this.name = this.segments[seg][pos]; + if (this.name.literal) { + value = this.name.literal; + state.output.append(this.name.literal, "empty"); + } else { + sequence = CSL.Util.Names.getNamepartSequence(state, seg, this.name); + state.output.openLevel(sequence[0][0]); // articular join + state.output.openLevel(sequence[0][1]); // join to last element (?) + state.output.openLevel(sequence[0][2]); // inter-element join (?) + this.outputNameParts(sequence[1]); + state.output.closeLevel(); + state.output.openLevel(sequence[0][2]); + this.outputNameParts(sequence[2]); + state.output.closeLevel(); + state.output.closeLevel(); + this.outputNameParts(sequence[3]); + state.output.closeLevel(); + } + } + this.nameoffset += this.segments[seg].length; +}; +CSL.Util.Names.StartMiddleEnd.prototype.outputNameParts = function (subsequence) { + var state, len, pos, key, namepart, initialize_with; + state = this.state; + len = subsequence.length; + for (pos = 0; pos < len; pos += 1) { + key = subsequence[pos]; + namepart = this.name[key]; + if (["given", "suffix", "dropping-particle"].indexOf(key) > -1 && 0 === state.tmp.disambig_settings.givens[state.tmp.nameset_counter][this.namenum + this.nameoffset]) { + continue; + } + if ("given" === key && 1 === state.tmp.disambig_settings.givens[state.tmp.nameset_counter][(this.namenum + this.nameoffset)]) { + initialize_with = state.output.getToken("name").strings["initialize-with"]; + namepart = CSL.Util.Names.initializeWith(state, namepart, initialize_with); + } + state.output.append(namepart, key); + } +}; +CSL.Util.Names.getNamepartSequence = function (state, seg, name) { + var token, suffix_sep, romanesque, sequence; + token = state.output.getToken("name"); + if (name["comma-suffix"]) { + state.output.getToken("suffixsep").strings.delimiter = ", "; + } else { + state.output.getToken("suffixsep").strings.delimiter = " "; + } + romanesque = name.family.match(CSL.ROMANESQUE_REGEXP); + if (!romanesque) { + sequence = [["empty", "empty", "empty"], ["non-dropping-particle", "family"], ["given"], []]; + } else if (name["static-ordering"]) { // entry likes sort order + sequence = [["empty", "space", "space"], ["non-dropping-particle", "family"], ["given"], []]; + } else if (state.tmp.sort_key_flag) { + if (state.opt["demote-non-dropping-particle"] === "never") { + sequence = [["suffixsep", "sortsep", "space"], ["non-dropping-particle", "family", "dropping-particle"], ["given"], ["suffix"]]; + } else { + sequence = [["suffixsep", "sortsep", "space"], ["family"], ["given", "dropping-particle", "non-dropping-particle"], ["suffix"]]; + } + } else if (token && (token.strings["name-as-sort-order"] === "all" || (token.strings["name-as-sort-order"] === "first" && seg === "start"))) { + if (["always", "display-and-sort"].indexOf(state.opt["demote-non-dropping-particle"]) > -1) { + sequence = [["sortsep", "sortsep", "space"], ["family"], ["given", "dropping-particle", "non-dropping-particle"], ["suffix"]]; + } else { + sequence = [["sortsep", "sortsep", "space"], ["non-dropping-particle", "family"], ["given", "dropping-particle"], ["suffix"]]; + } + } else { // plain vanilla + sequence = [["suffixsep", "space", "space"], ["given"], ["dropping-particle", "non-dropping-particle", "family"], ["suffix"]]; + } + return sequence; +}; +CSL.Util.Names.reinit = function (state, Item) { + state.tmp.value = []; + state.tmp.name_et_al_term = false; + state.tmp.name_et_al_decorations = false; + state.tmp.name_et_al_form = "long"; + state.tmp.et_al_prefix = false; +}; +CSL.Util.Names.getCommonTerm = function (state, namesets) { + var base_nameset, varnames, len, pos, short_namesets, nameset; + if (namesets.length < 2) { + return false; + } + base_nameset = namesets[0]; + varnames = []; + if (varnames.indexOf(base_nameset.variable) === -1) { + varnames.push(base_nameset.variable); + } + short_namesets = namesets.slice(1); + len = short_namesets.length; + for (pos = 0; pos < len; pos += 1) { + nameset = short_namesets[pos]; + if (!CSL.Util.Names.compareNamesets(base_nameset, nameset)) { + return false; + } + if (varnames.indexOf(nameset.variable) === -1) { + varnames.push(nameset.variable); + } + } + varnames.sort(); + return varnames.join(""); +}; +CSL.Util.Names.compareNamesets = function (base_nameset, nameset) { + var name, pos, len, part, ppos, llen; + if (!base_nameset.names || !nameset.names || base_nameset.names.length !== nameset.names.length) { + return false; + } + len = nameset.names.length; + for (pos = 0; pos < len; pos += 1) { + name = nameset.names[pos]; + llen = CSL.NAME_PARTS.length; + for (ppos = 0; ppos < llen; ppos += 1) { + part = CSL.NAME_PARTS[ppos]; + if (!base_nameset.names[pos] || base_nameset.names[pos][part] !== name[part]) { + return false; + } + } + } + return true; +}; +CSL.Util.Names.initializeWith = function (state, name, terminator) { + var namelist, l, i, n, m, extra, ret, s, c, pos, len, ppos, llen, llst, mx, lst; + if (!name) { + return ""; + } + namelist = name; + if (state.opt["initialize-with-hyphen"] === false) { + namelist = namelist.replace(/\-/g, " "); + } + namelist = namelist.replace(/\./g, " ").replace(/\s*\-\s*/g, "-").replace(/\s+/g, " "); + namelist = namelist.split(/(\-|\s+)/); + l = namelist.length; + for (pos = 0; pos < l; pos += 2) { + n = namelist[pos]; + m = n.match(CSL.NAME_INITIAL_REGEXP); + if (m && m[1] === m[1].toUpperCase()) { + extra = ""; + if (m[2]) { + s = ""; + llst = m[2].split(""); + llen = llst.length; + for (ppos = 0; ppos < llen; ppos += 1) { + c = llst[ppos]; + if (c === c.toUpperCase()) { + s += c; + } else { + break; + } + } + if (s.length < m[2].length) { + extra = s.toLocaleLowerCase(); + } + } + namelist[pos] = m[1].toLocaleUpperCase() + extra; + if (pos < (namelist.length - 1)) { + if (namelist[(pos + 1)].indexOf("-") > -1) { + namelist[(pos + 1)] = terminator + namelist[(pos + 1)]; + } else { + namelist[(pos + 1)] = terminator; + } + } else { + namelist.push(terminator); + } + } else if (n.match(CSL.ROMANESQUE_REGEXP)) { + namelist[pos] = " " + n; + } + } + ret = CSL.Util.Names.stripRight(namelist.join("")); + ret = ret.replace(/\s*\-\s*/g, "-").replace(/\s+/g, " "); + return ret; +}; +CSL.Util.Names.stripRight = function (str) { + var end, pos, len; + end = 0; + len = str.length - 1; + for (pos = len; pos > -1; pos += -1) { + if (str[pos] !== " ") { + end = pos + 1; + break; + } + } + return str.slice(0, end); +}; +CSL.Util.Names.initNameSlices = function (state) { + var len, pos; + state.tmp.names_cut = { + counts: [], + variable: {} + }; + len = CSL.NAME_VARIABLES.length; + for (pos = 0; pos < len; pos += 1) { + state.tmp.names_cut.counts[CSL.NAME_VARIABLES[pos]] = 0; + } +}; +CSL.Engine.prototype.parseName = function (name) { + var m, idx; + if (! name["non-dropping-particle"]) { + m = name.family.match(/^([ a-z]+\s+)/); + if (m) { + name.family = name.family.slice(m[1].length); + name["non-dropping-particle"] = m[1].replace(/\s+$/, ""); + } + } + if (! name.suffix) { + m = name.given.match(/(\s*,!*\s*)/); + if (m) { + idx = name.given.indexOf(m[1]); + if (name.given.slice(idx, idx + m[1].length).replace(/\s*/g, "").length === 2) { + name["comma-suffix"] = true; + } + name.suffix = name.given.slice(idx + m[1].length); + name.given = name.given.slice(0, idx); + } + } + if (! name["dropping-particle"]) { + m = name.given.match(/^(\s+[ a-z]*[a-z])$/); + if (m) { + name.given = name.given.slice(0, m[1].length * -1); + name["dropping-particle"] = m[2].replace(/^\s+/, ""); + } + } +}; +CSL.Util.Dates = {}; +CSL.Util.Dates.year = {}; +CSL.Util.Dates.year["long"] = function (state, num) { + if (!num) { + if ("boolean" === typeof num) { + num = ""; + } else { + num = 0; + } + } + return num.toString(); +}; +CSL.Util.Dates.year["short"] = function (state, num) { + num = num.toString(); + if (num && num.length === 4) { + return num.substr(2); + } +}; +CSL.Util.Dates.year.numeric = function (state, num) { + var m, pre; + num = "" + num; + m = num.match(/([0-9]*)$/); + if (m) { + pre = num.slice(0, m[1].length * -1); + num = m[1]; + } else { + pre = num; + num = ""; + } + while (num.length < 4) { + num = "0" + num; + } + return (pre + num); +}; +CSL.Util.Dates.month = {}; +CSL.Util.Dates.month.numeric = function (state, num) { + var ret = num.toString(); + return ret; +}; +CSL.Util.Dates.month["numeric-leading-zeros"] = function (state, num) { + if (!num) { + num = 0; + } + num = num.toString(); + while (num.length < 2) { + num = "0" + num; + } + return num.toString(); +}; +CSL.Util.Dates.month["long"] = function (state, num) { + num = num.toString(); + while (num.length < 2) { + num = "0" + num; + } + num = "month-" + num; + return state.getTerm(num, "long", 0); +}; +CSL.Util.Dates.month["short"] = function (state, num) { + num = num.toString(); + while (num.length < 2) { + num = "0" + num; + } + num = "month-" + num; + return state.getTerm(num, "short", 0); +}; +CSL.Util.Dates.day = {}; +CSL.Util.Dates.day.numeric = function (state, num) { + return num.toString(); +}; +CSL.Util.Dates.day["long"] = CSL.Util.Dates.day.numeric; +CSL.Util.Dates.day["numeric-leading-zeros"] = function (state, num) { + if (!num) { + num = 0; + } + num = num.toString(); + while (num.length < 2) { + num = "0" + num; + } + return num.toString(); +}; +CSL.Util.Dates.day.ordinal = function (state, num) { + return state.fun.ordinalizer(num); +}; +CSL.Util.Sort = {}; +CSL.Util.Sort.strip_prepositions = function (str) { + var m; + if ("string" === typeof str) { + m = str.toLocaleLowerCase(); + m = str.match(/^((a|an|the)\s+)/); + } + if (m) { + str = str.substr(m[1].length); + } + return str; +}; +CSL.Util.substituteStart = function (state, target) { + var element_trace, display, bib_first, func, choose_start, if_start, nodetypes; + nodetypes = ["number", "date", "names"]; + if (("text" === this.name && !this.postponed_macro) || nodetypes.indexOf(this.name) > -1) { + element_trace = function (state, Item, item) { + if (state.tmp.element_trace.value() === "author" || "names" === this.name) { + if (item && item["author-only"]) { + state.tmp.element_trace.push("do-not-suppress-me"); + } else if (item && item["suppress-author"]) { + state.tmp.element_trace.push("suppress-me"); + } + } else { + if (item && item["author-only"]) { + state.tmp.element_trace.push("suppress-me"); + } else if (item && item["suppress-author"]) { + state.tmp.element_trace.push("do-not-suppress-me"); + } + } + }; + this.execs.push(element_trace); + } + display = this.strings.cls; + this.strings.cls = false; + if (state.build.render_nesting_level === 0) { + if (state.build.area === "bibliography" && state.bibliography.opt["second-field-align"]) { + bib_first = new CSL.Token("group", CSL.START); + bib_first.decorations = [["@display", "left-margin"]]; + func = function (state, Item) { + if (!state.tmp.render_seen) { + state.output.startTag("bib_first", bib_first); + state.tmp.count_offset_characters = true; + state.output.calculate_offset = true; + } + }; + bib_first.execs.push(func); + target.push(bib_first); + } else if (CSL.DISPLAY_CLASSES.indexOf(display) > -1) { + bib_first = new CSL.Token("group", CSL.START); + bib_first.decorations = [["@display", display]]; + func = function (state, Item) { + state.output.startTag("bib_first", bib_first); + }; + bib_first.execs.push(func); + target.push(bib_first); + } + state.build.cls = display; + } + state.build.render_nesting_level += 1; + if (state.build.substitute_level.value() === 1) { + choose_start = new CSL.Token("choose", CSL.START); + CSL.Node.choose.build.call(choose_start, state, target); + if_start = new CSL.Token("if", CSL.START); + func = function (state, Item) { + if (state.tmp.can_substitute.value()) { + return true; + } + return false; + }; + if_start.tests.push(func); + if_start.evaluator = state.fun.match.any; + target.push(if_start); + } +}; +CSL.Util.substituteEnd = function (state, target) { + var func, bib_first_end, bib_other, if_end, choose_end, toplevel, hasval, author_substitute, printing, str; + state.build.render_nesting_level += -1; + if (state.build.render_nesting_level === 0) { + if (state.build.cls) { + func = function (state, Item) { + state.output.endTag("bib_first"); + state.tmp.count_offset_characters = false; + state.output.calculate_offset = false; + }; + this.execs.push(func); + state.build.cls = false; + } + if (state.build.area === "bibliography" && state.bibliography.opt["second-field-align"]) { + bib_first_end = new CSL.Token("group", CSL.END); + func = function (state, Item) { + if (!state.tmp.render_seen) { + state.output.endTag(); // closes bib_first + state.tmp.count_offset_characters = false; + state.output.calculate_offset = false; + } + }; + bib_first_end.execs.push(func); + target.push(bib_first_end); + bib_other = new CSL.Token("group", CSL.START); + bib_other.decorations = [["@display", "right-inline"]]; + func = function (state, Item) { + if (!state.tmp.render_seen) { + state.tmp.render_seen = true; + state.output.startTag("bib_other", bib_other); + } + }; + bib_other.execs.push(func); + target.push(bib_other); + } + } + if (state.build.substitute_level.value() === 1) { + if_end = new CSL.Token("if", CSL.END); + target.push(if_end); + choose_end = new CSL.Token("choose", CSL.END); + CSL.Node.choose.build.call(choose_end, state, target); + } + toplevel = "names" === this.name && state.build.substitute_level.value() === 0; + hasval = "string" === typeof state[state.build.area].opt["subsequent-author-substitute"]; + if (toplevel && hasval) { + author_substitute = new CSL.Token("text", CSL.SINGLETON); + func = function (state, Item) { + printing = !state.tmp.suppress_decorations; + if (printing) { + if (!state.tmp.rendered_name) { + state.tmp.rendered_name = state.output.string(state, state.tmp.name_node.blobs, false); + if (state.tmp.rendered_name) { + if (state.tmp.rendered_name === state.tmp.last_rendered_name) { + str = new CSL.Blob(false, state[state.tmp.area].opt["subsequent-author-substitute"]); + state.tmp.name_node.blobs = [str]; + } + state.tmp.last_rendered_name = state.tmp.rendered_name; + } + } + } + }; + author_substitute.execs.push(func); + target.push(author_substitute); + } + if (("text" === this.name && !this.postponed_macro) || ["number", "date", "names"].indexOf(this.name) > -1) { + func = function (state, Item) { + state.tmp.element_trace.pop(); + }; + this.execs.push(func); + } +}; +CSL.Util.LongOrdinalizer = function () {}; +CSL.Util.LongOrdinalizer.prototype.init = function (state) { + this.state = state; + this.names = {}; + for (var i = 1; i < 10; i += 1) { + this.names[("" + i)] = state.getTerm(("long-ordinal-0" + i)); + } + this.names["10"] = state.getTerm("long-ordinal-10"); +}; +CSL.Util.LongOrdinalizer.prototype.format = function (num) { + var ret = this.names[("" + num)]; + if (!ret) { + ret = this.state.fun.ordinalizer.format(num); + } + return ret; +}; +CSL.Util.Ordinalizer = function () {}; +CSL.Util.Ordinalizer.prototype.init = function (state) { + this.suffixes = []; + for (var i = 1; i < 5; i += 1) { + this.suffixes.push(state.getTerm(("ordinal-0" + i))); + } +}; +CSL.Util.Ordinalizer.prototype.format = function (num) { + var str; + num = parseInt(num, 10); + str = num.toString(); + if ((num / 10) % 10 === 1) { + str += this.suffixes[3]; + } else if (num % 10 === 1) { + str += this.suffixes[0]; + } else if (num % 10 === 2) { + str += this.suffixes[1]; + } else if (num % 10 === 3) { + str += this.suffixes[2]; + } else { + str += this.suffixes[3]; + } + return str; +}; +CSL.Util.Romanizer = function () {}; +CSL.Util.Romanizer.prototype.format = function (num) { + var ret, pos, n, numstr, len; + ret = ""; + if (num < 6000) { + numstr = num.toString().split(""); + numstr.reverse(); + pos = 0; + n = 0; + len = numstr.length; + for (pos = 0; pos < len; pos += 1) { + n = parseInt(numstr[pos], 10); + ret = CSL.ROMAN_NUMERALS[pos][n] + ret; + } + } + return ret; +}; +CSL.Util.Suffixator = function (slist) { + if (!slist) { + slist = CSL.SUFFIX_CHARS; + } + this.slist = slist.split(","); +}; +CSL.Util.Suffixator.prototype.format = function (num) { + var suffixes = this.get_suffixes(num); + return suffixes[(suffixes.length - 1)]; +}; +CSL.Util.Suffixator.prototype.get_suffixes = function (num) { + var suffixes, digits, chrs, pos, len, llen, ppos; + num = parseInt(num, 10); + suffixes = []; + for (pos = 0; pos <= num; pos += 1) { + if (!pos) { + suffixes.push([0]); + } else { + suffixes.push(this.incrementArray(suffixes[(suffixes.length - 1)], this.slist)); + } + } + len = suffixes.length; + for (pos = 0; pos < len; pos += 1) { + digits = suffixes[pos]; + chrs = ""; + llen = digits.length; + for (ppos = 0; ppos < llen; ppos += 1) { + chrs = chrs + this.slist[digits[ppos]]; + } + suffixes[pos] = chrs; + } + return suffixes; +}; +CSL.Util.Suffixator.prototype.incrementArray = function (array) { + var incremented, newdigit, i, pos, len, ppos, llen; + array = array.slice(); + incremented = false; + len = array.length - 1; + for (pos = len; pos > -1; pos += -1) { + if (array[pos] < (this.slist.length - 1)) { + array[pos] += 1; + for (ppos = (pos + 1), llen = array.length; ppos < llen; ppos += 1) { + array[ppos] = 0; + } + incremented = true; + break; + } + } + if (!incremented) { + len = array.length; + for (pos = 0; pos < len; pos += 1) { + array[pos] = 0; + } + newdigit = [0]; + array = newdigit.concat(array); + } + return array; +}; +CSL.Util.PageRangeMangler = {}; +CSL.Util.PageRangeMangler.getFunction = function (state) { + var rangerex, pos, len, stringify, listify, expand, minimize, minimize_internal, chicago, lst, m, b, e, ret, begin, end, ret_func, ppos, llen; + rangerex = /([a-zA-Z]*)([0-9]+)\s*-\s*([a-zA-Z]*)([0-9]+)/; + stringify = function (lst) { + len = lst.length; + for (pos = 1; pos < len; pos += 2) { + if ("object" === typeof lst[pos]) { + lst[pos] = lst[pos].join(""); + } + } + return lst.join(""); + }; + listify = function (str) { + var m, lst, ret; + m = str.match(/([a-zA-Z]*[0-9]+\s*-\s*[a-zA-Z]*[0-9]+)/g); + lst = str.split(/[a-zA-Z]*[0-9]+\s*-\s*[a-zA-Z]*[0-9]+/); + if (lst.length === 0) { + ret = m; + } else { + ret = [lst[0]]; + for (pos = 1, len = lst.length; pos < len; pos += 1) { + ret.push(m[pos - 1]); + ret.push(lst[pos]); + } + } + return ret; + }; + expand = function (str) { + str = "" + str; + lst = listify(str); + len = lst.length; + for (pos = 1; pos < len; pos += 2) { + m = lst[pos].match(rangerex); + if (m) { + if (!m[3] || m[1] === m[3]) { + if (m[4].length < m[2].length) { + m[4] = m[2].slice(0, (m[2].length - m[4].length)) + m[4]; + } + if (parseInt(m[2], 10) < parseInt(m[4], 10)) { + m[3] = "-" + m[1]; + lst[pos] = m.slice(1); + } + } + } + } + return lst; + }; + minimize = function (lst) { + len = lst.length; + for (pos = 1; pos < len; pos += 2) { + lst[pos][3] = minimize_internal(lst[pos][1], lst[pos][3]); + if (lst[pos][2].slice(1) === lst[pos][0]) { + lst[pos][2] = "-"; + } + } + return stringify(lst); + }; + minimize_internal = function (begin, end) { + b = ("" + begin).split(""); + e = ("" + end).split(""); + ret = e.slice(); + ret.reverse(); + if (b.length === e.length) { + llen = b.length; + for (ppos = 0; ppos < llen; ppos += 1) { + if (b[ppos] === e[ppos]) { + ret.pop(); + } else { + break; + } + } + } + ret.reverse(); + return ret.join(""); + }; + chicago = function (lst) { + len = lst.length; + for (pos = 1; pos < len; pos += 2) { + if ("object" === typeof lst[pos]) { + m = lst[pos]; + begin = parseInt(m[1], 10); + end = parseInt(m[3], 10); + if (begin > 100 && begin % 100 && parseInt((begin / 100), 10) === parseInt((end / 100), 10)) { + m[3] = "" + (end % 100); + } else if (begin >= 10000) { + m[3] = "" + (end % 1000); + } + } + if (m[2].slice(1) === m[0]) { + m[2] = "-"; + } + } + return stringify(lst); + }; + if (!state.opt["page-range-format"]) { + ret_func = function (str) { + return str; + }; + } else if (state.opt["page-range-format"] === "expanded") { + ret_func = function (str) { + var lst = expand(str); + return stringify(lst); + }; + } else if (state.opt["page-range-format"] === "minimal") { + ret_func = function (str) { + var lst = expand(str); + return minimize(lst); + }; + } else if (state.opt["page-range-format"] === "chicago") { + ret_func = function (str) { + var lst = expand(str); + return chicago(lst); + }; + } + return ret_func; +}; +CSL.Util.FlipFlopper = function (state) { + var tagdefs, pos, len, p, entry, allTags, ret, def, esc, makeHashes, closeTags, flipTags, openToClose, openToDecorations, okReverse, hashes, allTagsLst, lst; + this.state = state; + this.blob = false; + tagdefs = [ + ["", "", "italics", "@font-style", ["italic", "normal"], true], + ["", "", "bold", "@font-weight", ["bold", "normal"], true], + ["", "", "superscript", "@vertical-align", ["sup", "sup"], true], + ["", "", "subscript", "@vertical-align", ["sub", "sub"], true], + ["", "", "smallcaps", "@font-variant", ["small-caps", "small-caps"], true], + ["", "", "passthrough", "@passthrough", ["true", "true"], true], + ["", "", "passthrough", "@passthrough", ["true", "true"], true], + ['"', '"', "quotes", "@quotes", ["true", "inner"], "'"], + [" '", "'", "quotes", "@quotes", ["inner", "true"], '"'] + ]; + for (pos = 0; pos < 2; pos += 1) { + p = ["-", "-inner-"][pos]; + entry = []; + entry.push(state.getTerm(("open" + p + "quote"))); + entry.push(state.getTerm(("close" + p + "quote"))); + entry.push(("quote" + "s")); + entry.push(("@" + "quote" + "s")); + if ("-" === p) { + entry.push(["true", "inner"]); + } else { + entry.push(["inner", "true"]); + } + entry.push(true); + tagdefs.push(entry); + } + allTags = function (tagdefs) { + ret = []; + len = tagdefs.length; + for (pos = 0; pos < len; pos += 1) { + def = tagdefs[pos]; + if (ret.indexOf(def[0]) === -1) { + esc = ""; + if (["(", ")", "[", "]"].indexOf(def[0]) > -1) { + esc = "\\"; + } + ret.push(esc + def[0]); + } + if (ret.indexOf(def[1]) === -1) { + esc = ""; + if (["(", ")", "[", "]"].indexOf(def[1]) > -1) { + esc = "\\"; + } + ret.push(esc + def[1]); + } + } + return ret; + }; + allTagsLst = allTags(tagdefs); + lst = []; + for (pos = 0, len = allTagsLst.length; pos < len; pos += 1) { + if (allTagsLst[pos]) { + lst.push(allTagsLst[pos]); + } + } + allTagsLst = lst.slice(); + this.allTagsRexMatch = new RegExp("(" + allTagsLst.join("|") + ")", "g"); + this.allTagsRexSplit = new RegExp("(?:" + allTagsLst.join("|") + ")"); + makeHashes = function (tagdefs) { + closeTags = {}; + flipTags = {}; + openToClose = {}; + openToDecorations = {}; + okReverse = {}; + len = tagdefs.length; + for (pos = 0; pos < len; pos += 1) { + closeTags[tagdefs[pos][1]] = true; + flipTags[tagdefs[pos][1]] = tagdefs[pos][5]; + openToClose[tagdefs[pos][0]] = tagdefs[pos][1]; + openToDecorations[tagdefs[pos][0]] = [tagdefs[pos][3], tagdefs[pos][4]]; + okReverse[tagdefs[pos][3]] = [tagdefs[pos][3], [tagdefs[pos][4][1], tagdefs[pos][1]]]; + } + return [closeTags, flipTags, openToClose, openToDecorations, okReverse]; + }; + hashes = makeHashes(tagdefs); + this.closeTagsHash = hashes[0]; + this.flipTagsHash = hashes[1]; + this.openToCloseHash = hashes[2]; + this.openToDecorations = hashes[3]; + this.okReverseHash = hashes[4]; +}; +CSL.Util.FlipFlopper.prototype.init = function (str, blob) { + if (!blob) { + this.strs = this.getSplitStrings(str); + this.blob = new CSL.Blob(); + } else { + this.blob = blob; + this.strs = this.getSplitStrings(this.blob.blobs); + this.blob.blobs = []; + } + this.blobstack = new CSL.Stack(this.blob); +}; +CSL.Util.FlipFlopper.prototype.getSplitStrings = function (str) { + var strs, pos, len, newstr, head, tail, expected_closers, expected_openers, expected_flips, tagstack, badTagStack, posA, sameAsOpen, openRev, flipRev, tag, ibeenrunned, posB, wanted_closer, posC, sep, resplice, params, lenA, lenB, lenC, badTagPos, mx, myret; + mx = str.match(this.allTagsRexMatch); + strs = str.split(this.allTagsRexSplit); + myret = [strs[0]]; + for (pos = 1, len = strs.length; pos < len; pos += 1) { + myret.push(mx[pos - 1]); + myret.push(strs[pos]); + } + strs = myret.slice(); + len = strs.length - 2; + for (pos = len; pos > 0; pos += -2) { + if (strs[(pos - 1)].slice((strs[(pos - 1)].length - 1)) === "\\") { + newstr = strs[(pos - 1)].slice(0, (strs[(pos - 1)].length - 1)) + strs[pos] + strs[(pos + 1)]; + head = strs.slice(0, (pos - 1)); + tail = strs.slice((pos + 2)); + head.push(newstr); + strs = head.concat(tail); + } + } + expected_closers = []; + expected_openers = []; + expected_flips = []; + tagstack = []; + badTagStack = []; + lenA = strs.length - 1; + for (posA = 1; posA < lenA; posA += 2) { + tag = strs[posA]; + if (this.closeTagsHash[tag]) { + expected_closers.reverse(); + sameAsOpen = this.openToCloseHash[tag]; + openRev = expected_closers.indexOf(tag); + flipRev = expected_flips.indexOf(tag); + expected_closers.reverse(); + if (!sameAsOpen || (openRev > -1 && (openRev < flipRev || flipRev === -1))) { + ibeenrunned = false; + lenB = expected_closers.length - 1; + for (posB = lenB; posB > -1; posB += -1) { + ibeenrunned = true; + wanted_closer = expected_closers[posB]; + if (tag === wanted_closer) { + expected_closers.pop(); + expected_openers.pop(); + expected_flips.pop(); + tagstack.pop(); + break; + } + badTagStack.push(posA); + } + if (!ibeenrunned) { + badTagStack.push(posA); + } + continue; + } + } + if (this.openToCloseHash[tag]) { + expected_closers.push(this.openToCloseHash[tag]); + expected_openers.push(tag); + expected_flips.push(this.flipTagsHash[tag]); + tagstack.push(posA); + } + } + lenC = expected_closers.length - 1; + for (posC = lenC; posC > -1; posC += -1) { + expected_closers.pop(); + expected_flips.pop(); + expected_openers.pop(); + badTagStack.push(tagstack.pop()); + } + badTagStack.sort( + function (a, b) { + if (a < b) { + return 1; + } else if (a > b) { + return -1; + } + return 0; + } + ); + len = badTagStack.length; + for (pos = 0; pos < len; pos += 1) { + badTagPos = badTagStack[pos]; + head = strs.slice(0, (badTagPos - 1)); + tail = strs.slice((badTagPos + 2)); + sep = strs[badTagPos]; + if (sep.length && sep[0] !== "<" && this.openToDecorations[sep]) { + params = this.openToDecorations[sep]; + sep = this.state.fun.decorate[params[0]][params[1][0]](this.state); + } + resplice = strs[(badTagPos - 1)] + sep + strs[(badTagPos + 1)]; + head.push(resplice); + strs = head.concat(tail); + } + len = strs.length; + for (pos = 0; pos < len; pos += 2) { + strs[pos] = strs[pos].replace("'", this.state.getTerm("close-inner-quote"), "g"); + strs[pos] = CSL.Output.Formats[this.state.opt.mode].text_escape(strs[pos]); + } + return strs; +}; +CSL.Util.FlipFlopper.prototype.processTags = function () { + var expected_closers, expected_openers, expected_flips, expected_rendering, str, posA, tag, prestr, newblob, blob, sameAsOpen, openRev, flipRev, posB, wanted_closer, newblobnest, param, fulldecor, level, decor, lenA, lenB, posC, lenC; + expected_closers = []; + expected_openers = []; + expected_flips = []; + expected_rendering = []; + str = ""; + if (this.strs.length === 1) { + this.blob.blobs = this.strs[0]; + } else if (this.strs.length > 2) { + lenA = (this.strs.length - 1); + for (posA = 1; posA < lenA; posA += 2) { + tag = this.strs[posA]; + prestr = this.strs[(posA - 1)]; + newblob = new CSL.Blob(false, prestr); + blob = this.blobstack.value(); + blob.push(newblob); + if (this.closeTagsHash[tag]) { + expected_closers.reverse(); + sameAsOpen = this.openToCloseHash[tag]; + openRev = expected_closers.indexOf(tag); + flipRev = expected_flips.indexOf(tag); + expected_closers.reverse(); + if (!sameAsOpen || (openRev > -1 && (openRev < flipRev || flipRev === -1))) { + lenB = expected_closers.length; + for (posB = lenB; posB > -1; posB += -1) { + wanted_closer = expected_closers[posB]; + if (tag === wanted_closer) { + expected_closers.pop(); + expected_openers.pop(); + expected_flips.pop(); + expected_rendering.pop(); + this.blobstack.pop(); + break; + } + } + continue; + } + } + if (this.openToCloseHash[tag]) { + expected_closers.push(this.openToCloseHash[tag]); + expected_openers.push(tag); + expected_flips.push(this.flipTagsHash[tag]); + blob = this.blobstack.value(); + newblobnest = new CSL.Blob(); + blob.push(newblobnest); + param = this.addFlipFlop(newblobnest, this.openToDecorations[tag]); + if (tag === "") { + fulldecor = this.state[this.state.tmp.area].opt.topdecor.concat(this.blob.alldecor).concat([[["@quotes", "inner"]]]); + lenB = fulldecor.length; + for (posB = 0; posB < lenB; posB += 1) { + level = fulldecor[posB]; + lenC = level.length; + for (posC = 0; posC < lenC; posC += 1) { + decor = level[posC]; + if (["@font-style", "@font-weight", "@font-variant"].indexOf(decor[0]) > -1) { + param = this.addFlipFlop(newblobnest, this.okReverseHash[decor[0]]); + } + } + } + } + expected_rendering.push(this.state.fun.decorate[param[0]][param[1]](this.state)); + this.blobstack.push(newblobnest); + } + } + if (this.strs.length > 2) { + str = this.strs[(this.strs.length - 1)]; + blob = this.blobstack.value(); + newblob = new CSL.Blob(false, str); + blob.push(newblob); + } + } + return this.blob; +}; +CSL.Util.FlipFlopper.prototype.addFlipFlop = function (blob, fun) { + var posA, posB, fulldecor, lenA, decorations, breakme, decor, posC, newdecor, lenC; + posB = 0; + fulldecor = this.state[this.state.tmp.area].opt.topdecor.concat(blob.alldecor).concat([[["@quotes", "inner"]]]); + lenA = fulldecor.length; + for (posA = 0; posA < lenA; posA += 1) { + decorations = fulldecor[posA]; + breakme = false; + lenC = decorations.length - 1; + for (posC = lenC; posC > -1; posC += -1) { + decor = decorations[posC]; + if (decor[0] === fun[0]) { + if (decor[1] === fun[1][0]) { + posB = 1; + } + breakme = true; + break; + } + } + if (breakme) { + break; + } + } + newdecor = [fun[0], fun[1][posB]]; + blob.decorations.reverse(); + blob.decorations.push(newdecor); + blob.decorations.reverse(); + return newdecor; +}; +CSL.Output.Formatters = {}; +CSL.Output.Formatters.strip_periods = function (state, string) { + return string.replace(/\./g, " ").replace(/\s*$/g, "").replace(/\s+/g, " "); +}; +CSL.Output.Formatters.passthrough = function (state, string) { + return string; +}; +CSL.Output.Formatters.lowercase = function (state, string) { + var str = CSL.Output.Formatters.doppelString(string, CSL.TAG_USEALL); + str.string = str.string.toLowerCase(); + return CSL.Output.Formatters.undoppelString(str); +}; +CSL.Output.Formatters.uppercase = function (state, string) { + var str = CSL.Output.Formatters.doppelString(string, CSL.TAG_USEALL); + str.string = str.string.toUpperCase(); + return CSL.Output.Formatters.undoppelString(str); +}; +CSL.Output.Formatters["capitalize-first"] = function (state, string) { + var str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); + if (str.string.length) { + str.string = str.string.slice(0, 1).toUpperCase() + str.string.substr(1); + return CSL.Output.Formatters.undoppelString(str); + } else { + return ""; + } +}; +CSL.Output.Formatters.sentence = function (state, string) { + var str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); + str.string = str.string[0].toUpperCase() + str.string.substr(1).toLowerCase(); + return CSL.Output.Formatters.undoppelString(str); +}; +CSL.Output.Formatters["capitalize-all"] = function (state, string) { + var str, strings, len, pos; + str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); + strings = str.string.split(" "); + len = strings.length; + for (pos = 0; pos < len; pos += 1) { + if (strings[pos].length > 1) { + strings[pos] = strings[pos][0].toUpperCase() + strings[pos].substr(1).toLowerCase(); + } else if (strings[pos].length === 1) { + strings[pos] = strings[pos].toUpperCase(); + } + } + str.string = strings.join(" "); + return CSL.Output.Formatters.undoppelString(str); +}; +CSL.Output.Formatters.title = function (state, string) { + var str, words, isUpperCase, newString, lastWordIndex, previousWordIndex, upperCaseVariant, lowerCaseVariant, pos, skip, notfirst, notlast, firstword, aftercolon, len, idx, tmp, skipword, ppos, mx, lst, myret; + str = CSL.Output.Formatters.doppelString(string, CSL.TAG_ESCAPE); + if (!string) { + return ""; + } + mx = str.string.match(/(\s+)/g); + lst = str.string.split(/\s+/); + myret = [lst[0]]; + for (pos = 1, len = lst.length; pos < len; pos += 1) { + myret.push(mx[pos - 1]); + myret.push(lst[pos]); + } + words = myret.slice(); + isUpperCase = str.string.toUpperCase() === string; + newString = ""; + lastWordIndex = words.length - 1; + previousWordIndex = -1; + for (pos = 0; pos <= lastWordIndex; pos += 2) { + if (words[pos].length !== 0 && (words[pos].length !== 1 || !/\s+/.test(words[pos]))) { + upperCaseVariant = words[pos].toUpperCase(); + lowerCaseVariant = words[pos].toLowerCase(); + if (isUpperCase || words[pos] === lowerCaseVariant) { + skip = false; + len = CSL.SKIP_WORDS.length; + for (ppos = 0; ppos < len; ppos += 1) { + skipword = CSL.SKIP_WORDS[ppos]; + idx = lowerCaseVariant.indexOf(skipword); + if (idx > -1) { + tmp = lowerCaseVariant.slice(0, idx, idx + lowerCaseVariant.slice(skipword.length)); + if (!tmp.match(/[a-zA-Z]/)) { + skip = true; + } + } + } + notfirst = pos !== 0; + notlast = pos !== lastWordIndex; + firstword = previousWordIndex === -1; + aftercolon = words[previousWordIndex][(words[previousWordIndex].length - 1)] !== ":"; + if (skip && notfirst && notlast && (firstword || aftercolon)) { + words[pos] = lowerCaseVariant; + } else { + words[pos] = upperCaseVariant[0] + lowerCaseVariant.substr(1); + } + } + previousWordIndex = pos; + } + } + str.string = words.join(""); + return CSL.Output.Formatters.undoppelString(str); +}; +CSL.Output.Formatters.doppelString = function (string, rex) { + var ret, pos, len; + ret = {}; + ret.array = rex(string); + ret.string = ""; + len = ret.array.length; + for (pos = 0; pos < len; pos += 2) { + ret.string += ret.array[pos]; + } + return ret; +}; +CSL.Output.Formatters.undoppelString = function (str) { + var ret, len, pos; + ret = ""; + len = str.array.length; + for (pos = 0; pos < len; pos += 1) { + if ((pos % 2)) { + ret += str.array[pos]; + } else { + ret += str.string.slice(0, str.array[pos].length); + str.string = str.string.slice(str.array[pos].length); + } + } + return ret; +}; +CSL.Output.Formats = function () {}; +CSL.Output.Formats.prototype.html = { + "text_escape": function (text) { + return text.replace(/&/g, "&").replace(//g, ">"); + }, + "bibstart": "
\n", + "bibend": "
", + "@font-style/italic": "%%STRING%%", + "@font-style/oblique": "%%STRING%%", + "@font-style/normal": "%%STRING%%", + "@font-variant/small-caps": "%%STRING%%", + "@passthrough/true": CSL.Output.Formatters.passthrough, + "@font-variant/normal": false, + "@font-weight/bold": "%%STRING%%", + "@font-weight/normal": "%%STRING%%", + "@font-weight/light": false, + "@text-decoration/none": "%%STRING%%", + "@text-decoration/underline": "%%STRING%%", + "@vertical-align/sup": "%%STRING%%", + "@vertical-align/sub": "%%STRING%%", + "@vertical-align/baseline": "%%STRING%%", + "@strip-periods/true": CSL.Output.Formatters.strip_periods, + "@strip-periods/false": function (state, string) { + return string; + }, + "@quotes/true": function (state, str) { + if ("undefined" === typeof str) { + return state.getTerm("open-quote"); + } + return state.getTerm("open-quote") + str + state.getTerm("close-quote"); + }, + "@quotes/inner": function (state, str) { + if ("undefined" === typeof str) { + return "\u2019"; + } + return state.getTerm("open-inner-quote") + str + state.getTerm("close-inner-quote"); + }, + "@bibliography/entry": function (state, str) { + return "
" + str + "
\n"; + }, + "@display/block": function (state, str) { + return "\n\n
" + str + "
\n"; + }, + "@display/left-margin": function (state, str) { + return "\n
" + str + "
"; + }, + "@display/right-inline": function (state, str) { + return "
" + str + "
\n "; + }, + "@display/indent": function (state, str) { + return "
" + str + "
\n "; + } +}; +CSL.Output.Formats.prototype.text = { + "text_escape": function (text) { + return text; + }, + "bibstart": "", + "bibend": "", + "@font-style/italic": false, + "@font-style/oblique": false, + "@font-style/normal": false, + "@font-variant/small-caps": false, + "@passthrough/true": CSL.Output.Formatters.passthrough, + "@font-variant/normal": false, + "@font-weight/bold": false, + "@font-weight/normal": false, + "@font-weight/light": false, + "@text-decoration/none": false, + "@text-decoration/underline": false, + "@vertical-align/baseline": false, + "@vertical-align/sup": false, + "@vertical-align/sub": false, + "@strip-periods/true": CSL.Output.Formatters.strip_periods, + "@strip-periods/false": function (state, string) { + return string; + }, + "@quotes/true": function (state, str) { + if ("undefined" === typeof str) { + return state.getTerm("open-quote"); + } + return state.getTerm("open-quote") + str + state.getTerm("close-quote"); + }, + "@quotes/inner": function (state, str) { + if ("undefined" === typeof str) { + return "\u2019"; + } + return state.getTerm("open-inner-quote") + str + state.getTerm("close-inner-quote"); + }, + "@bibliography/entry": function (state, str) { + return str+"\n"; + }, + "@display/block": function (state, str) { + return "\n"+str; + }, + "@display/left-margin": function (state, str) { + return str; + }, + "@display/right-inline": function (state, str) { + return str; + }, + "@display/indent": function (state, str) { + return "\n "+str; + } +}; +CSL.Output.Formats.prototype.rtf = { + "text_escape": function (text) { + return text.replace("\\", "\\\\", "g").replace(/[\x7F-\uFFFF]/g, + function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+" " }) + .replace("\t", "\\tab ", "g"); + }, + "@font-style/italic": false, + "@font-style/oblique": false, + "@font-style/normal": false, + "@font-variant/small-caps": false, + "@passthrough/true": CSL.Output.Formatters.passthrough, + "@font-variant/normal": false, + "@font-weight/bold": false, + "@font-weight/normal": false, + "@font-weight/light": false, + "@text-decoration/none": false, + "@text-decoration/underline": false, + "@vertical-align/baseline": false, + "@vertical-align/sup": false, + "@vertical-align/sub": false, + "@strip-periods/true": CSL.Output.Formatters.strip_periods, + "@font-style/italic":"\\i %%STRING%%\\i0 ", + "@font-style/normal":false, + "@font-style/oblique":"\\i %%STRING%%\\i0 ", + "@font-variant/small-caps":"\\scaps %%STRING%%\\scaps0 ", + "@font-variant/normal":false, + "@font-weight/bold":"\\b %%STRING%%\\b0 ", + "@font-weight/normal":false, + "@font-weight/light":false, + "@text-decoration/none":false, + "@text-decoration/underline":"\\ul %%STRING%%\\ul0 ", + "@vertical-align/baseline":false, + "@vertical-align/sup":"\\super %%STRING%%\\nosupersub ", + "@vertical-align/sub":"\\sub %%STRING%%\\nosupersub ", + "@strip-periods/true": CSL.Output.Formatters.strip_periods, + "@strip-periods/false": function (state, string) { + return string; + }, + "@quotes/true": function (state, str) { + if ("undefined" === typeof str) { + return CSL.Output.Formats.rtf.text_escape(state.getTerm("open-quote")); + } + return CSL.Output.Formats.rtf.text_escape(state.getTerm("open-quote")) + str + CSL.Output.Formats.rtf.text_escape(state.getTerm("close-quote")); + }, + "@quotes/inner": function (state, str) { + if ("undefined" === typeof str) { + return CSL.Output.Formats.rtf.text_escape("\u2019"); + } + return CSL.Output.Formats.rtf.text_escape(state.getTerm("open-inner-quote")) + str + CSL.Output.Formats.rtf.text_escape(state.getTerm("close-inner-quote")); + }, + "bibstart":"{\\rtf ", + "bibend":"}", + "@display/block":"%%STRING%%\\line\r\n", + "@bibliography/entry": function(state,str){ + var spacing = []; + for(var i=0; i -1) { + items = this.ambigcites[ambig].slice(); + this.ambigcites[ambig] = items.slice(0, mypos).concat(items.slice([(mypos + 1)], items.length)); + } + len = this.ambigcites[ambig].length; + for (pos = 0; pos < len; pos += 1) { + id = this.ambigcites[ambig][pos]; + this.refreshes[id] = true; + } + delete this.registry[key]; + } + } +}; +CSL.Registry.prototype.doinserts = function (mylist) { + var len, pos, item, Item, akey, newitem, abase; + if ("string" === typeof mylist) { + mylist = [mylist]; + } + len = mylist.length; + for (pos = 0; pos < len; pos += 1) { + item = mylist[pos]; + if (!this.registry[item]) { + Item = this.state.sys.retrieveItem(item); + akey = CSL.getAmbiguousCite.call(this.state, Item); + this.akeys[akey] = true; + newitem = { + "id": item, + "seq": 0, + "offset": 0, + "sortkeys": false, + "ambig": false, + "disambig": false + }; + this.registry[item] = newitem; + abase = CSL.getAmbigConfig.call(this.state); + this.registerAmbigToken(akey, item, abase); + this.touched[item] = true; + } + } +}; +CSL.Registry.prototype.douncited = function () { + var pos, len; + for (pos = 0, len = this.mylist.length; pos < len; pos += 1) { + this.registry[this.mylist[pos]].uncited = false; + } + for (pos = 0, len = this.uncited.length; pos < len; pos += 1) { + this.registry[this.mylist[pos]].uncited = true; + } +}; +CSL.Registry.prototype.rebuildlist = function () { + var count, len, pos, item; + this.reflist = []; + len = this.mylist.length; + for (pos = 0; pos < len; pos += 1) { + item = this.mylist[pos]; + this.reflist.push(this.registry[item]); + this.registry[item].seq = (pos + 1); + } +}; +CSL.Registry.prototype.dorefreshes = function () { + var key, regtoken, Item, old_akey, akey, abase; + for (key in this.refreshes) { + if (this.refreshes.hasOwnProperty(key)) { + regtoken = this.registry[key]; + delete this.registry[key]; + if (!regtoken) { + continue; + } + regtoken.disambig = undefined; + regtoken.sortkeys = undefined; + regtoken.ambig = undefined; + Item = this.state.sys.retrieveItem(key); + old_akey = akey; + akey = CSL.getAmbiguousCite.call(this.state, Item); + if (this.state.tmp.taintedItemIDs && this.state.opt.update_mode !== CSL.NUMERIC && old_akey !== akey) { + this.state.tmp.taintedItemIDs[key] = true; + } + this.registry[key] = regtoken; + abase = CSL.getAmbigConfig.call(this.state); + this.registerAmbigToken(akey, key, abase); + this.akeys[akey] = true; + this.touched[key] = true; + } + } +}; +CSL.Registry.prototype.setdisambigs = function () { + var akey, leftovers, key, pos, len; + this.leftovers = []; + for (akey in this.akeys) { + if (this.akeys.hasOwnProperty(akey)) { + if (this.ambigcites[akey].length > 1) { + if (this.modes.length) { + leftovers = this.disambiguateCites(this.state, akey, this.modes); + } else { + leftovers = []; + len = this.ambigcites[akey].length; + for (pos = 0; pos < len; pos += 1) { + key = this.ambigcites[akey][pos]; + leftovers.push(this.registry[key]); + } + } + if (leftovers && leftovers.length && this.state.opt.has_disambiguate) { + leftovers = this.disambiguateCites(this.state, akey, this.modes, leftovers); + } + if (leftovers.length > 1) { + this.leftovers.push(leftovers); + } + } + } + } + this.akeys = {}; +}; +CSL.Registry.prototype.renumber = function () { + var len, pos, item; + len = this.reflist.length; + for (pos = 0; pos < len; pos += 1) { + item = this.reflist[pos]; + if (this.state.opt.update_mode === CSL.NUMERIC && this.state.tmp.taintedItemIDs && item.seq !== (pos + 1)) { + this.state.tmp.taintedItemIDs[item.id] = true; + } + item.seq = (pos + 1); + } +}; +CSL.Registry.prototype.yearsuffix = function () { + var leftovers, pos, len, ppos, llen; + len = this.leftovers.length; + for (pos = 0; pos < len; pos += 1) { + leftovers = this.leftovers[pos]; + if (leftovers && leftovers.length && this.state[this.state.tmp.area].opt["disambiguate-add-year-suffix"]) { + leftovers.sort(this.compareRegistryTokens); + llen = leftovers.length; + for (ppos = 0; ppos < llen; ppos += 1) { + this.registry[leftovers[("" + ppos)].id].disambig[2] = "" + ppos; + } + } + } +}; +CSL.Registry.prototype.setsortkeys = function () { + var key; + for (key in this.touched) { + if (this.touched.hasOwnProperty(key)) { + this.registry[key].sortkeys = CSL.getSortKeys.call(this.state, this.state.sys.retrieveItem(key), "bibliography_sort"); + } + } +}; +CSL.Registry.prototype.sorttokens = function () { + this.reflist.sort(this.sorter.compareKeys); +}; +CSL.Registry.Comparifier = function (state, keyset) { + var sort_directions, len, pos, compareKeys; + sort_directions = state[keyset].opt.sort_directions; + this.compareKeys = function (a, b) { + len = a.sortkeys.length; + for (pos = 0; pos < len; pos += 1) { + var cmp = 0; + if (a.sortkeys[pos] === b.sortkeys[pos]) { + cmp = 0; + } else if ("undefined" === typeof a.sortkeys[pos]) { + cmp = sort_directions[pos][1]; + } else if ("undefined" === typeof b.sortkeys[pos]) { + cmp = sort_directions[pos][0]; + } else { + cmp = a.sortkeys[pos].toLocaleLowerCase().localeCompare(b.sortkeys[pos].toLocaleLowerCase()); + } + if (0 < cmp) { + return sort_directions[pos][1]; + } else if (0 > cmp) { + return sort_directions[pos][0]; + } + } + if (a.seq > b.seq) { + return 1; + } else if (a.seq < b.seq) { + return -1; + } + return 0; + }; + compareKeys = this.compareKeys; + this.compareCompositeKeys = function (a, b) { + return compareKeys(a[1], b[1]); + }; +}; +CSL.Registry.prototype.compareRegistryTokens = function (a, b) { + if (a.seq > b.seq) { + return 1; + } else if (a.seq < b.seq) { + return -1; + } + return 0; +}; +CSL.Registry.prototype.registerAmbigToken = function (akey, id, ambig_config) { + if (!this.ambigcites[akey]) { + this.ambigcites[akey] = []; + } + if (this.ambigcites[akey].indexOf(id) === -1) { + this.ambigcites[akey].push(id); + } + this.registry[id].ambig = akey; + var dome = false; + if (this.state.tmp.taintedItemIDs) { + this.registry[id].disambig = CSL.cloneAmbigConfig.call(this.state, ambig_config, this.registry[id].disambig, id); + } else { + this.registry[id].disambig = CSL.cloneAmbigConfig(ambig_config); + } +}; +CSL.getSortKeys = function (Item, key_type) { + var area, strip_prepositions, use_parallels, len, pos; + area = this.tmp.area; + strip_prepositions = CSL.Util.Sort.strip_prepositions; + this.tmp.area = key_type; + this.tmp.disambig_override = true; + this.tmp.disambig_request = false; + use_parallels = this.parallel.use_parallels; + this.parallel.use_parallels = false; + this.tmp.suppress_decorations = true; + CSL.getCite.call(this, Item); + this.tmp.suppress_decorations = false; + this.parallel.use_parallels = use_parallels; + this.tmp.disambig_override = false; + len = this[key_type].keys.length; + for (pos = 0; pos < len; pos += 1) { + this[key_type].keys[pos] = strip_prepositions(this[key_type].keys[pos]); + } + this.tmp.area = area; + return this[key_type].keys; +}; +CSL.Registry.NameReg = function (state) { + var pkey, ikey, skey, floor, ceiling, param, dagopt, gdropt, ret, pos, items, strip_periods, set_keys, evalname, delitems, addname, key; + this.state = state; + this.namereg = {}; + this.nameind = {}; + this.itemkeyreg = {}; + strip_periods = function (str) { + if (!str) { + str = ""; + } + return str.replace(".", " ").replace(/\s+/, " "); + }; + set_keys = function (state, itemid, nameobj) { + pkey = strip_periods(nameobj.family); + skey = strip_periods(nameobj.given); + ikey = CSL.Util.Names.initializeWith(state, skey, ""); + if (state[state.tmp.area].opt["givenname-disambiguation-rule"] === "by-cite") { + pkey = itemid + pkey; + } + }; + evalname = function (item_id, nameobj, namenum, request_base, form, initials) { + var pos, len, items; + set_keys(this.state, item_id, nameobj); + if ("undefined" === typeof this.namereg[pkey] || "undefined" === typeof this.namereg[pkey].ikey[ikey]) { + return 2; + } + param = 2; + dagopt = state[state.tmp.area].opt["disambiguate-add-givenname"]; + gdropt = state[state.tmp.area].opt["givenname-disambiguation-rule"]; + if (gdropt === "by-cite") { + gdropt = "all-names"; + } + if ("short" === form) { + param = 0; + } else if ("string" === typeof initials) { + param = 1; + } + if (param < request_base) { + param = request_base; + } + if (!dagopt) { + return param; + } + if ("string" === typeof gdropt && gdropt.slice(0, 12) === "primary-name" && namenum > 0) { + return param; + } + if (!gdropt || gdropt === "all-names" || gdropt === "primary-name") { + if (this.namereg[pkey].count > 1) { + param = 1; + } + if (this.namereg[pkey].ikey && this.namereg[pkey].ikey[ikey].count > 1) { + param = 2; + } + } else if (gdropt === "all-names-with-initials" || gdropt === "primary-name-with-initials") { + if (this.namereg[pkey].count > 1) { + param = 1; + } + } + if (param === 0) { + pos = this.namereg[pkey].ikey[ikey].items.indexOf(item_id); + items = this.namereg[pkey].ikey[ikey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id); + items = this.namereg[pkey].ikey[ikey].skey[skey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + if (this.namereg[pkey].items.indexOf(item_id) === -1) { + this.namereg[pkey].items.push(item_id); + } + } else if (param === 1) { + pos = this.namereg[pkey].items.indexOf(item_id); + items = this.namereg[pkey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + pos = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id); + items = this.namereg[pkey].ikey[ikey].skey[skey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + if (this.namereg[pkey].ikey[ikey].items.indexOf(item_id) === -1) { + this.namereg[pkey].ikey[ikey].items.push(item_id); + } + } else if (param === 2) { + pos = this.namereg[pkey].items.indexOf(item_id); + items = this.namereg[pkey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + pos = this.namereg[pkey].ikey[ikey].items.indexOf(item_id); + items = this.namereg[pkey].ikey[ikey].items; + if (pos > -1) { + items = items.slice(0, pos).concat(items.slice(pos + 1)); + } + for (pos = 0, len = items.length; pos < len; pos += 1) { + this.state.tmp.taintedItemIDs[items[pos]] = true; + } + if (this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(item_id) === -1) { + this.namereg[pkey].ikey[ikey].skey[skey].items.push(item_id); + } + } + return param; + }; + delitems = function (ids) { + var i, item, pos, len, posA, posB, id, fullkey, llen, ppos, otherid; + if ("string" === typeof ids) { + ids = [ids]; + } + ret = {}; + len = ids.length; + for (pos = 0; pos < len; pos += 1) { + id = ids[pos]; + if (!this.nameind[id]) { + continue; + } + for (fullkey in this.nameind[id]) { + if (this.nameind[id].hasOwnProperty(fullkey)) { + key = fullkey.split("::"); + pkey = key[0]; + ikey = key[1]; + skey = key[2]; + posA = this.namereg[pkey].items.indexOf(posA); + items = this.namereg[pkey].items; + if (skey) { + posB = this.namereg[pkey].ikey[ikey].skey[skey].items.indexOf(id); + if (posB > -1) { + items = this.namereg[pkey].ikey[ikey].skey[skey].items.slice(); + this.namereg[pkey].ikey[ikey].skey[skey].items = items.slice(0, posB).concat(items.slice([(posB + 1)], items.length)); + } + if (this.namereg[pkey].ikey[ikey].skey[skey].items.length === 0) { + delete this.namereg[pkey].ikey[ikey].skey[skey]; + this.namereg[pkey].ikey[ikey].count += -1; + if (this.namereg[pkey].ikey[ikey].count < 2) { + llen = this.namereg[pkey].ikey[ikey].items.length; + for (ppos = 0; ppos < llen; ppos += 1) { + otherid = this.namereg[pkey].ikey[ikey].items[ppos]; + ret[otherid] = true; + } + } + } + } + if (ikey) { + posB = this.namereg[pkey].ikey[ikey].items.indexOf(id); + if (posB > -1) { + items = this.namereg[pkey].ikey[ikey].items.slice(); + this.namereg[pkey].ikey[ikey].items = items.slice(0, posB).concat(items.slice([posB + 1], items.length)); + } + if (this.namereg[pkey].ikey[ikey].items.length === 0) { + delete this.namereg[pkey].ikey[ikey]; + this.namereg[pkey].count += -1; + if (this.namereg[pkey].count < 2) { + llen = this.namereg[pkey].items.length; + for (ppos = 0; ppos < llen; ppos += 1) { + otherid = this.namereg[pkey].items[ppos]; + ret[otherid] = true; + } + } + } + } + if (pkey) { + posB = this.namereg[pkey].items.indexOf(id); + if (posB > -1) { + items = this.namereg[pkey].items.slice(); + this.namereg[pkey].items = items.slice(0, posB).concat(items.slice([posB + 1], items.length)); + } + if (this.namereg[pkey].items.length === 0) { + delete this.namereg[pkey]; + } + } + delete this.nameind[id][fullkey]; + } + } + } + return ret; + }; + addname = function (item_id, nameobj, pos) { + set_keys(this.state, item_id, nameobj); + if (pkey) { + if ("undefined" === typeof this.namereg[pkey]) { + this.namereg[pkey] = {}; + this.namereg[pkey].count = 0; + this.namereg[pkey].ikey = {}; + this.namereg[pkey].items = []; + } + } + if (pkey && ikey) { + if ("undefined" === typeof this.namereg[pkey].ikey[ikey]) { + this.namereg[pkey].ikey[ikey] = {}; + this.namereg[pkey].ikey[ikey].count = 0; + this.namereg[pkey].ikey[ikey].skey = {}; + this.namereg[pkey].ikey[ikey].items = []; + this.namereg[pkey].count += 1; + } + } + if (pkey && ikey && skey) { + if ("undefined" === typeof this.namereg[pkey].ikey[ikey].skey[skey]) { + this.namereg[pkey].ikey[ikey].skey[skey] = {}; + this.namereg[pkey].ikey[ikey].skey[skey].items = []; + this.namereg[pkey].ikey[ikey].count += 1; + } + } + if ("undefined" === typeof this.nameind[item_id]) { + this.nameind[item_id] = {}; + } + if (pkey) { + this.nameind[item_id][pkey + "::" + ikey + "::" + skey] = true; + } + }; + this.addname = addname; + this.delitems = delitems; + this.evalname = evalname; +}; +var debug = false; +CSL.Registry.prototype.disambiguateCites = function (state, akey, modes, candidate_list) { + var ambigs, reg_token, keypos, id_vals, a, base, token, pos, len, tokens, str, maxvals, minval, testpartner, otherstr, base_return, ret, id, key; + if (!candidate_list) { + ambigs = this.ambigcites[akey].slice(); + this.ambigcites[akey] = []; + } else { + ambigs = []; + len = candidate_list.length; + for (pos = 0; pos < len; pos += 1) { + reg_token = candidate_list[pos]; + ambigs.push(reg_token.id); + keypos = this.ambigcites[akey].indexOf(reg_token.id); + if (keypos > -1) { + this.ambigcites[akey] = this.ambigcites[akey].slice(0, keypos).concat(this.ambigcites[akey].slice((keypos + 1))); + } + } + } + id_vals = []; + len = ambigs.length; + for (pos = 0; pos < len; pos += 1) { + id_vals.push(ambigs[pos]); + } + tokens = state.retrieveItems(id_vals); + if (candidate_list && candidate_list.length) { + modes = ["disambiguate_true"].concat(modes); + } + CSL.initCheckerator.call(this.checkerator, tokens, modes); + this.checkerator.lastclashes = (ambigs.length - 1); + base = false; + this.checkerator.pos = 0; + str = CSL.getAmbiguousCite.call(state, tokens[0], base); + maxvals = CSL.getMaxVals.call(state); + minval = CSL.getMinVal.call(state); + base = CSL.getAmbigConfig.call(state); + while (CSL.runCheckerator.call(this.checkerator)) { + token = this.checkerator.tokens[this.checkerator.pos]; + if (this.ambigcites[akey].indexOf(token.id) > -1) { + this.checkerator.pos += 1; + continue; + } + this.checkerator.candidate = token.id; + if (base === false) { + this.checkerator.mode = modes[0]; + } + str = CSL.getAmbiguousCite.call(state, token, base); + maxvals = CSL.getMaxVals.call(state); + minval = CSL.getMinVal.call(state); + base = CSL.getAmbigConfig.call(state); + if (candidate_list && candidate_list.length) { + base.disambiguate = true; + } + CSL.setCheckeratorBase.call(this.checkerator, base); + CSL.setMaxVals.call(this.checkerator, maxvals); + CSL.setMinVal.call(this.checkerator, minval); + len = tokens.length; + for (pos = 0; pos < len; pos += 1) { + testpartner = tokens[pos]; + if (token.id === testpartner.id) { + continue; + } + otherstr = CSL.getAmbiguousCite.call(state, testpartner, base); + if (CSL.checkCheckeratorForClash.call(this.checkerator, str, otherstr)) { + break; + } + } + if (CSL.evaluateCheckeratorClashes.call(this.checkerator)) { + base_return = CSL.decrementCheckeratorNames.call(this, state, base); + this.registerAmbigToken(akey, token.id, base_return); + this.checkerator.seen.push(token.id); + continue; + } + if (CSL.maxCheckeratorAmbigLevel.call(this.checkerator)) { + if (!state.citation.opt["disambiguate-add-year-suffix"]) { + this.checkerator.mode1_counts = false; + this.checkerator.maxed_out_bases[token.id] = CSL.cloneAmbigConfig(base); + } else { + } + this.checkerator.seen.push(token.id); + base = false; + continue; + } + CSL.incrementCheckeratorAmbigLevel.call(this.checkerator); + } + ret = []; + len = this.checkerator.ids.length; + for (pos = 0; pos < len; pos += 1) { + id = this.checkerator.ids[pos]; + if (id) { + ret.push(this.registry[id]); + } + } + len = this.checkerator.maxed_out_bases.length; + for (key in this.checkerator.maxed_out_bases) { + if (this.checkerator.maxed_out_bases.hasOwnProperty(key)) { + this.registry[key].disambig = this.checkerator.maxed_out_bases[key]; + } + } + return ret; +}; +CSL.Checkerator = function () {}; +CSL.initCheckerator = function (tokens, modes) { + var len, pos; + this.tokens = tokens; + this.seen = []; + this.modes = modes; + this.mode = this.modes[0]; + this.tokens_length = tokens.length; + this.pos = 0; + this.clashes = 0; + this.maxvals = false; + this.base = false; + this.ids = []; + this.maxed_out_bases = {}; + len = tokens.length; + for (pos = 0; pos < len; pos += 1) { + this.ids.push(tokens[pos].id); + } + this.lastclashes = -1; + this.namepos = 0; + this.modepos = 0; + this.mode1_counts = false; +}; +CSL.runCheckerator = function () { + var len, pos; + if (this.seen.length < this.tokens_length) { + return true; + } + return false; +}; +CSL.setMaxVals = function (maxvals) { + this.maxvals = maxvals; +}; +CSL.setMinVal = function (minval) { + this.minval = minval; +}; +CSL.setCheckeratorBase = function (base) { + var pos, len; + this.base = base; + if (! this.mode1_counts) { + this.mode1_counts = []; + len = this.base.givens.length; + for (pos = 0; pos < len; pos += 1) { + this.mode1_counts.push(0); + } + } +}; +CSL.setCheckeratorMode = function (mode) { + this.mode = mode; +}; +CSL.checkCheckeratorForClash = function (str, otherstr) { + if (str === otherstr) { + if (this.mode === "names" || this.mode === "disambiguate_true") { + this.clashes += 1; + return true; + } + if (this.mode === "givens") { + this.clashes += 1; + } + return false; + } +}; +CSL.evaluateCheckeratorClashes = function () { + var namepos, ret, old; + if (!this.maxvals.length) { + return false; + } + if (this.mode === "names" || this.mode === "disambiguate_true") { + if (this.clashes) { + this.lastclashes = this.clashes; + this.clashes = 0; + return false; + } else { + this.ids[this.pos] = false; + this.pos += 1; + this.lastclashes = this.clashes; + return true; + } + } + if (this.mode === "givens") { + ret = true; + namepos = this.mode1_counts[this.modepos]; + if (this.clashes && this.clashes === this.lastclashes) { + if (this.mode1_defaults && namepos > 0) { + old = this.mode1_defaults[(namepos - 1)]; + this.base.givens[this.modepos][(namepos - 1)] = old; + } + ret = false; + } else if (this.clashes) { + ret = false; + } else { // only non-clash should be possible + this.mode1_counts = false; + this.pos += 1; + ret = true; + } + this.lastclashes = this.clashes; + this.clashes = 0; + if (ret) { + this.ids[this.pos] = false; + } + return ret; + } +}; +CSL.maxCheckeratorAmbigLevel = function () { + if (!this.maxvals.length) { + return true; + } + if (this.mode === "disambiguate_true") { + if (this.modes.indexOf("disambiguate_true") < (this.modes.length - 1)) { + this.mode = this.modes[(this.modes.indexOf("disambiguate_true") + 1)]; + this.modepos = 0; + } else { + this.pos += 1; + return true; + } + } + if (this.mode === "names") { + if (this.modepos === (this.base.names.length - 1) && this.base.names[this.modepos] === this.maxvals[this.modepos]) { + if (this.modes.length === 2) { + this.mode = "givens"; + this.mode1_counts[this.modepos] = 0; + this.modepos = 0; + } else { + this.pos += 1; + return true; + } + } + } else if (this.mode === "givens") { + if (this.modepos === (this.mode1_counts.length - 1) && this.mode1_counts[this.modepos] === (this.maxvals[this.modepos])) { + if (this.modes.length === 2) { + this.mode = "givens"; + this.pos += 1; + } else { + this.pos += 1; + } + return true; + } + } + return false; +}; +CSL.incrementCheckeratorAmbigLevel = function () { + var val; + if (this.mode === "names") { + val = this.base.names[this.modepos]; + if (val < this.maxvals[this.modepos]) { + this.base.names[this.modepos] += 1; + } else if (this.modepos < (this.base.names.length - 1)) { + this.modepos += 1; + this.base.names[this.modepos] = 0; + } + } + if (this.mode === "givens") { + val = (this.mode1_counts[this.modepos]); + if (val < this.maxvals[this.modepos]) { + if (this.given_name_second_pass) { + this.given_name_second_pass = false; + this.mode1_counts[this.modepos] += 1; + this.base.givens[this.modepos][val] += 1; + } else { + this.mode1_defaults = this.base.givens[this.modepos].slice(); + this.given_name_second_pass = true; + } + } else if (this.modepos < (this.base.givens.length - 1)) { + this.modepos += 1; + this.base.givens[this.modepos][0] += 1; + this.mode1_defaults = this.base.givens[this.modepos].slice(); + } else { + this.mode = "names"; + this.pos += 1; + } + } +}; +CSL.decrementCheckeratorNames = function (state, base) { + var base_return, do_me, i, j, pos, len, ppos, llen; + base_return = CSL.cloneAmbigConfig(base); + do_me = false; + len = base_return.givens.length - 1; + for (pos = len; pos > -1; pos += -1) { + llen = base_return.givens[pos].length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + if (base_return.givens[pos][ppos] === 2) { + do_me = true; + } + } + } + if (do_me) { + len = base_return.givens.length - 1; + for (pos = len; pos > -1; pos += -1) { + llen = base_return.givens[pos].length - 1; + for (ppos = llen; ppos > -1; ppos += -1) { + if (base_return.givens[pos][ppos] === 2) { + i = -1; + break; + } + if (ppos < base_return.names[pos]) { + base_return.names[pos] += -1; + } + } + } + } + return base_return; +}; +CSL.getAmbigConfig = function () { + var config, ret; + config = this.tmp.disambig_request; + if (!config) { + config = this.tmp.disambig_settings; + } + ret = CSL.cloneAmbigConfig(config); + return ret; +}; +CSL.getMaxVals = function () { + return this.tmp.names_max.mystack.slice(); +}; +CSL.getMinVal = function () { + return this.tmp["et-al-min"]; +}; +CSL.getModes = function () { + var ret, dagopt, gdropt; + ret = []; + if (this[this.tmp.area].opt["disambiguate-add-names"]) { + ret.push("names"); + } + dagopt = this[this.tmp.area].opt["disambiguate-add-givenname"]; + gdropt = this[this.tmp.area].opt["givenname-disambiguation-rule"]; + if (dagopt) { + if (!gdropt || ("string" === typeof gdropt && "primary-name" !== gdropt.slice(0, 12))) { + ret.push("givens"); + } + } + return ret; +}; +CSL.Registry.CitationReg = function (state) { + this.citationById = {}; + this.citationByIndex = []; +}; diff --git a/chrome/content/zotero/xpcom/csl.js b/chrome/content/zotero/xpcom/csl.js deleted file mode 100644 index 0df5b7d223..0000000000 --- a/chrome/content/zotero/xpcom/csl.js +++ /dev/null @@ -1,2956 +0,0 @@ -/* - ***** BEGIN LICENSE BLOCK ***** - - Copyright © 2009 Center for History and New Media - George Mason University, Fairfax, Virginia, USA - http://zotero.org - - This file is part of Zotero. - - Zotero is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Zotero is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Zotero. If not, see . - - ***** END LICENSE BLOCK ***** -*/ - -/* - * CSL: a class for creating bibliographies from CSL files - * this is abstracted as a separate class for the benefit of anyone who doesn't - * want to use the Scholar data model, but does want to use CSL in JavaScript - */ -Zotero.CSL = function(csl) { - // "with ({});" needed to fix default namespace scope issue - // See https://bugzilla.mozilla.org/show_bug.cgi?id=330572 - default xml namespace = "http://purl.org/net/xbiblio/csl"; with ({}); - - if(typeof csl != "xml") { - this._csl = new XML(Zotero.CSL.Global.cleanXML(csl)); - } else { - this._csl = csl; - } - - // initialize CSL - Zotero.CSL.Global.init(); - - // load localizations - this._terms = Zotero.CSL.Global.parseLocales(this._csl.terms); - - // load class and styleID - this.styleID = this._csl.info.id.toString(); - this.class = this._csl["@class"].toString(); - Zotero.debug("CSL: style class is "+this.class); - - this.hasBibliography = (this._csl.bibliography.length() ? 1 : 0); -} - -/* - * Constants for citation positions - */ -Zotero.CSL.POSITION_FIRST = 0; -Zotero.CSL.POSITION_SUBSEQUENT = 1; -Zotero.CSL.POSITION_IBID = 2; -Zotero.CSL.POSITION_IBID_WITH_LOCATOR = 3; - - -Zotero.CSL._dateVariables = { - "issued":true, - "accessed":true, - "submitted":true -} - -Zotero.CSL._namesVariables = { - "editor":true, - "translator":true, - "recipient":true, - "interviewer":true, - "collection-editor":true, - "container-author":true, - "author":true -} - -/* - * Constants for name (used for disambiguate-add-givenname) - */ -Zotero.CSL.NAME_USE_INITIAL = 1; -Zotero.CSL.NAME_USE_FULL = 2; - -/* - * generate an item set - */ -Zotero.CSL.prototype.createItemSet = function(items) { - return new Zotero.CSL.ItemSet(items, this); -} - -/* - * generate a citation object - */ -Zotero.CSL.prototype.createCitation = function(citationItems) { - return new Zotero.CSL.Citation(citationItems, this); -} - -/* - * create a citation (in-text or footnote) - */ -Zotero.CSL._firstNameRegexp = /^[^\s]*/; -Zotero.CSL._textCharRegexp = /[a-zA-Z0-9]/; -Zotero.CSL._numberRegexp = /\d+/; -Zotero.CSL._quotedRegexp = /^".+"$/; -Zotero.CSL.prototype.formatCitation = function(citation, format) { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - var context = this._csl.citation; - if(!context) { - throw "CSL: formatCitation called on style with no citation context"; - } - if(!citation.citationItems.length) { - throw "CSL: formatCitation called with empty citation"; - } - - // clone citationItems, so as not to disturb the citation - var citationItems = citation.citationItems; - - // handle collapse - var cslAdded = []; - - var collapse = context.option.(@name == "collapse").@value.toString(); - if(collapse) { - // clone citationItems, so as not to disturb the citation - citationItems = new Array(); - - if(collapse == "citation-number") { - // loop through, collecting citation numbers - var citationNumbers = new Object(); - for(var i=0; i 2) { - // if previous set of citations was a range, collapse them - var firstNumber = citationItems[span[0]].item.getProperty("citation-number"); - citationItems[span[0]]._csl = {"citation-number":(firstNumber+"-"+(parseInt(firstNumber, 10)+span.length-1))}; - cslAdded.push(span[0]); - } else if(span.length == 2) { - citationItems[span[1]] = citation.citationItems[span[1]]; - } - - span = [citationNumbers[i]]; - } - previousI = i; - } - } else if(collapse.substr(0, 4) == "year") { - // loop through, collecting citations (sans date) in an array - var lastNames = {}; - for(var i=0; i 1) { - for(k=1; k\r\n'; - } else { - preamble += '
\r\n'; - } - } - } else { - if(format == "RTF" || format == "Integration") { - if(format == "RTF") { - preamble = "{\\rtf\\ansi{\\fonttbl\\f0\\froman Times New Roman;}{\\colortbl;\\red255\\green255\\blue255;}\\pard\\f0\r\n"; - } - - var tabStop = null; - if(hangingIndent) { - var indent = 720; // 720 twips = 0.5 in - var firstLineIndent = -720; // -720 twips = -0.5 in - } else { - var indent = 0; - var firstLineIndent = 0; - } - } - - var returnChars = ""; - for(j=0; j<=entrySpacing; j++) { - if(format == "RTF") { - returnChars += "\\\r\n"; - } else if(Zotero.isWin) { - returnChars += "\r\n"; - } else { - returnChars += "\n"; - } - } - } - - var maxFirstFieldLength = 0; - for(var i in itemSet.items) { - var item = itemSet.items[i]; - if(item == undefined) continue; - - // try to get custom bibliography - var string = item.getProperty("bibliography-"+(format == "Integration" ? "RTF" : format)); - if(!string) { - string = new Zotero.CSL.FormattedString(context, format); - this._processElements(item, context.layout, string, context); - if(!string) { - continue; - } - - // add format - string.string = context.layout.@prefix.toString() + string.string; - if(context.layout.@suffix.length()) { - string.append(context.layout.@suffix.toString()); - } - - string = string.get(); - } - - if(secondFieldAlign && (format == "RTF" || format == "Integration")) { - if(format == "RTF") { - var tab = string.indexOf("\\tab "); - } else { - var tab = string.indexOf("\t"); - } - if(tab > maxFirstFieldLength) { - maxFirstFieldLength = tab; - } - } - - // add line feeds - if(format == "HTML") { - var coins = Zotero.OpenURL.createContextObject(item.zoteroItem, "1.0"); - - // Wrap URLs and DOIs in HTML links - // - // This should be handled when the values are still in variables - // (and presumably will be in the new engine) - string = Zotero.Utilities.prototype.autoLink(string); - - var span = (coins ? '  ' : ''); - - if(this.class == "note" && isCitation) { - output += "
  • "+string+span+"
  • \r\n"; - } else if(secondFieldAlign) { - output += ''+string+span+"\r\n"; - for(var j=0; j'+string+span+"

    \r\n"; - } - } else { - if(this.class == "note" && isCitation) { - if(format == "RTF") { - index++; - output += index+". "; - } else if(format == "Text") { - index++; - output += index+". "; - } - } - output += string+returnChars; - } - } - - if(format == "HTML") { - if(this.class == "note" && isCitation) { - output += ''; - } else if(secondFieldAlign) { - output += ''; - } else { - output += '
    '; - } - } else if(format == "RTF" || format == "Integration") { - if(secondFieldAlign) { - // this is a really sticky issue. the below works for first fields - // that look like "[1]" and "1." otherwise, i have no idea. luckily, - // this will be good enough 99% of the time. - var alignAt = 24+maxFirstFieldLength*120; - - if(secondFieldAlign == "margin") { - firstLineIndent -= alignAt; - tabStop = 0; - } else { - indent += alignAt; - firstLineIndent = -indent; - tabStop = indent; - } - } - - preamble += "\\li"+indent+" \\fi"+firstLineIndent+" "; - if(format == "Integration") { - preamble += "\\sl"+lineSpacing+" "; - } else if(format == "RTF" && lineSpacing != 1) { - preamble += "\\sl"+(240*lineSpacing)+" \\slmult1 "; - } - - if(tabStop !== null) { - preamble += "\\tx"+tabStop+" "; - } - preamble += "\r\n"; - - // drop last returns - output = output.substr(0, output.length-returnChars.length); - - // add bracket for RTF - if(format == "RTF") output += "\\par }"; - } - - return preamble+output; -} - -/* - * gets a term, in singular or plural form - */ -Zotero.CSL.prototype._getTerm = function(term, plural, form, includePeriod) { - if(!form) { - form = "long"; - } - - if(!this._terms[form] || !this._terms[form][term]) { - if(form == "verb-short") { - return this._getTerm(term, plural, "verb"); - } else if(form == "symbol") { - return this._getTerm(term, plural, "short"); - } else if(form != "long") { - return this._getTerm(term, plural, "long"); - } else { - Zotero.debug("CSL: WARNING: could not find term \""+term+'"'); - return ""; - } - } - - var term; - if(typeof(this._terms[form][term]) == "object") { // singular and plural forms - // are available - if(plural) { - term = this._terms[form][term][1]; - } else { - term = this._terms[form][term][0]; - } - } else { - term = this._terms[form][term]; - } - - if((form == "short" || form == "verb-short") && includePeriod) { - term += "."; - } - - return term; -} - -/* - * process creator objects; if someone had a creator model that handled - * non-Western names better than ours, this would be the function to change - */ -Zotero.CSL.prototype._processNames = function(item, element, formattedString, context, citationItem, variables) { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - var children = element.children(); - if(!children.length()) return false; - var variableSucceeded = false; - - for(var j=0; j= Zotero.CSL.POSITION_SUBSEQUENT) { - if(context.option.(@name == "et-al-subsequent-min").length()) { - etAlMin = context.option.(@name == "et-al-subsequent-min").@value.toString(); - } - if(context.option.(@name == "et-al-subsequent-use-first").length()) { - etAlUseFirst = context.option.(@name == "et-al-subsequent-use-first").@value.toString(); - } - } - - if(etAlMin && etAlUseFirst && maxCreators >= parseInt(etAlMin, 10)) { - etAlUseFirst = parseInt(etAlUseFirst, 10); - if(etAlUseFirst != maxCreators) { - maxCreators = etAlUseFirst; - useEtAl = true; - } - } - - // add additional names to disambiguate - if(variables[j] == "author" && useEtAl) { - var disambigNames = item.getProperty("disambiguate-add-names"); - if(disambigNames != "") { - maxCreators = disambigNames; - if(disambigNames == creators.length) useEtAl = false; - } - } - - if(child.@form == "short") { - var fullNames = item.getProperty("disambiguate-add-givenname").split(","); - } - } - - var authorStrings = []; - var firstName, lastName; - // parse authors into strings - for(var i=0; i 1 && lastNameParts[0] !== "" && lastNameParts[0].length <= 4 - && lastNameParts[0][0].toLowerCase() == lastNameParts[0][0] - && lastNameParts[lastNameParts.length-1][0].toUpperCase() == lastNameParts[lastNameParts.length-1][0]) { - name = ""; - for(var k=1; k 1) { - if(useEtAl) { // multiple creators and need et al - authorStrings.push(this._getTerm("et-al")); - } else { // multiple creators but no et al - // add and to last creator - if(child["@and"].length()) { - if(child["@and"] == "symbol") { - var and = "&" - } else if(child["@and"] == "text") { - var and = this._getTerm("and"); - } - - authorStrings[maxCreators-1] = and+" "+authorStrings[maxCreators-1]; - } - } - - // check whether to use a serial comma - if((authorStrings.length == 2 && (child["@delimiter-precedes-last"] != "always" || useEtAl)) || - (authorStrings.length > 2 && child["@delimiter-precedes-last"] == "never")) { - var lastString = authorStrings.pop(); - authorStrings[authorStrings.length-1] = authorStrings[authorStrings.length-1]+" "+lastString; - } - } - newString.append(authorStrings.join(joinString), child); - } - } else if(formattedString.format != "Sort" && - name == "label" && variables[j] != "author") { - newString.append(this._getTerm(variables[j], (maxCreators != 1 || useEtAl), child["@form"].toString(), child["@include-period"] == "true"), child); - } - } - success = true; - } - } - - if(success) { - variableSucceeded = true; - formattedString.concat(newString); - } - } - - return variableSucceeded; -} - -/* - * processes an element from a (pre-processed) item into text - */ -Zotero.CSL.prototype._processElements = function(item, element, formattedString, - context, citationItem, ignore, isSingle) { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - if(!ignore) { - ignore = [[], []]; - // ignore[0] is for variables; ignore[1] is for macros - } - - var dataAppended = false; - - if(isSingle) { - // handle single elements - var numberOfChildren = 1; - var children = [element]; - } else { - // accept groups of elements by default - var children = element.children(); - var numberOfChildren = children.length(); - var lastChild = children.length()-1; - } - - for(var i=0; i 0 - } - else if(Zotero.CSL._dateVariables[variables[j]]) { - // getDate not false/undefined - exists = !!item.getDate(variables[j]); - } else if(Zotero.CSL._namesVariables[variables[j]]) { - // getNames not false/undefined, not empty - exists = item.getNames(variables[j]); - if(exists) exists = !!exists.length; - } else { - exists = item.getVariable(variables[j]); - if (exists) exists = !!exists.length; - } - } else if (attribute == "is-numeric") { - exists = item.getNumericVariable(variables[j]); - } else if (attribute == "is-date") { // XXX - this needs improving - if (Zotero.CSL._dateVariables[variables[j]]) { - exists = !!item.getDate(variables[j]); - } - } else if(attribute == "is-plural") { - if(Zotero.CSL._namesVariables[variables[j]]) { - exists = item.getNames(variables[j]); - if(exists) exists = exists.length > 1; - } else if(variables[j] == "page" || variables[j] == "locator") { - if(variables[j] == "page") { - var value = item.getVariable("page"); - } else { - var value = citationItem && citationItem.locator ? citationItem.locator : ""; - } - exists = value.indexOf("-") != -1 || value.indexOf(",") != -1 || value.indexOf("\u2013") != -1; - } - } else if(attribute == "type") { - exists = item.isType(variables[j]); - } else if(attribute == "disambiguate") { - exists = (variables[j] == "true" && item.getProperty("disambiguate-condition")) - || (variables[j] == "false" && !item.getProperty("disambiguate-condition")); - } else if(attribute == "locator") { - exists = citationItem && citationItem.locator && - (citationItem.locatorType == variables[j] - || (!citationItem.locatorType && variables[j] == "page")); - } else { // attribute == "position" - if(variables[j] == "first") { - exists = !citationItem - || !citationItem.position - || citationItem.position == Zotero.CSL.POSITION_FIRST; - } else if(variables[j] == "subsequent") { - exists = citationItem && citationItem.position >= Zotero.CSL.POSITION_SUBSEQUENT; - } else if(variables[j] == "ibid") { - exists = citationItem && citationItem.position >= Zotero.CSL.POSITION_IBID; - } else if(variables[j] == "ibid-with-locator") { - exists = citationItem && citationItem.position == Zotero.CSL.POSITION_IBID_WITH_LOCATOR; - } - } - - if(matchAny) { - if(exists) { - truthValue = true; - done = true; - } - } else if(matchNone) { - if(exists) { - truthValue = false; - done = true; - } - } else if(!exists) { - truthValue = false; - done = true; - } - } - } - } - } - - if(truthValue) { - // if true, process - var newString = formattedString.clone(newChild.@delimiter.toString()); - var success = this._processElements(item, newChild, - newString, context, citationItem, ignore); - if(success) dataAppended = true; - formattedString.concat(newString, child); - - // then break - break; - } - } - } else { - Zotero.debug("CSL: WARNING: could not add element "+name); - } - } - - return dataAppended; -} - -/* - * Compares two items, in order to sort the reference list - * Returns -1 if A comes before B, 1 if B comes before A, or 0 if they are equal - */ -Zotero.CSL.prototype._compareItem = function(a, b, context, cache) { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - var sortA = []; - var sortB = []; - - var aID = a.id; - var bID = b.id; - - // author - if(context.sort.key.length()) { - var keyA, keyB; - for each(var key in context.sort.key) { - if(key.@macro.length()) { - var aCacheKey = aID+"-macro-"+key.@macro; - var bCacheKey = bID+"-macro-"+key.@macro; - - if(cache[aCacheKey]) { - keyA = cache[aCacheKey]; - } else { - keyA = new Zotero.CSL.SortString(); - this._processElements(a, this._csl.macro.(@name == key.@macro), keyA); - cache[aCacheKey] = keyA; - } - - if(cache[bCacheKey]) { - keyB = cache[bCacheKey]; - } else { - keyB = new Zotero.CSL.SortString(); - this._processElements(b, this._csl.macro.(@name == key.@macro), keyB); - cache[bCacheKey] = keyB; - } - } else if(key.@variable.length()) { - var variable = key.@variable.toString(); - var keyA = new Zotero.CSL.SortString(); - var keyB = new Zotero.CSL.SortString(); - - if(Zotero.CSL._dateVariables[variable]) { // date - var date = a.getDate(variable); - if(date) keyA.append(date.getDateVariable("sort")); - date = b.getDate(variable); - if(date) keyB.append(date.getDateVariable("sort")); - } else if(Zotero.CSL._namesVariables[key.@variable]) { // names - var element = ; - element.setNamespace(Zotero.CSL.Global.ns); - - this._processNames(a, element, keyA, context, null, [variable]); - this._processNames(b, element, keyB, context, null, [variable]); - } else { // text - if(variable == "citation-number") { - keyA.append(a.getProperty(variable)); - keyB.append(b.getProperty(variable)); - } else { - keyA.append(a.getVariable(variable)); - keyB.append(b.getVariable(variable)); - } - } - } - - var compare = keyA.compare(keyB); - if(key.@sort == "descending") { // the compare method sorts ascending - // so we sort descending by reversing it - if(compare < 1) return 1; - if(compare > 1) return -1; - } else if(compare != 0) { - return compare; - } - } - } - - // sort by index in document - var aIndex = a.getProperty("index"); - var bIndex = b.getProperty("index"); - if(aIndex !== "" && (bIndex === "" || aIndex < bIndex)) { - return -1; - } else if(aIndex != bIndex) { - return 1; - } - - // sort by old index (to make this a stable sort) - var aOldIndex = a.getProperty("oldIndex"); - var bOldIndex = b.getProperty("oldIndex"); - if(aOldIndex < bOldIndex) { - return -1; - } else if(aOldIndex != bOldIndex) { - return 1; - } - - return 0; -} - - -/** - * Sorts a list of items, keeping a cache of processed keys - **/ -Zotero.CSL.prototype.cachedSort = function(items, context, field) { - var me = this; - var cache = new Object(); - - for(var i=0; i]*\?>/g, ""); - } - - /* - * parses locale strings into an array; - */ - function parseLocales(termXML, ignoreLang) { - // return defaults if there are no terms - if(!termXML.length()) { - return (Zotero.CSL.Global._defaultTerms ? Zotero.CSL.Global._defaultTerms : {}); - } - - var xml = new Namespace("http://www.w3.org/XML/1998/namespace"); - - if(ignoreLang) { - // ignore lang if loaded from chrome - locale = termXML.locale[0]; - } else { - // get proper locale - var locale = termXML.locale.(@xml::lang == Zotero.CSL.Global._xmlLang); - if(!locale.length()) { - var xmlLang = Zotero.CSL.Global._xmlLang.substr(0, 2); - locale = termXML.locale.(@xml::lang == xmlLang); - } - if(!locale.length()) { - // return defaults if there are no locales - return (Zotero.CSL.Global._defaultTerms ? Zotero.CSL.Global._defaultTerms : {}); - } - } - - var termArray = new Object(); - termArray["default"] = new Object(); - - if(Zotero.CSL.Global._defaultTerms) { - // ugh. copy default array. javascript dumb. - for(var i in Zotero.CSL.Global._defaultTerms) { - termArray[i] = new Object(); - for(var j in Zotero.CSL.Global._defaultTerms[i]) { - if(typeof(Zotero.CSL.Global._defaultTerms[i][j]) == "object") { - termArray[i][j] = Zotero.CSL.Global._defaultTerms[i][j].concat(); - } else { - termArray[i][j] = Zotero.CSL.Global._defaultTerms[i][j]; - } - } - } - } - - // loop through terms - for each(var term in locale.term) { - var name = term.@name.toString(); - if(!name) { - throw("CSL: citations cannot be generated: no name defined on term in locales.xml"); - } - // unless otherwise specified, assume "long" form - var form = term.@form.toString(); - if(!form) { - var form = "long"; - } - if(!termArray[form]) { - termArray[form] = new Object(); - } - - var single = term.single.text().toString(); - var multiple = term.multiple.text().toString(); - if(single || multiple) { - if((single && multiple) // if there's both elements or - || !termArray[form][name]) { // no previously defined value - termArray[form][name] = [single, multiple]; - } else { - if(typeof(termArray[name]) != "object") { - // if old object was just a single value, make it two copies - termArray[form][name] = [termArray[form][name], termArray[form][name]]; - } - - // redefine either single or multiple - if(single) { - termArray[form][name][0] = single; - } else { - termArray[form][name][1] = multiple; - } - } - } else { - if(name.substr(0, 6) == "month-") { - // place months into separate array - if(!termArray[form]["_months"]) { - termArray[form]["_months"] = new Array(); - } - var monthIndex = parseInt(name.substr(6),10)-1; - var term = term.text().toString(); - termArray[form]["_months"][monthIndex] = term[0].toUpperCase()+term.substr(1).toLowerCase(); - } else { - termArray[form][name] = term.text().toString(); - } - } - } - - // ensure parity between long and short months - var longMonths = termArray["long"]["_months"]; - var shortMonths = termArray["short"]["_months"]; - for(var i=0; i 5000) return ""; - var thousands = parseInt(number/1000); - if (thousands > 0) { - result += Zotero.CSL.Item._zoteroRomanNumerals[3][thousands]; - } - number = number % 1000; - var hundreds = parseInt(number/100); - if (hundreds > 0) { - result += Zotero.CSL.Item._zoteroRomanNumerals[2][hundreds]; - } - number = number % 100; - var tens = parseInt(number/10); - if (tens > 0) { - result += Zotero.CSL.Item._zoteroRomanNumerals[1][tens]; - } - number = number % 10; - if (number > 0) { - result += Zotero.CSL.Item._zoteroRomanNumerals[0][number]; - } - return result; -} - -Zotero.CSL.Item._zoteroNumberFieldMap = { - "volume":"volume", - "issue":"issue", - "number-of-volumes":"numberOfVolumes", - "edition":"edition", - "number":"number" -} -/* - * Gets a numeric object for a specific type. - */ -Zotero.CSL.Item.prototype.getNumericVariable = function(variable, form) { - - if(!Zotero.CSL.Item._zoteroNumberFieldMap[variable]) return ""; - - var zoteroFields = []; - var field; - - field = Zotero.CSL.Item._zoteroNumberFieldMap[variable]; - if(typeof field == "string") { - zoteroFields.push(field); - } else { - zoteroFields = zoteroFields.concat(field); - } - - var matches; - for each(var zoteroField in zoteroFields) { - var value = this.zoteroItem.getField(zoteroField, false, true).toString(); - - // Quoted strings are never numeric - if(value.match(Zotero.CSL._quotedRegexp)) { - continue; - } - - var matches; - if(value != "" && (matches = value.match(Zotero.CSL._numberRegexp)) ) { - value = matches[0]; - if (form == "ordinal") { - return this.makeOrdinal(value); - } - else if (form == "roman") { - return this.makeRoman(value); - } - else - return value; - } - } - return ""; -} - -/* - * Sets an item-specific property to a given value. - */ -Zotero.CSL.Item.prototype.setProperty = function(property, value) { - this._properties[property] = value; -} - -/* - * Sets an item-specific property to a given value. - */ -Zotero.CSL.Item.prototype.getProperty = function(property, value) { - return (this._properties[property] !== undefined ? this._properties[property] : ""); -} - -Zotero.CSL.Item._optionalTypeMap = { - journalArticle:"article-journal", - magazineArticle:"article-magazine", - newspaperArticle:"article-newspaper", - thesis:"thesis", - conferencePaper:"paper-conference", - letter:"personal_communication", - manuscript:"manuscript", - interview:"interview", - film:"motion_picture", - artwork:"graphic", - webpage:"webpage", - report:"report", - bill:"bill", - case:"legal_case", - hearing:"bill", // ?? - patent:"patent", - statute:"bill", // ?? - email:"personal_communication", - map:"map", - blogPost:"webpage", - instantMessage:"personal_communication", - forumPost:"webpage", - audioRecording:"song", // ?? - presentation:"speech", - videoRecording:"motion_picture", - tvBroadcast:"broadcast", - radioBroadcast:"broadcast", - podcast:"song", // ?? - computerProgram:"book" // ?? -}; - -// TODO: check with Elena/APA/MLA on this -Zotero.CSL.Item._fallbackTypeMap = { - book:"book", - bookSection:"chapter", - journalArticle:"article", - magazineArticle:"article", - newspaperArticle:"article", - thesis:"article", - encyclopediaArticle:"chapter", - dictionaryEntry:"chapter", - conferencePaper:"chapter", - letter:"article", - manuscript:"article", - interview:"article", - film:"book", - artwork:"book", - webpage:"article", - report:"book", - bill:"book", - case:"book", - hearing:"book", - patent:"article", - statute:"book", - email:"article", - map:"article", - blogPost:"article", - instantMessage:"article", - forumPost:"article", - audioRecording:"book", - presentation:"article", - videoRecording:"book", - tvBroadcast:"article", - radioBroadcast:"article", - podcast:"article", - computerProgram:"book" -}; - -/* - * Determines whether this item is of a given type - */ -Zotero.CSL.Item.prototype.isType = function(type) { - var zoteroType = Zotero.ItemTypes.getName(this.zoteroItem.itemTypeID); - - return (Zotero.CSL.Item._optionalTypeMap[zoteroType] - && Zotero.CSL.Item._optionalTypeMap[zoteroType] == type) - || (Zotero.CSL.Item._fallbackTypeMap[zoteroType] ? Zotero.CSL.Item._fallbackTypeMap[zoteroType] : "article") == type; -} - -/* - * Separates names into different types. - */ -Zotero.CSL.Item.prototype._separateNames = function() { - this._names = []; - - var authorID = Zotero.CreatorTypes.getPrimaryIDForType(this.zoteroItem.itemTypeID); - - var creators = this.zoteroItem.getCreators(); - for each(var creator in creators) { - if(creator.creatorTypeID == authorID) { - var variable = "author"; - } else { - var variable = Zotero.CreatorTypes.getName(creator.creatorTypeID); - } - - var name = new Zotero.CSL.Item.Name(creator); - - if(!this._names[variable]) { - this._names[variable] = [name]; - } else { - this._names[variable].push(name); - } - } -} - -/* - * Generates an date object for a given variable (currently supported: issued - * and accessed) - */ -Zotero.CSL.Item.prototype._createDate = function(variable) { - // first, figure out what date variable to use. - if(variable == "issued") { - var date = this.zoteroItem.getField("date", false, true); - var sort = this.zoteroItem.getField("date", true, true); - } else if(variable == "accessed") { - var date = this.zoteroItem.getField("accessDate", false, true); - var sort = this.zoteroItem.getField("accessDate", true, true); - } - - if(date) { - this._dates[variable] = new Zotero.CSL.Item.Date(date, sort); - } else { - this._dates[variable] = false; - } -} - -/* - * Date class - */ -Zotero.CSL.Item.Date = function(date, sort) { - this.date = date; - this.sort = sort; -} - -/* - * Should accept the following variables: - * - * year - returns a year (optionally, with attached B.C.) - * month - returns a month (numeric from 0, or, if numeric is not available, long) - * day - returns a day (numeric) - * sort - a date that can be used for sorting purposes - */ -Zotero.CSL.Item.Date.prototype.getDateVariable = function(variable) { - if(this.date) { - if(variable == "sort") { - return this.sort; - } - - if(!this.dateArray) { - this.dateArray = Zotero.Date.strToDate(this.date); - } - - if(this.dateArray[variable] !== undefined && this.dateArray[variable] !== false) { - return this.dateArray[variable]; - } else if(variable == "month") { - if(this.dateArray.part) { - return this.dateArray.part; - } - } - } - - return ""; -} - -/* - * Name class - */ -Zotero.CSL.Item.Name = function(zoteroCreator) { - this._zoteroCreator = zoteroCreator; -} - -/* - * Should accept the following variables: - * - * firstName - first name - * lastName - last name - */ -Zotero.CSL.Item.Name.prototype.getNameVariable = function(variable) { - return this._zoteroCreator.ref[variable] ? this._zoteroCreator.ref[variable] : ""; -} - -/* - * When an array of items are passed to create a new item set, each is wrapped - * in an item wrapper. - */ -Zotero.CSL.ItemSet = function(items, csl) { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - this.csl = csl; - - this.citation = csl._csl.citation; - this.bibliography = csl._csl.bibliography; - - // collect options - this.options = new Object(); - var options = this.citation.option.(@name.substr(0, 12) == "disambiguate") - + this.bibliography.option.(@name == "subsequent-author-substitute"); - for each(var option in options) { - this.options[option.@name.toString()] = option.@value.toString(); - } - - // check for disambiguate condition - for each(var thisIf in csl._csl..if) { - if(thisIf.@disambiguate.length()) { - this.options["disambiguate-condition"] = true; - break; - } - } - - // check for citation number - for each(var thisText in csl._csl..text) { - if(thisText.@variable == "citation-number") { - this.options["citation-number"] = true; - break; - } - } - - // set sortable - this.sortable = !!this.bibliography.sort.key.length(); - - this.items = []; - this.itemsById = {}; - - // add items - this.add(items); - - // check which disambiguation options are enabled - this._citationChangingOptions = new Array(); - this._disambiguate = false; - for(var option in this.options) { - if(option.substr(0, 12) == "disambiguate" && this.options[option]) { - this._citationChangingOptions.push(option); - this._disambiguate = true; - } else if(option == "citation-number" && this.options[option]) { - this._citationChangingOptions.push(option); - } - } - - if(!items) { - return; - } - - this.resort(); -} - - -/** - * Gets CSL.Item objects from an item set using their ids - * - * @param {Array} ids An array of ids - * @return {Array} items An array whose indexes correspond to those of ids, whose values are either - * the CSL.Item objects or false - **/ -Zotero.CSL.ItemSet.prototype.getItemsByIds = function(ids) { - var items = []; - for each(var id in ids) { - if(this.itemsById[id] != undefined) { - items.push(this.itemsById[id]); - } else { - items.push(false); - } - } - return items; -} - -/* - * Adds items to the given item set; must be passed either CSL.Item - * objects or objects that may be wrapped as CSL.Item objects - */ -Zotero.CSL.ItemSet.prototype.add = function(items) { - var newItems = new Array(); - - for(var i in items) { - if(items[i] instanceof Zotero.CSL.Item) { - var newItem = items[i]; - } else { - var newItem = new Zotero.CSL.Item(items[i]); - } - - newItem.setProperty("index", this.items.length); - - this.itemsById[newItem.id] = newItem; - this.items.push(newItem); - newItems.push(newItem); - } - - return newItems; -} - -/* - * Removes items from the item set; must be passed either CSL.Item objects - * or item IDs - */ -Zotero.CSL.ItemSet.prototype.remove = function(items) { - for(var i in items) { - if(!items[i]) continue; - if(items[i] instanceof Zotero.CSL.Item) { - var item = items[i]; - } else { - var item = this.itemsById[items[i]]; - } - if(item) { - this.itemsById[item.id] = undefined; - this.items.splice(this.items.indexOf(item), 1); - } - } -} - -/* - * Sorts the item set, also running postprocessing and returning items whose - * citations have changed - */ -Zotero.CSL.ItemSet.prototype.resort = function() { - default xml namespace = "http://purl.org/net/xbiblio/csl"; with({}); - - // sort - this.items = this.csl.cachedSort(this.items, this.bibliography); - - // first loop through to collect disambiguation data by item, so we can - // see if any items have changed; also collect last names - var oldOptions = new Array(); - for(var i in this._citationChangingOptions) { - oldOptions[i] = new Array(); - for(var j in this.items) { - if(this.items[j] == undefined) continue; - oldOptions[i][j] = this.items[j].getProperty(this._citationChangingOptions[i]); - this.items[j].setProperty(this._citationChangingOptions[i], ""); - } - } - - var namesByItem = new Object(); - for(var i=0; i 1) { - // have two items with identical last names but different - // first names - nameType[lastName] = Zotero.CSL.NAME_USE_INITIAL; - - // check initials to see if any match - var initials = new Object(); - for(var k=0; k lastNames.length) { - numberOfNames = lastNames.length; - item.setProperty("disambiguate-add-names", numberOfNames+1); - - // have to check old property - if(!oldAddNames || oldAddNames < numberOfNames) { - lastItem.setProperty("disambiguate-add-names", numberOfNames); - } - - disambiguated = true; - } else if(numberOfNames != lastNames.length) { - item.setProperty("disambiguate-add-names", numberOfNames); - - // have to check old property - if(!oldAddNames || oldAddNames < numberOfNames+1) { - lastItem.setProperty("disambiguate-add-names", numberOfNames+1); - } - - disambiguated = true; - } - } - - // now, loop through and see whether there's a - // dissimilarity before the end - var namesDiffer = false; - for(var j=0; j= 1) { - var nonZCharCode = lastDisambiguate.charCodeAt(newDisambiguate.length-1); - newDisambiguate = newDisambiguate.substring(0,newDisambiguate.length-1); - newDisambiguate += String.fromCharCode(nonZCharCode+1); - for(i=0;i 1) { - strings[i] = strings[i][0].toUpperCase()+strings[i].substr(1).toLowerCase(); - } else if(strings[i].length == 1) { - strings[i] = strings[i].toUpperCase(); - } - } - string = strings.join(" "); - } else if(element["@text-case"] == "title") { - string = Zotero.Text.titleCase(string); - } - } - - // style attributes - if(this.format == "HTML") { - var style = ""; - - var cssAttributes = ["font-family", "font-style", "font-variant", - "font-weight", "vertical-align", "display", - "text-decoration" ]; - for(var j in cssAttributes) { - var value = element["@"+cssAttributes[j]].toString(); - if(value && value.indexOf('"') == -1) { - style += cssAttributes[j]+":"+value+";"; - } - } - - if(style) { - addBefore += ''; - addAfter = ''+addAfter; - } - } else { - if(this.format == "RTF" || this.format == "Integration") { - var rtfAttributes = { - "font-style":{"oblique":"i", "italic":"i"}, - "font-variant":{"small-caps":"scaps"}, - "font-weight":{"bold":"b"}, - "text-decoration":{"underline":"ul"}, - "vertical-align":{"sup":"super", "sub":"sub"} - } - - for(var j in rtfAttributes) { - for(var k in rtfAttributes[j]) { - if(element["@"+j] == k) { - addBefore += "\\"+rtfAttributes[j][k]+" "; - addAfter = "\\"+rtfAttributes[j][k]+"0 "+addAfter; - } - } - } - } - } - - // add quotes if necessary - if(element.@quotes == "true") { - this.string += this._openQuote; - - if(this.useBritishStyleQuotes) { - string += this._closeQuote; - } else { - this.closePunctuation = this._closeQuote; - } - } - } - - if(!dontEscape) { - if(this.format == "HTML") { - string = string.replace("&", "&", "g") - .replace("<", "<", "g") - .replace(">", ">", "g") - .replace(/(\r\n|\r|\n)/g, "
    ") - .replace(/[\x00-\x1F]/g, ""); - } else if(this.format == "RTF" || this.format == "Integration") { - string = string.replace("\\", "\\\\", "g") - .replace(/(\r\n|\r|\n)/g, "\\line "); - if(string.substr(string.length-6) == "\\line ") { - string = string.substr(0, string.length-6); - addAfter = "\\line "+addAfter; - } - - if(this.format == "RTF") { - string = string.replace(/[{}\x7F-\uFFFF]/g, Zotero.CSL.FormattedString._rtfEscapeFunction) - .replace("\t", "\\tab ", "g"); - - if(string.substr(string.length-5) == "\\tab ") { - string = string.substr(0, string.length-5); - addAfter = "\\tab "+addAfter; - } - } - } else { - string = string.replace(/(\r\n|\r|\n)/g, (Zotero.isWin ? "\r\n" : "\n")); - } - } - - this.string += addBefore+string; - - if(element && element.@suffix.length()) { - this.append(element.@suffix.toString(), null, true); - } - - // save for second-field-align - if(!dontDelimit && this.insertTabAfterField) { - this.insertTabAfterField = false; - this.insertTabBeforeField = true; - } - - this.closeFormatting = addAfter; - - return true; -} - -/* - * gets the formatted string - */ -Zotero.CSL.FormattedString.prototype.get = function() { - return this.string+this.closeFormatting+this.closePunctuation; -} - -/* - * creates a new formatted string with the same formatting parameters as this one - */ -Zotero.CSL.FormattedString.prototype.clone = function(delimiter) { - return new Zotero.CSL.FormattedString(this.context, this.format, delimiter, true); -} - -/* - * Implementation of FormattedString for sort purposes. - */ -Zotero.CSL.SortString = function() { - default xml namespace = "http://purl.org/net/xbiblio/csl"; - - this.format = "Sort"; - this.string = []; -} - -Zotero.CSL.SortString.prototype.concat = function(newString) { - if(newString.string.length == 0) { - return; - } else if(newString.string.length == 1) { - this.string.push(newString.string[0]); - } else { - this.string.push(newString.string); - } -} - -Zotero.CSL.SortString.prototype.append = function(newString) { - this.string.push(newString); -} - -Zotero.CSL.SortString.prototype.compare = function(b, a) { - // by default, a is this string - if(a == undefined) { - a = this.string; - b = b.string; - } - - var aIsString = typeof(a) != "object"; - var bIsString = typeof(b) != "object"; - if(aIsString && bIsString) { - if(a == b) { - return 0; - } else if(!isNaN(a % 1) && !isNaN(b % 1)) { - // both numeric - if(b > a) return -1; - return 1; // already know they're not equal - } else { - var cmp = Zotero.CSL.Global.collation.compareString(Zotero.CSL.Global.collation.kCollationCaseInSensitive, a, b); - if(cmp == 0) { - // for some reason collation service returned 0; the collation - // service sucks! they can't be equal! - if(b > a) { - return -1; - } else { - return 1; - } - } - return cmp; - } - } else if(aIsString && !bIsString) { - var cmp = this.compare(b[0], a); - if(cmp == 0) { - return -1; // a before b - } - return cmp; - } else if(bIsString && !aIsString) { - var cmp = this.compare(b, a[0]); - if(cmp == 0) { - return 1; // b before a - } - return cmp; - } - - var maxLength = Math.min(b.length, a.length); - for(var i = 0; i < maxLength; i++) { - var cmp = this.compare(b[i], a[i]); - if(cmp != 0) { - return cmp; - } - } - - if(b.length > a.length) { - return -1; // a before b - } else if(b.length < a.length) { - return 1; // b before a - } - - return 0; -} - - -Zotero.CSL.SortString.prototype.clone = function() { - return new Zotero.CSL.SortString(); -} \ No newline at end of file diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 3fd0925896..d3223200cd 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -26,6 +26,7 @@ const RESELECT_KEY_URI = 1; const RESELECT_KEY_ITEM_KEY = 2; const RESELECT_KEY_ITEM_ID = 3; +const DATA_VERSION = 3; Zotero.Integration = new function() { var _fifoFile = null; @@ -222,6 +223,7 @@ Zotero.Integration = new function() { integration._doc.displayAlert(Zotero.getString("integration.error.generic")+message, Components.interfaces.zoteroIntegrationDocument.DIALOG_ICON_STOP, Components.interfaces.zoteroIntegrationDocument.DIALOG_BUTTONS_OK); + Zotero.debug(e); throw e; } } @@ -294,8 +296,11 @@ Zotero.Integration.UserCancelledException.prototype.name = "UserCancelledExcepti Zotero.Integration.UserCancelledException.prototype.message = "User cancelled document update."; Zotero.Integration.UserCancelledException.prototype.toString = function() { return this.message; }; -Zotero.Integration.DisplayException = function(name) { this.name = name }; -Zotero.Integration.DisplayException.prototype.toString = function() { return Zotero.getString("integration.error."+this.name); }; +Zotero.Integration.DisplayException = function(name, params) { + this.name = name; + this.params = params ? params : []; +}; +Zotero.Integration.DisplayException.prototype.toString = function() { return Zotero.getString("integration.error."+this.name, this.params); }; Zotero.Integration.CorruptFieldException = function(corruptFieldString) { this.corruptFieldString = corruptFieldString; @@ -358,14 +363,15 @@ Zotero.Integration.Document.prototype._getSession = function(require, dontRunSet this._doc.setDocumentData(this._session.data.serializeXML()); } } else { - if(dataString[0] != "<") { + var data = new Zotero.Integration.DocumentData(dataString); + if(data.dataVersion < DATA_VERSION) { var warning = this._doc.displayAlert(Zotero.getString("integration.upgradeWarning"), Components.interfaces.zoteroIntegrationDocument.DIALOG_ICON_WARNING, Components.interfaces.zoteroIntegrationDocument.DIALOG_BUTTONS_OK_CANCEL); if(!warning) throw new Zotero.Integration.UserCancelledException(); + } else if(data.dataVersion > DATA_VERSION) { + throw new Zotero.Integration.DisplayException("newerDocumentVersion", [data.zoteroVersion, Zotero.version]); } - - var data = new Zotero.Integration.DocumentData(dataString); if(Zotero.Integration.sessions[data.sessionID]) { this._session = Zotero.Integration.sessions[data.sessionID]; } else { @@ -409,7 +415,7 @@ Zotero.Integration.Document.prototype._getFields = function(require) { while(fields.hasMoreElements()) { this._fields.push(fields.getNext().QueryInterface(Components.interfaces.zoteroIntegrationField)); } - var endTime = (new Date()).getTime();; + var endTime = (new Date()).getTime(); Zotero.debug("Got "+this._fields.length+" fields in "+(endTime-getFieldsTime)/1000+"; "+1000/((endTime-getFieldsTime)/this._fields.length)+" fields/second"); if(require && !this._fields.length) { @@ -468,7 +474,7 @@ Zotero.Integration.Document.prototype._updateSession = function(newField, editFi var fieldCode = field.getCode(); if(fieldCode.substr(0, ITEM_CODE.length) == ITEM_CODE) { - var noteIndex = (this._session.style.class == "note" ? field.getNoteIndex() : 0); + var noteIndex = (this._session.styleClass == "note" ? field.getNoteIndex() : 0); try { this._session.addCitation(i, noteIndex, fieldCode.substr(ITEM_CODE.length+1)); } catch(e) { @@ -582,7 +588,8 @@ Zotero.Integration.Document.prototype._updateSession = function(newField, editFi } } - this._session.updateItemSet(); + //this._session.updateItems(); + this._session.updateCitations(); // create new citation or edit existing citation if(editFieldIndex) { @@ -602,6 +609,7 @@ Zotero.Integration.Document.prototype._updateSession = function(newField, editFi } } } + this._session.updateItems(); } /** @@ -632,37 +640,28 @@ Zotero.Integration.Document.prototype._updateDocument = function(forceCitations, // update citations this._session.updateUpdateIndices(forceCitations); - for(var i in this._session.updateIndices) { + this._deleteFields = this._deleteFields.concat(this._session.updateCitations()); + for(var i in this._session.citationText) { citation = this._session.citationsByIndex[i]; if(!citation) continue; - if(citation.properties["delete"]) { - // delete citation - this._deleteFields.push(i); + var fieldCode = this._session.getCitationField(citation); + if(fieldCode != citation.properties.field) { + this._fields[citation.properties.index].setCode(ITEM_CODE+" "+fieldCode); + } + + if(citation.properties.custom) { + var citationText = citation.properties.custom; } else { - var fieldCode = this._session.getCitationField(citation); - if(fieldCode != citation.properties.field) { - this._fields[citation.properties.index].setCode(ITEM_CODE+" "+fieldCode); - } - - if(citation.properties.custom) { - var citationText = citation.properties.custom; - // XML uses real RTF, rather than the format used for - // integration, so we have to escape things properly - citationText = citationText.replace(/[{}\x7F-\uFFFF]/g, - Zotero.Integration.Session._rtfEscapeFunction). - replace("\t", "\\tab ", "g"); - } else { - var citationText = this._session.style.formatCitation(citation, "RTF"); - } - - if(citationText.indexOf("\\") !== -1) { - // need to set text as RTF - this._fields[citation.properties.index].setText("{\\rtf "+citationText+"}", true); - } else { - // set text as plain - this._fields[citation.properties.index].setText(citationText, false); - } + var citationText = this._session.citationText[i]; + } + + if(citationText.indexOf("\\") !== -1) { + // need to set text as RTF + this._fields[citation.properties.index].setText("{\\rtf "+citationText+"}", true); + } else { + // set text as plain + this._fields[citation.properties.index].setText(citationText, false); } } @@ -713,7 +712,7 @@ Zotero.Integration.Document.prototype.addBibliography = function() { this._getSession(true); // Make sure we can have a bibliography - if(!this._session.style.hasBibliography) { + if(!this._session.data.style.hasBibliography) { throw new Zotero.Integration.DisplayException("noBibliography"); } @@ -856,7 +855,29 @@ Zotero.Integration.Document.JSEnumerator.prototype.getNext = function() { Zotero.Integration.Session = function() { // holds items not in document that should be in bibliography this.uncitedItems = new Object(); + this.customBibliographyText = new Object(); this.reselectedItems = new Object(); + this.citationIDs = new Object(); +} + +/** + * Resets per-request variables in the CitationSet + */ +Zotero.Integration.Session.prototype.resetRequest = function() { + this.citationsByItemID = new Object(); + this.citationsByIndex = new Array(); + this.uriMap = new Zotero.Integration.URIMap(this); + + this.regenerateAll = false; + this.bibliographyHasChanged = false; + this.bibliographyDataHasChanged = false; + this.updateItemIDs = new Object(); + this.updateIndices = new Object(); + this.newIndices = new Object(); + + this.oldCitationIDs = this.citationIDs; + this.citationIDs = new Object(); + this.citationText = new Object(); } /** @@ -868,12 +889,14 @@ Zotero.Integration.Session.prototype.setData = function(data) { this.data = data; if(data.style.styleID && oldStyleID != data.style.styleID) { this.styleID = data.style.styleID; + Zotero.debug("style is "+data.style.styleID); try { - this.style = Zotero.Styles.get(data.style.styleID).csl; + var getStyle = Zotero.Styles.get(data.style.styleID); + data.style.hasBibliography = getStyle.hasBibliography; + this.style = getStyle.csl; + this.style.setOutputFormat("rtf"); + this.styleClass = getStyle.class; this.dateModified = new Object(); - - this.itemSet = this.style.createItemSet(); - this.loadUncitedItems(); } catch(e) { Zotero.debug(e) data.style.styleID = undefined; @@ -916,7 +939,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se data.prefs.fieldType = io.fieldType; this.setData(data); // need to do this after setting the data so that we know if it's a note style - this.data.prefs.noteType = this.style && this.style.class == "note" ? io.useEndnotes+1 : 0; + this.data.prefs.noteType = this.style && this.styleClass == "note" ? io.useEndnotes+1 : 0; if(!oldData || oldData.style.styleID != data.style.styleID || oldData.prefs.noteType != data.prefs.noteType @@ -960,71 +983,61 @@ Zotero.Integration.Session.prototype.reselectItem = function(exception) { } } -/** - * Resets per-request variables in the CitationSet - */ -Zotero.Integration.Session.prototype.resetRequest = function() { - this.citationsByItemID = new Object(); - this.citationsByIndex = new Array(); - this.uriMap = new Zotero.Integration.URIMap(this); - - this.regenerateAll = false; - this.bibliographyHasChanged = false; - this.bibliographyDataHasChanged = false; - this.updateItemIDs = new Object(); - this.updateIndices = new Object(); -} - /** * Generates a field from a citation object */ Zotero.Integration.Session._acceptableTypes = ["string", "boolean", "number"]; Zotero.Integration.Session._saveProperties = ["custom", "sort"]; +Zotero.Integration.Session._saveItems = ["locator", "label", "suppress-author", "author-only", "prefix", "suffix"]; Zotero.Integration.Session.prototype.getCitationField = function(citation) { - var type, field = ""; + var type; + var field = []; + field.push('"citationID":'+Zotero.JSON.serialize(citation.citationID)); + var properties = []; for(var j=0; j= citation.properties.index - ? Zotero.CSL.POSITION_FIRST : Zotero.CSL.POSITION_SUBSEQUENT); - - // update if desired - if(update && (citation.citationItems[i].position || newPosition) && citation.citationItems[i].position != newPosition) { - this.updateIndices[citation.properties.index] = true; - } - citation.citationItems[i].position = newPosition; - } - } -} - -/** - * Updates the ItemSet, adding and deleting bibliography items as appropriate, then re-sorting - */ -Zotero.Integration.Session.prototype.updateItemSet = function() { - var deleteItems = []; - var missingItems = []; - - // see if items were deleted from Zotero - for(var i in this.citationsByItemID) { - if (!Zotero.Items.get(i)) { - deleteItems.push(i); - missingItems.push(i); - } - } - - // see if old items were deleted or changed - for each(var item in this.itemSet.items) { - var itemID = item.id; - - // see if items were removed - if(!this.citationsByItemID[itemID] && !this.uncitedItems[itemID]) { - deleteItems.push(itemID); - continue; - } - - if(item.zoteroItem && this.dateModified[itemID] != item.zoteroItem.getField("dateModified", true, true)) { - // update date modified - this.dateModified[itemID] = item.zoteroItem.getField("dateModified", true, true); - // add to list of updated item IDs - this.updateItemIDs[itemID] = true; - } - } - - // delete items from item set - if(deleteItems.length) { - this.itemSet.remove(deleteItems); - this.bibliographyHasChanged = true; - } - - this.sortItemSet(); -} - -/** - * Sorts the ItemSet - */ -Zotero.Integration.Session.prototype.sortItemSet = function() { - // save first index - for(var itemID in this.citationsByItemID) { - if(this.citationsByItemID[itemID]) { - var item = this.itemSet.getItemsByIds([itemID])[0]; - if(item) item.setProperty("index", this.citationsByItemID[itemID][0].properties.index); - } - } - - var citationChanged = this.itemSet.resort(); - - // add to list of updated item IDs - for each(var item in citationChanged) { - this.updateItemIDs[item.id] = true; - this.bibliographyHasChanged = true; - } -} - -/** - * Edits integration bibliography - */ -Zotero.Integration.Session.prototype.editBibliography = function() { - var bibliographyEditor = new Zotero.Integration.Session.BibliographyEditInterface(this); - var io = new function() { this.wrappedJSObject = bibliographyEditor; } - - this.bibliographyDataHasChanged = this.bibliographyHasChanged = true; - - var window = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] - .getService(Components.interfaces.nsIWindowWatcher) - .openWindow(null, 'chrome://zotero/content/integration/editBibliographyDialog.xul', '', - 'chrome,centerscreen,resizable', io, true); - while(!window.closed) Zotero.mainThread.processNextEvent(true); + this.updateIndices[index] = true; } /** @@ -1450,13 +1265,46 @@ Zotero.Integration.Session.prototype.editBibliography = function() { */ Zotero.Integration.Session.prototype.getBibliography = function() { // use real RTF, but chop off the first \n - var text = this.style.formatBibliography(this.itemSet, "RTF") - var nlIndex = text.indexOf("\n"); - if(nlIndex !== -1) { - return "{\\rtf "+text.substr(text.indexOf("\n")); - } else { - return ""; - } + return Zotero.Cite.makeFormattedBibliography(this.style, "rtf", this.customBibliographyText); +} + +/** + * Calls CSL.Engine.updateItems() to reconcile item list with current items in document + */ +Zotero.Integration.Session.prototype.updateItems = function() { + var items = [[i, this.citationsByItemID[i][0]] for(i in this.citationsByItemID) + if(this.citationsByItemID[i] && this.citationsByItemID[i].length && + this.citationsByItemID[i].some(function(citation) citation.properties && !citation.properties.delete))]; + + items.sort(function(a, b) { + // if first citation of each in different citations, use citation index + if(a[1].properties.index != b[1].properties.index) { + return a[1].properties.index-b[1].properties.index; + } + + // if a and b were both first cited in the same citation, look for index in the citation + for each(var citationItem in a[1].citationItems) { + if(citationItem.id == a[0]) { + return -1; + } else if(citationItem.id == b[0]) { + return 1; + } + } + + // should never happen + Zotero.debug("WARNING: Zotero.Integration.Session.updateItems sort function returned 0"); + return 0; + }); + + // get rid of the second part of the items (the first citation, used for sort purposes) + // and also add in the uncited items + items = [parseInt(item[0]) for each(item in items)].concat([parseInt(i) for(i in this.uncitedItems)]); + + //Zotero.debug("items are "); + //Zotero.debug(items); + + // set items in the bibliography + this.style.updateItems(items); } /** @@ -1480,8 +1328,70 @@ Zotero.Integration.Session.prototype.updateUpdateIndices = function(regenerateAl } } -Zotero.Integration.Session._rtfEscapeFunction = function(aChar) { - return "{\\uc0\\u"+aChar.charCodeAt(0).toString()+"}" +/** + * Returns a formatted citation + */ +Zotero.Integration.Session.prototype.formatCitation = function(index, citation) { + if(!this.citationText[index]) { + //this.updateItems(); + var citationIndices = []; + var citationsPre = []; + for(var i=0; i 1); + } +} + +/** + * Updates the list of citations to be serialized to the document + */ +Zotero.Integration.Session.prototype.updateCitations = function() { + Zotero.debug("Zotero.Integration: indices of new citations"); + Zotero.debug([key for(key in this.newIndices)]); + Zotero.debug("Zotero.Integration: indices of updated citations"); + Zotero.debug([key for(key in this.updateIndices)]); + var deleteCitations = []; + for each(var indexList in [this.newIndices, this.updateIndices]) { + for(var index in indexList) { + index = parseInt(index, 10); + var citation = this.citationsByIndex[index]; + if(citation.properties.delete) { + deleteCitations.push(index); + continue; + } + if(this.formatCitation(index, citation)) { + this.bibliographyHasChanged = true; + } + if(!this.citationIDs[citation.citationID]) { + this.citationIDs[citation.citationID] = citation; + } + delete this.newIndices[index]; + } + } + + return deleteCitations; } /** @@ -1519,8 +1429,6 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { } } - this.loadUncitedItems(); - // set custom bibliography entries if(documentData.custom) { if(documentData.custom[0]) { @@ -1531,11 +1439,9 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { if(!zoteroItem) continue; if(needUpdate) this.bibliographyDataHasChanged = true; - var item = this.itemSet.getItemsByIds([zoteroItem.id])[0]; - if(!item) continue; - - item.setProperty("bibliography-Integration", custom[1]); - item.setProperty("bibliography-RTF", custom[1]); + if(this.citationsByItemID[zoteroItem.id] || this.uncitedItems[zoteroItem.id]) { + this.customBibliographyText[zoteroItem.id] = custom[1]; + } } } else { // old style hash @@ -1544,10 +1450,9 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { if(!zoteroItem) zoteroItem = Zotero.Items.get(itemID); if(!zoteroItem) continue; - var item = this.itemSet.getItemsByIds([zoteroItem.id])[0]; - if (!item) continue; - item.setProperty("bibliography-Integration", documentData.custom[itemID]); - item.setProperty("bibliography-RTF", documentData.custom[itemID]); + if(this.citationsByItemID[zoteroItem.id] || this.uncitedItems[zoteroItem.id]) { + this.customBibliographyText[zoteroItem.id] = documentData.custom[itemID]; + } } this.bibliographyDataHasChanged = true; } @@ -1556,21 +1461,6 @@ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { this.bibliographyData = json; } -/** - * Adds items in this.uncitedItems to itemSet, if they are not already there - */ -Zotero.Integration.Session.prototype.loadUncitedItems = function() { - for(var itemID in this.uncitedItems) { - // skip "undefined" - if(!this.uncitedItems[itemID]) continue; - var item = this.itemSet.getItemsByIds([itemID])[0]; - if(!item) { - var zoteroItem = Zotero.Items.get(itemID); - if(zoteroItem) this.itemSet.add([zoteroItem]); - } - } -} - /** * Saves document data from a JSON object */ @@ -1586,17 +1476,8 @@ Zotero.Integration.Session.prototype.getBibliographyData = function() { } // look for custom bibliography entries - if(this.itemSet.items.length) { - for(var i=0; i + var xmlData =