def markup_serialize_tokens(tokens, markup_func):
 for token in tokens:
  for pre in token.pre_tags:
   (yield pre)
  html = token.html()
  html = markup_func(html, token.annotation)
  if token.trailing_whitespace:
   html += token.trailing_whitespace
  (yield html)
  for post in token.post_tags:
   (yield post)

def markup_serialize_tokens ( tokens , markup_func ) : for token in tokens : for pre in token . pre_tags : ( yield pre ) html = token . html ( ) html = markup_func ( html , token . annotation ) if token . trailing_whitespace : html += token . trailing_whitespace ( yield html ) for post in token . post_tags : ( yield post )
serialize the list of tokens into a list of text chunks .