Skip to content

Commit a254355

Browse files
committed
handle nbsp in citations
1 parent 6de0221 commit a254355

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

libs/citations/parse-text-cite/src/lib/lexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import moo from 'moo'
22
console.log(moo)
33
export const lexer = moo.compile({
4-
__: /[ \t]+/u,
4+
__: /[ \t ]+/u,
55
//_: /[ \t]*/u,
66
Year: /(?:\d{4}|n\.d\.?)/u,
77
BCE: /B\.C\.E\.|B\.C\.|C\.E\.|A\.D\.|a\.d\.|b\.c\.e\.|b\.c\.|c\.e\./u,

libs/citations/parse-text-cite/src/lib/testcites.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,35 @@ export const tests: TestData = {
2626
input: 'Wow (Bautista Perpinya, 2019).',
2727
},
2828
{
29-
description: 'A long et al',
30-
result: [{}],
29+
description: 'Can deal with NBSP',
30+
result: [
31+
'We considered outliers to be any response outside 2.5 times the median absolute deviation for each participant, SOA, and trial condition ',
32+
{
33+
citationId: 'CITE-X',
34+
citationItems: [
35+
{
36+
id: 'Leys2013',
37+
itemData: {
38+
author: [
39+
{
40+
family: 'Leys',
41+
},
42+
],
43+
issued: {
44+
'date-parts': [['2013']],
45+
},
46+
},
47+
},
48+
],
49+
originalText: '(Leys et al, 2013)',
50+
properties: {
51+
noteIndex: 0,
52+
},
53+
},
54+
'.',
55+
],
3156
input:
32-
'On the one hand, lighter smokers should show greater attentional bias than heavier smokers since they rarely show signs of nicotine dependence. Thus, the presence of smoking-related cues would be required to induce craving and motivate substance use. In support of this argument, some studies found that lighter smokers exhibit greater attentional bias than heavier smokers (Bradley et al., 2003; Hogarth et al., 2003; Mogg et al., 2005). ',
57+
'We considered outliers to be any response outside 2.5 times the median absolute deviation for each participant, SOA, and trial condition (Leys et al., 2013).',
3358
},
3459
{
3560
description: 'Just a normal fucking et al.!',

0 commit comments

Comments
 (0)