Next / Previous / Contents / Shipman's homepage

14.3. CLASS(): Helper function for adding CSS class attributes

Next comes the definition of the CLASS() helper function discussed in Section 13.2, “CLASS(): Adding class attributes”.
# - - -   C L A S S

def CLASS(*names):
    '''Helper function for adding 'class=...' attributes to tags.

      [ names is a list of strings ->
          return a dictionary with one key 'class' and the related
          value the concatenation of (names) with one space between
          them ]
    return {'class': ' '.join(names)}