From 021d0c0d03251adb741483ee899edc574756ab1f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 25 Oct 2008 08:10:01 +0000 Subject: [PATCH] Closes #1192, Patch to disable escaping of the URL field in BibTeX --- translators/BibTeX.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/translators/BibTeX.js b/translators/BibTeX.js index e71f1123b..57600c6b6 100644 --- a/translators/BibTeX.js +++ b/translators/BibTeX.js @@ -1786,10 +1786,14 @@ function writeField(field, value, isMacro) { value = value + ""; // convert integers to strings Zotero.write(",\n\t"+field+" = "); if(!isMacro) Zotero.write("{"); - // I hope these are all the escape characters! - value = value.replace(/[|\<\>\~\^\\]/g, mapEscape).replace(/([\#\$\%\&\_])/g, "\\$1"); - // Case of words with uppercase characters in non-initial positions is preserved with braces. - if(!isMacro) value = value.replace(/([^\s]+[A-Z][^\s]*)/g, "{$1}"); + // url field is preserved, for use with \href and \url + // Other fields (DOI?) may need similar treatment + if(field != "url") { + // I hope these are all the escape characters! + value = value.replace(/[|\<\>\~\^\\]/g, mapEscape).replace(/([\#\$\%\&\_])/g, "\\$1"); + // Case of words with uppercase characters in non-initial positions is preserved with braces. + if(!isMacro) value = value.replace(/([^\s]+[A-Z][^\s]*)/g, "{$1}"); + } if (!Zotero.getOption("UTF8")) { value = value.replace(/[\u0080-\uFFFF]/g, mapAccent); }