diff --git a/lib/citeServer.js b/lib/citeServer.js index 691ca78..a5d82c7 100644 --- a/lib/citeServer.js +++ b/lib/citeServer.js @@ -91,7 +91,7 @@ var defaultCiteserverConfig = { var defaultRequestConfig = { bibliography: '1', citations: '0', - outputformat: 'html', + outputformat: 'org', responseformat: 'json', locale: 'en-US', style: 'chicago-author-date', diff --git a/lib/citeproc.js b/lib/citeproc.js index 08a8008..8622533 100644 --- a/lib/citeproc.js +++ b/lib/citeproc.js @@ -13140,6 +13140,106 @@ CSL.Output.Formats.prototype.html = { return "" + str + ""; } }; + +CSL.Output.Formats.prototype.org = { + "text_escape": function (text) { + if (!text) { + text = ""; + } + return text.replace(/&/g, "&") + .replace(//g, ">") + .replace(" ", "  ", "g") + .replace(CSL.SUPERSCRIPTS_REGEXP, + function(aChar) { + return "" + CSL.SUPERSCRIPTS[aChar] + ""; + }); + }, + "bibstart": "* Bibliography\n", + "bibend": "\n", + "@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": false, + "@font-weight/light": false, + "@text-decoration/none": false, + "@text-decoration/underline": "_%%STRING%%_", + "@vertical-align/sup": "^{%%STRING%%}", + "@vertical-align/sub": "_{%%STRING%%}", + "@vertical-align/baseline": false, + "@strip-periods/true": CSL.Output.Formatters.passthrough, + "@strip-periods/false": CSL.Output.Formatters.passthrough, + "@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"); + }, + "@quotes/false": false, + "@cite/entry": function (state, str) { + return state.sys.wrapCitationEntry(str, this.item_id, this.locator_txt, this.suffix_txt); + }, + "@bibliography/entry": function (state, str) { + var insert = ""; + if (state.sys.embedBibliographyEntry) { + insert = state.sys.embedBibliographyEntry(this.item_id) + "\n"; + } + return " \n" + str + "\n" + insert; + }, + "@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 "; + }, + "@showid/true": function (state, str, cslid) { + if (!state.tmp.just_looking && ! state.tmp.suppress_decorations) { + if (cslid) { + return "" + str + ""; + } else if ("string" === typeof str) { + var prePunct = ""; + if (str) { + var m = str.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX); + prePunct = m[1]; + str = m[2]; + } + var postPunct = ""; + if (str && CSL.SWAPPING_PUNCTUATION.indexOf(str.slice(-1)) > -1) { + postPunct = str.slice(-1); + str = str.slice(0,-1); + } + return state.sys.variableWrapper(this.params, prePunct, str, postPunct); + } else { + return str; + } + } else { + return str; + } + }, + "@URL/true": function (state, str) { + return "" + str + ""; + }, + "@DOI/true": function (state, str) { + return "" + str + ""; + } +}; + CSL.Output.Formats.prototype.text = { "text_escape": function (text) { if (!text) {