Use em-dashes instead of hyphens for subsequent-author-substitute in Chicago

Put Unicode characters in RTF output in braces to avoid need for extra space (which showed up in OS X TextEdit but not Windows WordPad) -- as far as I can tell, this works cross-platform.

Replace en and em dashes in HTML bib output with HTML entities


Not pushing updated CSLs to repo, since the em-dashes rely on these other changes (particularly the RTF one) to appear properly
This commit is contained in:
Dan Stillman 2007-04-26 00:03:51 +00:00
parent 41e1570e66
commit 27960ad1f1
2 changed files with 38 additions and 13 deletions

View File

@ -1561,18 +1561,43 @@ Zotero.CSL.FormattedString.prototype.append = function(string, element, dontDeli
if(!dontEscape) {
if(this.format == "HTML") {
// replace HTML entities
string = string.replace(/&/g, "&");
string = string.replace(/</g, "&lt;");
string = string.replace(/>/g, "&gt;");
var newString = "";
for(var i=0; i<string.length; i++) {
var charCode = string.charCodeAt(i);
// Replace certain characters with HTML entities
switch (charCode) {
case 38: // &
newString += '&amp;';
break;
case 60: // <
newString += '&lt;';
break;
case 62: // >
newString += '&gt;';
break;
case 8211: // en-dash
newString += '&#8211;'
break;
case 8212: // em-dash
newString += '&#8212;'
break;
default:
newString += string[i];
}
}
string = newString;
} else if(this.format == "RTF") {
var newString = "";
// go through and fix up unicode entities
for(i=0; i<string.length; i++) {
for(var i=0; i<string.length; i++) {
var charCode = string.charCodeAt(i);
Zotero.debug(charCode);
if(charCode > 127) { // encode unicode
newString += "\\uc0\\u"+charCode.toString()+" ";
newString += "{\\uc0\\u"+charCode.toString()+"}";
} else if(charCode == 92) { // double backslashes
newString += "\\\\";
} else {
@ -1580,7 +1605,7 @@ Zotero.CSL.FormattedString.prototype.append = function(string, element, dontDeli
}
}
string = newString
string = newString;
} else if(this.format == "Integration") {
string = string.replace(/\\/g, "\\\\");
}

View File

@ -1,4 +1,4 @@
-- 220
-- 221
-- ***** BEGIN LICENSE BLOCK *****
--
@ -22,7 +22,7 @@
-- Set the following timestamp to the most recent scraper update date
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-04-24 15:30:00'));
REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-04-25 23:40:00'));
REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-03-21 15:26:54', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon',
'function detectWeb(doc, url) {
@ -11086,7 +11086,7 @@ REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/apa.csl', '2007-
</bibliography>
</style>');
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2007-03-23 19:25:00', 'Chicago Manual of Style (Author-Date)',
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-date.csl', '2007-04-25 23:40:00', 'Chicago Manual of Style (Author-Date)',
'<?xml version="1.0" encoding="UTF-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="author-date" xml:lang="en">
<info>
@ -11150,7 +11150,7 @@ REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-author-dat
</item>
</layout>
</citation>
<bibliography hanging-indent="true" subsequent-author-substitute="---">
<bibliography hanging-indent="true" subsequent-author-substitute="&#8212;&#8212;&#8212;">
<sort algorithm="author-date"/>
<et-al min-authors="6" use-first="6"/>
<layout>
@ -11415,7 +11415,7 @@ REPLACE INTO csl VALUES('http://purl.org/net/xbiblio/csl/styles/chicago-note.csl
</citation>
</style>');
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibliography.csl', '2007-03-23 21:30:00', 'Chicago Manual of Style (Note with Bibliography)',
REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibliography.csl', '2007-04-25 23:40:00', 'Chicago Manual of Style (Note with Bibliography)',
'<?xml version="1.0" encoding="UTF-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" xml:lang="en">
<info>
@ -11485,7 +11485,7 @@ REPLACE INTO csl VALUES('http://www.zotero.org/namespaces/CSL/chicago-note-bibli
</item>
</layout>
</citation>
<bibliography hanging-indent="true" subsequent-author-substitute="---">
<bibliography hanging-indent="true" subsequent-author-substitute="&#8212;&#8212;&#8212;">
<sort>
<author name-as-sort-order="all"/>
<titles/>