Skip to content

Commit c566b4e

Browse files
authored
Merge pull request #16 from Aetf/uncategorized-venue
uncategorized venue
2 parents 93fd762 + 66318c8 commit c566b4e

File tree

11 files changed

+91
-9
lines changed

11 files changed

+91
-9
lines changed

src/publist-tag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class PubsResolver {
168168
return venue.occurrences.map(conf => [
169169
conf.key,
170170
_.defaults(
171-
{venue: venueId, cat: venue.category},
171+
{venue: venueId, cat: _.get(venue, 'category', '')},
172172
_.update(conf, 'date', date => _.isUndefined(date) ? undefined : moment.utc(date)),
173173
{url: venue.url}
174174
),
@@ -297,6 +297,7 @@ class PubsResolver {
297297
value: '!others',
298298
count: pubs.filter(pub => pub.confkey.length === 0).length,
299299
},
300+
...venues[''] || [],
300301
];
301302

302303
fspecs.unshift({

src/schema_instopts.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"type": "object",
5454
"properties": {
5555
"category": {
56-
"description": "The category of the conference",
56+
"description": "the category of the conference. Omit to create an uncategorized venue",
5757
"type": "string"
5858
},
5959
"url": {
@@ -80,7 +80,7 @@
8080
"type": "string"
8181
},
8282
"date": {
83-
"description": "the date when the conference is held. Also used in sorting. When missing, the year and month from the bib entry is used.",
83+
"description": "the date when the conference is held. Also used in sorting. When omitted, the date defined in the venue is used. When both are missing, the year and month from the bib entry is used.",
8484
"type": "string"
8585
},
8686
"url": {
@@ -96,7 +96,7 @@
9696
}
9797
}
9898
},
99-
"required": [ "category", "occurrences" ],
99+
"required": [ "occurrences" ],
100100
"additionalProperties": false
101101
}
102102
}

test/data/config.v2.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ extra_filters:
1313
path: badges
1414
# mapping from general conference name to details
1515
venues:
16+
'PhD Dissertation':
17+
occurrences:
18+
- key: phdthesis
19+
name: PhD Dissertation
1620
arXiv:
1721
category: Technical Reports
1822
occurrences:

test/instopts.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ const fs = require('fs');
88
const { PubsResolver } = require('../src/publist-tag');
99
const { getHexo } = require('./helpers');
1010

11-
function normalize(obj) {
12-
return JSON.parse(JSON.stringify(obj));
13-
}
14-
1511
test('Tag Options V1', async t => {
1612
const hexo = await getHexo();
1713

test/publist-tag.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,15 @@ test('Filtering spec generation', async t => {
330330
const { hexo, opts } = t.context;
331331
const pubs = [
332332
createEntry({
333+
citekey: 'first-article',
333334
confkey: "abc'1", title: 'Title',
334335
badges: ['Badge1'],
335336
meta: {
336337
topic: ['Topic1', 'Topic2'],
337338
}
338339
}),
339340
createEntry({
341+
citekey: 'second-article',
340342
confkey: "abc'1", title: 'Title2',
341343
badges: ['Badge2'],
342344
meta: {
@@ -366,10 +368,37 @@ test('Filtering spec generation', async t => {
366368
t.snapshot(fspecs);
367369
});
368370

371+
test('Uncategorized venue', async t => {
372+
const { hexo, opts } = t.context;
373+
const pubs = [
374+
createEntry({
375+
citekey: 'mythesis', confkey: "phdthesis", title: 'Title',
376+
bib: {
377+
fields: {
378+
year: ['2021'], month: ['08'],
379+
}
380+
}
381+
}),
382+
];
383+
384+
const instOpts = `
385+
version: 2
386+
venues:
387+
'PhD Dissertation':
388+
occurrences:
389+
- key: phdthesis
390+
name: PhD Dissertation
391+
`;
392+
393+
const resolver = new PubsResolver(hexo, opts, instOpts, { source: 'test.bib' });
394+
const fspecs = resolver.processFspecs(resolver.processPubs(pubs));
395+
t.snapshot(fspecs);
396+
});
397+
369398
test('Strict reject entry without date', async t => {
370399
const { hexo, opts } = t.context;
371400
setHexoLocals(hexo, 'test', [
372-
createEntry({ confkey: "abc'1", title: 'Title' }),
401+
createEntry({ citekey: 'strict-article', confkey: "abc'1", title: 'Title' }),
373402
]);
374403

375404
const instOpts = `
@@ -392,6 +421,7 @@ test('Strict reject entry without confkey', async t => {
392421
const { hexo, opts } = t.context;
393422
setHexoLocals(hexo, 'test', [
394423
createEntry({
424+
citekey: 'no-confkey-article',
395425
title: 'Title',
396426
bib: {
397427
fields: {

test/snapshots/instopts.js.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12973,6 +12973,14 @@ Generated by [AVA](https://avajs.dev).
1297312973
url: 'https://arxiv.org/abs/$1',
1297412974
venue: 'arXiv',
1297512975
},
12976+
phdthesis: {
12977+
cat: '',
12978+
date: undefined,
12979+
key: 'phdthesis',
12980+
name: 'PhD Dissertation',
12981+
url: undefined,
12982+
venue: 'PhD Dissertation',
12983+
},
1297612984
},
1297712985
confs_fuzzy: [
1297812986
{

test/snapshots/instopts.js.snap

99 Bytes
Binary file not shown.

test/snapshots/mcpub.js.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ Generated by [AVA](https://avajs.dev).
5050
<svg class="SelectMenu-icon SelectMenu-icon--check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.78 4.22C13.9204 4.36062 13.9993 4.55125 13.9993 4.75C13.9993 4.94875 13.9204 5.13937 13.78 5.28L6.53 12.53C6.38937 12.6704 6.19875 12.7493 6 12.7493C5.80125 12.7493 5.61062 12.6704 5.47 12.53L2.22 9.28C2.08752 9.13782 2.0154 8.94978 2.01882 8.75547C2.02225 8.56117 2.10096 8.37579 2.23838 8.23837C2.37579 8.10096 2.56118 8.02225 2.75548 8.01882C2.94978 8.01539 3.13782 8.08752 3.28 8.22L6 10.94L12.72 4.22C12.8606 4.07955 13.0512 4.00066 13.25 4.00066C13.4487 4.00066 13.6394 4.07955 13.78 4.22Z"></path></svg>␊
5151
<span class="display-value">Others</span>␊
5252
<span class="Counter">0</span>␊
53+
</button>␊
54+
<button class="SelectMenu-item" role="menuitem"␊
55+
data-value-cat="@"␊
56+
data-value="PhD Dissertation"␊
57+
aria-checked="false"␊
58+
>␊
59+
<svg class="SelectMenu-icon SelectMenu-icon--check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.78 4.22C13.9204 4.36062 13.9993 4.55125 13.9993 4.75C13.9993 4.94875 13.9204 5.13937 13.78 5.28L6.53 12.53C6.38937 12.6704 6.19875 12.7493 6 12.7493C5.80125 12.7493 5.61062 12.6704 5.47 12.53L2.22 9.28C2.08752 9.13782 2.0154 8.94978 2.01882 8.75547C2.02225 8.56117 2.10096 8.37579 2.23838 8.23837C2.37579 8.10096 2.56118 8.02225 2.75548 8.01882C2.94978 8.01539 3.13782 8.08752 3.28 8.22L6 10.94L12.72 4.22C12.8606 4.07955 13.0512 4.00066 13.25 4.00066C13.4487 4.00066 13.6394 4.07955 13.78 4.22Z"></path></svg>␊
60+
<span class="display-value">PhD Dissertation</span>␊
61+
<span class="Counter">0</span>␊
5362
</button><div class="SelectMenu-divider" role="menuitem" data-value="@Conferences">␊
5463
<svg class="SelectMenu-icon SelectMenu-icon--check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.78 4.22C13.9204 4.36062 13.9993 4.55125 13.9993 4.75C13.9993 4.94875 13.9204 5.13937 13.78 5.28L6.53 12.53C6.38937 12.6704 6.19875 12.7493 6 12.7493C5.80125 12.7493 5.61062 12.6704 5.47 12.53L2.22 9.28C2.08752 9.13782 2.0154 8.94978 2.01882 8.75547C2.02225 8.56117 2.10096 8.37579 2.23838 8.23837C2.37579 8.10096 2.56118 8.02225 2.75548 8.01882C2.94978 8.01539 3.13782 8.08752 3.28 8.22L6 10.94L12.72 4.22C12.8606 4.07955 13.0512 4.00066 13.25 4.00066C13.4487 4.00066 13.6394 4.07955 13.78 4.22Z"></path></svg>␊
5564
Conferences␊

test/snapshots/mcpub.js.snap

31 Bytes
Binary file not shown.

test/snapshots/publist-tag.js.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,37 @@ Generated by [AVA](https://avajs.dev).
193193
path: 'badges',
194194
},
195195
]
196+
197+
## Uncategorized venue
198+
199+
> Snapshot 1
200+
201+
[
202+
{
203+
choices: {
204+
'': [
205+
{
206+
count: 1,
207+
display: 'All',
208+
value: '!all',
209+
},
210+
{
211+
count: 0,
212+
display: 'Others',
213+
value: '!others',
214+
},
215+
{
216+
count: 1,
217+
value: 'PhD Dissertation',
218+
},
219+
],
220+
},
221+
default: {
222+
count: 1,
223+
display: 'All',
224+
value: '!all',
225+
},
226+
id: 'venue',
227+
name: 'Venue',
228+
},
229+
]

0 commit comments

Comments
 (0)