commit 021d0c0d03251adb741483ee899edc574756ab1f
parent 310e233480f8a8582635df8a25242b1170e49a79
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 25 Oct 2008 08:10:01 +0000
Closes #1192, Patch to disable escaping of the URL field in BibTeX
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git 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);
}