| Home | Trees | Indices | Help |
|
|---|
|
|
1 # This file is part of pybliographer
2 #
3 # Copyright (C) 1998-2006 Frederic GOBRY
4 # Email : gobry@pybliographer.org
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 from Pyblio.Parsers.Syntax import BibTeX
21 from Pyblio import Attribute
22
23 _monthmap={
24 'january': 1, 'jan': 1,
25 'february': 2, 'feb': 2,
26 'march': 3, 'mar': 3,
27 'april': 4, 'apr': 4,
28 'may': 5,
29 'june': 6, 'jun': 6,
30 'july': 7, 'jul': 7,
31 'august': 8, 'aug': 8,
32 'september': 9, 'sep': 9,
33 'october': 10, 'oct': 10,
34 'november': 11, 'nov': 11,
35 'december': 12, 'dec': 12,
36 }
37
39 """ Default BibTeX parser.
40 """
41
43 # Simply fill in the provided strings
44 for key, value in data.fields:
45 self.env.strings[key] = value
46 return
47
49 txo = self.db.schema.txo['doctype'].byname(name.lower())
50 self.record.add('doctype', txo, Attribute.Txo)
51 return
52
56
58 if self.key is not None:
59 self.id_add('id', self.key)
60
61 if self.date != Attribute.Date():
62 self.record['date'] = [self.date]
63 return
64
66 year = self.to_text(value).strip()
67 if not year: return
68
69 try:
70 self.date.year = int(year)
71 except ValueError, msg:
72 raise ValueError('in %s: %s' % (self.key, msg))
73 return
74
84
85
86
89
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Thu Sep 13 21:54:23 2007 | http://epydoc.sourceforge.net |