- closes #841, Do not cite URL for articles with page numbers by default

- adds a preference to configure this behavior. if localizing the strings is too much work, we can defer this to a later release
This commit is contained in:
Simon Kornblith 2007-12-01 05:44:44 +00:00
parent 43c07f853b
commit 3487bf8737
5 changed files with 27 additions and 2 deletions

View File

@ -245,9 +245,16 @@ To add a new preference:
label="&zotero.preferences.prefpane.export;" label="&zotero.preferences.prefpane.export;"
image="chrome://zotero/skin/prefs-export.png"> image="chrome://zotero/skin/prefs-export.png">
<preferences> <preferences>
<preference id="pref-export-citePaperJournalArticleURL" name="extensions.zotero.export.citePaperJournalArticleURL" type="bool"/>
<preference id="pref-quickCopy-setting" name="extensions.zotero.export.quickCopy.setting" type="string"/> <preference id="pref-quickCopy-setting" name="extensions.zotero.export.quickCopy.setting" type="string"/>
</preferences> </preferences>
<groupbox>
<caption label="&zotero.preferences.citationOptions.caption;"/>
<checkbox label="&zotero.preferences.export.citePaperJournalArticleURL;" preference="pref-export-citePaperJournalArticleURL"/>
<label id="export-citePaperJournalArticleURL">&zotero.preferences.export.citePaperJournalArticleURL.description;</label>
</groupbox>
<groupbox> <groupbox>
<caption label="&zotero.preferences.quickCopy.caption;"/> <caption label="&zotero.preferences.quickCopy.caption;"/>

View File

@ -1713,6 +1713,14 @@ Zotero.CSL.Item = function(item) {
throw "Zotero.CSL.Item called to wrap a non-item"; throw "Zotero.CSL.Item called to wrap a non-item";
} }
// don't return URL or accessed information for journal articles if a
// pages field exists
if(!Zotero.Prefs.get("export.citePaperJournalArticleURL")
&& Zotero.ItemTypes.getName(this.zoteroItem.getType()) == "journalArticle"
&& this.zoteroItem.getField("pages")) {
this._ignoreURL = true;
}
this._properties = {}; this._properties = {};
this._refreshItem(); this._refreshItem();
} }
@ -1766,6 +1774,9 @@ Zotero.CSL.Item.prototype.getNames = function(variable) {
* Gets an Item.Date object for a specific type. * Gets an Item.Date object for a specific type.
*/ */
Zotero.CSL.Item.prototype.getDate = function(variable) { Zotero.CSL.Item.prototype.getDate = function(variable) {
// ignore accessed date
if(this._ignoreURL && variable == "accessed") return false;
// load date variable if possible // load date variable if possible
this._refreshItem(); this._refreshItem();
if(this._dates[variable] == undefined) { if(this._dates[variable] == undefined) {
@ -1813,6 +1824,9 @@ Zotero.CSL.Item._zoteroFieldMap = {
Zotero.CSL.Item.prototype.getVariable = function(variable, form) { Zotero.CSL.Item.prototype.getVariable = function(variable, form) {
if(!Zotero.CSL.Item._zoteroFieldMap["long"][variable]) return ""; if(!Zotero.CSL.Item._zoteroFieldMap["long"][variable]) return "";
// ignore URL
if(this._ignoreURL && variable == "URL") return ""
var zoteroFields = []; var zoteroFields = [];
var field; var field;
@ -1832,7 +1846,6 @@ Zotero.CSL.Item.prototype.getVariable = function(variable, form) {
zoteroFields = zoteroFields.concat(field); zoteroFields = zoteroFields.concat(field);
} }
for each(var zoteroField in zoteroFields) { for each(var zoteroField in zoteroFields) {
var value = this.zoteroItem.getField(zoteroField, false, true); var value = this.zoteroItem.getField(zoteroField, false, true);
if(value != "") return value; if(value != "") return value;

View File

@ -47,6 +47,10 @@
<!ENTITY zotero.preferences.prefpane.export "Export"> <!ENTITY zotero.preferences.prefpane.export "Export">
<!ENTITY zotero.preferences.citationOptions.caption "Citation Options">
<!ENTITY zotero.preferences.export.citePaperJournalArticleURL "Include URLs of paper journal articles in references">
<!ENTITY zotero.preferences.export.citePaperJournalArticleURL.description "When this option is disabled, Zotero includes URLs when citing journal articles only if the article does not have a page range specified.">
<!ENTITY zotero.preferences.quickCopy.caption "Quick Copy"> <!ENTITY zotero.preferences.quickCopy.caption "Quick Copy">
<!ENTITY zotero.preferences.quickCopy.defaultOutputFormat "Default Output Format:"> <!ENTITY zotero.preferences.quickCopy.defaultOutputFormat "Default Output Format:">
<!ENTITY zotero.preferences.quickCopy.macWarning "Note: Rich-text formatting will be lost on Mac OS X."> <!ENTITY zotero.preferences.quickCopy.macWarning "Note: Rich-text formatting will be lost on Mac OS X.">

View File

@ -95,7 +95,7 @@ grid row hbox:first-child
height: 1em; height: 1em;
} }
#quickCopy-instructions, #quickCopy-macWarning #quickCopy-instructions, #quickCopy-macWarning, #export-citePaperJournalArticleURL
{ {
font-size: .85em; font-size: .85em;
} }

View File

@ -60,6 +60,7 @@ pref("extensions.zotero.export.translatorSettings", 'true,false');
pref("extensions.zotero.export.lastStyle", 'http://www.zotero.org/styles/chicago-note.csl'); pref("extensions.zotero.export.lastStyle", 'http://www.zotero.org/styles/chicago-note.csl');
pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf'); pref("extensions.zotero.export.bibliographySettings", 'save-as-rtf');
pref("extensions.zotero.export.bibliographyLocale", ''); pref("extensions.zotero.export.bibliographyLocale", '');
pref("extensions.zotero.export.citePaperJournalArticleURL", false);
pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://www.zotero.org/styles/chicago-note.csl'); pref("extensions.zotero.export.quickCopy.setting", 'bibliography=http://www.zotero.org/styles/chicago-note.csl');