def process_input(self, paragraph):
        """Parse paragraph for the language of the code and the code itself."""
        try:
            lang, body = paragraph.split(None, 1)
        except ValueError:
            lang, body = paragraph, None

        if not lang.strip().startswith('%'):
            lang = 'scala'
            body = paragraph.strip()

        else:
            lang = lang.strip()[1:]

        if lang == 'md':
            self.build_markdown(lang, body)
        else:
            self.build_code(lang, body)
def process_input ( self , paragraph ) : try : lang , body = paragraph . split ( None , 1 ) except ValueError : lang , body = paragraph , None if not lang . strip ( ) . startswith ( '%' ) : lang = 'scala' body = paragraph . strip ( ) else : lang = lang . strip ( ) [ 1 : ] if lang == 'md' : self . build_markdown ( lang , body ) else : self . build_code ( lang , body )
Parse paragraph for the language of the code and the code itself.