Closes #1192, Patch to disable escaping of the URL field in BibTeX

This commit is contained in:
Dan Stillman 2008-10-25 08:10:01 +00:00
parent 310e233480
commit 021d0c0d03

View File

@ -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);
}