diff --git a/src/js/utils/formatters/__tests__/formatReferenceLinks-test.ts b/src/js/utils/formatters/__tests__/formatReferenceLinks-test.ts
index ec0faf89..d688612c 100644
--- a/src/js/utils/formatters/__tests__/formatReferenceLinks-test.ts
+++ b/src/js/utils/formatters/__tests__/formatReferenceLinks-test.ts
@@ -30,7 +30,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [PubMed]',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [PubMed]',
);
expect(
formatReferenceLinks(testRefs[1], 'always', {
@@ -38,7 +38,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [PubMed]',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [PubMed]',
);
expect(
formatReferenceLinks(testRefs[2], 'always', {
@@ -46,7 +46,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [PubMed]',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [PubMed]',
);
expect(
formatReferenceLinks(testRefs[3], 'always', {
@@ -54,7 +54,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [PubMed]',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [PubMed]',
);
expect(
formatReferenceLinks(testRefs[4], 'always', {
@@ -62,7 +62,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [PubMed]',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [PubMed]',
);
expect(
formatReferenceLinks(testRefs[5], 'always', {
@@ -70,7 +70,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [PubMed]`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [PubMed]`,
);
});
it('should handle DOIs', () => {
@@ -80,7 +80,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [Source]',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[1], 'always', {
@@ -88,7 +88,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [Source]',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[2], 'always', {
@@ -96,7 +96,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [Source]',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(
formatReferenceLinks(testRefs[3], 'always', {
@@ -104,7 +104,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [Source]',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[4], 'always', {
@@ -112,7 +112,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [Source]',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [Source]',
);
expect(
formatReferenceLinks(testRefs[5], 'always', {
@@ -120,7 +120,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [Source]`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [Source]`,
);
});
it('should handle PMCIDs', () => {
@@ -130,7 +130,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [PMC]',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [PMC]',
);
expect(
formatReferenceLinks(testRefs[1], 'always', {
@@ -138,7 +138,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [PMC]',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [PMC]',
);
expect(
formatReferenceLinks(testRefs[2], 'always', {
@@ -146,7 +146,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [PMC]',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [PMC]',
);
expect(
formatReferenceLinks(testRefs[3], 'always', {
@@ -154,7 +154,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [PMC]',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [PMC]',
);
expect(
formatReferenceLinks(testRefs[4], 'always', {
@@ -162,7 +162,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [PMC]',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [PMC]',
);
expect(
formatReferenceLinks(testRefs[5], 'always', {
@@ -170,7 +170,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [PMC]`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [PMC]`,
);
});
it('should handle URLs', () => {
@@ -180,7 +180,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [Source]',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[1], 'always', {
@@ -188,7 +188,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [Source]',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[2], 'always', {
@@ -196,7 +196,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [Source]',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769 [Source]',
);
expect(
formatReferenceLinks(testRefs[3], 'always', {
@@ -204,7 +204,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [Source]',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015. [Source]',
);
expect(
formatReferenceLinks(testRefs[4], 'always', {
@@ -212,7 +212,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [Source]',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International. [Source]',
);
expect(
formatReferenceLinks(testRefs[5], 'always', {
@@ -220,27 +220,27 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [Source]`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf. [Source]`,
);
});
it('should handle undefined identifiers', () => {
expect(formatReferenceLinks(testRefs[0], 'always')).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(formatReferenceLinks(testRefs[1], 'always')).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(formatReferenceLinks(testRefs[2], 'always')).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(formatReferenceLinks(testRefs[3], 'always')).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(formatReferenceLinks(testRefs[4], 'always')).toBe(
'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(formatReferenceLinks(testRefs[5], 'always')).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
});
@@ -252,7 +252,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'always-full-surround', {
@@ -260,7 +260,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'always-full-surround', {
@@ -268,7 +268,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
);
expect(
formatReferenceLinks(testRefs[3], 'always-full-surround', {
@@ -276,7 +276,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'always-full-surround', {
@@ -284,7 +284,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(
formatReferenceLinks(testRefs[5], 'always-full-surround', {
@@ -292,7 +292,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle DOIs', () => {
@@ -302,7 +302,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'always-full-surround', {
@@ -310,7 +310,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'always-full-surround', {
@@ -318,7 +318,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
);
expect(
formatReferenceLinks(testRefs[3], 'always-full-surround', {
@@ -326,7 +326,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'always-full-surround', {
@@ -334,7 +334,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(
formatReferenceLinks(testRefs[5], 'always-full-surround', {
@@ -342,7 +342,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle PMCIDs', () => {
@@ -352,7 +352,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'always-full-surround', {
@@ -360,7 +360,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'always-full-surround', {
@@ -368,7 +368,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
);
expect(
formatReferenceLinks(testRefs[3], 'always-full-surround', {
@@ -376,7 +376,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'always-full-surround', {
@@ -384,7 +384,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(
formatReferenceLinks(testRefs[5], 'always-full-surround', {
@@ -392,7 +392,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle URLs', () => {
@@ -402,7 +402,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'always-full-surround', {
@@ -410,7 +410,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. www.aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'always-full-surround', {
@@ -418,7 +418,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi:10.15200/winn.144720.08769.',
);
expect(
formatReferenceLinks(testRefs[3], 'always-full-surround', {
@@ -426,7 +426,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'always-full-surround', {
@@ -434,7 +434,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(
formatReferenceLinks(testRefs[5], 'always-full-surround', {
@@ -442,27 +442,39 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle undefined identifiers', () => {
- expect(formatReferenceLinks(testRefs[0], 'always-full-surround')).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ expect(
+ formatReferenceLinks(testRefs[0], 'always-full-surround'),
+ ).toBe(
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
- expect(formatReferenceLinks(testRefs[1], 'always-full-surround')).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ expect(
+ formatReferenceLinks(testRefs[1], 'always-full-surround'),
+ ).toBe(
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
- expect(formatReferenceLinks(testRefs[2], 'always-full-surround')).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ expect(
+ formatReferenceLinks(testRefs[2], 'always-full-surround'),
+ ).toBe(
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
- expect(formatReferenceLinks(testRefs[3], 'always-full-surround')).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ expect(
+ formatReferenceLinks(testRefs[3], 'always-full-surround'),
+ ).toBe(
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
- expect(formatReferenceLinks(testRefs[4], 'always-full-surround')).toBe(
+ expect(
+ formatReferenceLinks(testRefs[4], 'always-full-surround'),
+ ).toBe(
'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
- expect(formatReferenceLinks(testRefs[5], 'always-full-surround')).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ expect(
+ formatReferenceLinks(testRefs[5], 'always-full-surround'),
+ ).toBe(
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
});
@@ -474,7 +486,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'urls', {
@@ -482,7 +494,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'urls', {
@@ -490,7 +502,7 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(
formatReferenceLinks(testRefs[3], 'urls', {
@@ -498,21 +510,23 @@ describe('formatReferenceLinks()', () => {
value: PMID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'urls', {
kind: 'PMID',
value: PMID,
}),
- ).toBe('Cameron P. Pundit-Based Medicine. Emergency Physicians International.');
+ ).toBe(
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ );
expect(
formatReferenceLinks(testRefs[5], 'urls', {
kind: 'PMID',
value: PMID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle DOIs', () => {
@@ -522,7 +536,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'urls', {
@@ -530,7 +544,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'urls', {
@@ -538,7 +552,7 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(
formatReferenceLinks(testRefs[3], 'urls', {
@@ -546,21 +560,23 @@ describe('formatReferenceLinks()', () => {
value: DOI,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'urls', {
kind: 'DOI',
value: DOI,
}),
- ).toBe('Cameron P. Pundit-Based Medicine. Emergency Physicians International.');
+ ).toBe(
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ );
expect(
formatReferenceLinks(testRefs[5], 'urls', {
kind: 'DOI',
value: DOI,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle PMCIDs', () => {
@@ -570,7 +586,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'urls', {
@@ -578,7 +594,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'urls', {
@@ -586,7 +602,7 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(
formatReferenceLinks(testRefs[3], 'urls', {
@@ -594,21 +610,23 @@ describe('formatReferenceLinks()', () => {
value: PMCID,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'urls', {
kind: 'PMCID',
value: PMCID,
}),
- ).toBe('Cameron P. Pundit-Based Medicine. Emergency Physicians International.');
+ ).toBe(
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ );
expect(
formatReferenceLinks(testRefs[5], 'urls', {
kind: 'PMCID',
value: PMCID,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle URLs', () => {
@@ -618,7 +636,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[1], 'urls', {
@@ -626,7 +644,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[2], 'urls', {
@@ -634,7 +652,7 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(
formatReferenceLinks(testRefs[3], 'urls', {
@@ -642,41 +660,43 @@ describe('formatReferenceLinks()', () => {
value: URL,
}),
).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(
formatReferenceLinks(testRefs[4], 'urls', {
kind: 'URL',
value: URL,
}),
- ).toBe('Cameron P. Pundit-Based Medicine. Emergency Physicians International.');
+ ).toBe(
+ 'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
+ );
expect(
formatReferenceLinks(testRefs[5], 'urls', {
kind: 'URL',
value: URL,
}),
).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
it('should handle undefined identifiers', () => {
expect(formatReferenceLinks(testRefs[0], 'urls')).toBe(
- 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
+ 'Body R. The ProMISe Study: EGDT RIP? St. Emlyn’s website. http://stemlynsblog.org/the-promise-study-egdt-rip/; http://blogs.nejm.org/now/index.php/the-final-nail-in-early-goal-directed-therapys-coffin/2015/03/24/. Published 2015.',
);
expect(formatReferenceLinks(testRefs[1], 'urls')).toBe(
- 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
+ 'Chan T, Helman A, Davis T, Purdy E. MEdIC Series | The Case the FOAM Faux Pas – Expert Review and Curated Commentary. Academic Life in Emergency Medicine. http://aliem.com/MEdIC-Series-The-Case-the-FOAM-Faux-Pas-Expert-Review-and-Curated-Commentary. Published 2015.',
);
expect(formatReferenceLinks(testRefs[2], 'urls')).toBe(
- 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
+ 'Colmers IN, Paterson QS, Lin M, Thoma B, Chan TM. The quality checklists for medical education blogs and podcasts. The Winnower. 2015. doi: 10.15200/winn.144720.08769',
);
expect(formatReferenceLinks(testRefs[3], 'urls')).toBe(
- 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
+ 'Mathieu S. Trial of Early, Goal-Directed Resuscitation for Septic Shock. The Bottom Line. http://www.wessexics.com/The_Bottom_Line/Review/index.php?id=3665078336903245716. Published 2015.',
);
expect(formatReferenceLinks(testRefs[4], 'urls')).toBe(
'Cameron P. Pundit-Based Medicine. Emergency Physicians International.',
);
expect(formatReferenceLinks(testRefs[5], 'urls')).toBe(
- `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
+ `Dunning J. Unskilled and unaware of it. Journal of Personality and Social Psychology. 1999;77(6):1121-1134. http://psych.colorado.edu/~vanboven/teaching/p7536_heurbias/p7536_readings/kruger_dunning.pdf.`,
);
});
});
@@ -834,12 +854,24 @@ describe('formatReferenceLinks()', () => {
).toBe(testRefs[5]);
});
it('should handle undefined identifiers', () => {
- expect(formatReferenceLinks(testRefs[0], 'never')).toBe(testRefs[0]);
- expect(formatReferenceLinks(testRefs[1], 'never')).toBe(testRefs[1]);
- expect(formatReferenceLinks(testRefs[2], 'never')).toBe(testRefs[2]);
- expect(formatReferenceLinks(testRefs[3], 'never')).toBe(testRefs[3]);
- expect(formatReferenceLinks(testRefs[4], 'never')).toBe(testRefs[4]);
- expect(formatReferenceLinks(testRefs[5], 'never')).toBe(testRefs[5]);
+ expect(formatReferenceLinks(testRefs[0], 'never')).toBe(
+ testRefs[0],
+ );
+ expect(formatReferenceLinks(testRefs[1], 'never')).toBe(
+ testRefs[1],
+ );
+ expect(formatReferenceLinks(testRefs[2], 'never')).toBe(
+ testRefs[2],
+ );
+ expect(formatReferenceLinks(testRefs[3], 'never')).toBe(
+ testRefs[3],
+ );
+ expect(formatReferenceLinks(testRefs[4], 'never')).toBe(
+ testRefs[4],
+ );
+ expect(formatReferenceLinks(testRefs[5], 'never')).toBe(
+ testRefs[5],
+ );
});
});
});
diff --git a/src/js/utils/formatters/formatBibliography.ts b/src/js/utils/formatters/formatBibliography.ts
index 9e0e1f4e..2531fa36 100644
--- a/src/js/utils/formatters/formatBibliography.ts
+++ b/src/js/utils/formatters/formatBibliography.ts
@@ -50,28 +50,29 @@ export function formatBibliography(
case 'flush':
el.classList.add('flush');
break;
- default:
- break;
}
const innerEl = el.querySelector('.csl-right-inline') || el;
const innerHTML = innerEl.innerHTML;
switch (true) {
- case item.PMID !== undefined && !new RegExp(item.PMID).test(innerHTML): {
+ case item.PMID !== undefined &&
+ !new RegExp(item.PMID).test(innerHTML): {
innerEl.innerHTML = formatReferenceLinks(innerHTML, links, {
kind: 'PMID',
value: item.PMID!,
});
break;
}
- case item.DOI !== undefined && !new RegExp(item.DOI).test(innerHTML): {
+ case item.DOI !== undefined &&
+ !new RegExp(item.DOI).test(innerHTML): {
innerEl.innerHTML = formatReferenceLinks(innerHTML, links, {
kind: 'DOI',
value: item.DOI!,
});
break;
}
- case item.PMCID !== undefined && !new RegExp(item.PMCID).test(innerHTML): {
+ case item.PMCID !== undefined &&
+ !new RegExp(item.PMCID).test(innerHTML): {
innerEl.innerHTML = formatReferenceLinks(innerHTML, links, {
kind: 'PMCID',
value: item.PMCID!,
diff --git a/src/js/utils/formatters/formatReferenceLinks.ts b/src/js/utils/formatters/formatReferenceLinks.ts
index dad4e8d9..04b49b1b 100644
--- a/src/js/utils/formatters/formatReferenceLinks.ts
+++ b/src/js/utils/formatters/formatReferenceLinks.ts
@@ -1,3 +1,7 @@
+// tslint:disable: no-stateless-class
+import { oneLineTrim } from 'common-tags';
+import { decode } from 'he';
+
interface IDType {
kind: 'PMID' | 'DOI' | 'PMCID' | 'URL';
value: string;
@@ -7,97 +11,141 @@ interface IDType {
* Parses and formats the bibliography links according to the user's chosen
* link format
* @param html - HTML string of a single reference
- * @param linkStyle - Selected link style
+ * @param style - Selected link style
* @param id - Identifier for linking out
* @returns HTML string with formatted links
*/
-export function formatReferenceLinks(html: string, linkStyle: ABT.LinkStyle, id?: IDType): string {
- if (linkStyle === 'never') return html;
+export function formatReferenceLinks(
+ html: string,
+ style: ABT.LinkStyle,
+ id?: IDType,
+): string {
+ if (style === 'never') {
+ return html;
+ }
- const url: RegExp = /((http:\/\/(?:www\.)?|https:\/\/(?:www\.)?)|www\.)([^;\s<]+[0-9a-zA-Z\/])/g;
+ const url: RegExp = /((?:https?:\/\/(?:www\.)?)|(?:www\.))([^;\s<]+[0-9a-zA-Z\/])/g;
const doi: RegExp = /doi:(\S+)\./g;
+ const matches: Set = new Set();
- const linkedHtml = html
- .replace(/(<|&|>|")/g, match => {
- switch (match) {
- case '<':
- return '<';
- case '>':
- return '>';
- case '&':
- return '&';
- case '"':
- default:
- return '"';
- }
+ const linkedHtml = decode(html)
+ .replace(url, (_match, p1, p2) => {
+ const u = p1 === 'www.' ? `http://${p2}` : `${p1}${p2}`;
+ matches.add(u);
+ return `${u}`;
})
- .replace(
- url,
- (_match, _p1, p2 = 'http://', p3) =>
- `${p2}${p3}`,
- )
- .replace(doi, 'doi: $1');
+ .replace(doi, (_match, p1) => {
+ matches.add('DOI');
+ return `doi: ${p1}`;
+ });
- if (!id) return linkedHtml;
+ if (!id) {
+ return linkedHtml;
+ }
- switch (linkStyle) {
- case 'always': {
- switch (id.kind) {
- case 'PMID': {
- return (
- linkedHtml +
- ` ` +
- `[PubMed]` +
- ``
- );
- }
- case 'DOI': {
- return (
- linkedHtml +
- ` ` +
- `[Source]` +
- ``
- );
- }
- case 'PMCID': {
- return (
- linkedHtml +
- ` ` +
- `[PMC]` +
- ``
- );
- }
- case 'URL':
- default: {
- return (
- linkedHtml +
- ` ` +
- `[Source]` +
- ``
- );
- }
- }
- }
- case 'always-full-surround': {
- switch (id.kind) {
- case 'PMID': {
- return `${html}`;
- }
- case 'DOI': {
- return `${html}`;
- }
- case 'PMCID': {
- return `${html}`; // tslint:disable-line
- }
- case 'URL':
- default: {
- return `${html}`;
- }
+ switch (style) {
+ case 'always':
+ if (
+ (id.kind === 'DOI' && matches.has('DOI')) ||
+ (id.kind === 'URL' && matches.has(id.value))
+ ) {
+ return linkedHtml;
}
- }
+ return LinkStyle.always(linkedHtml, id);
+ case 'always-full-surround':
+ return LinkStyle.fullSurround(html, id);
case 'urls':
- default: {
+ default:
return linkedHtml;
+ }
+}
+
+class LinkStyle {
+ static always(html: string, id: IDType): string {
+ switch (id.kind) {
+ case 'PMID': {
+ return oneLineTrim`
+ ${html}${' '}
+
+ [PubMed]
+
+ `;
+ }
+ case 'DOI': {
+ return oneLineTrim`
+ ${html}${' '}
+
+ [Source]
+
+ `;
+ }
+ case 'PMCID': {
+ return oneLineTrim`
+ ${html}${' '}
+
+ [PMC]
+
+ `;
+ }
+ case 'URL':
+ default: {
+ // FIXME: i18n "Source"
+ const sourceText = id.value.toLocaleLowerCase().endsWith('.pdf')
+ ? 'PDF'
+ : 'Source';
+ return oneLineTrim`
+ ${html}${' '}
+
+ [
+ ${sourceText}
+ ]
+
+ `;
+ }
+ }
+ }
+ static fullSurround(html: string, id: IDType): string {
+ switch (id.kind) {
+ case 'PMID': {
+ return oneLineTrim`
+
+ ${html}
+ `;
+ }
+ case 'DOI': {
+ return oneLineTrim`
+
+ ${html}
+ `;
+ }
+ case 'PMCID': {
+ return oneLineTrim`
+
+ ${html}
+ `;
+ }
+ default: {
+ return oneLineTrim`
+
+ ${html}
+ `;
+ }
}
}
}