Package Pyblio :: Package Format :: Module Generator
[hide private]
[frames] | no frames]

Source Code for Module Pyblio.Format.Generator

 1  # -*- coding: utf-8 -*- 
 2  # This file is part of pybliographer 
 3  #  
 4  # Copyright (C) 1998-2006 Frederic GOBRY 
 5  # Email : gobry@pybliographer.org 
 6  #           
 7  # This program is free software; you can redistribute it and/or 
 8  # modify it under the terms of the GNU General Public License 
 9  # as published by the Free Software Foundation; either version 2  
10  # of the License, or (at your option) any later version. 
11  #    
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details.  
16  #  
17  # You should have received a copy of the GNU General Public License 
18  # along with this program; if not, write to the Free Software 
19  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
20   
21  """ 
22  A base generator, specialized for every output style. 
23  """ 
24   
25 -class Generator(object):
26
27 - def __call__(self, t):
28 if isinstance(t, (str, unicode)): 29 self.do_string(t) 30 else: 31 getattr(self, 'do_' + t.tag)(t) 32 return
33
34 - def do_t(self, t):
35 for s in t.children: 36 self(s) 37 return
38
39 - def begin_biblio(self):
40 pass
41 - def end_biblio(self):
42 pass
43
44 - def begin_reference(self, key):
45 pass
46 - def end_reference(self, key):
47 pass
48