[Docstring-checkins] CVS: dps/dps/parsers __init__.py,1.2,1.3
Status: Pre-Alpha
Brought to you by:
goodger
From: David G. <go...@us...> - 2002-02-06 02:48:15
|
Update of /cvsroot/docstring/dps/dps/parsers In directory usw-pr-cvs1:/tmp/cvs-serv27067/dps/dps/parsers Modified Files: __init__.py Log Message: updated Index: __init__.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/parsers/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 2002/01/30 04:49:53 1.2 --- __init__.py 2002/02/06 02:48:12 1.3 *************** *** 11,20 **** __docformat__ = 'reStructuredText' - class Parser: ! def __init__(self, debug=0): ! """Initialize the Parser instance.""" ! self.debug = debug def parse(self, inputstring, docroot): --- 11,18 ---- __docformat__ = 'reStructuredText' + __all__ = ['Parser'] ! class Parser: def parse(self, inputstring, docroot): *************** *** 26,27 **** --- 24,36 ---- self.inputstring = inputstring self.docroot = docroot + + + _parser_aliases = {'rtxt': 'restructuredtext'} + + def get_parser_class(parsername): + """Return the Parser class from the `parsername` module.""" + parsername = parsername.lower() + if _parser_aliases.has_key(parsername): + parsername = _parser_aliases[parsername] + module = __import__(parsername, globals(), locals()) + return module.Parser |