Next / Previous / Contents / Shipman's homepage

23.9. MonthCell.__span(): Add a span inline

This service routine is used to add to some parent element a span child with a given class and textual content.

# - - -   M o n t h C e l l . _ _ s p a n

    def __span ( self, parent, class_, text ):
        '''Add text inside a span inline

          [ (parent is an et.Element) and
            (class_ is a string) and
            (text is a string) ->
              parent  +:=  a new span element with class=(class_)
                           and text=(text)
              return that new span element ]
        span  =  et.SubElement ( parent, 'span' )
        span.attrib['class']  =  class_
        span.text  =  text
        return span