Source code for fudge.gnds.documentation
# <<BEGIN-copyright>>
# <<END-copyright>>
"""
This module contains the documentation class.
"""
__metaclass__ = type
import xData.ancestry as ancestryModule
[docs]class documentation( ancestryModule.ancestry ) :
"""For storing descriptive information, either about the reactionSuite or about an individual reaction. """
moniker = 'documentation'
def __init__( self, name, documentation ) :
ancestryModule.ancestry.__init__( self )
self.name = name
self.documentation = documentation
def __str__( self ) :
return( self.documentation )
[docs] def getLines( self ) :
return( self.documentation.split( '\n' ) )
[docs] def toXMLList( self, indent = '', **kwargs ) :
xmlString = [ '%s<%s name="%s"><![CDATA[' % ( indent, self.moniker, self.name ) ]
xmlString.append( self.documentation )
xmlString[-1] += ']]></%s>' % self.moniker
return( xmlString )
[docs] @staticmethod
def parseXMLNode(element, xPath, linkData):
""" translate <documentation> element from XML: """
xPath.append( element.tag )
doc_ = documentation( element.get('name'), element.text.lstrip('\n') )
xPath.pop()
return doc_