Closes #1192, Patch to disable escaping of the URL field in BibTeX
This commit is contained in:
parent
310e233480
commit
021d0c0d03
|
@ -1786,10 +1786,14 @@ function writeField(field, value, isMacro) {
|
||||||
value = value + ""; // convert integers to strings
|
value = value + ""; // convert integers to strings
|
||||||
Zotero.write(",\n\t"+field+" = ");
|
Zotero.write(",\n\t"+field+" = ");
|
||||||
if(!isMacro) Zotero.write("{");
|
if(!isMacro) Zotero.write("{");
|
||||||
|
// 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!
|
// I hope these are all the escape characters!
|
||||||
value = value.replace(/[|\<\>\~\^\\]/g, mapEscape).replace(/([\#\$\%\&\_])/g, "\\$1");
|
value = value.replace(/[|\<\>\~\^\\]/g, mapEscape).replace(/([\#\$\%\&\_])/g, "\\$1");
|
||||||
// Case of words with uppercase characters in non-initial positions is preserved with braces.
|
// 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(!isMacro) value = value.replace(/([^\s]+[A-Z][^\s]*)/g, "{$1}");
|
||||||
|
}
|
||||||
if (!Zotero.getOption("UTF8")) {
|
if (!Zotero.getOption("UTF8")) {
|
||||||
value = value.replace(/[\u0080-\uFFFF]/g, mapAccent);
|
value = value.replace(/[\u0080-\uFFFF]/g, mapAccent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user