1 from Pyblio.Adapter import OneToOneAdapter
2 from Pyblio import Store, Attribute, Registry
3
5
11
12 typemap = {
13 '@': 'article'
14 }
15
17 bibtex = Store.Record()
18 bibtex['id'] = wok['ut']
19
20 dt = wok['doctype'][0]
21 dt = self.base.schema.txo[dt.group][dt.id].names['C']
22 target_type = self.typemap.get(dt, 'article')
23 bibtex.add('doctype', self.schema.txo['doctype'].byname(
24 target_type), Attribute.Txo)
25
26 for k in ('title', 'author', 'abstract'):
27 if k in wok:
28 bibtex[k] = wok[k]
29
30 if 'source' in wok:
31 source = wok.get('source')[0]
32 bibtex.add('journal', unicode(source), Attribute.Text)
33 for sub in ('pages', 'volume', 'number'):
34 data = source.q.get(sub)
35 if data:
36 bibtex.add(sub, data[0])
37 if 'year' in source.q:
38 try:
39 bibtex.add('date',
40 Attribute.Date(int(source.q['year'][0])))
41 except TypeError:
42 pass
43 return bibtex
44