From e0bff73ba5da48781c198e8bdfd66a5ea3fd08c2 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Wed, 31 Jul 2024 12:19:13 +0200 Subject: [PATCH 01/17] Update index.html add option and scenario for by-count display --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index f290755..9643944 100644 --- a/index.html +++ b/index.html @@ -97,6 +97,7 @@

Results

+
@@ -136,6 +137,7 @@

About Reference Extractor

  • Count the number of times each item has been cited.

    +

    Scenario: You wish to find and remove references cited once or twice to reduce your manuscript’s word count.

  • Identify the Citation Style Language citation style used in the document.

    From 852423fc36bc46a59122f1d10f2b8eb9a941d778 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Wed, 31 Jul 2024 13:12:08 +0200 Subject: [PATCH 02/17] Update ref-extractor.js added count by number in convertOutput function --- libraries/ref-extractor.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 0d34d86..9bec2b2 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -478,6 +478,7 @@ document.getElementById("download").addEventListener("click", function(){ outputExtension = ".ris"; break; case 'bibliography': + case 'by-number': outputExtension = ".txt"; break; default: @@ -496,10 +497,24 @@ var clipboard = new ClipboardJS('#copy_to_clipboard', { function convertOutput() { var csl_json = savedItemsString; var outputFormat = outputElement.options[outputElement.selectedIndex].value; - - let citationRender = new Cite(csl_json); - - return citationRender.format(outputFormat); + + if (outputFormat == 'by-number') { + try { + var citedRefs = JSON.parse(csl_json).map(c => ({ + 'count': (c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'), + 'authors': c['author'][0]['family'] + ((c['author'].length == 2) ? ' and ' + c['author'][1]['family'] : ((c['author'].length > 2) ? ' et al.' : '')), + 'year': c['issued']['date-parts'][0][0], + 'title': c['title'], + })); + return refExtract.map(c => `${c.count} citations: ${c.authors} (${c.year}). ${c.title}`).sort().join('\n'); + } catch (ex) { + console.error(ex); + return 'Failed to count references.' + } + } else { + let citationRender = new Cite(csl_json); + return citationRender.format(outputFormat); + } } // Provide some feedback on button click From 21a244f768bebad52d0ecf17bc6f8ae37614ce03 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Wed, 31 Jul 2024 13:13:17 +0200 Subject: [PATCH 03/17] Update README.md update scenario --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 99f2197..729474a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Reference extractor allows you to: *Scenario*: You wish to create a collection for the items you've cited in a manuscript. * **Count** the number of times each item has been cited. + + *Scenario*: You wish to find and remove references cited once or twice to reduce your manuscript’s word count. * **Identify** the [Citation Style Language](https://citationstyles.org/) citation style used in the document. ## Tips for use From 363c6f65252e70f3c60b74ecc20fa177e0455204 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Wed, 31 Jul 2024 16:10:15 +0200 Subject: [PATCH 04/17] Update index.html changed description of new "by-number" option --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 9643944..a9cae1a 100644 --- a/index.html +++ b/index.html @@ -97,7 +97,7 @@

    Results

    - +
  • From c00ea98d7a97d3d4d7e187f5b2cbae513d5dc16f Mon Sep 17 00:00:00 2001 From: mbroedl Date: Wed, 31 Jul 2024 16:11:46 +0200 Subject: [PATCH 05/17] Update ref-extractor.js use APA rendering for the reference list and add cite count before the reference (by including it first into the title and then moving it) --- libraries/ref-extractor.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 9bec2b2..9fb4f58 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -500,16 +500,24 @@ function convertOutput() { if (outputFormat == 'by-number') { try { - var citedRefs = JSON.parse(csl_json).map(c => ({ - 'count': (c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'), - 'authors': c['author'][0]['family'] + ((c['author'].length == 2) ? ' and ' + c['author'][1]['family'] : ((c['author'].length > 2) ? ' et al.' : '')), - 'year': c['issued']['date-parts'][0][0], - 'title': c['title'], + // add cite count into json title + let edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { + let count = c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'; + c['title'] = `[${count.toString().padStart(2, '0')} citations] ${c['title']}`; + return c; })); - return refExtract.map(c => `${c.count} citations: ${c.authors} (${c.year}). ${c.title}`).sort().join('\n'); + // format as apa and move to beginning of line + let citationRender = new Cite(edited_json); + let bibliography = citationRender.format('bibliography').split('\n').map(ref => { + let count_str = (ref.match(/\[\d+ citations\] /) || [''])[0]; + ref = count_str + ref.replace(count_str, ''); + return ref; + }); + // sort by count + return bibliography.sort().filter(l => l != '').join('\n'); } catch (ex) { console.error(ex); - return 'Failed to count references.' + return 'Failed to count references. Did you activate the "Store cite counts" option?' } } else { let citationRender = new Cite(csl_json); From 40bb2e0a4eea8825a3169559fa21a593e54c5f8d Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:14:01 +0200 Subject: [PATCH 06/17] Update ref-extractor.js add tsv export option --- libraries/ref-extractor.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 9fb4f58..278d4bf 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -478,9 +478,11 @@ document.getElementById("download").addEventListener("click", function(){ outputExtension = ".ris"; break; case 'bibliography': - case 'by-number': outputExtension = ".txt"; break; + case 'by-number': + outputExtension = ".tsv"; + break; default: outputExtension = ".json"; } @@ -509,12 +511,12 @@ function convertOutput() { // format as apa and move to beginning of line let citationRender = new Cite(edited_json); let bibliography = citationRender.format('bibliography').split('\n').map(ref => { - let count_str = (ref.match(/\[\d+ citations\] /) || [''])[0]; - ref = count_str + ref.replace(count_str, ''); + let count_str = (ref.match(/\[(\d+) citations\] /) || ['', 00])[1]; + ref = count_str + '\t' + ref.replace(count_str, ''); return ref; }); // sort by count - return bibliography.sort().filter(l => l != '').join('\n'); + return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '').join('\n'); } catch (ex) { console.error(ex); return 'Failed to count references. Did you activate the "Store cite counts" option?' From 1638891a6f32b9a71845375fe71213f4e5fc8be6 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:21:39 +0200 Subject: [PATCH 07/17] Update index.html rename by-number to by-citations and amend info text --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index a9cae1a..da181ce 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,7 @@

    Input

    - Select this option to store the cite count (the number of times each item has been cited in the document) in the "note" field of the CSL JSON output. This field matches the "Extra" field in the Zotero user interface. + Select this option to store the cite count (the number of times each item has been cited in the document). It is added to the "note" field of the CSL JSON output, which matches the "Extra" field in the Zotero user interface. It is also used as the first column in the tsv export.
    @@ -97,7 +97,7 @@

    Results

    - +
    From da1f3f3b266d971716aac8b559408c96f906bcb5 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:21:53 +0200 Subject: [PATCH 08/17] Update ref-extractor.js rename by-number to by-citations and amend info text --- libraries/ref-extractor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 278d4bf..ad7b4d7 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -480,7 +480,7 @@ document.getElementById("download").addEventListener("click", function(){ case 'bibliography': outputExtension = ".txt"; break; - case 'by-number': + case 'by-citations': outputExtension = ".tsv"; break; default: @@ -500,7 +500,7 @@ function convertOutput() { var csl_json = savedItemsString; var outputFormat = outputElement.options[outputElement.selectedIndex].value; - if (outputFormat == 'by-number') { + if (outputFormat == 'by-citations') { try { // add cite count into json title let edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { From 193690f7597352f66d9c542ba3b0190c6208b5d2 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:23:34 +0200 Subject: [PATCH 09/17] Update ref-extractor.js remove empty row --- libraries/ref-extractor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index ad7b4d7..89fde27 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -516,7 +516,7 @@ function convertOutput() { return ref; }); // sort by count - return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '').join('\n'); + return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '00\t').join('\n'); } catch (ex) { console.error(ex); return 'Failed to count references. Did you activate the "Store cite counts" option?' From 0550c50ce764c3e6fc836a971d411fb43f0374aa Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:24:45 +0200 Subject: [PATCH 10/17] Update ref-extractor.js empty row fix --- libraries/ref-extractor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 89fde27..cffc497 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -511,7 +511,7 @@ function convertOutput() { // format as apa and move to beginning of line let citationRender = new Cite(edited_json); let bibliography = citationRender.format('bibliography').split('\n').map(ref => { - let count_str = (ref.match(/\[(\d+) citations\] /) || ['', 00])[1]; + let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '00'])[1]; ref = count_str + '\t' + ref.replace(count_str, ''); return ref; }); From 9ea474df5f910bf1280f16e991b89196a5363aa4 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:29:51 +0200 Subject: [PATCH 11/17] Update index.html typos and changed option value --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index da181ce..06baeb5 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,7 @@

    Input

    - Select this option to store the cite count (the number of times each item has been cited in the document). It is added to the "note" field of the CSL JSON output, which matches the "Extra" field in the Zotero user interface. It is also used as the first column in the tsv export. + Select this option to store the cite count (the number of times each item has been cited in the document). It is added to the "note" field of the CSL JSON output, which matches the "Extra" field in the Zotero user interface. It is also used as the first column in the TSV export.
    @@ -97,7 +97,7 @@

    Results

    - +
    From 73ee923ccc6f1b983a72a0835dd9dd4234e5e6e9 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:32:50 +0200 Subject: [PATCH 12/17] Update index.html citations -> references --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 06baeb5..a74bc57 100644 --- a/index.html +++ b/index.html @@ -96,8 +96,8 @@

    Results

    - - + +
    From 6727951bf3c1ed531ecd11bd748d568bc1112a42 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:37:22 +0200 Subject: [PATCH 13/17] Update ref-extractor.js changed output format and fix removal of temporary count --- libraries/ref-extractor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index cffc497..97b8118 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -480,7 +480,7 @@ document.getElementById("download").addEventListener("click", function(){ case 'bibliography': outputExtension = ".txt"; break; - case 'by-citations': + case 'by-count': outputExtension = ".tsv"; break; default: @@ -500,23 +500,23 @@ function convertOutput() { var csl_json = savedItemsString; var outputFormat = outputElement.options[outputElement.selectedIndex].value; - if (outputFormat == 'by-citations') { + if (outputFormat == 'by-count') { try { // add cite count into json title let edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { let count = c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'; - c['title'] = `[${count.toString().padStart(2, '0')} citations] ${c['title']}`; + c['title'] = `[${count} citations] ${c['title']}`; return c; })); // format as apa and move to beginning of line let citationRender = new Cite(edited_json); let bibliography = citationRender.format('bibliography').split('\n').map(ref => { - let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '00'])[1]; - ref = count_str + '\t' + ref.replace(count_str, ''); + let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '0']); + ref = count_str[1] + '\t' + ref.replace(count_str[0], ''); return ref; }); // sort by count - return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '00\t').join('\n'); + return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '0\t').join('\n'); } catch (ex) { console.error(ex); return 'Failed to count references. Did you activate the "Store cite counts" option?' From b2367ddd724382942fb2c2ee42a6548317086b09 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Mon, 26 Aug 2024 21:45:49 +0200 Subject: [PATCH 14/17] Update ref-extractor.js sort on natural numbers instead of strings --- libraries/ref-extractor.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 97b8118..306a551 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -510,13 +510,19 @@ function convertOutput() { })); // format as apa and move to beginning of line let citationRender = new Cite(edited_json); - let bibliography = citationRender.format('bibliography').split('\n').map(ref => { - let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '0']); - ref = count_str[1] + '\t' + ref.replace(count_str[0], ''); - return ref; + let bibliography = citationRender.format('bibliography') + .split('\n') + .map(ref => { + let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '0']); + ref = [Number(count_str[1]), count_str[1] + '\t' + ref.replace(count_str[0], '')]; + return ref; }); // sort by count - return 'cite_count\treference\n' + bibliography.sort().filter(l => l != '0\t').join('\n'); + return 'cite_count\treference\n' + bibliography + .sort((a, b) => { return a[0] - b[0]}) + .map(r => r[1]) + .filter(r => r != '0\t') + .join('\n'); } catch (ex) { console.error(ex); return 'Failed to count references. Did you activate the "Store cite counts" option?' From e1eb270828c55d96f2bc6b670a9ef0443171154d Mon Sep 17 00:00:00 2001 From: rmzelle Date: Thu, 12 Sep 2024 00:27:31 -0400 Subject: [PATCH 15/17] Remove cite count toggle --- index.html | 122 +++++++++++++++++++------------------ libraries/ref-extractor.js | 99 +++++++++++++++--------------- 2 files changed, 112 insertions(+), 109 deletions(-) diff --git a/index.html b/index.html index a74bc57..04dbe9a 100644 --- a/index.html +++ b/index.html @@ -54,69 +54,68 @@ References must have been inserted with the Zotero or Mendeley word processor plugins and must not have been converted to plain text. The tool runs entirely on your own computer, keeping your documents and citations private and secure.


    -

    Input

    +
    -
    +
    +
    Step 1.
    +

    Select your Word (.docx) or LibreOffice (.odt) file

    -
    - - - - Select this option to store the cite count (the number of times each item has been cited in the document). It is added to the "note" field of the CSL JSON output, which matches the "Extra" field in the Zotero user interface. It is also used as the first column in the TSV export. - -
    - - Select your .docx (Word) or .odt (LibreOffice) file -
    -

    Results

    +
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    - -
    - - -
    - - +
    +
    Step 2.
    +

    Save the extracted citations in your preferred format, or select them in your Zotero library.

    +
    +
    + +
    + +
    + +
    -
    -
    - -
    +
    + +
    + +
    +
    +
    + + +
    +
    + +
    + + +
    + + +
    +
    +
    + +
    +
    +
    - +

    @@ -125,19 +124,26 @@

    About Reference Extractor

    • Extract Zotero and Mendeley references and save them to CSL JSON, BibTeX, or RIS format, or as a rendered bibliography in APA style.

      -

      Scenario 1: You lost your Zotero/Mendeley library but still have your documents. - Extraction allows you to recover the items you cited in your documents and import them back into your reference manager. - Note that imported items won’t be linked to the items in the document you extracted them from.

      -

      Scenario 2: Somebody sent you a document and you would like to get the cited items into your own reference manager library.

      +
        +
      • +

        Scenario 1: You lost your Zotero/Mendeley library but still have your documents. + Extraction allows you to recover the items you cited in your documents and import them back into your reference manager. + Note that imported items won’t be linked to the items in the document you extracted them from.

        +
      • +
      • +

        Scenario 2: Somebody sent you a document and you would like to get the cited items into your own reference manager library.

        +
      • +
    • Select the original cited items in your existing Zotero libraries [only available for Zotero]. Once items are selected in Zotero, you can drag the items into a new collection or apply a tag.

      -

      Scenario: You wish to create a collection for the items you’ve cited in a manuscript.

      +
        +
      • Scenario: You wish to create a collection for the items you’ve cited in a manuscript.

      • +
    • Count the number of times each item has been cited.

      -

      Scenario: You wish to find and remove references cited once or twice to reduce your manuscript’s word count.

    • Identify the Citation Style Language citation style used in the document.

      diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index 306a551..c3cd65f 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -5,12 +5,6 @@ window.savedZoteroLibrarySelectors = {}; var Cite = require('citation-js'); -var citationCountCheckboxElement = document.getElementById("add_citation_counts_toggle"); -citationCountCheckboxElement.addEventListener("change", function(){ - document.getElementById("file_upload").value = null; - pageReset(); - }, false); - var inputElement = document.getElementById("file_upload"); inputElement.addEventListener("change", handleFileSelect, false); @@ -283,12 +277,7 @@ function processExtractedFields(fields) { } } -function deduplicateCites(cites) { - addCitationCounts = false; - if (add_citation_counts_toggle.checked) { - addCitationCounts = true; - } - +function deduplicateCites(cites) { // create a nested array with items, their extracted uris, and their citation counts var deduplicationArray = []; for (let i = 0; i < cites.length; i++) { @@ -355,14 +344,12 @@ function deduplicateCites(cites) { // Store cite count deduplicationArray[i].count = matchingCites.length; - // Add cite count to item metadata, if pref is set - if (addCitationCounts) { - if (deduplicationArray[i].hasOwnProperty("item")) { - if (!deduplicationArray[i].item.hasOwnProperty("note")) { - deduplicationArray[i].item.note = ""; - } - deduplicationArray[i].item.note = "Times cited: " + deduplicationArray[i].count + "\n" + deduplicationArray[i].item.note; + // Add cite count to item metadata + if (deduplicationArray[i].hasOwnProperty("item")) { + if (!deduplicationArray[i].item.hasOwnProperty("note")) { + deduplicationArray[i].item.note = ""; } + deduplicationArray[i].item.note = "Times cited: " + deduplicationArray[i].count + "\n" + deduplicationArray[i].item.note; } // Mark other cites for deletion (via index property) @@ -480,7 +467,7 @@ document.getElementById("download").addEventListener("click", function(){ case 'bibliography': outputExtension = ".txt"; break; - case 'by-count': + case 'by-bibliography-with-counts': outputExtension = ".tsv"; break; default: @@ -498,39 +485,49 @@ var clipboard = new ClipboardJS('#copy_to_clipboard', { function convertOutput() { var csl_json = savedItemsString; - var outputFormat = outputElement.options[outputElement.selectedIndex].value; - if (outputFormat == 'by-count') { - try { - // add cite count into json title - let edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { - let count = c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'; - c['title'] = `[${count} citations] ${c['title']}`; - return c; - })); - // format as apa and move to beginning of line - let citationRender = new Cite(edited_json); - let bibliography = citationRender.format('bibliography') - .split('\n') - .map(ref => { - let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '0']); - ref = [Number(count_str[1]), count_str[1] + '\t' + ref.replace(count_str[0], '')]; - return ref; - }); - // sort by count - return 'cite_count\treference\n' + bibliography - .sort((a, b) => { return a[0] - b[0]}) - .map(r => r[1]) - .filter(r => r != '0\t') - .join('\n'); - } catch (ex) { - console.error(ex); - return 'Failed to count references. Did you activate the "Store cite counts" option?' - } - } else { - let citationRender = new Cite(csl_json); - return citationRender.format(outputFormat); + var outputFormat = outputElement.options[outputElement.selectedIndex].value; + var renderedOutput = ""; + + switch (outputFormat) { + case 'data-with-counts': + var citationRender = new Cite(csl_json); + renderedOutput = citationRender.format("data"); + break; + case 'bibliography-with-counts': + // add cite count into json title + var edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { + let count = c.note.match(/(?<=Times cited: )(\d+)/g) | 'NA'; + c['title'] = `[${count} citations] ${c['title']}`; + return c; + })); + // format as apa and move to beginning of line + var citationRender = new Cite(edited_json); + let bibliography = citationRender.format('bibliography') + .split('\n') + .map(ref => { + let count_str = (ref.match(/\[(\d+) citations\] /) || ['', '0']); + ref = [Number(count_str[1]), count_str[1] + '\t' + ref.replace(count_str[0], '')]; + return ref; + }); + // sort by count + renderedOutput = 'cite_count\treference\n' + bibliography + .sort((a, b) => { return a[0] - b[0]}) + .map(r => r[1]) + .filter(r => r != '0\t') + .join('\n'); + break; + default: + //remove cite counts + var edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { + c.note = c.note.replace(/Times cited: \d+\n/g, ''); + return c; + })); + var citationRender = new Cite(edited_json); + renderedOutput = citationRender.format(outputFormat); } + + return renderedOutput; } // Provide some feedback on button click From 30bc1fd17b2a37e0923a678fe8fe14df2de4f7d7 Mon Sep 17 00:00:00 2001 From: mbroedl Date: Thu, 12 Sep 2024 16:04:11 +0200 Subject: [PATCH 16/17] Update ref-extractor.js fix file ending for apa with counts --- libraries/ref-extractor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index c3cd65f..c51d766 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -467,7 +467,7 @@ document.getElementById("download").addEventListener("click", function(){ case 'bibliography': outputExtension = ".txt"; break; - case 'by-bibliography-with-counts': + case 'bibliography-with-counts': outputExtension = ".tsv"; break; default: From b7812c9da0191c143e67a0281045dfa926fc17ee Mon Sep 17 00:00:00 2001 From: mbroedl Date: Thu, 12 Sep 2024 16:13:07 +0200 Subject: [PATCH 17/17] Update ref-extractor.js remove empty note field --- libraries/ref-extractor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/ref-extractor.js b/libraries/ref-extractor.js index c51d766..7c9b675 100644 --- a/libraries/ref-extractor.js +++ b/libraries/ref-extractor.js @@ -521,6 +521,7 @@ function convertOutput() { //remove cite counts var edited_json = JSON.stringify(JSON.parse(csl_json).map(c => { c.note = c.note.replace(/Times cited: \d+\n/g, ''); + if (c.note == "") { c.note = undefined; } return c; })); var citationRender = new Cite(edited_json);