Skip to content

Commit

Permalink
Merge pull request #764 from aurimasv/bibtex-page-range
Browse files Browse the repository at this point in the history
[Bib(La)TeX] Convert all dashes in pages to double dash on export
  • Loading branch information
aurimasv committed Aug 24, 2014
2 parents e809d0e + b7e30d0 commit 9725e32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion BibLaTeX.js
Expand Up @@ -15,7 +15,7 @@
"exportFileData": false,
"useJournalAbbreviation": false
},
"lastUpdated": "2014-06-23 05:03:43"
"lastUpdated": "2014-08-22 20:03:43"
}


Expand Down Expand Up @@ -280,6 +280,11 @@ function writeField(field, value, isMacro, noEscape) {
if (field != "pages") {
value = ZU.XRegExp.replace(value, protectCaps, "{$0}");
}

// Page ranges should use double dash
if (field == "pages"{
value = value.replace(/[-\u2012-\u2015\u2053]+/g,"--");
}
}
//we write utf8
//convert the HTML markup allowed in Zotero for rich text to TeX; excluding doi/url/file shouldn't be necessary, but better to be safe;
Expand Down
4 changes: 2 additions & 2 deletions BibTeX.js
Expand Up @@ -18,7 +18,7 @@
"inRepository": true,
"translatorType": 3,
"browserSupport": "gcsv",
"lastUpdated": "2014-06-23 03:37:22"
"lastUpdated": "2014-08-22 20:37:22"
}

function detectImport() {
Expand Down Expand Up @@ -1246,7 +1246,7 @@ function doExport() {
}

if(item.pages) {
writeField("pages", item.pages.replace("-","--"));
writeField("pages", item.pages.replace(/[-\u2012-\u2015\u2053]+/g,"--"));
}

// Commented out, because we don't want a books number of pages in the BibTeX "pages" field for books.
Expand Down

0 comments on commit 9725e32

Please sign in to comment.